Skip to content

Latest commit

 

History

History
443 lines (413 loc) · 17.4 KB

YPP-0034.md

File metadata and controls

443 lines (413 loc) · 17.4 KB

Proposal

Introduce FRAX as a borrowable asset.

Background

You can find more details here

Details

The summary of the execution is as follows:

  1. Deploy Accumulator Oracle (no need for governance approval)
  2. Deploy FRAX Join (no need for governance approval)
  3. Deploy the FYFRAX2209 and FYFRAX2303 fyToken & pools (no need for governance approval)
  4. Deploy YSETH6MMS and YSETH6MJD strategies (no need for governance approval)
  5. Deploy OnChainTest (no need for governance approval)
  6. Governance proposal a. Update chi and rate in accumulator oracle b. Update Chainlink sources c. Update sources in the Composite Oracle d. Update paths in the Composite Oracle e. Add FRAX as an asset f. Make FRAX a base g. Approve DAI, USDC, WBTC, WSTETH, ENS and LINK as collaterals for FRAX using the Composite Oracle h. Approve ETH as collateral for FRAX using the Chainlink Oracle i. Add the FYFRAX2209 and FYFRAX2303 fyToken and pools as series j. Initialize the FYETH2206 and FYETH2209 pools with 100 FRAX each, and burn the LP tokens k. Orchestrate the YSETH6MMS and YSETH6MJD strategies l. Initialize the YSETH6MMS and YSETH6MJD strategies with 100 FRAX each, and burn the strategy tokens

These steps in 6 are encoded into the addFraxSeries.ts scripts, while the steps 1 to 5 are the regular deployment scripts from the environment deployment.

This input will be used:

Proposal Config

/// @notice Configuration of the acummulator
/// @param Asset identifier (bytes6 tag)
/// @param Acummulator type (bytes6 tag)
/// @param start Initial value for the acummulator (18 decimal fixed point)
/// @param increasePerSecond Acummulator multiplier, per second (18 decimal fixed point)
export const rateChiSources: Array<[string, string, string, string]> = [
  [FRAX, RATE, WAD.toString(), '1000000001546067000'],
  [FRAX, CHI, WAD.toString(), WAD.toString()],
]

/// @notice Assets that will be added to the protocol
/// @param Asset identifier (bytes6 tag)
/// @param Address for the asset
export const assetsToAdd: Map<string, string> = new Map([[FRAX, assets.get(FRAX) as string]])

/// @notice Assets that will be made into a base
/// @param Asset identifier (bytes6 tag)
/// @param Address for the related Join
export const bases: Array<[string, string]> = [[FRAX, newJoins.get(FRAX) as string]]

/// @notice Sources that will be added to the Chainlink Oracle
/// @param Base asset identifier (bytes6 tag)
/// @param Address for the base asset
/// @param Quote asset identifier (bytes6 tag)
/// @param Address for the quote asset
/// @param Address for the chainlink aggregator
export const chainlinkSources: Array<[string, string, string, string, string]> = [
  [FRAX, assets.get(FRAX) as string, ETH, assets.get(ETH) as string, '0x14d04Fff8D21bd62987a5cE9ce543d2F1edF5D3E'],
]

/// @notice Oracles that will be used for Chi
/// @param Asset identifier (bytes6 tag)
/// @param Address for the chi oracle
export const newChiSources: Array<[string, string]> = [[FRAX, protocol.get(ACCUMULATOR) as string]]

/// @notice Oracles that will be used for Rate
/// @param Asset identifier (bytes6 tag)
/// @param Address for the rate oracle
export const newRateSources: Array<[string, string]> = [[FRAX, protocol.get(ACCUMULATOR) as string]]

/// @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]> = [[FRAX, ETH, protocol.get(CHAINLINK) as string]]

/// @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 newCompositePaths: Array<[string, string, Array<string>]> = [
  [FRAX, ENS, [ETH]],
  [FRAX, WSTETH, [ETH, STETH]],
]

/// @notice Configure an asset as an ilk for a base using the Chainlink 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 newChainlinkLimits: Array<[string, string, number, number, number, number]> = [
  [FRAX, FRAX, 1000000, 5000000, 5000, 18],
  [FRAX, ETH, 1400000, 1000000, 5000, 18],
  [FRAX, DAI, 1100000, 1000000, 5000, 18],
  [FRAX, USDC, 1100000, 1000000, 5000, 18],
  [FRAX, WBTC, 1500000, 1000000, 5000, 18],
  [FRAX, LINK, 1670000, 1000000, 5000, 18],
  [FRAX, UNI, 1670000, 1000000, 5000, 18],
  [DAI, FRAX, 1100000, 100000, 5000, 18],
  [USDC, FRAX, 1100000, 100000, 5000, 6],
  [ETH, FRAX, 1400000, 1000000, 5000, 12],
]

