2021-02-22 13:58:16 +00:00
|
|
|
import { task } from 'hardhat/config';
|
|
|
|
import { AaveConfig } from '../../markets/aave/index';
|
|
|
|
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
2021-02-22 14:57:48 +00:00
|
|
|
import { loadPoolConfig, ConfigNames, getWethAddress } from '../../helpers/configuration';
|
2021-02-22 13:58:16 +00:00
|
|
|
import { deployWETHGateway } from '../../helpers/contracts-deployments';
|
|
|
|
import { DRE } from '../../helpers/misc-utils';
|
2021-02-23 14:42:47 +00:00
|
|
|
import { eNetwork } from '../../helpers/types';
|
2021-02-22 13:58:16 +00:00
|
|
|
|
|
|
|
const CONTRACT_NAME = 'WETHGateway';
|
|
|
|
|
|
|
|
task(`full-deploy-weth-gateway`, `Deploys the ${CONTRACT_NAME} contract`)
|
|
|
|
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
|
|
|
|
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
|
|
|
|
.setAction(async ({ verify, pool }, localBRE) => {
|
|
|
|
await localBRE.run('set-DRE');
|
2021-02-23 14:42:47 +00:00
|
|
|
const network = <eNetwork>localBRE.network.name;
|
2021-02-22 13:58:16 +00:00
|
|
|
const poolConfig = loadPoolConfig(pool);
|
2021-02-22 14:57:48 +00:00
|
|
|
const Weth = await getWethAddress(poolConfig);
|
2021-02-22 13:58:16 +00:00
|
|
|
const { WethGateway } = poolConfig;
|
|
|
|
|
|
|
|
if (!localBRE.network.config.chainId) {
|
|
|
|
throw new Error('INVALID_CHAIN_ID');
|
|
|
|
}
|
2021-03-11 15:55:04 +00:00
|
|
|
const wethGateWay = await deployWETHGateway([Weth], verify);
|
|
|
|
console.log(`${CONTRACT_NAME}.address`, wethGateWay.address);
|
|
|
|
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
|
2021-02-22 13:58:16 +00:00
|
|
|
});
|