-
Notifications
You must be signed in to change notification settings - Fork 23
[VPD 1241] Certik: Venus Labs - Core Feature Reaudit #315
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
Changes from all commits
007a6f2
165b7c5
ddbf66d
de41efd
39ba374
76f1d8f
e234339
e91edb6
742dd0e
5d84dec
3094df0
c1f924a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,9 @@ abstract contract CorrelatedTokenOracle is OracleInterface, ICappedOracle { | |
| /// @notice Thrown if the max snapshot exchange rate is invalid | ||
| error InvalidSnapshotMaxExchangeRate(); | ||
|
|
||
| /// @notice Thrown if the snapshot timestamp is invalid | ||
| error InvalidSnapshotTimestamp(); | ||
|
|
||
| /// @notice @notice Thrown when the action is prohibited by AccessControlManager | ||
| error Unauthorized(address sender, address calledContract, string methodSignature); | ||
|
|
||
|
|
@@ -115,11 +118,20 @@ abstract contract CorrelatedTokenOracle is OracleInterface, ICappedOracle { | |
| * @notice Directly sets the snapshot exchange rate and timestamp | ||
| * @param _snapshotMaxExchangeRate The exchange rate to set | ||
| * @param _snapshotTimestamp The timestamp to set | ||
| * @custom:error InvalidSnapshotMaxExchangeRate error is thrown if the max snapshot exchange rate is zero while | ||
| * the snapshot interval is active (a zero cap would silently disable the growth cap) | ||
| * @custom:error InvalidSnapshotTimestamp error is thrown if the snapshot timestamp is zero or in the future while | ||
| * the snapshot interval is active (a future timestamp would underflow getMaxAllowedExchangeRate and revert pricing) | ||
| * @custom:event Emits SnapshotUpdated event on successful update of the snapshot | ||
| */ | ||
| function setSnapshot(uint256 _snapshotMaxExchangeRate, uint256 _snapshotTimestamp) external { | ||
| _checkAccessAllowed("setSnapshot(uint256,uint256)"); | ||
|
|
||
| if (snapshotInterval != 0) { | ||
| if (_snapshotMaxExchangeRate == 0) revert InvalidSnapshotMaxExchangeRate(); | ||
| if (_snapshotTimestamp == 0 || _snapshotTimestamp > block.timestamp) revert InvalidSnapshotTimestamp(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [minor] This guard correctly closes DS2-87 for |
||
| } | ||
|
|
||
| snapshotMaxExchangeRate = _snapshotMaxExchangeRate; | ||
| snapshotTimestamp = _snapshotTimestamp; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
better to have same validation in setGrowthRate (against the stored snapshot) when interval goes 0 → non-zero,
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.
Yes, that would be better. However, we already have the final audit report, and in practice we wouldn't set the values to 0 anyway. So, I think we can include this change the next time the contract goes through an audit.