Skip to content

Latest commit

 

History

History
335 lines (311 loc) · 18.6 KB

YPP-0032.md

File metadata and controls

335 lines (311 loc) · 18.6 KB

Proposal

Deploy the fyToken and pool contracts for the DAI and USDC September series & activate the series

Background

On March 25th 2022 the FYDAI2203 and FYUSDC2203 series will mature, and the YSDAI6MMS and YSUSDC6MMS strategies will stop accruing fees. To prepare for the maturity and rollover, the fyToken and pool contracts can already be deployed. The fyToken contracts won't be able to mint any tokens yet, effectively keeping both contracts disabled. The contracts would be activated after the maturity of previous pools by executing a separate transaction.

Details

Here are the steps:

  1. Deploy fyToken contracts for FYDAI2209 & FYUSDC2209 (no need for governance approval)
  2. Deploy pool contracts(no need for governance approval)
  3. Governance proposal
    1. Add new series
    2. Add ilks to the new series
    3. Initialize new pools
    4. Roll the strategies to the next pool

We would be deploying the fyTokens & pools using the deploySeptSeries.arbitrum.sh, with this input:

// Parameters to deploy fyToken with
// seriesId, underlyingId, chiOracleAddress, joinAddress, maturity, name, symbol
export const fyTokenData: Array<[string, string, string, string, number, string, string]> = [
  [FYDAI2209, DAI, protocol.get(ACCUMULATOR) as string, joins.get(DAI) as string, EOSEPT22, 'FYDAI2209', 'FYDAI2209'],
  [
    FYUSDC2209,
    USDC,
    protocol.get(ACCUMULATOR) as string,
    joins.get(USDC) as string,
    EOSEPT22,
    'FYUSDC2209',
    'FYUSDC2209',
  ],
]

// Parameters to deploy pools with, a pool being identified by the related seriesId
// seriesId, baseAddress, fyTokenAddress, ts (time stretch), g1 (Sell base to the pool fee), g2 (Sell fyToken to the pool fee)
export const poolData: Array<[string, string, string, BigNumber, BigNumber, BigNumber]> = [
  [
    FYDAI2209,
    assets.get(DAI) as string,
    fyTokens.get(FYDAI2209) as string,
    ONE64.div(secondsIn30Years),
    ONE64.mul(75).div(100),
    ONE64.mul(100).div(75),
  ],
  [
    FYUSDC2209,
    assets.get(USDC) as string,
    fyTokens.get(FYUSDC2209) as string,
    ONE64.div(secondsIn30Years),
    ONE64.mul(75).div(100),
    ONE64.mul(100).div(75),
  ],
]

We would be activating the series using activateSeptSeries.arbitrum.sh with this input

// Amounts to initialize pools with, a pool being identified by the related seriesId
// seriesId, baseId, baseAmount, fyTokenAmount
export const poolsInit: Array<[string, string, BigNumber, BigNumber]> = [
  [FYDAI2209, DAI, WAD.mul(100), BigNumber.from(0)],
  [FYUSDC2209, USDC, ONEUSDC.mul(100), BigNumber.from(0)],
]

// Ilks to accept for each series
// seriesId, accepted ilks
export const seriesIlks: Array<[string, string[]]> = [
  [FYDAI2209, [ETH, DAI, USDC, WBTC, WSTETH, LINK, ENS, UNI]],
  [FYUSDC2209, [ETH, DAI, USDC, WBTC, WSTETH, LINK, ENS, UNI, YVUSDC]],
]

// Parameters to roll each strategy
// strategyId, nextSeriesId, minRatio, maxRatio
export const rollData: Array<[string, string, BigNumber, BigNumber]> = [
  [YSDAI6MMS, FYDAI2209, BigNumber.from(0), MAX256],
  [YSUSDC6MMS, FYUSDC2209, BigNumber.from(0), MAX256],
]

Testing

The change has been deployed on a arbitrum fork with the following output.

