Skip to content

Latest commit

 

History

History
253 lines (236 loc) · 13 KB

YPP-0072.md

File metadata and controls

253 lines (236 loc) · 13 KB

Proposal

Configure series for Contango March 2023 instruments

Background

Contango exchange uses fixed rate markets to synthesise expirable futures. In order to allow for a smoother interaction, Yield holds a separate copy of some key contracts (Ladle, Cauldron, & Witch) and so they need to be updated in a similar fashion as the "public" ones

Details

Here are the steps:

  1. Deploy new Joins (no need for governance approval)
  2. Initialise PoolOracle (no need for governance approval)
  3. Governance proposal
    1. Configure each new Join's permissions
    2. Add YieldSpaceMultiOracle oracle sources
    3. Add Composite oracle sources
    4. Add Composite oracle paths
    5. Add assets to 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/279bd0b6c6047b4bd3b27e6f76ddca598dcd75d7/scripts/governance/contango/shared/orchestrateNewInstruments.ts

Configuration applied:

// Input data: baseId, quoteId, oracle name
export const compositeSources: Array<[string, string, string]> = [
  [FYDAI2303, DAI, protocol.get(YIELD_SPACE_MULTI_ORACLE)!],
  [FYUSDC2303, USDC, protocol.get(YIELD_SPACE_MULTI_ORACLE)!],
  [FYETH2303, ETH, protocol.get(YIELD_SPACE_MULTI_ORACLE)!],
]
// Input data: assetId, assetId, [intermediate assetId]
export const compositePaths: Array<[string, string, Array<string>]> = [
  [DAI, FYUSDC2303, [USDC]],
  [USDC, FYDAI2303, [DAI]],
  [DAI, FYETH2303, [ETH]],
  [USDC, FYETH2303, [ETH]],
  [ETH, FYDAI2303, [DAI]],
  [ETH, FYUSDC2303, [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]> = [
  [FYDAI2303, fyTokens.get(FYDAI2303)!, newJoins.get(FYDAI2303)!],
  [FYUSDC2303, fyTokens.get(FYUSDC2303)!, newJoins.get(FYUSDC2303)!],
  [FYETH2303, fyTokens.get(FYETH2303)!, newJoins.get(FYETH2303)!],
]

// Input data: baseId, ilkId, ratio (1000000 == 100%), line, dust, dec
/// @notice Collateralisation parameters and debt limits for each new asset pair
/// @param Base asset identifier (bytes6 tag)
/// @param Collateral asset identifier (bytes6 tag)
/// @param Collateralisation 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, FYUSDC2303, 1100000, 10000, 40, 18], // dai collateralized with fyUsdc
  [DAI, FYETH2303, 1400000, 10000, 40, 18], // dai collateralized with fyEth
  [USDC, FYDAI2303, 1100000, 10000, 40, 6], // usdc collateralized with fyDai
  [USDC, FYETH2303, 1400000, 10000, 40, 6], // usdc collateralized with fyETH
  [ETH, FYUSDC2303, 1400000, 10000000, 25000, 12], // eth collateralized with fyUsdc
  [ETH, FYDAI2303, 1400000, 10000000, 25000, 12], // eth collateralized with fyDai
]

export const auctionLineAndLimits: AuctionLineAndLimit[] = [
  // ETH
  {
    baseId: ETH,
    ilkId: FYUSDC2303,
    duration: 600,
    vaultProportion: parseUnits('0.5'),
    collateralProportion: parseUnits('0.75'), // 105 / 140
    max: parseUnits('500'),
  },
  {
    baseId: ETH,
    ilkId: FYDAI2303,
    duration: 600,
    vaultProportion: parseUnits('0.5'),
    collateralProportion: parseUnits('0.75'), // 105 / 140
    max: parseUnits('1000000'),
  },
  // USDC
  {
    baseId: USDC,
    ilkId: FYETH2303,
    duration: 600,
    vaultProportion: parseUnits('0.5'),
    collateralProportion: parseUnits('0.75'), // 105 / 140
    max: parseUnits('500'),
  },
  {
    baseId: USDC,
    ilkId: FYDAI2303,
    duration: 600,
    vaultProportion: parseUnits('1'),
    collateralProportion: parseUnits('0.9545454545'), // 105 / 110
    max: parseUnits('1000000'),
  },
  // DAI
  {
    baseId: DAI,
    ilkId: FYETH2303,
    duration: 600,
    vaultProportion: parseUnits('0.5'),
    collateralProportion: parseUnits('0.75'), // 105 / 140
    max: parseUnits('500'),
  },
  {
    baseId: DAI,
    ilkId: FYUSDC2303,
    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[]]> = [
  [FYDAI2303, [FYUSDC2303, FYETH2303]],
  [FYUSDC2303, [FYDAI2303, FYETH2303]],
  [FYETH2303, [FYUSDC2303, FYDAI2303]],
]

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/contango/fork/59accc0b-4696-4b77-85c9-cff276ebd040

Proposal log

➜  environments-v2 git:(contango/march23) ✗ sh scripts/governance/contango/arbitrum/mar23instruments/addMar23Instruments.sh             
++ dirname scripts/governance/contango/arbitrum/mar23instruments/addMar23Instruments.sh
+ HERE=scripts/governance/contango/arbitrum/mar23instruments
+ export CONF=/Users/bbonanno/Developer/projects/yield/environments-v2/scripts/governance/contango/arbitrum/mar23instruments/contango.arb_mainnet.mar23.config
+ CONF=/Users/bbonanno/Developer/projects/yield/environments-v2/scripts/governance/contango/arbitrum/mar23instruments/contango.arb_mainnet.mar23.config
+ RUN='npx hardhat run --network arb_mainnet'
+ npx hardhat run --network arb_mainnet scripts/governance/contango/arbitrum/mar23instruments/../../../deploy/deployJoins.ts
Join deployed at 0xa73b1Ea466C18D166b718dE5AF269ae177128CeE for 0x3295a74Bca0d6FdFeF648BA8549d305a8bA9cc13
npx hardhat verify --network arb_mainnet 0xa73b1Ea466C18D166b718dE5AF269ae177128CeE 0x3295a74Bca0d6FdFeF648BA8549d305a8bA9cc13 
join.grantRoles(ROOT, timelock)
Join deployed at 0xF7242fb5b73A6f7E8808bAAE6a81BB899c86A5dc for 0x0FBd5ca8eE61ec921B3F61B707f1D7D64456d2d1
npx hardhat verify --network arb_mainnet 0xF7242fb5b73A6f7E8808bAAE6a81BB899c86A5dc 0x0FBd5ca8eE61ec921B3F61B707f1D7D64456d2d1 
join.grantRoles(ROOT, timelock)
Join deployed at 0x47E6b83cAC4e297D04c3F8548c806CF2B2e8FE77 for 0x8a9262C7C6eC9bb143Eb68798AdB377c95F47138
npx hardhat verify --network arb_mainnet 0x47E6b83cAC4e297D04c3F8548c806CF2B2e8FE77 0x8a9262C7C6eC9bb143Eb68798AdB377c95F47138 
join.grantRoles(ROOT, timelock)
+ npx hardhat run --network arb_mainnet scripts/governance/contango/arbitrum/mar23instruments/../../../../fragments/witchV2/initialisePoolOracle.ts
Initialised PoolOracle for pool: 0209-0x2eb907fb4b71390dC5CD00e6b81B7dAAcE358193
Initialised PoolOracle for pool: 0109-0x22E1e5337C5BA769e98d732518b2128dE14b553C
Initialised PoolOracle for pool: 0009-0x79A6Be1Ae54153AA6Fc7e4795272c63F63B2a6DC
+ npx hardhat run --network arb_mainnet scripts/governance/contango/arbitrum/mar23instruments/../../shared/orchestrateNewInstruments.ts
join.revokeRole(ROOT, deployer)
join.grantRole(ROOT, cloak)
cloak.plan(ladle, join(0109)): 0x5409eaea02f46cd72f33c4e5b9d03ed42ef18001fd465c0cc4717d1fec8709a0
join.revokeRole(ROOT, deployer)
join.grantRole(ROOT, cloak)
cloak.plan(ladle, join(0209)): 0xadb6d04ba1d33725439e9e70c3c3264a750606512a367c1ef23dc3d83f4d3ba4
join.revokeRole(ROOT, deployer)
join.grantRole(ROOT, cloak)
cloak.plan(ladle, join(0009)): 0x60f2a069fc407718eff675594a0222d1b1fb5b5a674d7445c419ffae06d0bcb6
Adding 0x303130390000/0x303100000000 from 0x210F4e1942bEEc4038743A8f885B870E0c27b414
pair: 0109/01 -> 0x22E1e5337C5BA769e98d732518b2128dE14b553C
Adding 0x303230390000/0x303200000000 from 0x210F4e1942bEEc4038743A8f885B870E0c27b414
pair: 0209/02 -> 0x2eb907fb4b71390dC5CD00e6b81B7dAAcE358193
Adding 0x303030390000/0x303000000000 from 0x210F4e1942bEEc4038743A8f885B870E0c27b414
pair: 0009/00 -> 0x79A6Be1Ae54153AA6Fc7e4795272c63F63B2a6DC
Adding 0x303130390000/0x303100000000 from 0xb958bA862D70C0a4bD0ea976f9a1907686dd41e2
pair: 0109/01 -> 0xb958bA862D70C0a4bD0ea976f9a1907686dd41e2
Adding 0x303230390000/0x303200000000 from 0xb958bA862D70C0a4bD0ea976f9a1907686dd41e2
pair: 0209/02 -> 0xb958bA862D70C0a4bD0ea976f9a1907686dd41e2
Adding 0x303030390000/0x303000000000 from 0xb958bA862D70C0a4bD0ea976f9a1907686dd41e2
pair: 0009/00 -> 0xb958bA862D70C0a4bD0ea976f9a1907686dd41e2
[path: 01/0209 -> 0x303200000000],
[path: 02/0109 -> 0x303100000000],
[path: 01/0009 -> 0x303000000000],
[path: 02/0009 -> 0x303000000000],
[path: 00/0109 -> 0x303100000000],
[path: 00/0209 -> 0x303200000000],
Using asset at 0x3295a74Bca0d6FdFeF648BA8549d305a8bA9cc13
Using join at 0xa73b1Ea466C18D166b718dE5AF269ae177128CeE
Adding asset 0x303130390000 at 0x3295a74Bca0d6FdFeF648BA8549d305a8bA9cc13 with join 0xa73b1Ea466C18D166b718dE5AF269ae177128CeE
Using asset at 0x0FBd5ca8eE61ec921B3F61B707f1D7D64456d2d1
Using join at 0xF7242fb5b73A6f7E8808bAAE6a81BB899c86A5dc
Adding asset 0x303230390000 at 0x0FBd5ca8eE61ec921B3F61B707f1D7D64456d2d1 with join 0xF7242fb5b73A6f7E8808bAAE6a81BB899c86A5dc
Using asset at 0x8a9262C7C6eC9bb143Eb68798AdB377c95F47138
Using join at 0x47E6b83cAC4e297D04c3F8548c806CF2B2e8FE77
Adding asset 0x303030390000 at 0x8a9262C7C6eC9bb143Eb68798AdB377c95F47138 with join 0x47E6b83cAC4e297D04c3F8548c806CF2B2e8FE77
Using fyToken at 0x3295a74Bca0d6FdFeF648BA8549d305a8bA9cc13 for 0x303130390000
Using pool at 0x22E1e5337C5BA769e98d732518b2128dE14b553C for 0x303130390000
Adding 0x303130390000 for 0x303100000000 using 0x3295a74Bca0d6FdFeF648BA8549d305a8bA9cc13
Adding 0x303130390000 pool to Ladle using 0x22E1e5337C5BA769e98d732518b2128dE14b553C
fyToken.grantRoles(mint/burn, ladle)
cloak.plan(ladle, fyToken(0109)): 0xccf79a71279ba77ac4d6776fc4ab9c87e56a7676c527eae6ae2d1de1e4db440a
cloak.plan(witch, burn(0109)): 0x1dad383c9579a87a382a63d93f85716ab3732ae2372bd7275fc3cbd1a9f35363
Using fyToken at 0x0FBd5ca8eE61ec921B3F61B707f1D7D64456d2d1 for 0x303230390000
Using pool at 0x2eb907fb4b71390dC5CD00e6b81B7dAAcE358193 for 0x303230390000
Adding 0x303230390000 for 0x303200000000 using 0x0FBd5ca8eE61ec921B3F61B707f1D7D64456d2d1
Adding 0x303230390000 pool to Ladle using 0x2eb907fb4b71390dC5CD00e6b81B7dAAcE358193
fyToken.grantRoles(mint/burn, ladle)
cloak.plan(ladle, fyToken(0209)): 0xc734cce075d192bc6e9f40ea3d47de012ef4c486e14d82091c57d9295ecddfb4
cloak.plan(witch, burn(0209)): 0x53e72d71585d83af72e22e9b6d8c48a3b2ae84a5761d4ea64afdb9d215d970fd
Using fyToken at 0x8a9262C7C6eC9bb143Eb68798AdB377c95F47138 for 0x303030390000
Using pool at 0x79A6Be1Ae54153AA6Fc7e4795272c63F63B2a6DC for 0x303030390000
Adding 0x303030390000 for 0x303000000000 using 0x8a9262C7C6eC9bb143Eb68798AdB377c95F47138
Adding 0x303030390000 pool to Ladle using 0x79A6Be1Ae54153AA6Fc7e4795272c63F63B2a6DC
fyToken.grantRoles(mint/burn, ladle)
cloak.plan(ladle, fyToken(0009)): 0x54e63d01753176525846b3d6125ac283abe52321c40553a3190eb7d1a32598cb
cloak.plan(witch, burn(0009)): 0x6e14b26cea65f7e1ff3fefd64fbcddce0484fb5090bf5a100f5f54f05158137d
Witch#setLineAndLimit(0209, 00, 600, 500000000000000000, 750000000000000000, 500000000000000000000)
Witch#setLineAndLimit(0109, 00, 600, 500000000000000000, 750000000000000000, 1000000000000000000000000)
Witch#setLineAndLimit(0009, 02, 600, 500000000000000000, 750000000000000000, 500000000000000000000)
Witch#setLineAndLimit(0109, 02, 600, 1000000000000000000, 954545454500000000, 1000000000000000000000000)
Witch#setLineAndLimit(0009, 01, 600, 500000000000000000, 750000000000000000, 500000000000000000000)
Witch#setLineAndLimit(0209, 01, 600, 1000000000000000000, 954545454500000000, 1000000000000000000000000)
Allowing witch to exit join: 0xF7242fb5b73A6f7E8808bAAE6a81BB899c86A5dc
cloak.plan(witch, exit(0209)): 0x4f1c853a070e51c0861ea1479d7eade531784d48f11f20b12eabbdc38dad4c40
Allowing witch to exit join: 0xa73b1Ea466C18D166b718dE5AF269ae177128CeE
cloak.plan(witch, exit(0109)): 0x8db292e13c3c028db6b9312386f3b5ab89969c32060e094c6cd43180f6539d93
Allowing witch to exit join: 0x47E6b83cAC4e297D04c3F8548c806CF2B2e8FE77
cloak.plan(witch, exit(0009)): 0x75348bc6a16e7dbd6595722dee7a60f898a150ba87d611a5c1de4752ba262ba3
Adding for 01/0209 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Adding for 01/0009 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Adding for 02/0109 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Adding for 02/0009 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Adding for 00/0209 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Adding for 00/0109 from 0x750B3a18115fe090Bc621F9E4B90bd442bcd02F2
Updating 0x303130390000 series with 0x303230390000,0x303030390000 ilks
addIlks 0109: 0x303230390000,0x303030390000
Updating 0x303230390000 series with 0x303130390000,0x303030390000 ilks
addIlks 0209: 0x303130390000,0x303030390000
Updating 0x303030390000 series with 0x303230390000,0x303130390000 ilks
addIlks 0009: 0x303230390000,0x303130390000
Proposal: 0x0dcb71c3cc1e001bbc6d30611b0f2c9b972c2d63225d78170041a1dadf5983c8
Proposing
Developer: 0x05950b4e68f103d5aBEf20364dE219a247e59C23
Proposed 0x0dcb71c3cc1e001bbc6d30611b0f2c9b972c2d63225d78170041a1dadf5983c8