## Oracle Migration to Uniswap v3 (incentive adjustments) ### Overview The list of oracles currently used can be found in this [post](https://hackmd.io/@piesrtasty/current-reflexer-oracles). We would like to migrate the Chainlink RAI / USD oracle to Uni V3 (3 day TWAP). As a Uni V3 pool would be RAI / ETH we will need to multiply the value by an ETH / USD price to get RAI / USD. We will have a converter feed contract that sits in front of the RAI / ETH uni v3 oracle and the ETH / USD Chainlink TWAP to perform this conversion. This post will outline why we are switching, the associated incentive adjustments, the steps we will take to enact that change, and the timeline for the change. ### Reasons for switching 1. Chainlink plans to deprecate both it's RAI / ETH and RAI / USD feeds due to lack of liquidity. 2. We have decreasing confidence in the data sources behind the RAI / USD chainlink feed as we have been seeing odd pricing deviations from time to time. ### Incentive Adjustments We currently incentize liquidity in the RAI / ETH Uni V2 pool with 30 FLX / day. To ensure adequate liquidity for the Uni V3 oracle we will shift incentives from the V2 pool to the V3 pool so the LPs will migrate. As we know it's an inconvenience to move LP positions over we will increase rewards the first month to 40 FLX / day (split between both pools) followed by a constant 30 FLX / day rate on the Uni v3 pool going forward. The incentive adjustment schedule will be as follows: #### **FLX Distribution #31** **Distribution date:** October 2023 **Start:** September-15-2023 12:50pm UTC **Cutoff-date:** October-15-2023 12:50pm UTC **RAI/ETH UNI-V2 LP**: 30 FLX / day **RAI/ETH UNI-V3 LP**: 0 FLX / day #### **FLX Distribution #32** **Distribution date:** November 2023 **Start:** October-15-2023 12:50pm UTC **Cutoff-date:** November-15-2023 12:50pm UTC **RAI/ETH UNI-V2 LP**: 20 FLX / day **RAI/ETH UNI-V3 LP**: 20 FLX / day #### **FLX Distribution #33 and onward** **Distribution date:** December 2023 **Start:** November-15-2023 12:50pm UTC **Cutoff-date:** December-15-2023 12:50pm UTC **RAI/ETH UNI-V2 LP**: 0 FLX / day **RAI/ETH UNI-V3 LP**: 30 FLX / day ### Steps to implement oracle migration 1. Write forum post to share with community and get feedback (that is this post 🥹) 2. Write Uni V3 oracle and `ConverterFeed` contract. - TAI is currently using this setup for their [TAI / USD](https://etherscan.io/address/0xC8078539f56ae8E0e3741BAa8F8Ed939D63976a8#code) oracle. - We also have written a [contract for HAI](https://github.com/hai-on-op/core/blob/dev/src/contracts/oracles/DenominatedOracle.sol) that combines 2 price feeds with a shared unit (token) that we could use as well. 3. Deploy contracts and monitor for period of time - This monitoring period is to ensure the oracle is running as expected. 4. Governance Proposal - Submit a governance proposal to change the `orcl` value in the [`PiRateSetter`](https://etherscan.io/address/0x7Acfc14dBF2decD1c9213Db32AE7784626daEb48) contract via the [`MinimalRateSetterOverlay`](https://etherscan.io/address/0x67E38536d8b1eFad846a030B797C00e43364372E) contract. ### Timeline - The contracts can be written, deployed, and monitored immediately. - We will need to wait until the LPs have migrated by the end of November to enact the change. - The governance process will take ~ 8 days - 1 day vote delay - 6 day vote period - 1 day execution delay ### Next Steps / Going Forward Some things we are thinking about include 1. Having multiple duration TWAPs we can switch between for the RAI / USD feed. (1, 3, and 7) 2. Explore alternate ETH / USD oracles besides chainlink. 3. Add an additional backup (3rd) ETH / USD oracle and put all 3 behind a medianizer.