From fda95dd318be3da821e8652d8002ad4657785af5 Mon Sep 17 00:00:00 2001 From: Zer0dot Date: Wed, 10 Feb 2021 18:23:05 -0500 Subject: [PATCH] Added optimized deployment functionality --- helpers/init-helpers.ts | 205 ++++++++++---------------------- helpers/types.ts | 14 ++- markets/aave/rateStrategies.ts | 91 ++++++++++++++ markets/aave/reservesConfigs.ts | 175 +++++---------------------- markets/lp/rateStrategies.ts | 36 ++++++ markets/lp/reservesConfigs.ts | 162 ++++--------------------- tasks/verifications/2_tokens.ts | 2 +- 7 files changed, 260 insertions(+), 425 deletions(-) create mode 100644 markets/aave/rateStrategies.ts create mode 100644 markets/lp/rateStrategies.ts diff --git a/helpers/init-helpers.ts b/helpers/init-helpers.ts index d06faf99..de0e99f4 100644 --- a/helpers/init-helpers.ts +++ b/helpers/init-helpers.ts @@ -58,16 +58,11 @@ export const initReservesByHelper = async ( // Set aTokenAndRatesDeployer as temporal admin await waitForTx(await addressProvider.setPoolAdmin(atokenAndRatesDeployer.address)); - console.log("Got deployer address"); + // CHUNK CONFIGURATION - const tokensChunks = 2; const initChunks = 4; // Initialize variables for future reserves initialization - let deployedStableTokens: string[] = []; - let deployedVariableTokens: string[] = []; - let deployedATokens: string[] = []; - let deployedRates: string[] = []; let reserveTokens: string[] = []; let reserveInitDecimals: string[] = []; let reserveSymbols: string[] = []; @@ -100,7 +95,6 @@ export const initReservesByHelper = async ( string, string ]; - // TEST - replacing with two maps, like a mapping to mapping in solidity let rateStrategies: Record = {}; let strategyAddresses: Record = {}; let strategyAddressPerAsset: Record = {}; @@ -109,7 +103,6 @@ export const initReservesByHelper = async ( let aTokenImplementationAddress = ""; let stableDebtTokenImplementationAddress = ""; let variableDebtTokenImplementationAddress = ""; - // --TEST const tx1 = await waitForTx( await stableAndVariableDeployer.initDeployment([ZERO_ADDRESS], ["1"]) @@ -120,12 +113,13 @@ export const initReservesByHelper = async ( rawInsertContractAddressInDb(`stableDebtTokenImpl`, stableDebtTokenImplementationAddress); rawInsertContractAddressInDb(`variableDebtTokenImpl`, variableDebtTokenImplementationAddress); }); + //gasUsage = gasUsage.add(tx1.gasUsed); const aTokenImplementation = await deployGenericATokenImpl(verify); aTokenImplementationAddress = aTokenImplementation.address; rawInsertContractAddressInDb(`aTokenImpl`, aTokenImplementationAddress); - // Deploy delegated aware reserves tokens + const delegatedAwareReserves = Object.entries(reservesParams).filter( ([_, { aTokenImpl }]) => aTokenImpl === eContractid.DelegationAwareAToken ) as [string, IReserveParams][]; @@ -136,122 +130,28 @@ export const initReservesByHelper = async ( rawInsertContractAddressInDb(`delegationAwareATokenImpl`, delegationAwareATokenImplementationAddress); } - // Deploy tokens and rates that uses common aToken in chunks - const reservesChunks = chunk( - Object.entries(reservesParams).filter( - ([_, { aTokenImpl }]) => aTokenImpl === eContractid.AToken - ) as [string, IReserveParams][], - tokensChunks - ); + const reserves = Object.entries(reservesParams).filter( + ([_, { aTokenImpl }]) => aTokenImpl === eContractid.DelegationAwareAToken || + aTokenImpl === eContractid.AToken + ) as [string, IReserveParams][]; - // const reserves = Object.entries(reservesParams).filter( - // ([_, { aTokenImpl }]) => aTokenImpl === eContractid.AToken - // ) as [string, IReserveParams][]; - - - console.log( - `- Token deployments in ${reservesChunks.length * 2} txs instead of ${ - Object.entries(reservesParams).length * 4 - } txs` - ); - // All of these use the same aToken implementation - // but they might use different rate strategy implementations, - // it is better to simply iterate through every reserve instead of chunks later - for (let reservesChunk of reservesChunks) { - - // Prepare data - const tokens: string[] = []; - const symbols: string[] = []; - - const reservesDecimals: string[] = []; - - for (let [assetSymbol, { reserveDecimals }] of reservesChunk) { - - const assetAddressIndex = Object.keys(tokenAddresses).findIndex( - (value) => value === assetSymbol - ); - - const [, tokenAddress] = (Object.entries(tokenAddresses) as [string, string][])[ - assetAddressIndex - ]; - - const reserveParamIndex = Object.keys(reservesParams).findIndex( - (value) => value === assetSymbol - ); - - const [ - , - { - strategy, - optimalUtilizationRate, - baseVariableBorrowRate, - variableRateSlope1, - variableRateSlope2, - stableRateSlope1, - stableRateSlope2, - }, - ] = (Object.entries(reservesParams) as [string, IReserveParams][])[reserveParamIndex]; - // Add to lists - - tokens.push(tokenAddress); - symbols.push(assetSymbol); - - if (!strategyAddresses[strategy]) { - // Strategy does not exist, create a new one - rateStrategies[strategy] = [ - addressProvider.address, - optimalUtilizationRate, - baseVariableBorrowRate, - variableRateSlope1, - variableRateSlope2, - stableRateSlope1, - stableRateSlope2, - ]; - //lastStrategy = strategy; - strategyAddresses[strategy] = (await deployDefaultReserveInterestRateStrategy( - rateStrategies[strategy], - verify - )).address; - } - strategyAddressPerAsset[assetSymbol] = strategyAddresses[strategy]; - console.log("Strategy address for asset %s: %s", assetSymbol, strategyAddressPerAsset[assetSymbol]) - - reservesDecimals.push(reserveDecimals); - aTokenType[assetSymbol] = "generic"; - // inputParams.push({ - // asset: tokenAddress, - // rates: [ - // optimalUtilizationRate, - // baseVariableBorrowRate, - // variableRateSlope1, - // variableRateSlope2, - // stableRateSlope1, - // stableRateSlope2 - // ] - // }); - } - reserveInitDecimals = [...reserveInitDecimals, ...reservesDecimals]; - reserveTokens = [...reserveTokens, ...tokens]; - reserveSymbols = [...reserveSymbols, ...symbols]; - } - - - - for (let [symbol, params] of delegatedAwareReserves) { - console.log(` - Deploy ${symbol} delegation aware aToken, debts tokens, and strategy`); + for (let [symbol, params] of reserves) { const { strategy, + aTokenImpl, + reserveDecimals, + } = params; + const { optimalUtilizationRate, baseVariableBorrowRate, variableRateSlope1, variableRateSlope2, stableRateSlope1, stableRateSlope2, - } = params; - - if (!strategyAddresses[strategy]) { + } = strategy; + if (!strategyAddresses[strategy.name]) { // Strategy does not exist, create a new one - rateStrategies[strategy] = [ + rateStrategies[strategy.name] = [ addressProvider.address, optimalUtilizationRate, baseVariableBorrowRate, @@ -260,23 +160,28 @@ export const initReservesByHelper = async ( stableRateSlope1, stableRateSlope2, ]; - //lastStrategy = strategy; - strategyAddresses[strategy] = (await deployDefaultReserveInterestRateStrategy( - rateStrategies[strategy], + strategyAddresses[strategy.name] = (await deployDefaultReserveInterestRateStrategy( + rateStrategies[strategy.name], verify )).address; + // This causes the last strategy to be printed twice, once under "DefaultReserveInterestRateStrategy" + // and once under the actual `strategyASSET` key. + rawInsertContractAddressInDb(strategy.name, strategyAddresses[strategy.name]); } - strategyAddressPerAsset[symbol] = strategyAddresses[strategy]; + strategyAddressPerAsset[symbol] = strategyAddresses[strategy.name]; console.log("Strategy address for asset %s: %s", symbol, strategyAddressPerAsset[symbol]) - aTokenType[symbol] = "delegation aware"; - reserveInitDecimals.push(params.reserveDecimals); + if (aTokenImpl === eContractid.AToken) { + aTokenType[symbol] = "generic"; + } else if (aTokenImpl === eContractid.DelegationAwareAToken) { + aTokenType[symbol] = "delegation aware"; + } + + reserveInitDecimals.push(reserveDecimals); reserveTokens.push(tokenAddresses[symbol]); reserveSymbols.push(symbol); } - //gasUsage = gasUsage.add(tx1.gasUsed); - for (let i = 0; i < reserveSymbols.length; i ++) { let aTokenToUse: string; if (aTokenType[reserveSymbols[i]] === 'generic') { @@ -319,7 +224,7 @@ export const initReservesByHelper = async ( console.log(` - Reserve ready for: ${chunkedSymbols[chunkIndex].join(', ')}`); console.log(' * gasUsed', tx3.gasUsed.toString()); - gasUsage = gasUsage.add(tx3.gasUsed); + //gasUsage = gasUsage.add(tx3.gasUsed); } @@ -490,7 +395,7 @@ export const initTokenReservesByHelper = async ( let deployedVariableTokens: string[] = []; let deployedATokens: string[] = []; let deployedRates: string[] = []; - let reserveTokens: string[] = []; + //let reserveTokens: string[] = []; let reserveInitDecimals: string[] = []; let reserveSymbols: string[] = []; @@ -529,10 +434,19 @@ export const initTokenReservesByHelper = async ( console.log(`- Skipping ${symbol} due already initialized`); continue; } - let stableTokenImpl = await getAddressById(`stableDebt${symbol}`, network); - let variableTokenImpl = await getAddressById(`variableDebt${symbol}`, network); - let aTokenImplementation = await getAddressById(`a${symbol}`, network); - let strategyImpl = await getAddressById(`strategy${symbol}`, network); + let stableTokenImpl = await getAddressById(`stableDebtTokenImpl`, network); + let variableTokenImpl = await getAddressById(`variableDebtTokenImpl`, network); + let aTokenImplementation: string | undefined = ""; + const [, { aTokenImpl, strategy }] = (Object.entries(reservesParams) as [string, IReserveParams][])[ + reserveParamIndex + ]; + if (aTokenImpl === eContractid.AToken) { + aTokenImplementation = await getAddressById(`aTokenImpl`, network); + } else if (aTokenImpl === eContractid.DelegationAwareAToken) { + aTokenImplementation = await getAddressById(`delegationAwareATokenImpl`, network); + } + + let strategyImpl = await getAddressById(strategy.name, network); if (!stableTokenImpl) { const stableDebt = await deployStableDebtToken( @@ -582,14 +496,17 @@ export const initTokenReservesByHelper = async ( const [ , { - optimalUtilizationRate, - baseVariableBorrowRate, - variableRateSlope1, - variableRateSlope2, - stableRateSlope1, - stableRateSlope2, + strategy }, ] = (Object.entries(reservesParams) as [string, IReserveParams][])[reserveParamIndex]; + const { + optimalUtilizationRate, + baseVariableBorrowRate, + variableRateSlope1, + variableRateSlope2, + stableRateSlope1, + stableRateSlope2, + } = strategy; const rates = await deployDefaultReserveInterestRateStrategy( [ tokenAddresses[symbol], @@ -604,19 +521,19 @@ export const initTokenReservesByHelper = async ( ); strategyImpl = rates.address; } - const symbols = [`a${symbol}`, `variableDebt${symbol}`, `stableDebt${symbol}`]; - const tokens = [aTokenImplementation, variableTokenImpl, stableTokenImpl]; - for (let index = 0; index < symbols.length; index++) { - if (!(await isErc20SymbolCorrect(tokens[index], symbols[index]))) { - console.error(`${symbol} and implementation does not match: ${tokens[index]}`); - throw Error('Symbol does not match implementation.'); - } - } + // --- REMOVED BECAUSE WE NOW USE THE SAME IMPLEMENTATIONS --- + // const symbols = [`a${symbol}`, `variableDebt${symbol}`, `stableDebt${symbol}`]; + // const tokens = [aTokenImplementation, variableTokenImpl, stableTokenImpl]; + // for (let index = 0; index < symbols.length; index++) { + // if (!(await isErc20SymbolCorrect(tokens[index], symbols[index]))) { + // console.error(`${symbol} and implementation does not match: ${tokens[index]}`); + // throw Error('Symbol does not match implementation.'); + // } + // } console.log(`- Added ${symbol} to the initialize batch`); deployedStableTokens.push(stableTokenImpl); deployedVariableTokens.push(variableTokenImpl); deployedATokens.push(aTokenImplementation); - reserveTokens.push(); deployedRates.push(strategyImpl); reserveInitDecimals.push(decimals.toString()); reserveSymbols.push(symbol); diff --git a/helpers/types.ts b/helpers/types.ts index 4a8b6475..b6c9195f 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -329,16 +329,26 @@ export enum TokenContractId { export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams { aTokenImpl: eContractid; reserveFactor: string; - strategy: string; + strategy: IInterestRateStrategyParams; } -export interface IReserveBorrowParams { +export interface IInterestRateStrategyParams { + name: string, optimalUtilizationRate: string; baseVariableBorrowRate: string; variableRateSlope1: string; variableRateSlope2: string; stableRateSlope1: string; stableRateSlope2: string; +} + +export interface IReserveBorrowParams { + // optimalUtilizationRate: string; + // baseVariableBorrowRate: string; + // variableRateSlope1: string; + // variableRateSlope2: string; + // stableRateSlope1: string; + // stableRateSlope2: string; borrowingEnabled: boolean; stableBorrowRateEnabled: boolean; reserveDecimals: string; diff --git a/markets/aave/rateStrategies.ts b/markets/aave/rateStrategies.ts new file mode 100644 index 00000000..afe19b63 --- /dev/null +++ b/markets/aave/rateStrategies.ts @@ -0,0 +1,91 @@ +import BigNumber from 'bignumber.js'; +import { oneRay } from '../../helpers/constants'; +import { IInterestRateStrategyParams } from '../../helpers/types'; + +// BUSD SUSD +export const rateStrategyStableOne: IInterestRateStrategyParams = { + name: "rateStrategyStableOne", + optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', +}; + +// DAI TUSD +export const rateStrategyStableTwo: IInterestRateStrategyParams = { + name: "rateStrategyStableTwo", + optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(), + stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(), + stableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(), +} + +// USDC USDT +export const rateStrategyStableThree: IInterestRateStrategyParams = { + name: "rateStrategyStableThree", + optimalUtilizationRate: new BigNumber(0.9).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(), + stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(), + stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(), +} + +// WETH +export const rateStrategyWETH: IInterestRateStrategyParams = { + name: "rateStrategyWETH", + optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), + stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), + stableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), +} + +// AAVE +export const rateStrategyAAVE: IInterestRateStrategyParams = { + name: "rateStrategyAAVE", + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: '0', + variableRateSlope1: '0', + variableRateSlope2: '0', + stableRateSlope1: '0', + stableRateSlope2: '0', +} + +// BAT ENJ LINK MANA MKR REN YFI ZRX +export const rateStrategyVolatileOne: IInterestRateStrategyParams = { + name: "rateStrategyVolatileOne", + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), + stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), +} + +// KNC WBTC +export const rateStrategyVolatileTwo: IInterestRateStrategyParams = { + name: "rateStrategyVolatileTwo", + optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), + stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), +} + +// SNX +export const rateStrategyVolatileThree: IInterestRateStrategyParams = { + name: "rateStrategyVolatileThree", + optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), + stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), +} diff --git a/markets/aave/reservesConfigs.ts b/markets/aave/reservesConfigs.ts index 213cb6cf..6921afed 100644 --- a/markets/aave/reservesConfigs.ts +++ b/markets/aave/reservesConfigs.ts @@ -1,15 +1,19 @@ -import BigNumber from 'bignumber.js'; -import { oneRay } from '../../helpers/constants'; +// import BigNumber from 'bignumber.js'; +// import { oneRay } from '../../helpers/constants'; import { eContractid, IReserveParams } from '../../helpers/types'; +import { + rateStrategyStableOne, + rateStrategyStableTwo, + rateStrategyStableThree, + rateStrategyWETH, + rateStrategyAAVE, + rateStrategyVolatileOne, + rateStrategyVolatileTwo, + rateStrategyVolatileThree, +} from './rateStrategies'; export const strategyBUSD: IReserveParams = { - strategy: "busd", - optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyStableOne, baseLTVAsCollateral: '0', liquidationThreshold: '0', liquidationBonus: '0', @@ -21,13 +25,7 @@ export const strategyBUSD: IReserveParams = { }; export const strategyDAI: IReserveParams = { - strategy: "dai", - optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyStableTwo, baseLTVAsCollateral: '7500', liquidationThreshold: '8000', liquidationBonus: '10500', @@ -39,13 +37,7 @@ export const strategyDAI: IReserveParams = { }; export const strategySUSD: IReserveParams = { - strategy: "susd", - optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyStableOne, baseLTVAsCollateral: '0', liquidationThreshold: '0', liquidationBonus: '0', @@ -57,13 +49,7 @@ export const strategySUSD: IReserveParams = { }; export const strategyTUSD: IReserveParams = { - strategy: "tusd", - optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyStableTwo, baseLTVAsCollateral: '7500', liquidationThreshold: '8000', liquidationBonus: '10500', @@ -75,13 +61,7 @@ export const strategyTUSD: IReserveParams = { }; export const strategyUSDC: IReserveParams = { - strategy: "usdc", - optimalUtilizationRate: new BigNumber(0.9).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyStableThree, baseLTVAsCollateral: '8000', liquidationThreshold: '8500', liquidationBonus: '10500', @@ -93,13 +73,7 @@ export const strategyUSDC: IReserveParams = { }; export const strategyUSDT: IReserveParams = { - strategy: "usdt", - optimalUtilizationRate: new BigNumber(0.9).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyStableThree, baseLTVAsCollateral: '8000', liquidationThreshold: '8500', liquidationBonus: '10500', @@ -111,13 +85,7 @@ export const strategyUSDT: IReserveParams = { }; export const strategyAAVE: IReserveParams = { - strategy: "aave", - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: '0', - variableRateSlope1: '0', - variableRateSlope2: '0', - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyAAVE, baseLTVAsCollateral: '5000', liquidationThreshold: '6500', liquidationBonus: '11000', @@ -129,13 +97,7 @@ export const strategyAAVE: IReserveParams = { }; export const strategyBAT: IReserveParams = { - strategy: "bat", - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyVolatileOne, baseLTVAsCollateral: '7000', liquidationThreshold: '7500', liquidationBonus: '11000', @@ -147,13 +109,7 @@ export const strategyBAT: IReserveParams = { }; export const strategyENJ: IReserveParams = { - strategy: "enj", - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyVolatileOne, baseLTVAsCollateral: '5500', liquidationThreshold: '6000', liquidationBonus: '11000', @@ -165,13 +121,7 @@ export const strategyENJ: IReserveParams = { }; export const strategyWETH: IReserveParams = { - strategy: "weth", - optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyWETH, baseLTVAsCollateral: '8000', liquidationThreshold: '8250', liquidationBonus: '10500', @@ -183,13 +133,7 @@ export const strategyWETH: IReserveParams = { }; export const strategyKNC: IReserveParams = { - strategy: "knc", - optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyVolatileTwo, baseLTVAsCollateral: '6000', liquidationThreshold: '6500', liquidationBonus: '11000', @@ -201,13 +145,7 @@ export const strategyKNC: IReserveParams = { }; export const strategyLINK: IReserveParams = { - strategy: "link", - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyVolatileOne, baseLTVAsCollateral: '7000', liquidationThreshold: '7500', liquidationBonus: '11000', @@ -219,13 +157,7 @@ export const strategyLINK: IReserveParams = { }; export const strategyMANA: IReserveParams = { - strategy: "mana", - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyVolatileOne, baseLTVAsCollateral: '6000', liquidationThreshold: '6500', liquidationBonus: '11000', @@ -237,13 +169,7 @@ export const strategyMANA: IReserveParams = { }; export const strategyMKR: IReserveParams = { - strategy: "mkr", - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyVolatileOne, baseLTVAsCollateral: '6000', liquidationThreshold: '6500', liquidationBonus: '11000', @@ -255,13 +181,7 @@ export const strategyMKR: IReserveParams = { }; export const strategyREN: IReserveParams = { - strategy: "ren", - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyVolatileOne, baseLTVAsCollateral: '5500', liquidationThreshold: '6000', liquidationBonus: '11000', @@ -273,13 +193,7 @@ export const strategyREN: IReserveParams = { }; export const strategySNX: IReserveParams = { - strategy: "snx", - optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.12).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyVolatileThree, baseLTVAsCollateral: '1500', liquidationThreshold: '4000', liquidationBonus: '11000', @@ -290,14 +204,9 @@ export const strategySNX: IReserveParams = { reserveFactor: '3500' }; +// Invalid borrow rates in params currently, replaced with snx params export const strategyUNI: IReserveParams = { - strategy: "uni", - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: '0', - variableRateSlope1: '0', - variableRateSlope2: '0', - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyVolatileThree, baseLTVAsCollateral: '6000', liquidationThreshold: '6500', liquidationBonus: '11000', @@ -309,13 +218,7 @@ export const strategyUNI: IReserveParams = { }; export const strategyWBTC: IReserveParams = { - strategy: "wbtc", - optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: '0', - variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyVolatileTwo, baseLTVAsCollateral: '7000', liquidationThreshold: '7500', liquidationBonus: '11000', @@ -327,13 +230,7 @@ export const strategyWBTC: IReserveParams = { }; export const strategyYFI: IReserveParams = { - strategy: "yfi", - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: '0', - variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyVolatileOne, baseLTVAsCollateral: '4000', liquidationThreshold: '5500', liquidationBonus: '11500', @@ -345,13 +242,7 @@ export const strategyYFI: IReserveParams = { }; export const strategyZRX: IReserveParams = { - strategy: "zrx", - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: '0', - variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyVolatileOne, baseLTVAsCollateral: '6000', liquidationThreshold: '6500', liquidationBonus: '11000', diff --git a/markets/lp/rateStrategies.ts b/markets/lp/rateStrategies.ts new file mode 100644 index 00000000..a91af2ea --- /dev/null +++ b/markets/lp/rateStrategies.ts @@ -0,0 +1,36 @@ +import BigNumber from 'bignumber.js'; +import { oneRay } from '../../helpers/constants'; +import { IInterestRateStrategyParams } from '../../helpers/types'; + +// DAIWETH WBTCWETH AAVEWETH BATWETH USDCDAI CRVWETH LINKWETH MKRWETH RENWETH SNXWETH UNIWETH USDCWETH WBTCUSDC YFIWETH +export const rateStrategyLpBase: IInterestRateStrategyParams = { + name: "rateStrategyLpBase", + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', +} + +// WETH WBTC +export const rateStrategyBaseOne: IInterestRateStrategyParams = { + name: "rateStrategyBaseOne", + optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), + stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), + stableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), +} + +// DAI USDC USDT +export const rateStrategyStable: IInterestRateStrategyParams = { + name: "rateStrategyStable", + optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(), + stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(), + stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(), +} \ No newline at end of file diff --git a/markets/lp/reservesConfigs.ts b/markets/lp/reservesConfigs.ts index a27261d0..21db2a1e 100644 --- a/markets/lp/reservesConfigs.ts +++ b/markets/lp/reservesConfigs.ts @@ -1,15 +1,13 @@ -import BigNumber from 'bignumber.js'; -import { oneRay } from '../../helpers/constants'; -import { eContractid, IReserveParams } from '../../helpers/types'; +import { eContractid, IReserveParams} from '../../helpers/types'; +import { + rateStrategyLpBase, + rateStrategyStable, + rateStrategyBaseOne, +} from './rateStrategies'; + export const strategyWETH: IReserveParams = { - strategy: 'WETH and WBTC', - optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyBaseOne, baseLTVAsCollateral: '8000', liquidationThreshold: '8250', liquidationBonus: '10500', @@ -21,13 +19,7 @@ export const strategyWETH: IReserveParams = { }; export const strategyWBTC: IReserveParams = { - strategy: 'WETH and WBTC', - optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyBaseOne, baseLTVAsCollateral: '7000', liquidationThreshold: '7500', liquidationBonus: '11000', @@ -39,13 +31,7 @@ export const strategyWBTC: IReserveParams = { }; export const strategyDAI: IReserveParams = { - strategy: 'stablecoin', - optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyStable, baseLTVAsCollateral: '7500', liquidationThreshold: '8000', liquidationBonus: '10500', @@ -57,13 +43,7 @@ export const strategyDAI: IReserveParams = { }; export const strategyUSDC: IReserveParams = { - strategy: 'stablecoin', - optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyStable, baseLTVAsCollateral: '8000', liquidationThreshold: '8500', liquidationBonus: '10500', @@ -75,13 +55,7 @@ export const strategyUSDC: IReserveParams = { }; export const strategyUSDT: IReserveParams = { - strategy: 'stablecoin', - optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(), - stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(), - stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(), + strategy: rateStrategyStable, baseLTVAsCollateral: '-1', liquidationThreshold: '8500', liquidationBonus: '10500', @@ -93,13 +67,7 @@ export const strategyUSDT: IReserveParams = { }; export const strategyDAIWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '6000', liquidationThreshold: '7000', liquidationBonus: '11500', @@ -111,13 +79,7 @@ export const strategyDAIWETH: IReserveParams = { }; export const strategyWBTCWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '6000', liquidationThreshold: '7000', liquidationBonus: '11500', @@ -129,13 +91,7 @@ export const strategyWBTCWETH: IReserveParams = { }; export const strategyAAVEWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '6000', liquidationThreshold: '7000', liquidationBonus: '11500', @@ -147,13 +103,7 @@ export const strategyAAVEWETH: IReserveParams = { }; export const strategyBATWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '6000', liquidationThreshold: '7000', liquidationBonus: '11500', @@ -165,13 +115,7 @@ export const strategyBATWETH: IReserveParams = { }; export const strategyUSDCDAI: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '6000', liquidationThreshold: '7000', liquidationBonus: '11500', @@ -183,13 +127,7 @@ export const strategyUSDCDAI: IReserveParams = { }; export const strategyCRVWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '5000', liquidationThreshold: '6000', liquidationBonus: '11500', @@ -201,13 +139,7 @@ export const strategyCRVWETH: IReserveParams = { }; export const strategyLINKWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '6000', liquidationThreshold: '7000', liquidationBonus: '11500', @@ -219,13 +151,7 @@ export const strategyLINKWETH: IReserveParams = { }; export const strategyMKRWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '6000', liquidationThreshold: '7000', liquidationBonus: '11500', @@ -237,13 +163,7 @@ export const strategyMKRWETH: IReserveParams = { }; export const strategyRENWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '6000', liquidationThreshold: '7000', liquidationBonus: '11500', @@ -255,13 +175,7 @@ export const strategyRENWETH: IReserveParams = { }; export const strategySNXWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '4000', liquidationThreshold: '6000', liquidationBonus: '11500', @@ -273,13 +187,7 @@ export const strategySNXWETH: IReserveParams = { }; export const strategyUNIWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '6000', liquidationThreshold: '7000', liquidationBonus: '11500', @@ -291,13 +199,7 @@ export const strategyUNIWETH: IReserveParams = { }; export const strategyUSDCWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '6000', liquidationThreshold: '7000', liquidationBonus: '11500', @@ -309,13 +211,7 @@ export const strategyUSDCWETH: IReserveParams = { }; export const strategyWBTCUSDC: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '6000', liquidationThreshold: '7000', liquidationBonus: '11500', @@ -327,13 +223,7 @@ export const strategyWBTCUSDC: IReserveParams = { }; export const strategyYFIWETH: IReserveParams = { - strategy: 'uniswap LP base', - optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), - baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), - variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), - variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), - stableRateSlope1: '0', - stableRateSlope2: '0', + strategy: rateStrategyLpBase, baseLTVAsCollateral: '5000', liquidationThreshold: '6000', liquidationBonus: '11500', diff --git a/tasks/verifications/2_tokens.ts b/tasks/verifications/2_tokens.ts index 591aa45a..4ea86cc5 100644 --- a/tasks/verifications/2_tokens.ts +++ b/tasks/verifications/2_tokens.ts @@ -52,7 +52,7 @@ task('verify:tokens', 'Deploy oracles for dev enviroment') variableRateSlope2, stableRateSlope1, stableRateSlope2, - } = tokenConfig[1]; + } = tokenConfig[1].strategy; console.log; // Proxy Stable Debt