Feature : Collateralization oracle#94
Conversation
Joeysantoro
left a comment
There was a problem hiding this comment.
This is awesome thanks for coding it up so fast!
One final note is it is good to reduce the number of external contract calls as much as possible to save on gas. One call to read should only hit every external call once in the entire flow.
Rationale from Joey's review : "Using the spot reserves of Uniswap would be vulnerable to flash manipulation. I'd suggest using an ETH-FEI TWAP oracle and then back out manipulation resistant numbers for the reserves" Also add : - collateralizationRatio() view function - overCollateralized() view function - associated tests
|
I changed the implementation of But since we introduced the On a related topic : is the code of the webapp (https://app.fei.money/analytics) available somewhere ? The analytics page could be updated to read the oracle. |
The webapp code is not available but we could update it! Have you tested this oracle on a mainnet fork? |
|
Note : to be updated after #95 is merged ( |
Also reindent to comply with solhint & small fixes to work in a local mainnet fork (used to revert due to math overflow).

Hi,
Here is a pull request to add a Collateralization Oracle as discussed on the governance forums.
This contract is pretty straightforward & mainly composed of pure functions :
EthUniswapPCVDepositto get thetotalValue()andgetReserves().totalSupply()minus FEI in the Uniswap pool owned byEthUniswapPCVDeposit.UniswapOracleis used for the ETH/USD current price.UniswapOracleis used for the ETH/FEI current price (234b68f).I also implemented a small test suite inspired from the one of

UniswapOracle:Can be run with
npm run test -- -g CollateralizationOracleAlso tested on a local mainnet fork, with results consistent with what's observed on https://app.fei.money/analytics (see comments below)
Best,