++ dirname ./scripts/governance/addSeries/addSeptSeries/deploySeptSeries.arbitrum.sh
+ HERE=./scripts/governance/addSeries/addSeptSeries
+ export CONF=/Users/praffulsahu/Documents/Crypto/Yield/environments-v2/./scripts/governance/addSeries/addSeptSeries/addSeptSeries.arbitrum.config
+ CONF=/Users/praffulsahu/Documents/Crypto/Yield/environments-v2/./scripts/governance/addSeries/addSeptSeries/addSeptSeries.arbitrum.config
+ RUN='npx hardhat run --network localhost'
+ npx hardhat run --network localhost ./scripts/governance/addSeries/addSeptSeries/../../newEnvironment/deployFYTokens.ts
No need to generate any newer typings.
ChainId: 31337
Running on a fork, impersonating 0xC7aE076086623ecEA2450e364C838916a043F9a8
Using join at 0xc31cce4fFA203d8F8D865b6cfaa4F36AD77E9810 for 0x303130370000
Using oracle at 0x0ad9Ef93673B6081c0c3b753CcaaBDdd8d2e7848 for 0x303130370000
FYToken deployed at 0x0165878A594ca255338adfa4d48449f69242Eb8F
npx hardhat verify --network localhost 0x0165878A594ca255338adfa4d48449f69242Eb8F 0x303100000000 0x0ad9Ef93673B6081c0c3b753CcaaBDdd8d2e7848 0xc31cce4fFA203d8F8D865b6cfaa4F36AD77E9810 1664550000 FYDAI2209 FYDAI2209 --libraries safeERC20Namer.js
fyToken.grantRoles(ROOT, timelock)
Using join at 0x1229C71482E458fa2cd51d13eB157Bd2b5D5d1Ee for 0x303230370000
Using oracle at 0x0ad9Ef93673B6081c0c3b753CcaaBDdd8d2e7848 for 0x303230370000
FYToken deployed at 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6
npx hardhat verify --network localhost 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6 0x303200000000 0x0ad9Ef93673B6081c0c3b753CcaaBDdd8d2e7848 0x1229C71482E458fa2cd51d13eB157Bd2b5D5d1Ee 1664550000 FYUSDC2209 FYUSDC2209 --libraries safeERC20Namer.js
fyToken.grantRoles(ROOT, timelock)
+ npx hardhat run --network localhost ./scripts/governance/addSeries/addSeptSeries/../../newEnvironment/deployPools.ts
No need to generate any newer typings.
ChainId: 31337
Running on a fork, impersonating 0xC7aE076086623ecEA2450e364C838916a043F9a8
Using base at 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1
Using fyToken at 0x0165878A594ca255338adfa4d48449f69242Eb8F
Pool deployed at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788
npx hardhat verify --network localhost 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 0x0165878A594ca255338adfa4d48449f69242Eb8F 23381681843 13835058055282163712 24595658764946068821 --libraries yieldMath.js
Using base at 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8
Using fyToken at 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6
Pool deployed at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
npx hardhat verify --network localhost 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6 23381681843 13835058055282163712 24595658764946068821 --libraries yieldMath.js
+ npx hardhat run --network localhost ./scripts/governance/addSeries/addSeptSeries/addSeptSeries-3.ts
No need to generate any newer typings.
ChainId: 31337
Running on a fork, impersonating 0xC7aE076086623ecEA2450e364C838916a043F9a8
Using fyToken at 0x0165878A594ca255338adfa4d48449f69242Eb8F for 0x303130370000
Using pool at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 for 0x303130370000
Using join at 0xc31cce4fFA203d8F8D865b6cfaa4F36AD77E9810 for 0x303100000000
Adding 0x303130370000 for 0x303100000000 using 0x0165878A594ca255338adfa4d48449f69242Eb8F
Adding 0x303130370000 pool to Ladle using 0x610178dA211FEF7D417bC0e6FeD39F05609AD788
join.grantRoles(join/exit, fyToken)
fyToken.grantRoles(mint/burn, ladle)
fyToken.grantRoles(gov, timelock)
fyToken.revokeRole(ROOT, deployer)
fyToken.grantRole(ROOT, cloak)
cloak.plan(ladle, fyToken(0107)): 0x5794d09491c575f0e7b5ea52f6a7fddf762287c3673cde80f53c9d754d4229ad
cloak.plan(fyToken, join(01)): 0x460aa44857d2df1afd22864cd65f0ef2c518e4db29c66c4f78d0489a910c14b9
Using fyToken at 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6 for 0x303230370000
Using pool at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e for 0x303230370000
Using join at 0x1229C71482E458fa2cd51d13eB157Bd2b5D5d1Ee for 0x303200000000
Adding 0x303230370000 for 0x303200000000 using 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6
Adding 0x303230370000 pool to Ladle using 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
join.grantRoles(join/exit, fyToken)
fyToken.grantRoles(mint/burn, ladle)
fyToken.grantRoles(gov, timelock)
fyToken.revokeRole(ROOT, deployer)
fyToken.grantRole(ROOT, cloak)
cloak.plan(ladle, fyToken(0207)): 0x612ee019a734cba8fa048623b03ef27d6d1a77251440179d0e7af88dee2e5311
cloak.plan(fyToken, join(02)): 0x569bcd375dfd1288feb109fb0c4c47dfaeccc21ec4e6c3b12028465f8c3b5aad
Updating 0x303130370000 series with 0x303000000000,0x303100000000,0x303200000000 ilks
addIlks 0107: 0x303000000000,0x303100000000,0x303200000000
Updating 0x303230370000 series with 0x303000000000,0x303100000000,0x303200000000 ilks
addIlks 0207: 0x303000000000,0x303100000000,0x303200000000
Using pool at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 for 0x303130370000
Timelock balance of 0x303100000000 is 101414980801618940905
Transferring 100000000000000000000 of 0x303100000000 from Timelock to Pool
Initializing FYDAI2209LP at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788
Transferring 0 of 0x303100000000 from Timelock to Join
Minting 0 amount with underlying to 0x610178dA211FEF7D417bC0e6FeD39F05609AD788
Using pool at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e for 0x303230370000
Timelock balance of 0x303200000000 is 101940880
Transferring 100000000 of 0x303200000000 from Timelock to Pool
Initializing FYUSDC2209LP at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
Transferring 0 of 0x303200000000 from Timelock to Join
Minting 0 amount with underlying to 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
Using strategy at 0xE779cd75E6c574d83D3FD6C92F3CBE31DD32B1E1 for YSDAI6MMS
Using pool at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 for 0x303130370000
Strategy YSDAI6MMS divested from 0x303130350000
Strategy YSDAI6MMS rolled onto 0x303130370000
Using strategy at 0x92A5B31310a3ED4546e0541197a32101fCfBD5c8 for YSUSDC6MMS
Using pool at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e for 0x303230370000
Strategy YSUSDC6MMS divested from 0x303230350000
Strategy YSUSDC6MMS rolled onto 0x303230370000
Proposal: 0x52466d6952dc0513a3d13ff7b2a9f13a8626239c762ff738f3d303f6f8aacca2
Proposing
Proposed 0x52466d6952dc0513a3d13ff7b2a9f13a8626239c762ff738f3d303f6f8aacca2
+ npx hardhat run --network localhost ./scripts/governance/addSeries/addSeptSeries/addSeptSeries-3.ts
No need to generate any newer typings.
ChainId: 31337
Running on a fork, impersonating 0xC7aE076086623ecEA2450e364C838916a043F9a8
Using fyToken at 0x0165878A594ca255338adfa4d48449f69242Eb8F for 0x303130370000
Using pool at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 for 0x303130370000
Using join at 0xc31cce4fFA203d8F8D865b6cfaa4F36AD77E9810 for 0x303100000000
Adding 0x303130370000 for 0x303100000000 using 0x0165878A594ca255338adfa4d48449f69242Eb8F
Adding 0x303130370000 pool to Ladle using 0x610178dA211FEF7D417bC0e6FeD39F05609AD788
join.grantRoles(join/exit, fyToken)
fyToken.grantRoles(mint/burn, ladle)
fyToken.grantRoles(gov, timelock)
fyToken.revokeRole(ROOT, deployer)
fyToken.grantRole(ROOT, cloak)
cloak.plan(ladle, fyToken(0107)): 0x5794d09491c575f0e7b5ea52f6a7fddf762287c3673cde80f53c9d754d4229ad
cloak.plan(fyToken, join(01)): 0x460aa44857d2df1afd22864cd65f0ef2c518e4db29c66c4f78d0489a910c14b9
Using fyToken at 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6 for 0x303230370000
Using pool at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e for 0x303230370000
Using join at 0x1229C71482E458fa2cd51d13eB157Bd2b5D5d1Ee for 0x303200000000
Adding 0x303230370000 for 0x303200000000 using 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6
Adding 0x303230370000 pool to Ladle using 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
join.grantRoles(join/exit, fyToken)
fyToken.grantRoles(mint/burn, ladle)
fyToken.grantRoles(gov, timelock)
fyToken.revokeRole(ROOT, deployer)
fyToken.grantRole(ROOT, cloak)
cloak.plan(ladle, fyToken(0207)): 0x612ee019a734cba8fa048623b03ef27d6d1a77251440179d0e7af88dee2e5311
cloak.plan(fyToken, join(02)): 0x569bcd375dfd1288feb109fb0c4c47dfaeccc21ec4e6c3b12028465f8c3b5aad
Updating 0x303130370000 series with 0x303000000000,0x303100000000,0x303200000000 ilks
addIlks 0107: 0x303000000000,0x303100000000,0x303200000000
Updating 0x303230370000 series with 0x303000000000,0x303100000000,0x303200000000 ilks
addIlks 0207: 0x303000000000,0x303100000000,0x303200000000
Using pool at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 for 0x303130370000
Timelock balance of 0x303100000000 is 101414980801618940905
Transferring 100000000000000000000 of 0x303100000000 from Timelock to Pool
Initializing FYDAI2209LP at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788
Transferring 0 of 0x303100000000 from Timelock to Join
Minting 0 amount with underlying to 0x610178dA211FEF7D417bC0e6FeD39F05609AD788
Using pool at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e for 0x303230370000
Timelock balance of 0x303200000000 is 101940880
Transferring 100000000 of 0x303200000000 from Timelock to Pool
Initializing FYUSDC2209LP at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
Transferring 0 of 0x303200000000 from Timelock to Join
Minting 0 amount with underlying to 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
Using strategy at 0xE779cd75E6c574d83D3FD6C92F3CBE31DD32B1E1 for YSDAI6MMS
Using pool at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 for 0x303130370000
Strategy YSDAI6MMS divested from 0x303130350000
Strategy YSDAI6MMS rolled onto 0x303130370000
Using strategy at 0x92A5B31310a3ED4546e0541197a32101fCfBD5c8 for YSUSDC6MMS
Using pool at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e for 0x303230370000
Strategy YSUSDC6MMS divested from 0x303230350000
Strategy YSUSDC6MMS rolled onto 0x303230370000
Proposal: 0x52466d6952dc0513a3d13ff7b2a9f13a8626239c762ff738f3d303f6f8aacca2
Approving
Running on a fork, impersonating multisig at 0xC7aE076086623ecEA2450e364C838916a043F9a8
Approved 0x52466d6952dc0513a3d13ff7b2a9f13a8626239c762ff738f3d303f6f8aacca2
+ npx hardhat run --network localhost ./scripts/governance/addSeries/addSeptSeries/addSeptSeries-3.ts
No need to generate any newer typings.
ChainId: 31337
Running on a fork, impersonating 0xC7aE076086623ecEA2450e364C838916a043F9a8
Using fyToken at 0x0165878A594ca255338adfa4d48449f69242Eb8F for 0x303130370000
Using pool at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 for 0x303130370000
Using join at 0xc31cce4fFA203d8F8D865b6cfaa4F36AD77E9810 for 0x303100000000
Adding 0x303130370000 for 0x303100000000 using 0x0165878A594ca255338adfa4d48449f69242Eb8F
Adding 0x303130370000 pool to Ladle using 0x610178dA211FEF7D417bC0e6FeD39F05609AD788
join.grantRoles(join/exit, fyToken)
fyToken.grantRoles(mint/burn, ladle)
fyToken.grantRoles(gov, timelock)
fyToken.revokeRole(ROOT, deployer)
fyToken.grantRole(ROOT, cloak)
cloak.plan(ladle, fyToken(0107)): 0x5794d09491c575f0e7b5ea52f6a7fddf762287c3673cde80f53c9d754d4229ad
cloak.plan(fyToken, join(01)): 0x460aa44857d2df1afd22864cd65f0ef2c518e4db29c66c4f78d0489a910c14b9
Using fyToken at 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6 for 0x303230370000
Using pool at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e for 0x303230370000
Using join at 0x1229C71482E458fa2cd51d13eB157Bd2b5D5d1Ee for 0x303200000000
Adding 0x303230370000 for 0x303200000000 using 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6
Adding 0x303230370000 pool to Ladle using 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
join.grantRoles(join/exit, fyToken)
fyToken.grantRoles(mint/burn, ladle)
fyToken.grantRoles(gov, timelock)
fyToken.revokeRole(ROOT, deployer)
fyToken.grantRole(ROOT, cloak)
cloak.plan(ladle, fyToken(0207)): 0x612ee019a734cba8fa048623b03ef27d6d1a77251440179d0e7af88dee2e5311
cloak.plan(fyToken, join(02)): 0x569bcd375dfd1288feb109fb0c4c47dfaeccc21ec4e6c3b12028465f8c3b5aad
Updating 0x303130370000 series with 0x303000000000,0x303100000000,0x303200000000 ilks
addIlks 0107: 0x303000000000,0x303100000000,0x303200000000
Updating 0x303230370000 series with 0x303000000000,0x303100000000,0x303200000000 ilks
addIlks 0207: 0x303000000000,0x303100000000,0x303200000000
Using pool at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 for 0x303130370000
Timelock balance of 0x303100000000 is 101414980801618940905
Transferring 100000000000000000000 of 0x303100000000 from Timelock to Pool
Initializing FYDAI2209LP at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788
Transferring 0 of 0x303100000000 from Timelock to Join
Minting 0 amount with underlying to 0x610178dA211FEF7D417bC0e6FeD39F05609AD788
Using pool at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e for 0x303230370000
Timelock balance of 0x303200000000 is 101940880
Transferring 100000000 of 0x303200000000 from Timelock to Pool
Initializing FYUSDC2209LP at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
Transferring 0 of 0x303200000000 from Timelock to Join
Minting 0 amount with underlying to 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
Using strategy at 0xE779cd75E6c574d83D3FD6C92F3CBE31DD32B1E1 for YSDAI6MMS
Using pool at 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 for 0x303130370000
Strategy YSDAI6MMS divested from 0x303130350000
Strategy YSDAI6MMS rolled onto 0x303130370000
Using strategy at 0x92A5B31310a3ED4546e0541197a32101fCfBD5c8 for YSUSDC6MMS
Using pool at 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e for 0x303230370000
Strategy YSUSDC6MMS divested from 0x303230350000
Strategy YSUSDC6MMS rolled onto 0x303230370000
Proposal: 0x52466d6952dc0513a3d13ff7b2a9f13a8626239c762ff738f3d303f6f8aacca2
Executing
Executed 0x52466d6952dc0513a3d13ff7b2a9f13a8626239c762ff738f3d303f6f8aacca2

