Initial implementation of Tenderly plugin

This commit is contained in:
David Racero 2020-11-12 14:12:26 +01:00
parent 23c5d9af29
commit d1c6943cd3
15 changed files with 254 additions and 43 deletions

View File

@ -129,6 +129,29 @@ export const AaveConfig: IAaveConfiguration = {
YFI: '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e',
ZRX: '0xe41d2489571d322189246dafa5ebde1f4699f498',
},
[EthereumNetwork.tenderlyMain]: {
AAVE: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9',
BAT: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
BUSD: '0x4Fabb145d64652a948d72533023f6E7A623C7C53',
DAI: '0x6b175474e89094c44da98b954eedeac495271d0f',
ENJ: '0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c',
KNC: '0xdd974d5c2e2928dea5f71b9825b8b646686bd200',
LINK: '0x514910771af9ca656af840dff83e8264ecf986ca',
MANA: '0x0f5d2fb29fb7d3cfee444a200298f468908cc942',
MKR: '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2',
REN: '0x408e41876cCCDC0F92210600ef50372656052a38',
REP: '0x1985365e9f78359a9B6AD760e32412f4a445E862',
SNX: '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F',
SUSD: '0x57ab1ec28d129707052df4df418d58a2d46d5f51',
TUSD: '0x0000000000085d4780B73119b644AE5ecd22b376',
UNI: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984',
USDC: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
USDT: '0xdac17f958d2ee523a2206206994597c13d831ec7',
WBTC: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
WETH: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
YFI: '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e',
ZRX: '0xe41d2489571d322189246dafa5ebde1f4699f498',
},
},
};

View File

