-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: risk stewards #1
Conversation
|
|
*/ | ||
struct RiskParamConfig { | ||
uint40 minDelay; | ||
uint256 maxPercentChange; |
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.
If the system will be changed to params per asset, then I would put debounce to this struct as well. It could simplify the code a bit
src/contracts/RiskSteward.sol
Outdated
// diff denotes the difference between the from and to values, ensuring it is a positive value always | ||
int256 diff = int256(from) - int256(to); | ||
if (diff < 0) diff = -diff; |
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.
// diff denotes the difference between the from and to values, ensuring it is a positive value always | |
int256 diff = int256(from) - int256(to); | |
if (diff < 0) diff = -diff; | |
uint256 diff = from > to ? from - to : to - from; |
that way we will sure that it's positive, because it's uint
src/contracts/RiskSteward.sol
Outdated
int256 diff = int256(from) - int256(to); | ||
if (diff < 0) diff = -diff; | ||
|
||
// maxDiff denotes the max permitted difference on both the upper and lower bounds, if the maxPercentChange is relative in value | ||
// we calculate the max permitted difference using the maxPercentChange and the from value, otherwise if the maxPercentChange is absolute in value | ||
// the max permitted difference is the maxPercentChange itself | ||
uint256 maxDiff = isChangeRelative ? (maxPercentChange * from) / BPS_MAX : maxPercentChange; | ||
if (uint256(diff) > maxDiff) return false; |
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.
if (uint256(diff) > maxDiff) return false; | |
if (diff > maxDiff) return false; |
following previous change
No description provided.