aave-protocol-v2/tasks/deployments/deploy-ParaSwapLiquiditySwapAdapter.ts
Jason Raymond Bell 4fe36c8fa4 Introduce registry of valid Augustus addresses
Set in constructor of BaseParaSwapSellAdapter and validates before swap.
Created mock registry that only validates one address.
Changed the test fixtures to accomodate registry and added two new tests.
Updated deployment script.
Registry address left as a placeholder in package.json since not known yet.

Fixes MixBytes Warning 1.
2021-05-20 23:25:51 +01:00

30 lines
1.2 KiB
TypeScript

import { task } from 'hardhat/config';
import { ParaSwapLiquiditySwapAdapterFactory } from '../../types';
import { verifyContract } from '../../helpers/etherscan-verification';
import { getFirstSigner } from '../../helpers/contracts-getters';
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);
await verifyContract(adapter.address, [provider, augustusRegistry]);
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
});