CoW DAO Grantsby
bh2smith.eth
Manipulation-Resilient Price Oracle for CoW AMM LP Tokens
Author
The implementation of this project will be carried out by: @bh2smith & @lumoswiz
About the authors
-
bh2smith is an experienced blockchain engineer and former contributor to CoW Protocol.
-
lumoswiz is a smart contract developer with experience working with DeFi protocols, including lending and p2p lending protocols.
Grant Category
Integrations and protocol order flow
Grant Description
In response to this RFG, we aim to develop the manipulation-resistant price oracle for CoW AMM LP tokens. This will require incorporating the following ideas:
- Computing the rebalancing trade that a zero-fee constant function AMM would accept based on its current balance and external price feeds. This will require utilisation of the CoW helper contract and Chainlink price feeds for the underlying tokens.
- The effect on the price of LP tokens is counteracted since their price is a function of the simulated pool state post-rebalancing.
Grant Goals and Impact
The use of AMM LP tokens as collateral is a challenge due to their susceptibility to manipulation within price oracles.
The objective of this work is to produce an oracle for LP tokens that guards against an attacker's ability to capitalise from short-term under-reporting of value or short-term over-reporting of value.
The use of an oracle that guards against these attacks should boost the adoption of LP tokens as collateral in some lending markets.
To demonstrate real-world application, we will create a proof-of-concept integration with Aave V3, showcasing how LP tokens can be used as collateral while utilising our oracle solution.
Milestones
Milestone 1
This milestone has three deliverables, including:
-
A smart contract implementing the oracle. The oracle must:
-
Adhere to the Chainlink oracle interface.
-
Utilise existing Chainlink-compatible oracles for the underlying tokens.
-
Support two token pools with arbitrary weights.
-
-
Comprehensive test suite demonstrating the oracle's manipulation resistance.
-
Documentation detailing the oracle's functionality. The documentation will be supplied in markdown format within the project's Github repository.
Milestone 2
An integration example with Aave V3 will be provided where
-
LP tokens can be used as collateral.
-
The oracle source for these tokens will point to the oracle developed herein.
This will involve:
- Setting up an Anvil mainnet fork.
- Setup scripts to initialise and configure the LP tokens as a reserve.
- Demonstration of user actions against this state, such as supplying LP tokens as collateral.
- Demonstration of oracle resilience to manipulation.
Timeline
- Milestone 1 aim to ship before 1/1/2025.
- Milestone 2 aim to ship before 15/1/2025.
Funding Request
Funding request summary:
- 6000 xDAI for milestone 1.
- 1000 xDAI for milestone 2.
Gnosis Chain Address (to receive the grant)
0x62780bac6b361C703148B7fdeCDE44987C5C69D0
Referral
Other Information
Foundry will be utilised.
Terms and Conditions
By submitting this grant application, I acknowledge and agree to be bound by the CoW DAO Participation Agreement and the CoW Grant Terms and Conditions.
Off-Chain Vote
Loading…
- Author
bh2smith.eth
- IPFS#bafkreia
- Voting Systembasic
- Start DateDec 10, 2024
- End DateDec 13, 2024
- Total Votes Cast7 OTS
- Total Voters7
Timeline
- Dec 10, 2024Proposal created
- Dec 10, 2024Proposal vote started
- Dec 13, 2024Proposal vote ended
- Jan 18, 2025Proposal updated