Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cvx3Crv as Collateral #36

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

cvx3Crv as Collateral #36

wants to merge 2 commits into from

Conversation

iamsahu
Copy link
Contributor

@iamsahu iamsahu commented May 6, 2022

Proposal

Enable cvx3Crv as a collateral for borrowing DAI and USDC

Background

cvx3CRV has a TVL of $720.4 million.

Details

1. Deploy cvx3CrvOracle (no need for governance approval)

The deploycvx3CrvOracle.ts script will be used, with no input.

2. Deploy Cvx3CrvLadleModule (no need for governance approval)

The deployCvx3CrvLadleModule.ts script will be used, with no input.

3. Deploy ConvexJoin (no need for governance approval)

The 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<string>]> = [
  [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.

+ 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

@alcueca alcueca self-requested a review May 9, 2022 08:31
@iamsahu
Copy link
Contributor Author

iamsahu commented May 10, 2022

Proposed: 0x65c2f87b0f778b9f8c3e059bc28a01fb7b5a5f35e480899e947e6665d00f52e3

@iamsahu
Copy link
Contributor Author

iamsahu commented May 10, 2022

Decoded proposal:
screencapture-info-yieldprotocol-decode-proposal-2022-05-10-19_50_39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants