From e39e9fdce1fa400d615a38ab31fb2f98de829edc Mon Sep 17 00:00:00 2001 From: iamsahu Date: Fri, 6 May 2022 17:51:55 +0530 Subject: [PATCH 1/2] feat: cvx3Crv proposal --- YPP-0036.md | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 YPP-0036.md diff --git a/YPP-0036.md b/YPP-0036.md new file mode 100644 index 0000000..8597a50 --- /dev/null +++ b/YPP-0036.md @@ -0,0 +1,160 @@ +# Proposal + +Enable cvx3Crv as a collateral for DAI and USDC + +# Background + +cvx3CRV has a TVL of $720.4 million. + +# Details + +**1. Deploy cvx3CrvOracle** (no need for governance approval) + +The [deploycvx3CrvOracle.ts](https://github.com/yieldprotocol/environments-v2/blob/feat/convex-collateral/scripts/governance/add/addCollateral/addCompositeCollateral/convex/deployCVX3CRVOracle.ts) script will be used, with no input. + +**2. Deploy Cvx3CrvLadleModule** (no need for governance approval) + +The [deployCvx3CrvLadleModule.ts](https://github.com/yieldprotocol/environments-v2/blob/feat/convex-collateral/scripts/governance/add/addCollateral/addCompositeCollateral/convex/deployCvx3CrvLadleModule.ts) script will be used, with no input. + +**3. Deploy ConvexJoin** (no need for governance approval) + +The [deployConvexJoin.ts](https://github.com/yieldprotocol/environments-v2/blob/feat/convex-collateral/scripts/governance/add/addCollateral/addCompositeCollateral/convex/deployConvexJoin.ts) script will be used, with no input. + +**4. Governance Proposal** + +The [addConvexAsset.ts]() script will be used to do the following: + +1. Orchestrate and configure oracles +2. Add module & remove ladle permissions +3. Orchestrate join, add asset & making ilk + +The following input would be used: + +``` +export const crv = '0xd533a949740bb3306d119cc777fa900ba034cd52' + +export const cvx3CrvAddress = '0x30d9410ed1d5da1f6c8391af5338c93ab8d4035c' // https://cvx3Crv.mirror.xyz/5cGl-Y37aTxtokdWk21qlULmE1aSM_NuX9fstbOPoWU +export const cvxBaseRewardPool = '0x689440f2Ff927E1f24c72F1087E1FAF471eCe1c8' +export const cvxAddress = '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b' + +/// @notice Threecrv pool and the chainlink sources for cvx3crv oracle +/// @param cvx3CrvId_ cvx3crv Id +/// @param ethId_ ETH ID +/// @param threecrv_ The 3CRV pool address +/// @param DAI_ DAI/ETH chainlink price feed address +/// @param USDC_ USDC/ETH chainlink price feed address +/// @param USDT_ USDT/ETH chainlink price feed address +export const cvx3CrvSources: [string, string, string, string, string, string] = [ + bytes6ToBytes32(CVX3CRV), + bytes6ToBytes32(ETH), + '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', + '0x773616E4d11A78F511299002da57A0a94577F1f4', + '0x986b5E1e1755e3C2440e960477f25201B0a8bbD4', + '0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46', +] + +/// @notice Sources that will be added to the Composite Oracle +/// @param Base asset identifier (bytes6 tag) +/// @param Quote asset identifier (bytes6 tag) +/// @param Address for the source +export const compositeSources: Array<[string, string, string]> = [[CVX3CRV, ETH, protocol.get(CVX3CRVORACLE) as string]] + +/// @notice Assets that will be added to the protocol +/// @param Asset identifier (bytes6 tag) +/// @param Address for the asset +export const assetsToAdd: Array<[string, string]> = [[CVX3CRV, '0x30d9410ed1d5da1f6c8391af5338c93ab8d4035c']] + +/// @notice Paths that will be added to the Composite Oracle +/// @param Base asset identifier (bytes6 tag) +/// @param Quote asset identifier (bytes6 tag) +/// @param Path to traverse (array of bytes6 tags) +export const compositePaths: Array<[string, string, Array]> = [ + [DAI, CVX3CRV, [ETH]], + [USDC, CVX3CRV, [ETH]], +] + +/// @notice Configure an asset as an ilk for a base using the Composite Oracle +/// @param Base asset identifier (bytes6 tag) +/// @param Ilk asset identifier (bytes6 tag) +/// @param Collateralization ratio as a fixed point number with 6 decimals +/// @param Debt ceiling, modified by decimals +/// @param Minimum vault debt, modified by decimals +/// @param Decimals to append to debt ceiling and minimum vault debt. +export const compositeDebtLimits: Array<[string, string, number, number, number, number]> = [ + [DAI, CVX3CRV, 1111111, 1000000, 5000, 18], + [USDC, CVX3CRV, 1111111, 1000000, 5000, 6], +] + +/// @notice Ilks to accept for series +/// @param series identifier (bytes6 tag) +/// @param newly accepted ilks (array of bytes6 tags) +export const seriesIlks: Array<[string, string[]]> = [ + [FYDAI2206, [CVX3CRV]], + [FYDAI2209, [CVX3CRV]], + [FYUSDC2206, [CVX3CRV]], + [FYUSDC2209, [CVX3CRV]], +] + +/// @notice Limits to be used in an auction +/// @param base identifier (bytes6 tag) +/// @param duration of auctions in seconds +/// @param initial percentage of the collateral to be offered (fixed point with 6 decimals) +/// @param Maximum concurrently auctionable for this asset, modified by decimals +/// @param Minimum vault debt, modified by decimals +/// @param Decimals to append to auction ceiling and minimum vault debt. +export const compositeAuctionLimits: Array<[string, number, number, number, number, number]> = [ + [CVX3CRV, 3600, 900000, 10000000, 5000, 18], +] +``` + +# Testing + +The change has been tested on a mainnet fork by posting CVX3CRV to all series, borrowing, repaying and wthdrawing. [Script](https://github.com/yieldprotocol/environments-v2/blob/feat/convex-collateral/scripts/governance/add/addCollateral/addCompositeCollateral/convex/addCvx3Crv.test.ts). + +``` ++ npx hardhat run --network localhost ./scripts/governance/add/addCollateral/addCompositeCollateral/convex/addCvx3Crv.test.ts +No need to generate any newer typings. +ChainId: 1 +101011113587269006625707 cvx3Crv available +join 0x0f2e27e862dffa42c890020ed7ef873f06CdB854 +series: 0x303130360000 +496036846628265878438 cvx3Crv posted +vault: 0x49c732b44c80fac3a20ede58 +Allowance 496036846628265878438 +Borrowed Successfully +Claiming Reward +User1 7940432577674132 +Earned 7940432577674132 +User2 7940363369100879 +Earned 7940363369100879 +Reward Claimed +repaid and withdrawn +101011113587269006625707 cvx3Crv before +101011113587269006625707 cvx3Crv after +Earned 0 +User1 7940432577674132 +Earned 0 +User2 7940363369100879 +Claimed leftover reward +series: 0x303230360000 +496229609048951335104 cvx3Crv posted +vault: 0xa14bfb582b3dfd49646760fd +Allowance 496229609048951335104 +Borrowed Successfully +Claiming Reward +User1 7940432577674132 +Earned 0 +User2 7940363369100879 +Earned 0 +Reward Claimed +repaid and withdrawn +101011113587269006625707 cvx3Crv before +101011113587269006625707 cvx3Crv after +Earned 0 +User1 7940432577674132 +Earned 0 +User2 7940363369100879 +Claimed leftover reward +Amount CRV left in join: 14 +Amount CVX left in join: 6 +``` From de76462ee1f9d3c2142e7ea20e52d57871f8ed72 Mon Sep 17 00:00:00 2001 From: iamsahu Date: Fri, 6 May 2022 17:58:50 +0530 Subject: [PATCH 2/2] fix: `addConvexAsset` link corrected --- YPP-0036.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/YPP-0036.md b/YPP-0036.md index 8597a50..96980ad 100644 --- a/YPP-0036.md +++ b/YPP-0036.md @@ -22,7 +22,7 @@ The [deployConvexJoin.ts](https://github.com/yieldprotocol/environments-v2/blob/ **4. Governance Proposal** -The [addConvexAsset.ts]() script will be used to do the following: +The [addConvexAsset.ts](https://github.com/yieldprotocol/environments-v2/blob/feat/convex-collateral/scripts/governance/add/addCollateral/addCompositeCollateral/convex/addConvexAsset.ts) script will be used to do the following: 1. Orchestrate and configure oracles 2. Add module & remove ladle permissions