2021-02-19 23:50:24 +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-03-26 14:20:24 +00:00
|
|
|
task('sidechain:mainnet', 'Deploy market at sidechain')
|
|
|
|
.addParam('pool', `Market pool configuration, one of ${Object.keys(ConfigNames)}`)
|
2021-02-19 23:50:24 +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')
|
2021-05-14 07:26:22 +00:00
|
|
|
.setAction(async ({ verify, pool, skipRegistry }, DRE) => {
|
2021-03-26 14:20:24 +00:00
|
|
|
const POOL_NAME = pool;
|
2021-02-19 23:50:24 +00:00
|
|
|
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');
|
|
|
|
|
2021-03-26 14:20:24 +00:00
|
|
|
console.log('0. Deploy address provider registry');
|
|
|
|
await DRE.run('full:deploy-address-provider-registry', { pool: POOL_NAME });
|
|
|
|
|
2021-02-19 23:50:24 +00:00
|
|
|
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 });
|
2021-02-19 23:50:24 +00:00
|
|
|
|
|
|
|
console.log('2. Deploy lending pool');
|
2021-03-03 11:25:10 +00:00
|
|
|
await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME });
|
2021-02-19 23:50:24 +00:00
|
|
|
|
|
|
|
console.log('3. Deploy oracles');
|
|
|
|
await DRE.run('full:deploy-oracles', { pool: POOL_NAME });
|
|
|
|
|
|
|
|
console.log('4. Deploy Data Provider');
|
|
|
|
await DRE.run('full:data-provider', { pool: POOL_NAME });
|
2021-03-11 15:55:04 +00:00
|
|
|
console.log('5. Deploy WETH Gateway');
|
|
|
|
await DRE.run('full-deploy-weth-gateway', { pool: POOL_NAME });
|
2021-02-19 23:50:24 +00:00
|
|
|
|
2021-03-11 15:55:04 +00:00
|
|
|
console.log('6. Initialize lending pool');
|
2021-02-19 23:50:24 +00:00
|
|
|
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
|
|
|
|
|
|
|
|
if (verify) {
|
|
|
|
printContracts();
|
2021-03-11 15:55:04 +00:00
|
|
|
console.log('7. Veryfing contracts');
|
2021-02-19 23:50:24 +00:00
|
|
|
await DRE.run('verify:general', { all: true, pool: POOL_NAME });
|
|
|
|
|
2021-03-11 15:55:04 +00:00
|
|
|
console.log('8. Veryfing aTokens and debtTokens');
|
2021-02-19 23:50:24 +00:00
|
|
|
await DRE.run('verify:tokens', { pool: POOL_NAME });
|
|
|
|
}
|
|
|
|
|
|
|
|
if (usingTenderly()) {
|
|
|
|
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);
|
2021-02-19 23:50:24 +00:00
|
|
|
}
|
|
|
|
console.log('\nFinished migrations');
|
|
|
|
printContracts();
|
|
|
|
});
|