Removed drift check from Oracle Router and gas optimizations#1943
Removed drift check from Oracle Router and gas optimizations#1943naddison36 wants to merge 5 commits intonicka/oeth-oraclefrom
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 |
sparrowDom
left a comment
There was a problem hiding this comment.
I think this is a great idea, a nice gas savings, since the Oracle decimals should never change.
Left some comments inline
| // Chainlink: CRV/USD | ||
| feedAddress = 0xCd627aA160A6fA45Eb793D19Ef54f5062F20f33f; | ||
| maxStaleness = 1 days + STALENESS_BUFFER; | ||
| decimals = 18; |
There was a problem hiding this comment.
Crv/Usd has 8 decimals: https://etherscan.io/address/0xcd627aa160a6fa45eb793d19ef54f5062f20f33f#readContract
| maxStaleness = 1 days + STALENESS_BUFFER; | ||
| decimals = 18; | ||
| } else if (asset == 0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B) { | ||
| // Chainlink: CVX/USD |
There was a problem hiding this comment.
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], |
| [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], |
| USDT: 8, | ||
| DAI: 8, | ||
| COMP: 8, | ||
| CVX: 18, |
| DAI: 8, | ||
| COMP: 8, | ||
| CVX: 18, | ||
| CRV: 18, |
|
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 theOETHOracleRouterdoes 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: