2020-12-01 10:27:57 +00:00
|
|
|
import { task } from 'hardhat/config';
|
|
|
|
|
|
|
|
import { UniswapLiquiditySwapAdapterFactory } from '../../types';
|
2021-03-11 15:55:04 +00:00
|
|
|
import { verifyContract } from '../../helpers/contracts-helpers';
|
2020-12-01 10:27:57 +00:00
|
|
|
import { getFirstSigner } from '../../helpers/contracts-getters';
|
2021-03-11 15:55:04 +00:00
|
|
|
import { eContractid } from '../../helpers/types';
|
2020-12-01 10:27:57 +00:00
|
|
|
|
|
|
|
const CONTRACT_NAME = 'UniswapLiquiditySwapAdapter';
|
|
|
|
|
|
|
|
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-12-01 10:27:57 +00:00
|
|
|
await localBRE.run('set-DRE');
|
|
|
|
|
|
|
|
if (!localBRE.network.config.chainId) {
|
|
|
|
throw new Error('INVALID_CHAIN_ID');
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(`\n- ${CONTRACT_NAME} deployment`);
|
2020-12-02 10:18:31 +00:00
|
|
|
/*const args = [
|
2020-12-01 10:27:57 +00:00
|
|
|
'0x88757f2f99175387aB4C6a4b3067c77A695b0349', // lending provider kovan address
|
|
|
|
'0xfcd87315f0e4067070ade8682fcdbc3006631441', // uniswap router address
|
|
|
|
];
|
2020-12-02 10:18:31 +00:00
|
|
|
*/
|
2020-12-01 10:27:57 +00:00
|
|
|
const uniswapRepayAdapter = await new UniswapLiquiditySwapAdapterFactory(
|
|
|
|
await getFirstSigner()
|
2020-12-02 15:56:38 +00:00
|
|
|
).deploy(provider, router, weth);
|
2020-12-01 10:27:57 +00:00
|
|
|
await uniswapRepayAdapter.deployTransaction.wait();
|
|
|
|
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
|
2021-03-11 15:55:04 +00:00
|
|
|
|
|
|
|
if (verify) {
|
|
|
|
await verifyContract(eContractid.UniswapLiquiditySwapAdapter, uniswapRepayAdapter, [
|
|
|
|
provider,
|
|
|
|
router,
|
|
|
|
weth,
|
|
|
|
]);
|
|
|
|
}
|
2020-12-01 10:27:57 +00:00
|
|
|
|
|
|
|
console.log(`\tFinished ${CONTRACT_NAME} proxy and implementation deployment`);
|
|
|
|
});
|