@ -141,6 +141,7 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.kovan]: undefined,
[eEthereumNetwork.ropsten]: undefined,
[eEthereumNetwork.main]: undefined,
[eEthereumNetwork.tenderlyMain]: undefined,
},
PoolAdminIndex: 0,
EmergencyAdmin: {
@ -150,6 +151,7 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.kovan]: undefined,
[eEthereumNetwork.ropsten]: undefined,
[eEthereumNetwork.main]: undefined,
[eEthereumNetwork.tenderlyMain]: undefined,
},
EmergencyAdminIndex: 1,
ProviderRegistry: {
@ -159,6 +161,7 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.coverage]: '',
[eEthereumNetwork.hardhat]: '',
[eEthereumNetwork.buidlerevm]: '',
[eEthereumNetwork.tenderlyMain]: '',
},
LendingRateOracle: {
[eEthereumNetwork.coverage]: '',
@ -166,7 +169,8 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.buidlerevm]: '',
[eEthereumNetwork.kovan]: '0xdCde9Bb6a49e37fA433990832AB541AE2d4FEB4a',
[eEthereumNetwork.ropsten]: '0x05dcca805a6562c1bdd0423768754acb6993241b',
[eEthereumNetwork.main]: '0x4d728a4496e4de35f218d5a214366bde3a62b51c',
[eEthereumNetwork.main]: '',
[eEthereumNetwork.tenderlyMain]: '',
},
TokenDistributor: {
[eEthereumNetwork.coverage]: '',
@ -175,6 +179,7 @@ export const CommonsConfig: ICommonConfiguration = {
[EthereumNetwork.kovan]: '0x971efe90088f21dc6a36f610ffed77fc19710708',
[EthereumNetwork.ropsten]: '0xeba2ea67942b8250d870b12750b594696d02fc9c',
[EthereumNetwork.main]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
[EthereumNetwork.tenderlyMain]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
},
ChainlinkProxyPriceProvider: {
[eEthereumNetwork.coverage]: '',
@ -182,7 +187,8 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.buidlerevm]: '',
[EthereumNetwork.kovan]: '0x276C4793F2EE3D5Bf18C5b879529dD4270BA4814',
[EthereumNetwork.ropsten]: '0x657372A559c30d236F011239fF9fbB6D76718271',
[EthereumNetwork.main]: '0x76B47460d7F7c5222cFb6b6A75615ab10895DDe4',
[EthereumNetwork.main]: '',
[EthereumNetwork.tenderlyMain]: '',
},
FallbackOracle: {
[eEthereumNetwork.coverage]: '',
@ -190,7 +196,8 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.buidlerevm]: '',
[EthereumNetwork.kovan]: '0x50913E8E1c650E790F8a1E741FF9B1B1bB251dfe',
[EthereumNetwork.ropsten]: '0xAD1a978cdbb8175b2eaeC47B01404f8AEC5f4F0d',
[EthereumNetwork.main]: '0xf67a8b0e3e0ee303422f78b4c5b8da60df80a59c',
[EthereumNetwork.main]: '',
[EthereumNetwork.tenderlyMain]: '',
},
ChainlinkAggregator: {
[eEthereumNetwork.coverage]: {},
@ -259,7 +266,36 @@ export const CommonsConfig: ICommonConfiguration = {
BAT: '0x9b4e2579895efa2b4765063310Dc4109a7641129',
BUSD: '0x5d4BB541EED49D0290730b4aB332aA46bd27d888',
DAI: '0x037E8F2125bF532F3e228991e051c8A7253B642c',
ENJ: '0x24D9aB51950F3d62E9144fdC2f3135DAA6Ce8D1B',
ENJ: '0x24D9aB51950F3d62E9 144fdC2f3135DAA6Ce8D1B',
KNC: '0xd0e785973390fF8E77a83961efDb4F271E6B8152',
LINK: '0xeCfA53A8bdA4F0c4dd39c55CC8deF3757aCFDD07',
MANA: '0xc89c4ed8f52Bb17314022f6c0dCB26210C905C97',
MKR: '0xda3d675d50ff6c555973c4f0424964e1f6a4e7d3',
REN: '0x3147D7203354Dc06D9fd350c7a2437bcA92387a4',
REP: '0xb8b513d9cf440C1b6f5C7142120d611C94fC220c',
SNX: '0xE23d1142dE4E83C08bb048bcab54d50907390828',
SUSD: '0x6d626Ff97f0E89F6f983dE425dc5B24A18DE26Ea',
TUSD: '0x73ead35fd6A572EF763B13Be65a9db96f7643577',
UNI: '0xD6aA3D25116d8dA79Ea0246c4826EB951872e02e',
USDC: '0xdE54467873c3BCAA76421061036053e371721708',
USDT: '0xa874fe207DF445ff19E7482C746C4D3fD0CB9AcE',
WBTC: '0x0133Aa47B6197D0BA090Bf2CD96626Eb71fFd13c',
YFI: '0x7c5d4F8345e66f68099581Db340cd65B078C41f4',
ZRX: '0xA0F9D94f060836756FFC84Db4C78d097cA8C23E8',
UNI_DAI_ETH: '0x1bAB293850289Bf161C5DA79ff3d1F02A950555b',
UNI_LEND_ETH: '0xF4C8Db2d999b024bBB6c6022566503eD41f2AC1E',
UNI_LINK_ETH: '0xE2A639Beb647d7F709ca805ABa760bBEfdbE37e3',
UNI_MKR_ETH: '0xEe40a5E8F3732bE6ECDb5A90e23D0b7bF0D4a73c',
UNI_SETH_ETH: '0x517D40E49660c7705b2e99eEFA6d7B0E9Ba5BF10',
UNI_USDC_ETH: '0x444315Ee92F2bb3579293C17B07194227fA99bF0',
USD: '0x59b826c214aBa7125bFA52970d97736c105Cc375',
},
[EthereumNetwork.tenderlyMain]: {
AAVE: '0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012',
BAT: '0x9b4e2579895efa2b4765063310Dc4109a7641129',
BUSD: '0x5d4BB541EED49D0290730b4aB332aA46bd27d888',
DAI: '0x037E8F2125bF532F3e228991e051c8A7253B642c',
ENJ: '0x24D9aB51950F3d62E9 144fdC2f3135DAA6Ce8D1B',
KNC: '0xd0e785973390fF8E77a83961efDb4F271E6B8152',
LINK: '0xeCfA53A8bdA4F0c4dd39c55CC8deF3757aCFDD07',
MANA: '0xc89c4ed8f52Bb17314022f6c0dCB26210C905C97',
@ -291,6 +327,7 @@ export const CommonsConfig: ICommonConfiguration = {
[EthereumNetwork.main]: {},
[EthereumNetwork.kovan]: {},
[EthereumNetwork.ropsten]: {},
[EthereumNetwork.tenderlyMain]: {},
},
ReservesConfig: {},
ATokenDomainSeparator: {
@ -303,6 +340,7 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.kovan]: '',
[eEthereumNetwork.ropsten]: '',
[eEthereumNetwork.main]: '',
[eEthereumNetwork.tenderlyMain]: '',
},
ProxyPriceProvider: {
[eEthereumNetwork.coverage]: '',
@ -311,6 +349,7 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.kovan]: '0xB8bE51E6563BB312Cbb2aa26e352516c25c26ac1',
[eEthereumNetwork.ropsten]: '',
[eEthereumNetwork.main]: '',
[eEthereumNetwork.tenderlyMain]: '',
},
WETH: {
[eEthereumNetwork.coverage]: '', // deployed in local evm
@ -319,5 +358,6 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
},
};

