Skip to content

Latest commit

 

History

History
260 lines (241 loc) · 11.7 KB

YPP-0054.md

File metadata and controls

260 lines (241 loc) · 11.7 KB

Proposal

Deploy & configure contracts needed by Contango. Step 2

Background

Contango exchange uses fixed rate markets to synthesise expirable futures. In order to allow for a smoother interaction, Yield will deploy a set of contracts specially tailored for Contango. This is the second proposal (out of 3) that'll allow for the full integration with Contango.

Details

Here are the steps:

  1. Deploy new Joins (no need for governance approval)
  2. Governance proposal
    1. Configure each new Join's permissions
    2. Add Composite oracle sources
    3. Add Composite oracle paths
    4. Add assets to the Contango cauldron
    5. Configure base assets on the Contango cauldron
    6. Add series to the Contango cauldron
    7. Create ilks on the Contango cauldron
    8. Enable ilks for the created series

Script that performed said actions: https://github.com/yieldprotocol/environments-v2/blob/9ce65d72eece5de5fb002432175455185eb0545d/scripts/governance/contango/arbitrum/deployContango.sh

Configuration applied:

// Assets that will be made into a base
export const bases: Array<[string, string]> = [
  [DAI, joins.get(DAI) as string],
  [USDC, joins.get(USDC) as string],
  [ETH, joins.get(ETH) as string],
]

// Input data: baseId, quoteId, oracle name
export const compositeSources: Array<[string, string, string]> = [
  [FYDAI2209, DAI, IDENTITY],
  [FYUSDC2209, USDC, IDENTITY],
  [FYETH2209, ETH, IDENTITY],
  [DAI, USDC, CHAINLINKUSD],
  [ETH, USDC, CHAINLINKUSD],
  [ETH, DAI, CHAINLINKUSD],
]
// Input data: assetId, assetId, [intermediate assetId]
export const compositePaths: Array<[string, string, Array<string>]> = [
  [DAI, FYUSDC2209, [USDC]],
  [USDC, FYDAI2209, [DAI]],
  [DAI, FYETH2209, [ETH]],
  [USDC, FYETH2209, [ETH]],
  [ETH, FYDAI2209, [DAI]],
  [ETH, FYUSDC2209, [USDC]],
]

/// @notice Assets that will be added to the protocol
/// @param Asset identifier (bytes6 tag)
/// @param Address for the asset
/// @param Address for the join
export const assetsToAdd: Array<[string, string, string]> = [
  [DAI, assets.get(DAI) as string, joins.get(DAI) as string],
  [USDC, assets.get(USDC) as string, joins.get(USDC) as string],
  [ETH, assets.get(ETH) as string, joins.get(ETH) as string],
  [FYDAI2209, fyTokens.get(FYDAI2209) as string, newJoins.get(FYDAI2209) as string],
  [FYUSDC2209, fyTokens.get(FYUSDC2209) as string, newJoins.get(FYUSDC2209) as string],
  [FYETH2209, fyTokens.get(FYETH2209) as string, newJoins.get(FYETH2209) as string],
]

// Input data: baseId, ilkId, ratio (1000000 == 100%), line, dust, dec
/// @notice Collateralization parameters and debt limits for each new asset pair
/// @param Base asset identifier (bytes6 tag)
/// @param Collateral asset identifier (bytes6 tag)
/// @param Collateralization ratio, with six decimals
/// @param Maximum protocol debt, decimals to be added
/// @param Minimum vault debt, decimals to be added
/// @param Decimals to add to maximum protocol debt, and minimum vault debt.
export const fyTokenDebtLimits: Array<[string, string, number, number, number, number]> = [
  [DAI, FYUSDC2209, 1100000, 10000, 40, 18], // dai collateralized with fyUsdc
  [DAI, FYETH2209, 1400000, 10000, 40, 18], // dai collateralized with fyEth
  [USDC, FYDAI2209, 1100000, 10000, 40, 6], // usdc collateralized with fyDai
  [USDC, FYETH2209, 1400000, 10000, 40, 6], // usdc collateralized with fyETH
  [ETH, FYUSDC2209, 1400000, 10000000, 25000, 12], // eth collateralized with fyUsdc
  [ETH, FYDAI2209, 1400000, 10000000, 25000, 12], // eth collateralized with fyDai
]

