Title: [ARFC] PYTH TO SUPPORT AAVE ON OPTIMISM AS A SECONDARY ORACLE
Author: @KemarTiti - Contributor, Pyth Data Association
Date: 7/24/2023
Summary
This ARFC proposes Pyth to become AAVE’s secondary oracle on Optimism. Following a successful TEMP CHECK, this proposal allows Aave to have a fallback oracle on Optimism at no extra cost.
When / if approved by the Aave community, the Pyth Network oracle will be integrated in Aave as the secondary (or fallback) oracle and the Pyth Data Association will operate (for no less than three months) a price scheduler that will regularly update Pyth’s on-chain price on Optimism for all assets supported by Aave.
Motivation
Incorporating Pyth as a secondary oracle will yield clear and material benefit for AAVE, its participants, and the wider community. These benefits are rooted in three core principles: resilience, efficiency, and decentralization. For more details and thorough explanation of these benefits, you can refer to the successful TEMP CHECK here.
Specification
High-level Integration with Aave
Based on initial discussions with BDG labs, we have determined that a push-based integration is the most straightforward. The AAVE protocol already has a notion of a backup oracle provider that Pyth can fit into with minimal development work. In this integration, Pyth will adapt to the contracts’ interface of the AaveOracle smart contract — reading on-chain prices for any of the supported assets, in a similar way to any other integrated oracle.
In order to support this integration, the Pyth Data Association will commit to regularly update the Pyth on-chain price for all assets supported by Aave (DAI, USDC, USDT, AAVE, LINK, OP, BTC, ETH, stETH) on Optimism. This design allows Aave to natively read the Pyth prices on Optimism at no extra cost. The Pyth Data Association will update all the following assets prices on Optimism: DAI, USDC, USDT, AAVE, LINK, OP, BTC, ETH, stETH, at a frequency matching Chainlink Data Feeds (usually every 20 minutes or 0.2% price deviation ; whichever is faster).
The Pyth Data Association will update Pyth prices on Optimism for a trial period of no less than 3 months. At the end of this period, the Aave DAO can decide on the best path forward — to continue using Pyth push updates, or an alternative. Note that, since Pyth price updates are permissionless, Pyth can be useful as a backup oracle even if the Pyth Data Association is not pushing updates. If the primary oracle is down, any Aave user can update the Pyth backup to restore protocol functionality.
Simulating a push-based Pyth over April 2023 with updates every 1200s or during any 15bps deviation—Chainklink’s current parameters—Pyth performs well with strong price-robustness and accuracy.
Technical Integration for Aave
The technical integration for Aave consists of three parts:
- The Pyth Data Association developed a contract that implements the
getAssetPrice
function in the IPriceOracleGetter.sol interface. This contract adapts the existing Pyth oracle contract to satisfy the Aave backup oracle interface. The contract will maintain a mapping from Aave assets to Pyth price feed ids. When queried for the price of an asset, the contract will relay that query to the Pyth contract, convert the resulting price into the format expected by Aave, and return it.
For simplicity and security, this contract will be immutable. If Aave decides to add new assets, a new version of the contract can be deployed with the new asset to price feed mapping. - The Pyth Data Association will operate a price scheduler for Optimism. This service monitors both the Pyth price and the on-chain price, then submits a price update transaction whenever certain time or price conditions are met.
- The Pyth Data Association will create a Aave governance proposal. This proposal will simply call
AaveV3Optimism.ORACLE.setFallbackOracle()
to set the optimism fallback oracle to the address of the deployed contract in (1).
Disclaimer
The authors of this proposal are members of the Pyth Data Association. The Pyth Data Association is a Swiss association founded by Pyth Network participants to advance the development of the network. This proposal was created and put forward without any compensation from any third party.
Next Steps
- If consensus is reached, submit the ARFC to a Snapshot vote for final approval.
- If consensus is reached, submit an Aave Improvement Proposal (AIP) to integrate Pyth as Aave’s secondary oracle on Optimism
Copyrights
Copyright and related rights waived via CC0.