-
Notifications
You must be signed in to change notification settings - Fork 79
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
Removed drift check from Oracle Router and gas optimizations #1943
base: nicka/oeth-oracle
Are you sure you want to change the base?
Conversation
Seems like a great idea. Might be good to write some kind of test (even if a one off script) that verifies that the answers are the same before and after the upgraded. |
I added |
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 think this is a great idea, a nice gas savings, since the Oracle decimals should never change.
Left some comments inline
} else if (asset == 0xD533a949740bb3306d119CC777fa900bA034cd52) { | ||
// https://data.chain.link/ethereum/mainnet/crypto-usd/crv-usd | ||
// Chainlink: CRV/USD | ||
feedAddress = 0xCd627aA160A6fA45Eb793D19Ef54f5062F20f33f; | ||
maxStaleness = 1 days + STALENESS_BUFFER; | ||
decimals = 18; |
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.
Crv/Usd has 8 decimals: https://etherscan.io/address/0xcd627aa160a6fa45eb793d19ef54f5062f20f33f#readContract
} else if (asset == 0xD533a949740bb3306d119CC777fa900bA034cd52) { | ||
// https://data.chain.link/ethereum/mainnet/crypto-usd/crv-usd | ||
// Chainlink: CRV/USD | ||
feedAddress = 0xCd627aA160A6fA45Eb793D19Ef54f5062F20f33f; | ||
maxStaleness = 1 days + STALENESS_BUFFER; | ||
decimals = 18; | ||
} else if (asset == 0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B) { | ||
// Chainlink: CVX/USD |
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.
Cvx/USD is also 8 decimals:
https://etherscan.io/address/0xd962fc30a72a84ce50161031391756bf2876af5d#readContract
can you also add this link into the comment for easier verification (like in the above feeds):
https://data.chain.link/ethereum/mainnet/crypto-usd/cvx-usd
[assetAddresses.TUSD, oracleAddresses.chainlink.TUSD_USD, 8], | ||
[assetAddresses.COMP, oracleAddresses.chainlink.COMP_USD, 8], | ||
[assetAddresses.AAVE, oracleAddresses.chainlink.AAVE_USD, 8], | ||
[assetAddresses.CRV, oracleAddresses.chainlink.CRV_USD, 18], |
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.
this should be 8 also
[assetAddresses.COMP, oracleAddresses.chainlink.COMP_USD, 8], | ||
[assetAddresses.AAVE, oracleAddresses.chainlink.AAVE_USD, 8], | ||
[assetAddresses.CRV, oracleAddresses.chainlink.CRV_USD, 18], | ||
[assetAddresses.CVX, oracleAddresses.chainlink.CVX_USD, 18], |
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.
also 8
USDT: 8, | ||
DAI: 8, | ||
COMP: 8, | ||
CVX: 18, |
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.
8 I think?
DAI: 8, | ||
COMP: 8, | ||
CVX: 18, | ||
CRV: 18, |
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.
aslo 8 I think?
There is another issue with these changes. The currently implemented floorPrice of the VaultCore doesn't do any of its own checks of Oracle drift. The potential issue with the current implementation is that 1 underlying asset could de-peg: e.g. rEth to 0.2 worth of ETH, and an Oracle of another asset could be manipulated to return 1.8 ETH still totaling a floorPrice at 1. While in the current master a drift check at the 1.8 ETH price would fail since it exceedes the 1.3 ETH of maximum drift and prevent such situation. We should probably utilize the _toUnitPrice by calling |
Changes
OracleRouter
. Note theOETHOracleRouter
does not do drift checks as its already done in the OETHVault.Gas Testing
Before upgrade of OETHOracleRouter
WETH before
stETH before
After change
WETH after
stETH after
Review
If you made a contract change, make sure to complete the checklist below before merging it in master.
Refer to our documentation for more details about contract security best practices.
Contract change checklist: