-
Notifications
You must be signed in to change notification settings - Fork 12
Spot pricer for automanager #220
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
Conversation
Spot pricer for automanager
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
3cb469e to
2b7d9ec
Compare
2b7d9ec to
7f1de53
Compare
| // If the market price of the USD coin fallen too much below 1$, | ||
| // it's an indication of some systemic issue with the USD token | ||
| // and thus its price should be considered unreliable. | ||
| return (ONE, (v && p > USD_LOWER_BOUND)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about checking deviation USDC from $1.00, which also covers the case where the dollar token is >> $1? That's also a sign of market trouble, that's missed by just checking the downside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's specifically a risk when it comes to USDC. If usdc is trading above one, folks will just mint more? Custody/Bank failure risk is only on the downside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm more coming from the perspective of-- IF the price of USDC is high, then something is going wrong.
Perhaps minting is halted by Circle corp (there are humans in the loop there), a liquidity pool address gets blacklisted through their AML system, there's an chainlink oracle attack/failure. Maybe other things I can't think of as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Worth noting, that the current spot appraiser which is deployed and used by Billy doesn't have this check.
brandoniles
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with the slight name change
| uint256 private constant ONE = (10 ** DECIMALS); | ||
| uint256 public constant CL_ORACLE_DECIMALS = 8; | ||
| uint256 public constant CL_ORACLE_STALENESS_THRESHOLD_SEC = 3600 * 48; // 2 days | ||
| uint256 public constant USD_LOWER_UPPER = (101 * ONE) / 100; // 1.01$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| uint256 public constant USD_LOWER_UPPER = (101 * ONE) / 100; // 1.01$ | |
| uint256 public constant USD_UPPER_BOUND = (101 * ONE) / 100; // 1.01$ |
| // it's an indication of some systemic issue with the USD token | ||
| // and thus its price should be considered unreliable. | ||
| return (ONE, (v && p > USD_LOWER_BOUND)); | ||
| return (ONE, (v && p < USD_LOWER_UPPER && p > USD_LOWER_BOUND)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return (ONE, (v && p < USD_LOWER_UPPER && p > USD_LOWER_BOUND)); | |
| return (ONE, (v && p < USD_UPPER_BOUND && p > USD_LOWER_BOUND)); |
Added a new SPOT pricing strategy for the charm manager.
The bill broker uses the spot appraiser which has stricter rules around DR and tranche CDRs. However, the AMM pool can use a much simpler pricing strategy.