View File

@ -181,6 +181,17 @@ export const UniswapConfig: IUniswapConfiguration = {
UNI_SETH_ETH: '0x517D40E49660c7705b2e99eEFA6d7B0E9Ba5BF10',
UNI_USDC_ETH: '0x444315Ee92F2bb3579293C17B07194227fA99bF0',
},
[EthereumNetwork.tenderlyMain]: {
DAI: '0x037E8F2125bF532F3e228991e051c8A7253B642c',
USDC: '0xdE54467873c3BCAA76421061036053e371721708',
USDT: '0xa874fe207DF445ff19E7482C746C4D3fD0CB9AcE',
UNI_DAI_ETH: '0x1bAB293850289Bf161C5DA79ff3d1F02A950555b',
UNI_LEND_ETH: '0xF4C8Db2d999b024bBB6c6022566503eD41f2AC1E',
UNI_LINK_ETH: '0xE2A639Beb647d7F709ca805ABa760bBEfdbE37e3',
UNI_MKR_ETH: '0xEe40a5E8F3732bE6ECDb5A90e23D0b7bF0D4a73c',
UNI_SETH_ETH: '0x517D40E49660c7705b2e99eEFA6d7B0E9Ba5BF10',
UNI_USDC_ETH: '0x444315Ee92F2bb3579293C17B07194227fA99bF0',
},
},
ReserveAssets: {
[eEthereumNetwork.hardhat]: {},
@ -222,5 +233,17 @@ export const UniswapConfig: IUniswapConfiguration = {
UNI_SETH_ETH: '0xe9cf7887b93150d4f2da7dfc6d502b216438f244',
UNI_USDC_ETH: '0x97dec872013f6b5fb443861090ad931542878126',
},
[EthereumNetwork.tenderlyMain]: {
DAI: '0x6b175474e89094c44da98b954eedeac495271d0f',
USDC: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
USDT: '0xdac17f958d2ee523a2206206994597c13d831ec7',
WETH: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
UNI_DAI_ETH: '0x2a1530c4c41db0b0b2bb646cb5eb1a67b7158667',
UNI_LEND_ETH: '0xcaa7e4656f6a2b59f5f99c745f91ab26d1210dce',
UNI_LINK_ETH: '0xf173214c720f58e03e194085b1db28b50acdeead',
UNI_MKR_ETH: '0x2c4bd064b998838076fa341a83d007fc2fa50957',
UNI_SETH_ETH: '0xe9cf7887b93150d4f2da7dfc6d502b216438f244',
UNI_USDC_ETH: '0x97dec872013f6b5fb443861090ad931542878126',
},
},
};

View File

@ -10,6 +10,7 @@ services:
command: npm run run-env
volumes:
- ./:/src
- $HOME/.tenderly/config.yaml:/root/.tenderly/config.yaml
environment:
MNEMONIC: ${MNEMONIC}
ETHERSCAN_KEY: ${ETHERSCAN_KEY}

View File

