Skip to content

Latest commit

 

History

History
101 lines (84 loc) · 5.26 KB

YPP-0025.md

File metadata and controls

101 lines (84 loc) · 5.26 KB

Proposal

Deploy the fyToken and pool contracts for the DAI and USDC June series

Background

On December 31st 2021 the FYDAI2112 and FYUSDC2112 series will mature, and the YSDAI6MJD and YSUSDC6MJD 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.

Details

This deployment is an intermediate step as well in decommissioning the Wand and Factories. While the FYTokenFactory doesn't need to be used, to deploy the Pools without the PoolFactory would require a refactor of the Pool constructor which is beyond the risk apettite at this point. For this reason, we are premissioning the Timelock to deploy the Pools using the PoolFactory, in the way that the Wand would do it.

The deployJuneSeries.mainnet.sh script will be used, 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]> = [
  [FYDAI2206,  DAI,  protocol.get(COMPOUND) as string, joins.get(DAI) as string,  EOJUN22, 'FYDAI2206',  'FYDAI2206'],
  [FYUSDC2206, USDC, protocol.get(COMPOUND) as string, joins.get(USDC) as string, EOJUN22, 'FYUSDC2206', 'FYUSDC2206'],
]

// Pool fees to be set in the PoolFactory prior to pool deployment
// g1, g2
export const poolFees: [BigNumber, BigNumber] = [
  ONE64.mul(75).div(100), // Sell base to the pool
  ONE64.mul(100).div(75), // Sell fyToken to the pool
]

// Time stretch to be set in the PoolFactory prior to pool deployment
export const timeStretch: BigNumber = ONE64.div(secondsIn25Years)


// Pool fees to be set in the PoolFactory prior to pool deployment
// g1, g2
export const poolFees: [BigNumber, BigNumber] = [
  ONE64.mul(75).div(100), // Sell base to the pool
  ONE64.mul(100).div(75), // Sell fyToken to the pool
]

// Time stretch to be set in the PoolFactory prior to pool deployment
export const timeStretch: BigNumber = ONE64.div(secondsIn25Years)

The steps taken are five:

  1. Deploy fyToken contracts
  2. Set pool fees in PoolFactory
  3. Set time stretch in the PoolFactory
  4. Permission the PoolFactory for the Timelock to be able to create pools
  5. Deploy pool contracts
# Testing
The change has been deployed on a mainnet fork with the following output.

alberto@alberto-laptop:~/Code/Yield/environments-v2$ ./scripts/governance/addSeries/addJuneSeries/addJuneSeries.localhost.sh

  • RUN='npx hardhat run --network localhost' ++ dirname ./scripts/governance/addSeries/addJuneSeries/addJuneSeries.localhost.sh
  • HERE=./scripts/governance/addSeries/addJuneSeries
  • npx hardhat run --network localhost ./scripts/governance/addSeries/addJuneSeries/addJuneSeries-1.ts No need to generate any newer typings. ChainId: 1 Running on a fork, impersonating 0xC7aE076086623ecEA2450e364C838916a043F9a8 Using join at 0x4fE92119CDf873Cf8826F4E6EcfD4E578E3D44Dc for 0x303130360000 Using oracle at 0x53FBa816BD69a7f2a096f58687f87dd3020d0d5c for 0x303130360000 FYToken deployed at 0x720472c8ce72c2A2D711333e064ABD3E6BbEAdd3 npx hardhat verify --network localhost 0x720472c8ce72c2A2D711333e064ABD3E6BbEAdd3 0x303100000000 0x53FBa816BD69a7f2a096f58687f87dd3020d0d5c 0x4fE92119CDf873Cf8826F4E6EcfD4E578E3D44Dc 1656039600 FYDAI2206 FYDAI2206 --libraries safeERC20Namer.js fyToken.grantRoles(ROOT, timelock) Using join at 0x0d9A1A773be5a83eEbda23bf98efB8585C3ae4f4 for 0x303230360000 Using oracle at 0x53FBa816BD69a7f2a096f58687f87dd3020d0d5c for 0x303230360000 FYToken deployed at 0x5067457698Fd6Fa1C6964e416b3f42713513B3dD npx hardhat verify --network localhost 0x5067457698Fd6Fa1C6964e416b3f42713513B3dD 0x303200000000 0x53FBa816BD69a7f2a096f58687f87dd3020d0d5c 0x0d9A1A773be5a83eEbda23bf98efB8585C3ae4f4 1656039600 FYUSDC2206 FYUSDC2206 --libraries safeERC20Namer.js fyToken.grantRoles(ROOT, timelock)
  • npx hardhat run --network localhost ./scripts/governance/addSeries/addJuneSeries/addJuneSeries-2.ts No need to generate any newer typings. ChainId: 1 Running on a fork, impersonating 0xC7aE076086623ecEA2450e364C838916a043F9a8 g1 set to 13835058055282163712 g2 set to 24595658764946068821 ts set to 23381681843 poolFactory.grantRoles(gov, timelock) poolFactory.grantRole(ROOT, cloak) poolFactory.revokeRole(ROOT, deployer) Using join at 0x720472c8ce72c2A2D711333e064ABD3E6BbEAdd3 for 0x303130360000 Using join at 0x5067457698Fd6Fa1C6964e416b3f42713513B3dD for 0x303230360000 Proposal: 0xddb6d79987dff4bf5c83c8c7ceaf8d8846070f31429d1a7ffa661d86723fa19a Proposed 0xddb6d79987dff4bf5c83c8c7ceaf8d8846070f31429d1a7ffa661d86723fa19a

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 23381681843


To convert the values from 64.64 to decimal, the [ABDK converter](https://toolkit.abdk.consulting/math#convert-number) can be used.