The following test was run on the forked arbitrum to ensure that the protocol is working as expected:

++ dirname ./scripts/governance/addSeries/addSeptSeries/deploySeptSeries.arbitrum.sh
+ HERE=./scripts/governance/addSeries/addSeptSeries
+ export CONF=/Users/praffulsahu/Documents/Crypto/Yield/environments-v2/./scripts/governance/addSeries/addSeptSeries/addSeptSeries.arbitrum.config
+ CONF=/Users/praffulsahu/Documents/Crypto/Yield/environments-v2/./scripts/governance/addSeries/addSeptSeries/addSeptSeries.arbitrum.config
+ RUN='npx hardhat run --network localhost'
+ npx hardhat run --network localhost ./scripts/governance/addSeries/addSeptSeries/addSeptSeries.arbitrum.test.ts
No need to generate any newer typings.
ChainId: 31337
Running on a fork, impersonating 0xC7aE076086623ecEA2450e364C838916a043F9a8
series: 0x303130370000
vault: 0xf549925ad13ceda785d851dd
posting 46483409614600459 ETH out of 10374424496720295078951
borrowing 100000000000000000000 FYDAI2209
posted and borrowed
repaying 100000000000000000000 FYDAI2209 and withdrawing 46483409614600459 ETH
repaid and withdrawn
series: 0x303230370000
vault: 0x0cbf412756695bf96e6159b4
posting 46493734000000000 ETH out of 10374424496720295078951
borrowing 100000000 FYUSDC2209
posted and borrowed
repaying 100000000 FYUSDC2209 and withdrawing 46493734000000000 ETH
repaid and withdrawn

The g1 and g2 values being set are as follows:

g1 set to 13835058055282163712
g2 set to 24595658764946068821

The ts value being set are as follows:

ts set to 19484734869

Maturity of the series is set to:

EOSEPT22 = 1664550000 // Friday, Sep 30, 2022 3:00:00 PM GMT+00:00