/// @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 newCompositeLimits: Array<[string, string, number, number, number, number]> = [
  [FRAX, WSTETH, 1400000, 1000000, 5000, 18],
  [FRAX, ENS, 1670000, 1000000, 5000, 18],
]

/// @notice Deploy fyToken series
/// @param series identifier (bytes6 tag)
/// @param underlying identifier (bytes6 tag)
/// @param Address for the chi oracle
/// @param Address for the related Join
/// @param Maturity in unix time (seconds since Jan 1, 1970)
/// @param Name for the series
/// @param Symbol for the series
export const fyTokenData: Array<[string, string, string, string, number, string, string]> = [
  [
    FYFRAX2206,
    FRAX,
    protocol.get(ACCUMULATOR) as string,
    newJoins.get(FRAX) as string,
    EOJUN22,
    'FYFRAX2206',
    'FYFRAX2206',
  ],
  [
    FYFRAX2209,
    FRAX,
    protocol.get(ACCUMULATOR) as string,
    newJoins.get(FRAX) as string,
    EOSEP22,
    'FYFRAX2209',
    'FYFRAX2209',
  ],
]

/// @notice Deploy YieldSpace pools
/// @param pool identifier, usually matching the series (bytes6 tag)
/// @param base address
/// @param fyToken address
/// @param time stretch, in 64.64
/// @param g1, in 64.64
/// @param g2, in 64.64
export const poolData: Array<[string, string, string, BigNumber, BigNumber, BigNumber]> = [
  [
    FYFRAX2206,
    assets.get(FRAX) as string,
    newFYTokens.get(FYFRAX2206) as string,
    ONE64.div(secondsInOneYear.mul(37)),
    ONE64.mul(80).div(100),
    ONE64.mul(100).div(80),
  ],
  [
    FYFRAX2209,
    assets.get(FRAX) as string,
    newFYTokens.get(FYFRAX2209) as string,
    ONE64.div(secondsInOneYear.mul(37)),
    ONE64.mul(80).div(100),
    ONE64.mul(100).div(80),
  ],
]

/// @notice Pool initialization parameters
/// @param pool identifier, usually matching the series (bytes6 tag)
/// @param base identifier (bytes6 tag)
/// @param amount of base to initialize pool with
/// @param amount of fyToken to initialize pool with
export const poolsInit: Array<[string, string, BigNumber, BigNumber]> = [
  [FYFRAX2206, FRAX, WAD.mul(100), ZERO],
  [FYFRAX2209, FRAX, WAD.mul(100), ZERO],
]

/// @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[]]> = [
  [FYFRAX2206, [FRAX, ETH, DAI, USDC, WBTC, WSTETH, LINK, ENS, UNI]],
  [FYFRAX2209, [FRAX, ETH, DAI, USDC, WBTC, WSTETH, LINK, ENS, UNI]],
  [FYETH2206, [FRAX]],
  [FYETH2209, [FRAX]],
  [FYDAI2206, [FRAX]],
  [FYDAI2209, [FRAX]],
  [FYUSDC2206, [FRAX]],
  [FYUSDC2209, [FRAX]],
]

/// @notice Deploy strategies
/// @param strategy name
/// @param strategy identifier (bytes6 tag)
/// @param Address for the related Join
/// @param Address for the related asset
export const strategiesData: Array<[string, string, string, string, string]> = [
  // name, symbol, baseId
  ['Yield Strategy FRAX 6M Mar Sep', YSFRAX6MMS, FRAX, newJoins.get(FRAX) as string, assets.get(FRAX) as string],
  ['Yield Strategy FRAX 6M Jun Dec', YSFRAX6MJD, FRAX, newJoins.get(FRAX) as string, assets.get(FRAX) as string],
]

/// @notice Strategy initialization parameters
/// @param strategy identifier (bytes6 tag)
/// @param address of initial pool
/// @param series identifier (bytes6 tag)
/// @param amount of base to initialize strategy with
export const strategiesInit: Array<[string, string, string, BigNumber]> = [
  // [strategyId, startPoolAddress, startPoolId, initAmount]
  [YSFRAX6MMS, newPools.get(FYFRAX2209) as string, FYFRAX2209, WAD.mul(100)],
  [YSFRAX6MJD, newPools.get(FYFRAX2206) as string, FYFRAX2206, WAD.mul(100)],
]

// Input data: ilkId, duration, initialOffer, auctionLine, auctionDust, dec
/// @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 chainlinkAuctionLimits: Array<[string, number, number, number, number, number]> = [
  [FRAX, 3600, 1000000, 1000000, 5000, 18],
]