@ -1,6 +1,5 @@
import path from 'path';
import fs from 'fs';
import {HardhatUserConfig} from 'hardhat/config';
// @ts-ignore
import {accounts} from './test-wallets.js';
import {eEthereumNetwork} from './helpers/types';
@ -11,6 +10,7 @@ import '@nomiclabs/hardhat-waffle';
import 'temp-hardhat-etherscan';
import 'hardhat-gas-reporter';
import 'hardhat-typechain';
import '@tenderly/hardhat-tenderly';
const SKIP_LOAD = process.env.SKIP_LOAD === 'true';
const DEFAULT_BLOCK_GAS_LIMIT = 12450000;
@ -75,8 +75,8 @@ const buidlerConfig = {
timeout: 0,
},
tenderly: {
project: process.env.TENDERLY_PROJECT,
username: process.env.TENDERLY_USERNAME,
// project: process.env.TENDERLY_PROJECT,
//username: process.env.TENDERLY_USERNAME,
forkNetwork: '1', //Network id of the network we want to fork
},
networks: {
@ -87,6 +87,7 @@ const buidlerConfig = {
kovan: getCommonNetworkConfig(eEthereumNetwork.kovan, 42),
ropsten: getCommonNetworkConfig(eEthereumNetwork.ropsten, 3),
main: getCommonNetworkConfig(eEthereumNetwork.main, 1),
tenderlyMain: getCommonNetworkConfig(eEthereumNetwork.main, 1),
hardhat: {
hardfork: 'istanbul',
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,

View File

@ -2,6 +2,7 @@ import {
AaveProtocolDataProviderFactory,
ATokenFactory,
ATokensAndRatesHelperFactory,
ChainlinkProxyPriceProviderFactory,
DefaultReserveInterestRateStrategyFactory,
GenericLogicFactory,
InitializableAdminUpgradeabilityProxyFactory,
@ -23,12 +24,10 @@ import {
StableDebtTokenFactory,
VariableDebtTokenFactory,
WalletBalanceProviderFactory,
Weth9Factory,
Weth9MockedFactory,
WethGatewayFactory,
} from '../types';
import {Ierc20DetailedFactory} from '../types/Ierc20DetailedFactory';
import {UpgradeabilityProxy} from '../types/UpgradeabilityProxy';
import {MockTokenMap} from './contracts-helpers';
import {DRE, getDb} from './misc-utils';
import {eContractid, PoolConfiguration, tEthereumAddress, TokenContractId} from './types';
@ -323,3 +322,11 @@ export const getLendingPoolCollateralManager = async (address?: tEthereumAddress
export const getAddressById = async (id: string) =>
(await getDb().get(`${id}.${DRE.network.name}`).value()).address;
export const getChainlinkPriceProvider = async (address?: tEthereumAddress) =>
await ChainlinkProxyPriceProviderFactory.connect(
address ||
(await getDb().get(`${eContractid.ChainlinkProxyPriceProvider}.${DRE.network.name}`).value())
.address,
await getFirstSigner()
);

View File

@ -124,7 +124,7 @@ export const linkBytecode = (artifact: BuidlerArtifact | Artifact, libraries: an
};
export const getParamPerNetwork = <T>(
{kovan, ropsten, main, buidlerevm, coverage}: iParamsPerNetwork<T>,
{kovan, ropsten, main, buidlerevm, coverage, tenderlyMain}: iParamsPerNetwork<T>,
network: eEthereumNetwork
) => {
switch (network) {
@ -140,6 +140,8 @@ export const getParamPerNetwork = <T>(
return ropsten;
case eEthereumNetwork.main:
return main;
case eEthereumNetwork.tenderlyMain:
return tenderlyMain;
}
};

View File

@ -11,6 +11,7 @@ export enum eEthereumNetwork {
main = 'main',
coverage = 'coverage',
hardhat = 'hardhat',
tenderlyMain = 'tenderlyMain',
}
export enum EthereumNetworkNames {
@ -324,6 +325,7 @@ export interface iParamsPerNetwork<T> {
[eEthereumNetwork.ropsten]: T;
[eEthereumNetwork.main]: T;
[eEthereumNetwork.hardhat]: T;
[eEthereumNetwork.tenderlyMain]: T;
}
export interface iParamsPerPool<T> {
@ -352,6 +354,7 @@ export enum EthereumNetwork {
development = 'development',
main = 'main',
coverage = 'soliditycoverage',
tenderlyMain = 'tenderlyMain',
}
export interface IProtocolGlobalConfig {

32
modules/tenderly/tenderly.d.ts vendored Normal file
View File

@ -0,0 +1,32 @@
import 'hardhat/types/config';
import 'hardhat/types/runtime';
import {TenderlyConfig} from './types';
declare module 'hardhat/types/runtime' {
export interface HardhatRuntimeEnvironment {
tenderly: {
verify: (...contracts) => Promise<void>;
push: (...contracts) => Promise<void>;
persistArtifacts: (...contracts) => Promise<void>;
};
tenderlyRPC: {
verify: (...contracts) => Promise<void>;
resetFork: () => string | undefined;
getHead: () => string | undefined;
setHead: (head: string | undefined) => void;
getFork: () => string | undefined;
setFork: (fork: string | undefined) => void;
};
}
}
declare module 'hardhat/types/config' {
export interface HardhatUserConfig {
tenderly?: TenderlyConfig;
}
export interface HardhatConfig {
tenderly: TenderlyConfig;
}
}

View File

@ -6,6 +6,7 @@
"run-env": "npm i && tail -f /dev/null",
"hardhat": "hardhat",
"hardhat:kovan": "hardhat --network kovan",
"hardhat:tenderly-main": "hardhat --network tenderlyMain",
"hardhat:ropsten": "hardhat--network ropsten",
"hardhat:main": "hardhat --network main",
"hardhat:docker": "hardhat --network hardhatevm_docker",
@ -21,6 +22,7 @@
"aave:kovan:full:initialize": "npm run hardhat:kovan -- full:initialize-lending-pool --verify --pool Aave",
"aave:ropsten:dev:migration": "npm run hardhat:ropsten -- aave:dev --verify",
"aave:ropsten:full:migration": "npm run hardhat:ropsten -- aave:full --verify",
"aave:fork:main:migration": "npm run hardhat:tenderly-main -- aave:full:fork",
"aave:main:dev:migration": "npm run hardhat:main -- aave:dev --verify",
"aave:main:full:migration": "npm run hardhat:main -- aave:full --verify",
"uniswap:evm:dev:migration": "hardhat uniswap:dev",

View File

@ -28,7 +28,9 @@ task(
const providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
// Deploy address provider and set genesis manager
console.log('addres provider');
const addressesProvider = await deployLendingPoolAddressesProvider(verify);
await waitForTx(await addressesProvider.setPoolAdmin(await getGenesisPoolAdmin(poolConfig)));
const admin = await getEmergencyAdmin(poolConfig);
console.log('Admin is ', admin);
@ -46,18 +48,4 @@ task(
ProviderId
)
);
//register the proxy price provider on the addressesProvider
const proxyProvider = getParamPerNetwork(poolConfig.ProxyPriceProvider, network);
if (proxyProvider && proxyProvider !== '') {
await waitForTx(await addressesProvider.setPriceOracle(proxyProvider));
}
//register the lending rate oracle
const lendingRateOracle = getParamPerNetwork(poolConfig.LendingRateOracle, network);
if (lendingRateOracle && lendingRateOracle !== '') {
await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle));
}
});

View File

@ -7,10 +7,18 @@ import {
import {setInitialMarketRatesInRatesOracleByHelper} from '../../helpers/oracles-helpers';
import {ICommonConfiguration, eEthereumNetwork, SymbolMap} from '../../helpers/types';
import {waitForTx, filterMapBy} from '../../helpers/misc-utils';
import {ConfigNames, loadPoolConfig, getWethAddress} from '../../helpers/configuration';
import {
ConfigNames,
loadPoolConfig,
getWethAddress,
getGenesisPoolAdmin,
} from '../../helpers/configuration';
import {exit} from 'process';
import {
getAddressById,
getChainlinkPriceProvider,
getLendingPoolAddressesProvider,
getLendingRateOracle,
getPairsTokenAggregator,
} from '../../helpers/contracts-getters';
@ -33,8 +41,9 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
Object.keys(ReserveAssets[network]).includes(key)
);
const addressesProvider = await getLendingPoolAddressesProvider();
const admin = await addressesProvider.getPoolAdmin();
const admin = await getGenesisPoolAdmin(poolConfig);
const proxyPriceProviderAddress = getParamPerNetwork(poolConfig.ProxyPriceProvider, network);
const lendingRateOracleAddress = getParamPerNetwork(poolConfig.LendingRateOracle, network);
const fallbackOracle = await getParamPerNetwork(FallbackOracle, network);
const reserveAssets = await getParamPerNetwork(ReserveAssets, network);
const chainlinkAggregators = await getParamPerNetwork(ChainlinkAggregator, network);
@ -45,24 +54,33 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
};
const [tokens, aggregators] = getPairsTokenAggregator(tokensToWatch, chainlinkAggregators);
const chainlinkProviderPriceProvider = await deployChainlinkProxyPriceProvider(
[tokens, aggregators, fallbackOracle, await getWethAddress(poolConfig)],
verify
);
const chainlinkProviderPriceProvider = proxyPriceProviderAddress
? await getChainlinkPriceProvider(proxyPriceProviderAddress)
: await deployChainlinkProxyPriceProvider(
[tokens, aggregators, fallbackOracle, await getWethAddress(poolConfig)],
verify
);
const lendingRateOracle = lendingRateOracleAddress
? await getLendingRateOracle(lendingRateOracleAddress)
: await deployLendingRateOracle(verify);
const {USD, ...tokensAddressesWithoutUsd} = tokensToWatch;
if (!lendingRateOracleAddress) {
await setInitialMarketRatesInRatesOracleByHelper(
lendingRateOracles,
tokensAddressesWithoutUsd,
lendingRateOracle,
admin
);
}
// Register the proxy price provider on the addressesProvider
await waitForTx(
await addressesProvider.setPriceOracle(chainlinkProviderPriceProvider.address)
);
const lendingRateOracle = await deployLendingRateOracle(verify);
await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle.address));
const {USD, ...tokensAddressesWithoutUsd} = tokensToWatch;
await setInitialMarketRatesInRatesOracleByHelper(
lendingRateOracles,
tokensAddressesWithoutUsd,
lendingRateOracle,
admin
);
} catch (err) {
console.error(err);
exit(1);

View File

@ -54,6 +54,20 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
const lendingPoolAddress = await addressesProvider.getLendingPool();
await deployWETHGateway([wethAddress, lendingPoolAddress]);
//register the proxy price provider on the addressesProvider
const proxyProvider = getParamPerNetwork(poolConfig.ProxyPriceProvider, network);
if (proxyProvider && proxyProvider !== '') {
await waitForTx(await addressesProvider.setPriceOracle(proxyProvider));
}
//register the lending rate oracle
const lendingRateOracle = getParamPerNetwork(poolConfig.LendingRateOracle, network);
if (lendingRateOracle && lendingRateOracle !== '') {
await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle));
}
} catch (err) {
console.error(err);
exit(1);

View File

@ -0,0 +1,55 @@
import {task} from 'hardhat/config';
import {ExternalProvider} from '@ethersproject/providers';
import {checkVerification} from '../../helpers/etherscan-verification';
import {ConfigNames} from '../../helpers/configuration';
import {EthereumNetworkNames} from '../../helpers/types';
import {printContracts} from '../../helpers/misc-utils';
task('aave:full:fork', 'Deploy development enviroment')
.addFlag('verify', 'Verify contracts at Etherscan')
.setAction(async ({verify}, DRE) => {
const POOL_NAME = ConfigNames.Aave;
const network = <EthereumNetworkNames>DRE.network.name;
if (!network.includes('tenderly')) {
throw 'This task only supports tenderly networks: tenderlyMain, tenderlyKovan';
}
await DRE.run('set-DRE');
// Prevent loss of gas verifying all the needed ENVs for Etherscan verification
if (verify) {
checkVerification();
}
console.log('- Setting up Tenderly provider');
DRE.ethers.provider = new DRE.ethers.providers.Web3Provider(
DRE.tenderlyRPC as ExternalProvider
);
//Set the ethers provider to the one we initialized so it targets the correct backend
console.log('Migration started\n');
console.log('1. Deploy address provider');
await DRE.run('full:deploy-address-provider', {pool: POOL_NAME});
console.log('2. Deploy lending pool');
await DRE.run('full:deploy-lending-pool');
console.log('3. Deploy oracles');
await DRE.run('full:deploy-oracles', {pool: POOL_NAME});
console.log('4. Initialize lending pool');
await DRE.run('full:initialize-lending-pool', {pool: POOL_NAME});
if (verify) {
printContracts();
console.log('4. Veryfing contracts');
await DRE.run('verify:general', {all: true, pool: POOL_NAME});
console.log('5. Veryfing aTokens and debtTokens');
await DRE.run('verify:tokens', {pool: POOL_NAME});
}
const postDeployHead = DRE.tenderlyRPC.getHead();
console.log('HEAD', postDeployHead);
console.log('\nFinished migrations');
printContracts();
});

View File

@ -4,11 +4,13 @@
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"outDir": "dist"
"outDir": "dist",
"noImplicitAny": false
},
"include": ["./scripts", "./test"],
"include": ["./scripts", "./test", "./tasks"],
"files": [
"./hardhat.config.ts",
"./modules/tenderly/tenderly.d.ts",
"node_modules/@nomiclabs/buidler-ethers/src/type-extensions.d.ts",
"node_modules/buidler-typechain/src/type-extensions.d.ts",
"node_modules/@nomiclabs/buidler-waffle/src/type-extensions.d.ts",