Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Market Reserve Automation #456

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

ElliotFriedman
Copy link
Collaborator

No description provided.

Copy link

openzeppelin-code bot commented Jan 9, 2025

Market Reserve Automation

Generated at commit: 0f560336e2d939b1a68c1d0adcbeacbbfcdc4ad2

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
3
4
0
12
45
64
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

src/market/ReserveAutomation.sol Show resolved Hide resolved
src/market/ReserveAutomation.sol Outdated Show resolved Hide resolved
src/market/ReserveAutomation.sol Outdated Show resolved Hide resolved
src/market/ReserveAutomation.sol Show resolved Hide resolved
}

/// normalize decimals up to 18 if reserve asset has less than 18 decimals
if (reserveAssetDecimals != 18) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to store reserveAssetDecimals as getPriceAndDecimals already gives this value at line 296

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getPriceAndDecimals returns the chainlink decimals.

reserveAssetDecimals deals with the actual token decimals, which chainlink does not

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for USDC we need to normalize the decimals between WELL and USDC, otherwise 1 well ends up buying you 1 trillion USDC due to it having 6 decimals

src/market/ReserveAutomation.sol Show resolved Hide resolved
@ElliotFriedman ElliotFriedman marked this pull request as ready for review January 11, 2025 03:17
Copy link

Compiling 4 files with Solc 0.8.19
Solc 0.8.19 finished in 8.33ms
Compiler run successful!
Script ran successfully.
Gas used: 34064219

If you wish to simulate on-chain transactions pass a RPC URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants