2021-01-15 15:48:54 +00:00
|
|
|
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';
|
2020-11-12 13:12:26 +00:00
|
|
|
|
2020-11-16 18:22:22 +00:00
|
|
|
task('aave:mainnet', 'Deploy development enviroment')
|
2020-11-12 13:12:26 +00:00
|
|
|
.addFlag('verify', 'Verify contracts at Etherscan')
|
2021-05-10 08:16:13 +00:00
|
|
|
.addFlag('skipRegistry', 'Skip addresses provider registration at Addresses Provider Registry')
|
|
|
|
.setAction(async ({ verify, skipRegistry }, DRE) => {
|
2020-11-12 13:12:26 +00:00
|
|
|
const POOL_NAME = ConfigNames.Aave;
|
|
|
|
await DRE.run('set-DRE');
|
|
|
|
|
|
|
|
// Prevent loss of gas verifying all the needed ENVs for Etherscan verification
|
|
|
|
if (verify) {
|
|
|
|
checkVerification();
|
|
|
|
}
|
2020-11-16 09:19:14 +00:00
|
|
|
|
2020-11-12 13:12:26 +00:00
|
|
|
console.log('Migration started\n');
|
|
|
|
|
|
|
|
console.log('1. Deploy address provider');
|
2021-05-10 08:16:13 +00:00
|
|
|
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME, skipRegistry });
|
2020-11-12 13:12:26 +00:00
|
|
|
|
|
|
|
console.log('2. Deploy lending pool');
|
2021-02-23 03:25:48 +00:00
|
|
|
await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME });
|
2020-11-12 13:12:26 +00:00
|
|
|
|
|
|
|
console.log('3. Deploy oracles');
|
2021-01-15 15:48:54 +00:00
|
|
|
await DRE.run('full:deploy-oracles', { pool: POOL_NAME });
|
2020-11-12 13:12:26 +00:00
|
|
|
|
2020-11-16 18:22:22 +00:00
|
|
|
console.log('4. Deploy Data Provider');
|
2021-01-15 15:48:54 +00:00
|
|
|
await DRE.run('full:data-provider', { pool: POOL_NAME });
|
2020-11-16 18:22:22 +00:00
|
|
|
|
2021-02-22 14:57:48 +00:00
|
|
|
console.log('5. Deploy WETH Gateway');
|
2021-02-22 13:58:16 +00:00
|
|
|
await DRE.run('full-deploy-weth-gateway', { pool: POOL_NAME });
|
|
|
|
|
|
|
|
console.log('6. Initialize lending pool');
|
2021-01-15 15:48:54 +00:00
|
|
|
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
|
2020-11-12 13:12:26 +00:00
|
|
|
|
|
|
|
if (verify) {
|
|
|
|
printContracts();
|
2021-02-22 13:58:16 +00:00
|
|
|
console.log('7. Veryfing contracts');
|
2021-01-15 15:48:54 +00:00
|
|
|
await DRE.run('verify:general', { all: true, pool: POOL_NAME });
|
2020-11-12 13:12:26 +00:00
|
|
|
|
2021-02-22 13:58:16 +00:00
|
|
|
console.log('8. Veryfing aTokens and debtTokens');
|
2021-01-15 15:48:54 +00:00
|
|
|
await DRE.run('verify:tokens', { pool: POOL_NAME });
|
2020-11-12 13:12:26 +00:00
|
|
|
}
|
|
|
|
|
2021-01-15 15:48:54 +00:00
|
|
|
if (usingTenderly()) {
|
2020-11-16 15:08:07 +00:00
|
|
|
const postDeployHead = DRE.tenderlyRPC.getHead();
|
2021-03-03 11:25:10 +00:00
|
|
|
const postDeployFork = DRE.tenderlyRPC.getFork();
|
|
|
|
console.log('Tenderly Info');
|
|
|
|
console.log('- Head', postDeployHead);
|
|
|
|
console.log('- Fork', postDeployFork);
|
2020-11-16 15:08:07 +00:00
|
|
|
}
|
2020-11-12 13:12:26 +00:00
|
|
|
console.log('\nFinished migrations');
|
|
|
|
printContracts();
|
|
|
|
});
|