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';
|
2021-02-04 22:57:03 +00:00
|
|
|
import {totalGas} from '../../helpers/gas-tracker';
|
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-01-15 15:48:54 +00:00
|
|
|
.setAction(async ({ verify }, 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-01-15 15:48:54 +00:00
|
|
|
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME });
|
2020-11-12 13:12:26 +00:00
|
|
|
|
|
|
|
console.log('2. Deploy lending pool');
|
|
|
|
await DRE.run('full:deploy-lending-pool');
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
console.log('5. 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();
|
|
|
|
console.log('4. 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
|
|
|
|
|
|
|
console.log('5. 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();
|
|
|
|
console.log('Tenderly UUID', postDeployHead);
|
|
|
|
}
|
2020-11-12 13:12:26 +00:00
|
|
|
console.log('\nFinished migrations');
|
|
|
|
printContracts();
|
2021-01-15 01:59:14 +00:00
|
|
|
console.log("Total gas used:", totalGas.toString());
|
2020-11-12 13:12:26 +00:00
|
|
|
});
|