From f52ea9154b390028f2ac2edd5721e32de01a3c64 Mon Sep 17 00:00:00 2001 From: shivani Date: Thu, 21 Oct 2021 19:31:30 +0530 Subject: [PATCH] fix deployment errors --- helpers/contracts-getters.ts | 1 + helpers/types.ts | 20 +++++++++- markets/realT/commons.ts | 63 ++++++++++++++++--------------- markets/realT/index.ts | 56 +++++++++++++-------------- tasks/full/3_oracles.ts | 7 ++-- tasks/migrations/pro.mainnet.ts | 2 +- tasks/migrations/realt.mainnet.ts | 59 +++++++++++++++++++++++++++++ 7 files changed, 143 insertions(+), 65 deletions(-) create mode 100644 tasks/migrations/realt.mainnet.ts diff --git a/helpers/contracts-getters.ts b/helpers/contracts-getters.ts index 78ef977f..a3729414 100644 --- a/helpers/contracts-getters.ts +++ b/helpers/contracts-getters.ts @@ -211,6 +211,7 @@ export const getPairsTokenAggregator = ( allAssetsAddresses, getQuoteCurrencies(oracleQuoteCurrency) ); + console.log('assets without quote', assetsWithoutQuoteCurrency); const pairs = Object.entries(assetsWithoutQuoteCurrency).map(([tokenSymbol, tokenAddress]) => { //if (true/*tokenSymbol !== 'WETH' && tokenSymbol !== 'ETH' && tokenSymbol !== 'LpWETH'*/) { diff --git a/helpers/types.ts b/helpers/types.ts index d8d2065d..f5fe2250 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -299,9 +299,20 @@ export type iAavePoolAssets = Pick< | 'xSUSHI' >; -export type iAaveArcPoolAssets = Pick< +export type iAaveArcPoolAssets = Pick, 'USDC' | 'WBTC' | 'WETH' | 'AAVE'>; + +export type iAaveRealTPoolAssets = Pick< iAssetsWithoutUSD, - 'USDC' | 'WBTC' | 'WETH' | 'AAVE' + | 'REALTOKEN-S-13895-SARATOGA-ST-DETROIT-MI' + | 'REALTOKEN-S-4380-BEACONSFIELD-ST-DETROIT-MI' + | 'REALTOKEN-S-17813-BRADFORD-ST-DETROIT-M' + | 'REALTOKEN-S-15796-HARTWELL-ST-DETROIT-MI' + | 'REALTOKEN-S-9717-EVERTS-ST-DETROIT-MI' + | 'REALTOKEN-S-19201-WESTPHALIA-ST-DETROIT-MI' + | 'REALTOKEN-S-19163-MITCHELL-ST-DETROIT-MI' + | 'REALTOKEN-S-4061-GRAND-ST-DETROIT-M' + | 'REALTOKEN-S-4680-BUCKINGHAM-AVE-DETROIT-MI' + | 'REALTOKEN-S-19311-KEYSTONE-ST-DETROIT-MI' >; export type iLpPoolAssets = Pick< @@ -562,6 +573,11 @@ export interface IAaveConfiguration extends ICommonConfiguration { export interface IAaveArcConfiguration extends ICommonConfiguration { ReservesConfig: iAaveArcPoolAssets; } + +export interface IAaveRealTConfiguration extends ICommonConfiguration { + ReservesConfig: iAaveRealTPoolAssets; +} + export interface IAmmConfiguration extends ICommonConfiguration { ReservesConfig: iLpPoolAssets; } diff --git a/markets/realT/commons.ts b/markets/realT/commons.ts index 6ab9fdd1..a51fd63f 100644 --- a/markets/realT/commons.ts +++ b/markets/realT/commons.ts @@ -1,5 +1,11 @@ import BigNumber from 'bignumber.js'; -import { oneEther, oneRay, RAY, ZERO_ADDRESS, MOCK_CHAINLINK_AGGREGATORS_PRICES } from '../../helpers/constants'; +import { + oneEther, + oneRay, + RAY, + ZERO_ADDRESS, + MOCK_CHAINLINK_AGGREGATORS_PRICES, +} from '../../helpers/constants'; import { ICommonConfiguration, eEthereumNetwork } from '../../helpers/types'; // ---------------- @@ -47,22 +53,22 @@ export const CommonsConfig: ICommonConfiguration = { 'REALTOKEN-S-15796-HARTWELL-ST-DETROIT-MI': { borrowRate: oneRay.multipliedBy(0.03).toFixed(), }, - "REALTOKEN-S-9717-EVERTS-ST-DETROIT-MI": { + 'REALTOKEN-S-9717-EVERTS-ST-DETROIT-MI': { borrowRate: oneRay.multipliedBy(0.03).toFixed(), }, - "REALTOKEN-S-19201-WESTPHALIA-ST-DETROIT-MI": { + 'REALTOKEN-S-19201-WESTPHALIA-ST-DETROIT-MI': { borrowRate: oneRay.multipliedBy(0.03).toFixed(), }, - "REALTOKEN-S-19163-MITCHELL-ST-DETROIT-MI": { + 'REALTOKEN-S-19163-MITCHELL-ST-DETROIT-MI': { borrowRate: oneRay.multipliedBy(0.03).toFixed(), }, - "REALTOKEN-S-4061-GRAND-ST-DETROIT-M": { + 'REALTOKEN-S-4061-GRAND-ST-DETROIT-M': { borrowRate: oneRay.multipliedBy(0.03).toFixed(), }, - "REALTOKEN-S-4680-BUCKINGHAM-AVE-DETROIT-MI": { + 'REALTOKEN-S-4680-BUCKINGHAM-AVE-DETROIT-MI': { borrowRate: oneRay.multipliedBy(0.03).toFixed(), }, - "REALTOKEN-S-19311-KEYSTONE-ST-DETROIT-MI": { + 'REALTOKEN-S-19311-KEYSTONE-ST-DETROIT-MI': { borrowRate: oneRay.multipliedBy(0.03).toFixed(), }, }, @@ -118,7 +124,7 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: '', [eEthereumNetwork.main]: '', [eEthereumNetwork.tenderly]: '', - }, + }, LendingPoolCollateralManager: { [eEthereumNetwork.coverage]: '', [eEthereumNetwork.hardhat]: '', @@ -150,7 +156,7 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.coverage]: '', [eEthereumNetwork.hardhat]: '', [eEthereumNetwork.buidlerevm]: '', - [eEthereumNetwork.kovan]: '0xf99b8E67a0E044734B01EC4586D1c88C9a869718', + [eEthereumNetwork.kovan]: '', [eEthereumNetwork.ropsten]: '', [eEthereumNetwork.main]: '', [eEthereumNetwork.tenderly]: '', @@ -174,11 +180,11 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.tenderly]: '', }, FallbackOracle: { - [eEthereumNetwork.coverage]: '', - [eEthereumNetwork.hardhat]: '', - [eEthereumNetwork.buidlerevm]: '', - [eEthereumNetwork.kovan]: '', - [eEthereumNetwork.ropsten]: '', + [eEthereumNetwork.coverage]: ZERO_ADDRESS, + [eEthereumNetwork.hardhat]: ZERO_ADDRESS, + [eEthereumNetwork.buidlerevm]: ZERO_ADDRESS, + [eEthereumNetwork.kovan]: ZERO_ADDRESS, + [eEthereumNetwork.ropsten]: ZERO_ADDRESS, [eEthereumNetwork.main]: ZERO_ADDRESS, [eEthereumNetwork.tenderly]: ZERO_ADDRESS, }, @@ -187,23 +193,20 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.hardhat]: {}, [eEthereumNetwork.buidlerevm]: {}, [eEthereumNetwork.kovan]: { - "REALTOKEN-S-13895-SARATOGA-ST-DETROIT-MI": '0xCd47A6DaC96a449332976e50f4942FF81cDfd26C', - "REALTOKEN-S-4380-BEACONSFIELD-ST-DETROIT-MI": '0x84D51b1fC4f9c1230307071463Dc80408Ae15f24', - "REALTOKEN-S-17813-BRADFORD-ST-DETROIT-M": '0xd02E3b9E37fC9A1CD3141bEa58ACa013517d72BF', - "REALTOKEN-S-15796-HARTWELL-ST-DETROIT-MI": '0x215D2f4C9512E2d62C33362e53067b9Bdd68428d', - "REALTOKEN-S-9717-EVERTS-ST-DETROIT-MI": '0xc08460763599BDAb216812Bef5d89562Dc2eF07d', - "REALTOKEN-S-19201-WESTPHALIA-ST-DETROIT-MI": '0xF119107D3eCfF3641e83509a13D7d8Cd028F5a93', - "REALTOKEN-S-19163-MITCHELL-ST-DETROIT-MI": '0x1bd4077e20Fe045b3A5266C7813cbbAc9ffccBDD', - "REALTOKEN-S-4061-GRAND-ST-DETROIT-M": '0x75471312599D7444F5782978e3D05d78565ce77A', - "REALTOKEN-S-4680-BUCKINGHAM-AVE-DETROIT-MI": '0xBec14F5E869F50e6971bebb3332417644a47485B', - "REALTOKEN-S-19311-KEYSTONE-ST-DETROIT-MI": '0xd9cB01869e215DcB3906a0dD43a4198a5A79f07a', - }, - [eEthereumNetwork.ropsten]: { - }, - [eEthereumNetwork.main]: { - }, - [eEthereumNetwork.tenderly]: { + 'REALTOKEN-S-13895-SARATOGA-ST-DETROIT-MI': '0xCd47A6DaC96a449332976e50f4942FF81cDfd26C', + 'REALTOKEN-S-4380-BEACONSFIELD-ST-DETROIT-MI': '0x84D51b1fC4f9c1230307071463Dc80408Ae15f24', + 'REALTOKEN-S-17813-BRADFORD-ST-DETROIT-M': '0xd02E3b9E37fC9A1CD3141bEa58ACa013517d72BF', + 'REALTOKEN-S-15796-HARTWELL-ST-DETROIT-MI': '0x215D2f4C9512E2d62C33362e53067b9Bdd68428d', + 'REALTOKEN-S-9717-EVERTS-ST-DETROIT-MI': '0xc08460763599BDAb216812Bef5d89562Dc2eF07d', + 'REALTOKEN-S-19201-WESTPHALIA-ST-DETROIT-MI': '0xF119107D3eCfF3641e83509a13D7d8Cd028F5a93', + 'REALTOKEN-S-19163-MITCHELL-ST-DETROIT-MI': '0x1bd4077e20Fe045b3A5266C7813cbbAc9ffccBDD', + 'REALTOKEN-S-4061-GRAND-ST-DETROIT-M': '0x75471312599D7444F5782978e3D05d78565ce77A', + 'REALTOKEN-S-4680-BUCKINGHAM-AVE-DETROIT-MI': '0xBec14F5E869F50e6971bebb3332417644a47485B', + 'REALTOKEN-S-19311-KEYSTONE-ST-DETROIT-MI': '0xd9cB01869e215DcB3906a0dD43a4198a5A79f07a', }, + [eEthereumNetwork.ropsten]: {}, + [eEthereumNetwork.main]: {}, + [eEthereumNetwork.tenderly]: {}, }, ReserveAssets: { [eEthereumNetwork.coverage]: {}, diff --git a/markets/realT/index.ts b/markets/realT/index.ts index 2b2cd18b..961ccf1f 100644 --- a/markets/realT/index.ts +++ b/markets/realT/index.ts @@ -1,3 +1,4 @@ +import { IAaveRealTConfiguration } from './../../helpers/types'; import { ZERO_ADDRESS } from '../../helpers/constants'; import { IAaveArcConfiguration, eEthereumNetwork, eContractid } from '../../helpers/types'; @@ -12,53 +13,50 @@ import { strategy4061Grnd, strategy4380Beaconsfield, strategy4680Buckingham, - strategy9717Everts + strategy9717Everts, } from './reservesConfigs'; // ---------------- // POOL--SPECIFIC PARAMS // ---------------- -export const AaveArcConfig: IAaveArcConfiguration = { +export const AaveArcConfig: IAaveRealTConfiguration = { ...CommonsConfig, MarketId: 'RealT', ProviderId: 1, LendingPoolImpl: eContractid.PermissionedLendingPool, ReservesConfig: { - "REALTOKEN-S-13895-SARATOGA-ST-DETROIT-MI": strategy13895Saratoga, - "REALTOKEN-S-4380-BEACONSFIELD-ST-DETROIT-MI": strategy4380Beaconsfield, - "REALTOKEN-S-17813-BRADFORD-ST-DETROIT-M": strategy17813Bradford, - "REALTOKEN-S-15796-HARTWELL-ST-DETROIT-MI": strategy15796Hartwell, - "REALTOKEN-S-9717-EVERTS-ST-DETROIT-MI": strategy9717Everts, - "REALTOKEN-S-19201-WESTPHALIA-ST-DETROIT-MI": strategy19201Westphalia, - "REALTOKEN-S-19163-MITCHELL-ST-DETROIT-MI": strategy19163Mitchell, - "REALTOKEN-S-4061-GRAND-ST-DETROIT-M": strategy4061Grnd, - "REALTOKEN-S-4680-BUCKINGHAM-AVE-DETROIT-MI": strategy4680Buckingham, - "REALTOKEN-S-19311-KEYSTONE-ST-DETROIT-MI": strategy19311Keystone, + 'REALTOKEN-S-13895-SARATOGA-ST-DETROIT-MI': strategy13895Saratoga, + 'REALTOKEN-S-4380-BEACONSFIELD-ST-DETROIT-MI': strategy4380Beaconsfield, + 'REALTOKEN-S-17813-BRADFORD-ST-DETROIT-M': strategy17813Bradford, + 'REALTOKEN-S-15796-HARTWELL-ST-DETROIT-MI': strategy15796Hartwell, + 'REALTOKEN-S-9717-EVERTS-ST-DETROIT-MI': strategy9717Everts, + 'REALTOKEN-S-19201-WESTPHALIA-ST-DETROIT-MI': strategy19201Westphalia, + 'REALTOKEN-S-19163-MITCHELL-ST-DETROIT-MI': strategy19163Mitchell, + 'REALTOKEN-S-4061-GRAND-ST-DETROIT-M': strategy4061Grnd, + 'REALTOKEN-S-4680-BUCKINGHAM-AVE-DETROIT-MI': strategy4680Buckingham, + 'REALTOKEN-S-19311-KEYSTONE-ST-DETROIT-MI': strategy19311Keystone, }, ReserveAssets: { [eEthereumNetwork.buidlerevm]: {}, [eEthereumNetwork.hardhat]: {}, [eEthereumNetwork.coverage]: {}, [eEthereumNetwork.kovan]: { - "REALTOKEN-S-13895-SARATOGA-ST-DETROIT-MI": '0x6F442Da588232DC57Bf0096E8dE48D6961D5CC83', - "REALTOKEN-S-4380-BEACONSFIELD-ST-DETROIT-MI": '0x96700Ffae33c651bC329c3f3fbFE56e1f291f117', - "REALTOKEN-S-17813-BRADFORD-ST-DETROIT-M": '0x499A6c19F5537dd6005E2B5c6E1263103f558Ba4', - "REALTOKEN-S-15796-HARTWELL-ST-DETROIT-MI": '0xB3D3C1bBcEf737204AADb4fA6D90e974bc262197', - "REALTOKEN-S-9717-EVERTS-ST-DETROIT-MI": '0x73BdE888664DF8DDfD156B52e6999EEaBAB57C94', - "REALTOKEN-S-19201-WESTPHALIA-ST-DETROIT-MI": '0x830B0e9a5ecf36D0A886D21e1C20043cD2d16515', - "REALTOKEN-S-19163-MITCHELL-ST-DETROIT-MI": '0x4Cc53Ee5ef306a95d407321d4B4acc30814C04ee', - "REALTOKEN-S-4061-GRAND-ST-DETROIT-M": '0xd9e89bFebAe447B42C1Fa85C590716eC8820f737', - "REALTOKEN-S-4680-BUCKINGHAM-AVE-DETROIT-MI": '0xeFe82D6baF0dB71f92889eB9d00721bD49121316', - "REALTOKEN-S-19311-KEYSTONE-ST-DETROIT-MI": '0x8a9F904B4EaD6a97F3aB304d0D2196f5c602c807', + 'REALTOKEN-S-13895-SARATOGA-ST-DETROIT-MI': '0x6F442Da588232DC57Bf0096E8dE48D6961D5CC83', + 'REALTOKEN-S-4380-BEACONSFIELD-ST-DETROIT-MI': '0x96700Ffae33c651bC329c3f3fbFE56e1f291f117', + 'REALTOKEN-S-17813-BRADFORD-ST-DETROIT-M': '0x499A6c19F5537dd6005E2B5c6E1263103f558Ba4', + 'REALTOKEN-S-15796-HARTWELL-ST-DETROIT-MI': '0xB3D3C1bBcEf737204AADb4fA6D90e974bc262197', + 'REALTOKEN-S-9717-EVERTS-ST-DETROIT-MI': '0x73BdE888664DF8DDfD156B52e6999EEaBAB57C94', + 'REALTOKEN-S-19201-WESTPHALIA-ST-DETROIT-MI': '0x830B0e9a5ecf36D0A886D21e1C20043cD2d16515', + 'REALTOKEN-S-19163-MITCHELL-ST-DETROIT-MI': '0x4Cc53Ee5ef306a95d407321d4B4acc30814C04ee', + 'REALTOKEN-S-4061-GRAND-ST-DETROIT-M': '0xd9e89bFebAe447B42C1Fa85C590716eC8820f737', + 'REALTOKEN-S-4680-BUCKINGHAM-AVE-DETROIT-MI': '0xeFe82D6baF0dB71f92889eB9d00721bD49121316', + 'REALTOKEN-S-19311-KEYSTONE-ST-DETROIT-MI': '0x8a9F904B4EaD6a97F3aB304d0D2196f5c602c807', }, - [eEthereumNetwork.ropsten]: { - }, - [eEthereumNetwork.main]: { - }, - [eEthereumNetwork.tenderly]: { - }, - } + [eEthereumNetwork.ropsten]: {}, + [eEthereumNetwork.main]: {}, + [eEthereumNetwork.tenderly]: {}, + }, }; export default AaveArcConfig; diff --git a/tasks/full/3_oracles.ts b/tasks/full/3_oracles.ts index 823f4138..78eb6155 100644 --- a/tasks/full/3_oracles.ts +++ b/tasks/full/3_oracles.ts @@ -44,8 +44,8 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment') const tokensToWatch: SymbolMap = { ...reserveAssets, - USD: UsdAddress, }; + console.log('reserve'); const [tokens, aggregators] = getPairsTokenAggregator( tokensToWatch, chainlinkAggregators, @@ -55,6 +55,7 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment') let aaveOracle: AaveOracle; let lendingRateOracle: LendingRateOracle; + console.log('X', fallbackOracleAddress); if (notFalsyOrZeroAddress(aaveOracleAddress)) { aaveOracle = await await getAaveOracle(aaveOracleAddress); await waitForTx(await aaveOracle.setAssetSources(tokens, aggregators)); @@ -76,10 +77,10 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment') lendingRateOracle = await getLendingRateOracle(lendingRateOracleAddress); } else { lendingRateOracle = await deployLendingRateOracle(verify); - const { USD, ...tokensAddressesWithoutUsd } = tokensToWatch; + await setInitialMarketRatesInRatesOracleByHelper( lendingRateOracles, - tokensAddressesWithoutUsd, + tokensToWatch, lendingRateOracle, admin ); diff --git a/tasks/migrations/pro.mainnet.ts b/tasks/migrations/pro.mainnet.ts index d1e679de..670cdb22 100644 --- a/tasks/migrations/pro.mainnet.ts +++ b/tasks/migrations/pro.mainnet.ts @@ -7,7 +7,7 @@ import { usingTenderly } from '../../helpers/tenderly-utils'; task('pro:mainnet', 'Deploy development enviroment') .addFlag('verify', 'Verify contracts at Etherscan') .setAction(async ({ verify }, DRE) => { - const POOL_NAME = ConfigNames.RealT; + const POOL_NAME = ConfigNames.Arc; await DRE.run('set-DRE'); // Prevent loss of gas verifying all the needed ENVs for Etherscan verification diff --git a/tasks/migrations/realt.mainnet.ts b/tasks/migrations/realt.mainnet.ts new file mode 100644 index 00000000..8a46bc8f --- /dev/null +++ b/tasks/migrations/realt.mainnet.ts @@ -0,0 +1,59 @@ +import { task } from 'hardhat/config'; +import { checkVerification } from '../../helpers/etherscan-verification'; +import { ConfigNames } from '../../helpers/configuration'; +import { printContracts } from '../../helpers/misc-utils'; +import { usingTenderly } from '../../helpers/tenderly-utils'; + +task('realt:mainnet', 'Deploy development enviroment') + .addFlag('verify', 'Verify contracts at Etherscan') + .setAction(async ({ verify }, DRE) => { + const POOL_NAME = ConfigNames.RealT; + await DRE.run('set-DRE'); + + // Prevent loss of gas verifying all the needed ENVs for Etherscan verification + if (verify) { + checkVerification(); + } + + console.log('Migration started\n'); + + console.log('1. Deploy address provider'); + await DRE.run('full:deploy-address-provider', { pool: POOL_NAME, skipRegistry: true }); + + console.log('2. Deploy permissions manager'); + await DRE.run('deploy-permission-manager', { pool: POOL_NAME }); + + console.log('3. Deploy lending pool'); + await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME }); + + console.log('4. Deploy oracles'); + await DRE.run('full:deploy-oracles', { pool: POOL_NAME }); + + console.log('5. Deploy Data Provider'); + await DRE.run('full:data-provider', { pool: POOL_NAME }); + + console.log('6. Deploy Permissioned WETH Gateway'); + await DRE.run('full-deploy-permissioned-weth-gateway', { pool: POOL_NAME }); + + console.log('7. Initialize lending pool'); + await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME }); + + if (verify) { + printContracts(); + console.log('7. Veryfing contracts'); + await DRE.run('verify:general', { all: true, pool: POOL_NAME }); + + console.log('8. Veryfing aTokens and debtTokens'); + await DRE.run('verify:tokens', { pool: POOL_NAME }); + } + + if (usingTenderly()) { + const postDeployHead = DRE.tenderlyNetwork.getHead(); + const postDeployFork = DRE.tenderlyNetwork.getFork(); + console.log('Tenderly Info'); + console.log('- Head', postDeployHead); + console.log('- Fork', postDeployFork); + } + console.log('\nFinished migrations'); + printContracts(); + });