aave-protocol-v2/tasks/full/5-deploy-wethGateWay.ts

26 lines
1000 B
TypeScript

import { task } from 'hardhat/config';
import {
loadPoolConfig,
ConfigNames,
getWrappedNativeTokenddress,
} from '../../helpers/configuration';
import { deployWETHGateway } from '../../helpers/contracts-deployments';
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');
const poolConfig = loadPoolConfig(pool);
const Weth = await getWrappedNativeTokenddress(poolConfig);
if (!localBRE.network.config.chainId) {
throw new Error('INVALID_CHAIN_ID');
}
const wethGateWay = await deployWETHGateway([Weth], verify);
console.log(`${CONTRACT_NAME}.address`, wethGateWay.address);
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
});