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

26 lines
1002 B
TypeScript
Raw Normal View History

2021-02-22 13:58:16 +00:00
import { task } from 'hardhat/config';
import {
loadPoolConfig,
ConfigNames,
getWrappedNativeTokenAddress,
} from '../../helpers/configuration';
2021-02-22 13:58:16 +00:00
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 getWrappedNativeTokenAddress(poolConfig);
2021-02-22 13:58:16 +00:00
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`);
2021-02-22 13:58:16 +00:00
});