Testing

The series was tested by running this test

Here is the result:

+ npx hardhat run --network localhost ./scripts/governance/addSeries/addFraxSeries/addFraxSeries.test.ts
No need to generate any newer typings.
ChainId: 4
Running on a fork, impersonating 0x5AD7799f02D5a829B2d6FA085e6bd69A872619D5
series: 0x303330360000
ilk: 0x313800000000
vault: 0x0606bdbb63859fcc95286bf8
posting 5050000000000000000000 ilk out of 151525543183659117749708699
borrowing 5000000000000000000000 FYFRAX2206
posted and borrowed
repaying 5000000000000000000000 FYFRAX2206 and withdrawing 5050000000000000000000 ilk
repaid and withdrawn
series: 0x303330360000
ilk: 0x303000000000
vault: 0xed7b278cbeb2204d5c78aee9
posting 2274882357032877830 ilk out of 92608287332401376819885
borrowing 5000000000000000000000 FYFRAX2206
posted and borrowed
repaying 5000000000000000000000 FYFRAX2206 and withdrawing 2274882357032877830 ilk
repaid and withdrawn
series: 0x303330360000
ilk: 0x303100000000
vault: 0xc89fb445a396b453cc35d371
posting 5558060590797659399488 ilk out of 96286893322197418742174162
borrowing 5000000000000000000000 FYFRAX2206
posted and borrowed
repaying 5000000000000000000000 FYFRAX2206 and withdrawing 5558060590797659399488 ilk
repaid and withdrawn
series: 0x303330360000
ilk: 0x303200000000
vault: 0x950ae09dbc4e2d3befda475f
posting 5572066730 ilk out of 398655589693586
borrowing 5000000000000000000000 FYFRAX2206
posted and borrowed
repaying 5000000000000000000000 FYFRAX2206 and withdrawing 5572066730 ilk
repaid and withdrawn
series: 0x303330360000
ilk: 0x303300000000
vault: 0xe6feaf07c78ac079d47f3e63
posting 18557899 ilk out of 702519327487
borrowing 5000000000000000000000 FYFRAX2206
posted and borrowed
repaying 5000000000000000000000 FYFRAX2206 and withdrawing 18557899 ilk
repaid and withdrawn
series: 0x303330360000
ilk: 0x303400000000
vault: 0x37cc863490738591de98b39c
posting 2130081307023477177 ilk out of 148914122498895132342796
borrowing 5000000000000000000000 FYFRAX2206
posted and borrowed
repaying 5000000000000000000000 FYFRAX2206 and withdrawing 2130081307023477177 ilk
repaid and withdrawn
series: 0x303330360000
ilk: 0x303600000000
vault: 0xdefe29dd81b129cb3bf1014a
posting 596918557234853578064 ilk out of 13098328453036755207358465
borrowing 5000000000000000000000 FYFRAX2206
posted and borrowed
repaying 5000000000000000000000 FYFRAX2206 and withdrawing 596918557234853578064 ilk
repaid and withdrawn
series: 0x303330360000
ilk: 0x303700000000
vault: 0xf78ae03086b5c3665a11ab6e
posting 576809336490220838247 ilk out of 65532017200000000000000000
borrowing 5000000000000000000000 FYFRAX2206
posted and borrowed
repaying 5000000000000000000000 FYFRAX2206 and withdrawing 576809336490220838247 ilk
repaid and withdrawn
series: 0x303330360000
ilk: 0x313000000000
vault: 0xe17ef5085bd5595568fedf05
posting 881138737845911073734 ilk out of 24679867136918000000000000
borrowing 5000000000000000000000 FYFRAX2206
posted and borrowed
repaying 5000000000000000000000 FYFRAX2206 and withdrawing 881138737845911073734 ilk
repaid and withdrawn
series: 0x303330370000
ilk: 0x313800000000
vault: 0x43bae57d87bba3c51f93a7e6
posting 5050000000000000000000 ilk out of 151525543183659117749708699
borrowing 5000000000000000000000 FYFRAX2209
posted and borrowed
repaying 5000000000000000000000 FYFRAX2209 and withdrawing 5050000000000000000000 ilk
repaid and withdrawn
series: 0x303330370000
ilk: 0x303000000000
vault: 0xaa181b19bf2ab5737ef3e11e
posting 2274882357032877830 ilk out of 92608287332401376819885
borrowing 5000000000000000000000 FYFRAX2209
posted and borrowed
repaying 5000000000000000000000 FYFRAX2209 and withdrawing 2274882357032877830 ilk
repaid and withdrawn
series: 0x303330370000
ilk: 0x303100000000
vault: 0xd2a4124fef53332aae77bd9b
posting 5558060590797659399488 ilk out of 96286893322197418742174162
borrowing 5000000000000000000000 FYFRAX2209
posted and borrowed
repaying 5000000000000000000000 FYFRAX2209 and withdrawing 5558060590797659399488 ilk
repaid and withdrawn
series: 0x303330370000
ilk: 0x303200000000
vault: 0x244c6ebdee465cbd8c568bba
posting 5572066730 ilk out of 398655589693586
borrowing 5000000000000000000000 FYFRAX2209
posted and borrowed
repaying 5000000000000000000000 FYFRAX2209 and withdrawing 5572066730 ilk
repaid and withdrawn
series: 0x303330370000
ilk: 0x303300000000
vault: 0x20d29513432c64488167d2b7
posting 18557899 ilk out of 702519327487
borrowing 5000000000000000000000 FYFRAX2209
posted and borrowed
repaying 5000000000000000000000 FYFRAX2209 and withdrawing 18557899 ilk
repaid and withdrawn
series: 0x303330370000
ilk: 0x303400000000
vault: 0x2225833352c5f714cb476781
posting 2130081307023477177 ilk out of 148914122498895132342796
borrowing 5000000000000000000000 FYFRAX2209
posted and borrowed
repaying 5000000000000000000000 FYFRAX2209 and withdrawing 2130081307023477177 ilk
repaid and withdrawn
series: 0x303330370000
ilk: 0x303600000000
vault: 0x8af445a3f40c45f3256d6242
posting 596918557234853578064 ilk out of 13098328453036755207358465
borrowing 5000000000000000000000 FYFRAX2209
posted and borrowed
repaying 5000000000000000000000 FYFRAX2209 and withdrawing 596918557234853578064 ilk
repaid and withdrawn
series: 0x303330370000
ilk: 0x303700000000
vault: 0x57d38fa22b039596d0f8c0c2
posting 576809336490220838247 ilk out of 65532017200000000000000000
borrowing 5000000000000000000000 FYFRAX2209
posted and borrowed
repaying 5000000000000000000000 FYFRAX2209 and withdrawing 576809336490220838247 ilk
repaid and withdrawn
series: 0x303330370000
ilk: 0x313000000000
vault: 0x447d645d1f7e22021fc53526
posting 881138737845911073734 ilk out of 24679867136918000000000000
borrowing 5000000000000000000000 FYFRAX2209
posted and borrowed
repaying 5000000000000000000000 FYFRAX2209 and withdrawing 881138737845911073734 ilk
repaid and withdrawn
series: 0x303030360000
ilk: 0x313800000000
vault: 0x55ed4b69794e26fcb1889b6c
posting 21972520840679934637 ilk out of 151525543183659117749708699
borrowing 5000000000000000 FYETH2206
posted and borrowed
repaying 5000000000000000 FYETH2206 and withdrawing 21972520840679934637 ilk
repaid and withdrawn
series: 0x303030370000
ilk: 0x313800000000
vault: 0xe084bf8876702cfc3448605f
posting 21972520840679934637 ilk out of 151525543183659117749708699
borrowing 5000000000000000 FYETH2209
posted and borrowed
repaying 5000000000000000 FYETH2209 and withdrawing 21972520840679934637 ilk
repaid and withdrawn
series: 0x303130360000
ilk: 0x313800000000
vault: 0xa22cda7c02864fa1e5cae716
posting 5551941094541296103524 ilk out of 151525543183659117749708699
borrowing 5000000000000000000000 FYDAI2206
posted and borrowed
repaying 5000000000000000000000 FYDAI2206 and withdrawing 5551941094541296103524 ilk
repaid and withdrawn
series: 0x303130370000
ilk: 0x313800000000
vault: 0x06978bebd74524463e6051ce
posting 5551941094541296103524 ilk out of 151525543183659117749708699
borrowing 5000000000000000000000 FYDAI2209
posted and borrowed
repaying 5000000000000000000000 FYDAI2209 and withdrawing 5551941094541296103524 ilk
repaid and withdrawn
series: 0x303230360000
ilk: 0x313800000000
vault: 0xa6e6e9f10592f4d2ed84662e
posting 5537985542000457412139 ilk out of 151525543183659117749708699
borrowing 5000000000 FYUSDC2206
posted and borrowed
repaying 5000000000 FYUSDC2206 and withdrawing 5537985542000457412139 ilk
repaid and withdrawn
series: 0x303230370000
ilk: 0x313800000000
vault: 0x709c43022ae3aaa95d7bdf21
posting 5537985542000457412139 ilk out of 151525543183659117749708699
borrowing 5000000000 FYUSDC2209
posted and borrowed
repaying 5000000000 FYUSDC2209 and withdrawing 5537985542000457412139 ilk
repaid and withdrawn