2020-11-30 13:14:29 +00:00
|
|
|
import { task } from 'hardhat/config';
|
|
|
|
|
|
|
|
import { UniswapRepayAdapterFactory } from '../../types';
|
|
|
|
import { verifyContract } from '../../helpers/etherscan-verification';
|
2020-11-30 13:27:56 +00:00
|
|
|
import { getFirstSigner } from '../../helpers/contracts-getters';
|
2020-11-30 13:14:29 +00:00
|
|
|
|
|
|
|
const CONTRACT_NAME = 'UniswapRepayAdapter';
|
|
|
|
|
2020-12-01 10:27:57 +00:00
|
|
|
task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
|
2020-12-02 10:18:31 +00:00
|
|
|
.addParam('provider', 'Address of the LendingPoolAddressesProvider')
|
|
|
|
.addParam('router', 'Address of the uniswap router')
|
2020-12-02 15:56:38 +00:00
|
|
|
.addParam('weth', 'Address of the weth token')
|
2020-12-01 10:27:57 +00:00
|
|
|
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
|
2020-12-02 15:56:38 +00:00
|
|
|
.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');
|
|
|
|
}
|
|
|
|
|
2020-12-01 10:27:57 +00:00
|
|
|
console.log(`\n- ${CONTRACT_NAME} deployment`);
|
2020-11-30 13:27:56 +00:00
|
|
|
const uniswapRepayAdapter = await new UniswapRepayAdapterFactory(await getFirstSigner()).deploy(
|
2020-12-02 10:18:31 +00:00
|
|
|
provider,
|
2020-12-02 15:56:38 +00:00
|
|
|
router,
|
|
|
|
weth
|
2020-11-30 13:27:56 +00:00
|
|
|
);
|
2020-11-30 13:14:29 +00:00
|
|
|
await uniswapRepayAdapter.deployTransaction.wait();
|
2020-12-01 10:27:57 +00:00
|
|
|
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
|
2020-12-02 15:56:38 +00:00
|
|
|
await verifyContract(uniswapRepayAdapter.address, [provider, router, weth]);
|
2020-11-30 13:14:29 +00:00
|
|
|
|
2020-12-01 10:27:57 +00:00
|
|
|
console.log(
|
|
|
|
`\tFinished ${CONTRACT_NAME}${CONTRACT_NAME}lDataProvider proxy and implementation deployment`
|
|
|
|
);
|
2020-11-30 13:14:29 +00:00
|
|
|
});
|