export interface AuctionLineAndLimit {
  baseId: string
  ilkId: string
  duration: number
  vaultProportion: BigNumber
  collateralProportion: BigNumber
  max: BigNumber
}
export const auctionLineAndLimits: AuctionLineAndLimit[] = [
  // ETH
  {
    baseId: ETH,
    ilkId: FYUSDC2209,
    duration: 600,
    vaultProportion: parseUnits('0.5'),
    collateralProportion: parseUnits('0.75'), // 105 / 140
    max: parseUnits('500'),
  },
  {
    baseId: ETH,
    ilkId: FYDAI2209,
    duration: 600,
    vaultProportion: parseUnits('0.5'),
    collateralProportion: parseUnits('0.75'), // 105 / 140
    max: parseUnits('1000000'),
  },
  // USDC
  {
    baseId: USDC,
    ilkId: FYETH2209,
    duration: 600,
    vaultProportion: parseUnits('0.5'),
    collateralProportion: parseUnits('0.75'), // 105 / 140
    max: parseUnits('500'),
  },
  {
    baseId: USDC,
    ilkId: FYDAI2209,
    duration: 600,
    vaultProportion: parseUnits('1'),
    collateralProportion: parseUnits('0.9545454545'), // 105 / 110
    max: parseUnits('1000000'),
  },
  // DAI
  {
    baseId: DAI,
    ilkId: FYETH2209,
    duration: 600,
    vaultProportion: parseUnits('0.5'),
    collateralProportion: parseUnits('0.75'), // 105 / 140
    max: parseUnits('500'),
  },
  {
    baseId: DAI,
    ilkId: FYUSDC2209,
    duration: 600,
    vaultProportion: parseUnits('1'),
    collateralProportion: parseUnits('0.9545454545'), // 105 / 110
    max: parseUnits('1000000'),
  },
]

// Input data: seriesId, [ilkIds]
/// @notice New asset pairs to be accepted
/// @param Base asset identifier (bytes6 tag)
/// @param Array of collateral asset identifiers (bytes6 tag array)
export const seriesIlks: Array<[string, string[]]> = [
  [FYDAI2209, [FYUSDC2209, FYETH2209]],
  [FYUSDC2209, [FYDAI2209, FYETH2209]],
  [FYETH2209, [FYUSDC2209, FYDAI2209]],
]

The contracts have been deployed to Arbitrum mainnet and the proposal sent to the multisig.

Testing

The proposal approval & execution were tested on tenderly: https://dashboard.tenderly.co/Yield/v2-arbitrum/fork/a1afd81b-e781-40fe-a672-578a4b3e6588

Proposal log

