wip: improved curve deployment scripts

This commit is contained in:
David Racero 2021-07-14 14:58:34 +02:00
parent 549bd7c944
commit 1b7d509051
9 changed files with 51 additions and 12 deletions

View File

@ -345,11 +345,28 @@ export const deployCurveGaugeReserveInterestRateStrategy = async (
) =>
withSaveAndVerify(
await new CurveGaugeReserveInterestRateStrategyFactory(await getFirstSigner()).deploy(...args),
eContractid.DefaultReserveInterestRateStrategy,
eContractid.CurveGaugeReserveInterestRateStrategy,
args,
verify
);
export const deployRateStrategy = async (
strategyName: string,
args: [tEthereumAddress, string, string, string, string, string, string],
verify: boolean
): Promise<tEthereumAddress> => {
switch (strategyName) {
case 'rateStrategyCurveBase':
return await (
await deployCurveGaugeReserveInterestRateStrategy(args, verify)
).address;
default:
return await (
await deployDefaultReserveInterestRateStrategy(args, verify)
).address;
}
};
export const deployStableDebtToken = async (
args: [tEthereumAddress, tEthereumAddress, tEthereumAddress, string, string],
verify: boolean

View File

@ -18,7 +18,7 @@ import {
rawInsertContractAddressInDb,
} from './contracts-helpers';
import { BigNumberish } from 'ethers';
import { deployDefaultReserveInterestRateStrategy } from './contracts-deployments';
import { deployRateStrategy } from './contracts-deployments';
import { ConfigNames } from './configuration';
import { defaultAbiCoder } from 'ethers/lib/utils';
import { isCurveGaugeV2, poolToGauge } from './external/curve/constants';
@ -115,9 +115,12 @@ export const initReservesByHelper = async (
stableRateSlope1,
stableRateSlope2,
];
strategyAddresses[strategy.name] = (
await deployDefaultReserveInterestRateStrategy(rateStrategies[strategy.name], verify)
).address;
strategyAddresses[strategy.name] = await deployRateStrategy(
strategy.name,
rateStrategies[strategy.name],
verify
);
// 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]);

View File

@ -93,6 +93,7 @@ export enum eContractid {
AaveOracleV2 = 'AaveOracleV2',
CurveGaugeRewardsAwareAToken = 'CurveGaugeRewardsAwareAToken',
CurveTreasury = 'CurveTreasury',
CurveGaugeReserveInterestRateStrategy = 'CurveGaugeReserveInterestRateStrategy',
}
/*

View File

@ -149,8 +149,8 @@ export const AmmConfig: IUsdAmmConfiguration = {
[eEthereumNetwork.buidlerevm]: '',
[eEthereumNetwork.kovan]: '0x8fb777d67e9945e2c01936e319057f9d41d559e6', // Need to re-deploy because of onlyOwner
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
[eEthereumNetwork.main]: ZERO_ADDRESS,
[eEthereumNetwork.tenderly]: '0x3a463fFE9b69364B51113352a17839e36268e657',
[eEthereumNetwork.main]: '0x3a463ffe9b69364b51113352a17839e36268e657', // Dev Fork only
[eEthereumNetwork.tenderly]: '0x3a463fFE9b69364B51113352a17839e36268e657', // Dev Fork only
},
FallbackOracle: {
[eEthereumNetwork.coverage]: '',
@ -174,7 +174,7 @@ export const AmmConfig: IUsdAmmConfiguration = {
USDT: '0x3E7d1eAB13ad0104d2750B8863b489D65364e32D',
a3CRV: '0x63180F55F421fEC4DD2C778bcE565D3fde03f931', // Oracle deployed at fork
saCRV: '0x1eD0819bD513A0B9271Fa831f1C3dbab8d80C36c', // Oracle deployed at fork
'3CRV': '0x03c3614b6888842EcCAc71ADA1Ef1ad8e54f6D89', // Oracle deployed at fork
'3CRV': '0x80D85fDA125B5779A09b5633af114c927392b01c', // Oracle deployed at fork
},
[eEthereumNetwork.tenderly]: {
DAI: '0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9',
@ -183,7 +183,7 @@ export const AmmConfig: IUsdAmmConfiguration = {
USDT: '0x3E7d1eAB13ad0104d2750B8863b489D65364e32D',
a3CRV: '0x63180F55F421fEC4DD2C778bcE565D3fde03f931', // Oracle deployed at fork
saCRV: '0x1eD0819bD513A0B9271Fa831f1C3dbab8d80C36c', // Oracle deployed at fork
'3CRV': '0x03c3614b6888842EcCAc71ADA1Ef1ad8e54f6D89', // Oracle deployed at fork
'3CRV': '0x80D85fDA125B5779A09b5633af114c927392b01c', // Oracle deployed at fork
},
},
ATokenDomainSeparator: {

View File

@ -12,6 +12,16 @@ export const rateStrategyAmmBase: IInterestRateStrategyParams = {
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
};
export const rateStrategyCurveBase: IInterestRateStrategyParams = {
name: 'rateStrategyCurveBase',
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
variableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
variableRateSlope2: new BigNumber(3.0).multipliedBy(oneRay).toFixed(),
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
};
// WETH WBTC
export const rateStrategyBaseOne: IInterestRateStrategyParams = {
name: 'rateStrategyBaseOne',

View File

@ -1,5 +1,5 @@
import { eContractid, IReserveParams } from '../../helpers/types';
import { rateStrategyAmmBase, rateStrategyStable, rateStrategyBaseOne } from './rateStrategies';
import { rateStrategyStable, rateStrategyBaseOne, rateStrategyCurveBase } from './rateStrategies';
export const strategyWETH: IReserveParams = {
strategy: rateStrategyBaseOne,
@ -74,7 +74,7 @@ export const strategyUSDT: IReserveParams = {
};
export const strategyCurveLP: IReserveParams = {
strategy: rateStrategyAmmBase,
strategy: rateStrategyCurveBase,
baseLTVAsCollateral: '9250',
liquidationThreshold: '9350',
liquidationBonus: '10500',

View File

@ -6,6 +6,8 @@ import {
deployInitializableAdminUpgradeabilityProxy,
} from '../../helpers/contracts-deployments';
import { waitForTx } from '../../helpers/misc-utils';
import { registerContractInJsonDb } from '../../helpers/contracts-helpers';
import { eContractid } from '../../helpers/types';
task(`deploy-curve-treasury`, `Deploys the CurveTreasury contract`)
.addParam('proxyAdmin')
@ -40,6 +42,9 @@ task(`deploy-curve-treasury`, `Deploys the CurveTreasury contract`)
await proxy['initialize(address,address,bytes)'](implementation.address, proxyAdmin, encoded)
);
await registerContractInJsonDb(eContractid.CurveTreasury, proxy);
await registerContractInJsonDb(`${eContractid.CurveTreasury}Impl`, implementation);
console.log(`\tFinished CurveTreasury deployment`);
console.log(`\tProxy:`, proxy.address);
console.log(`\tImpl:`, implementation.address);

View File

@ -35,7 +35,7 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
},
[eEthereumNetwork.tenderly]: {
incentivesController: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5',
aaveOracle: '0x3a463fFE9b69364B51113352a17839e36268e657',
aaveOracle: '0x90D5588357Ff9eB573Fa0693Cb77A14c1f5b89B1',
},
};
const supportedNetworks = Object.keys(addressesByNetwork);

View File

@ -19,6 +19,7 @@ import {
getPairsTokenAggregator,
} from '../../helpers/contracts-getters';
import { AaveOracle, AaveOracleV2, LendingRateOracle } from '../../types';
import { isAddress } from 'ethers/lib/utils';
task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
.addFlag('verify', 'Verify contracts at Etherscan')
@ -38,6 +39,7 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
const addressesProvider = await getLendingPoolAddressesProvider();
const admin = await getGenesisPoolAdmin(poolConfig);
const aaveOracleAddress = getParamPerNetwork(poolConfig.AaveOracle, network);
console.log('ORACLE ADRR', aaveOracleAddress);
const lendingRateOracleAddress = getParamPerNetwork(poolConfig.LendingRateOracle, network);
const fallbackOracleAddress = await getParamPerNetwork(FallbackOracle, network);
const reserveAssets = await getParamPerNetwork(ReserveAssets, network);
@ -58,6 +60,7 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
if (notFalsyOrZeroAddress(aaveOracleAddress)) {
aaveOracle = await await getAaveOracle(aaveOracleAddress);
await waitForTx(await aaveOracle.setAssetSources(tokens, aggregators));
} else {
aaveOracle = await deployAaveOracleV2(
[