2021-03-29 16:19:26 +00:00
|
|
|
import { task } from 'hardhat/config';
|
|
|
|
|
|
|
|
import { ParaSwapLiquiditySwapAdapterFactory } from '../../types';
|
2021-06-15 15:52:42 +00:00
|
|
|
import { verifyContract } from '../../helpers/contracts-helpers';
|
2021-03-29 16:19:26 +00:00
|
|
|
import { getFirstSigner } from '../../helpers/contracts-getters';
|
2021-06-15 15:52:42 +00:00
|
|
|
import { eContractid } from '../../helpers/types';
|
2021-03-29 16:19:26 +00:00
|
|
|
|
|
|
|
const CONTRACT_NAME = 'ParaSwapLiquiditySwapAdapter';
|
|
|
|
|
|
|
|
task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
|
|
|
|
.addParam('provider', 'Address of the LendingPoolAddressesProvider')
|
2021-05-20 22:25:51 +00:00
|
|
|
.addParam('augustusRegistry', 'Address of ParaSwap AugustusRegistry')
|
2021-03-29 16:19:26 +00:00
|
|
|
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
|
2021-05-20 22:25:51 +00:00
|
|
|
.setAction(async ({ provider, augustusRegistry, verify }, localBRE) => {
|
2021-03-29 16:19:26 +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 adapter = await new ParaSwapLiquiditySwapAdapterFactory(
|
|
|
|
await getFirstSigner()
|
2021-05-20 22:25:51 +00:00
|
|
|
).deploy(provider, augustusRegistry);
|
2021-03-29 16:19:26 +00:00
|
|
|
await adapter.deployTransaction.wait();
|
|
|
|
console.log(`${CONTRACT_NAME}.address`, adapter.address);
|
2021-06-15 15:52:42 +00:00
|
|
|
|
|
|
|
if (verify) {
|
|
|
|
await verifyContract(eContractid.ParaSwapLiquiditySwapAdapter, adapter, [
|
|
|
|
provider,
|
|
|
|
augustusRegistry,
|
|
|
|
]);
|
|
|
|
}
|
2021-03-29 16:19:26 +00:00
|
|
|
|
|
|
|
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
|
|
|
|
});
|