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

37 lines
1.3 KiB
TypeScript
Raw Permalink Normal View History

import { task } from 'hardhat/config';
import { ParaSwapLiquiditySwapAdapterFactory } from '../../types';
2021-06-15 15:52:42 +00:00
import { verifyContract } from '../../helpers/contracts-helpers';
import { getFirstSigner } from '../../helpers/contracts-getters';
2021-06-15 15:52:42 +00:00
import { eContractid } from '../../helpers/types';
const CONTRACT_NAME = 'ParaSwapLiquiditySwapAdapter';
task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
.addParam('provider', 'Address of the LendingPoolAddressesProvider')
.addParam('augustusRegistry', 'Address of ParaSwap AugustusRegistry')
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
.setAction(async ({ provider, augustusRegistry, verify }, localBRE) => {
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()
).deploy(provider, augustusRegistry);
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,
]);
}
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
});