➜  environments-v2 git:(deploy-contango-cauldron) ✗ sh scripts/governance/contango/arbitrum/deployContango.sh
++ dirname scripts/governance/contango/arbitrum/deployContango.sh
+ HERE=scripts/governance/contango/arbitrum
+ export CONF=/Users/egillhreinsson/dev/environments-v2/scripts/governance/contango/arbitrum/contango.arb_mainnet.config
+ CONF=/Users/egillhreinsson/dev/environments-v2/scripts/governance/contango/arbitrum/contango.arb_mainnet.config
+ RUN='npx hardhat run --network arb_mainnet'
+ npx hardhat run --network arb_mainnet scripts/governance/contango/arbitrum/fyTokenAsCollateral.ts
cloak.plan(ladle, join(01)): 0x4ba6a18c4178f5259ffcaffaab2e3609586c83599269bc9d605dc2c8730f1636
cloak.plan(ladle, join(02)): 0x2fc4e4368c6f7ef78eb12e00c637fb432cd6b39ecf1738355416e49d3c6a7fd5
cloak.plan(ladle, join(00)): 0x115d29ed63607d17e3b8156abdaddb09716454889c68c6315a5dd165a19fdf07
join.revokeRole(ROOT, deployer)
join.grantRole(ROOT, cloak)
cloak.plan(ladle, join(0107)): 0x79a2cce1b8be306750fa71919c35aebf77338a894433bd297dd3866bd2b135e9
join.revokeRole(ROOT, deployer)
join.grantRole(ROOT, cloak)
cloak.plan(ladle, join(0207)): 0x8ae6c6a4a209883dc83c376aff55c19ca26dfc10989904e425bdca1c9e2fe183
join.revokeRole(ROOT, deployer)
join.grantRole(ROOT, cloak)
cloak.plan(ladle, join(0007)): 0x44c83fc5c4cddcaf47cc6c8071c012335fa59427fab3cd1af5817adf6411a1c5
Adding 0x303130370000/0x303100000000 from 0xce3d36e19De6A7b66e851c5B7e468E35Dc83d29d
pair: 0107/01 -> 0xce3d36e19De6A7b66e851c5B7e468E35Dc83d29d
Adding 0x303230370000/0x303200000000 from 0xce3d36e19De6A7b66e851c5B7e468E35Dc83d29d
pair: 0207/02 -> 0xce3d36e19De6A7b66e851c5B7e468E35Dc83d29d
Adding 0x303030370000/0x303000000000 from 0xce3d36e19De6A7b66e851c5B7e468E35Dc83d29d
pair: 0007/00 -> 0xce3d36e19De6A7b66e851c5B7e468E35Dc83d29d
Adding 0x303100000000/0x303200000000 from 0x8E9696345632796e7D80fB341fF4a2A60aa39C89
pair: 01/02 -> 0x8E9696345632796e7D80fB341fF4a2A60aa39C89
Adding 0x303000000000/0x303200000000 from 0x8E9696345632796e7D80fB341fF4a2A60aa39C89
pair: 00/02 -> 0x8E9696345632796e7D80fB341fF4a2A60aa39C89
Adding 0x303000000000/0x303100000000 from 0x8E9696345632796e7D80fB341fF4a2A60aa39C89
pair: 00/01 -> 0x8E9696345632796e7D80fB341fF4a2A60aa39C89
[path: 01/0207 -> 0x303200000000],
[path: 02/0107 -> 0x303100000000],
[path: 01/0007 -> 0x303000000000],
[path: 02/0007 -> 0x303000000000],
[path: 00/0107 -> 0x303100000000],
[path: 00/0207 -> 0x303200000000],
Using Dai Stablecoin at 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1
0xc31cce4fFA203d8F8D865b6cfaa4F36AD77E9810
Adding asset 0x303100000000 at 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 with join 0xc31cce4fFA203d8F8D865b6cfaa4F36AD77E9810
Using USD Coin (Arb1) at 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8
0x1229C71482E458fa2cd51d13eB157Bd2b5D5d1Ee
Adding asset 0x303200000000 at 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8 with join 0x1229C71482E458fa2cd51d13eB157Bd2b5D5d1Ee
Using Wrapped Ether at 0x82af49447d8a07e3bd95bd0d56f35241523fbab1
0xaf93a04d5D8D85F69AF65ED66A9717DB0796fB10
Adding asset 0x303000000000 at 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 with join 0xaf93a04d5D8D85F69AF65ED66A9717DB0796fB10
Using FYDAI2209 at 0x4f9B5e639447456DDC784Bc441F5A6FD7CE80729
0xD273B80fB6CECDDC9A5a9398e63748c81E22cbF2
Adding asset 0x303130370000 at 0x4f9B5e639447456DDC784Bc441F5A6FD7CE80729 with join 0xD273B80fB6CECDDC9A5a9398e63748c81E22cbF2
Using FYUSDC2209 at 0xeC1b42EC9a1650238acE42fD57bc719cCC87851C
0xA589cA023CFeEa0931fDa37649dF1DA270E9B4EC
Adding asset 0x303230370000 at 0xeC1b42EC9a1650238acE42fD57bc719cCC87851C with join 0xA589cA023CFeEa0931fDa37649dF1DA270E9B4EC
Using FYETH2209 at 0xe1e878364EfC19712a2833C5C60B68d215f9a4Ab
0x898e9343e31E804a7986e89882D6055814727015
Adding asset 0x303030370000 at 0xe1e878364EfC19712a2833C5C60B68d215f9a4Ab with join 0x898e9343e31E804a7986e89882D6055814727015
Asset 01 made into base using 0x0ad9Ef93673B6081c0c3b753CcaaBDdd8d2e7848
Asset 02 made into base using 0x0ad9Ef93673B6081c0c3b753CcaaBDdd8d2e7848
Asset 00 made into base using 0x0ad9Ef93673B6081c0c3b753CcaaBDdd8d2e7848
Using fyToken at 0x4f9B5e639447456DDC784Bc441F5A6FD7CE80729 for 0x303130370000
Using pool at 0xFCb9B8C5160Cf2999f9879D8230dCed469E72eeb for 0x303130370000
Adding 0x303130370000 for 0x303100000000 using 0x4f9B5e639447456DDC784Bc441F5A6FD7CE80729
Adding 0x303130370000 pool to Ladle using 0xFCb9B8C5160Cf2999f9879D8230dCed469E72eeb
fyToken.grantRoles(mint/burn, ladle)
cloak.plan(ladle, fyToken(0107)): 0xd43678190dc5a866ab58f47ac2ce3dcfe93fec3b22900d1c7d3e661f348d0418
Using fyToken at 0xeC1b42EC9a1650238acE42fD57bc719cCC87851C for 0x303230370000
Using pool at 0x13aB946C6A9645EDfF2A33880e0Fc37f67122170 for 0x303230370000
Adding 0x303230370000 for 0x303200000000 using 0xeC1b42EC9a1650238acE42fD57bc719cCC87851C
Adding 0x303230370000 pool to Ladle using 0x13aB946C6A9645EDfF2A33880e0Fc37f67122170
fyToken.grantRoles(mint/burn, ladle)
cloak.plan(ladle, fyToken(0207)): 0xf749e1fcc33459726b8aedae9227931ff229855d59eab6d7cd6887dcce9fc356
Using fyToken at 0xe1e878364EfC19712a2833C5C60B68d215f9a4Ab for 0x303030370000
Using pool at 0x0FA29EEb169CDE6c779326d7b16c54529ECA1DD5 for 0x303030370000
Adding 0x303030370000 for 0x303000000000 using 0xe1e878364EfC19712a2833C5C60B68d215f9a4Ab
Adding 0x303030370000 pool to Ladle using 0x0FA29EEb169CDE6c779326d7b16c54529ECA1DD5
fyToken.grantRoles(mint/burn, ladle)
cloak.plan(ladle, fyToken(0007)): 0x65a9b6bd7d7d6c45261347a9d8525d03564e1da8d7ba62cf1d151c9e3b4b2ccf
Adding for 01/0207 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Adding for 01/0007 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Adding for 02/0107 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Adding for 02/0007 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Adding for 00/0207 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Adding for 00/0107 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Updating 0x303130370000 series with 0x303230370000,0x303030370000 ilks
addIlks 0107: 0x303230370000,0x303030370000
Updating 0x303230370000 series with 0x303130370000,0x303030370000 ilks
addIlks 0207: 0x303130370000,0x303030370000
Updating 0x303030370000 series with 0x303230370000,0x303130370000 ilks
addIlks 0007: 0x303230370000,0x303130370000
Proposal: 0x2ddc1dda531e88f2f349e2a0ddb33d0607bf68328c97ef0f3d9ce892e366f5a0
Proposing
Developer: 0x02f73B54ccfBA5c91bf432087D60e4b3a781E497