aave-protocol-v2/tasks/deployments/deploy-UniswapRepayAdapter.ts

35 lines
1.3 KiB
TypeScript
Raw Normal View History

2020-11-30 13:14:29 +00:00
import { task } from 'hardhat/config';
import { UniswapRepayAdapterFactory } from '../../types';
import { verifyContract } from '../../helpers/etherscan-verification';
import { getFirstSigner } from '../../helpers/contracts-getters';
2020-11-30 13:14:29 +00:00
const CONTRACT_NAME = 'UniswapRepayAdapter';
task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
.addParam('provider', 'Address of the LendingPoolAddressesProvider')
.addParam('router', 'Address of the uniswap router')
.addParam('weth', 'Address of the weth token')
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
.setAction(async ({ provider, router, weth, verify }, localBRE) => {
2020-11-30 13:14:29 +00:00
await localBRE.run('set-DRE');
if (!localBRE.network.config.chainId) {
throw new Error('INVALID_CHAIN_ID');
}
console.log(`\n- ${CONTRACT_NAME} deployment`);
const uniswapRepayAdapter = await new UniswapRepayAdapterFactory(await getFirstSigner()).deploy(
provider,
router,
weth
);
2020-11-30 13:14:29 +00:00
await uniswapRepayAdapter.deployTransaction.wait();
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
await verifyContract(uniswapRepayAdapter.address, [provider, router, weth]);
2020-11-30 13:14:29 +00:00
console.log(
`\tFinished ${CONTRACT_NAME}${CONTRACT_NAME}lDataProvider proxy and implementation deployment`
);
2020-11-30 13:14:29 +00:00
});