add deployment task for UniswapRepayAdapter

This commit is contained in:
andyk 2020-12-01 14:27:57 +04:00
parent a21d823646
commit 6ce019c04a
3 changed files with 39 additions and 5 deletions

View File

@ -44,6 +44,7 @@
"print-contracts:ropsten": "npm run hardhat:main -- print-contracts",
"dev:deployUIProvider": "npm run hardhat:kovan deploy-UiPoolDataProvider",
"dev:deployUniswapRepayAdapter": "npm run hardhat:kovan deploy-UniswapRepayAdapter",
"dev:UniswapLiquiditySwapAdapter": "npm run hardhat:kovan deploy-UniswapLiquiditySwapAdapter",
"kovan:verify": "npm run hardhat:kovan verify:general -- --all --pool Aave",
"ropsten:verify": "npm run hardhat:ropsten verify:general -- --all --pool Aave",
"mainnet:verify": "npm run hardhat:main verify:general -- --all --pool Aave",

View File

@ -0,0 +1,31 @@
import { task } from 'hardhat/config';
import { UniswapLiquiditySwapAdapterFactory } from '../../types';
import { verifyContract } from '../../helpers/etherscan-verification';
import { getFirstSigner } from '../../helpers/contracts-getters';
const CONTRACT_NAME = 'UniswapLiquiditySwapAdapter';
task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
.setAction(async ({ 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 args = [
'0x88757f2f99175387aB4C6a4b3067c77A695b0349', // lending provider kovan address
'0xfcd87315f0e4067070ade8682fcdbc3006631441', // uniswap router address
];
const uniswapRepayAdapter = await new UniswapLiquiditySwapAdapterFactory(
await getFirstSigner()
).deploy(args[0], args[1]);
await uniswapRepayAdapter.deployTransaction.wait();
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
await verifyContract(uniswapRepayAdapter.address, args);
console.log(`\tFinished ${CONTRACT_NAME} proxy and implementation deployment`);
});

View File

@ -6,8 +6,8 @@ import { getFirstSigner } from '../../helpers/contracts-getters';
const CONTRACT_NAME = 'UniswapRepayAdapter';
task(`deploy-${CONTRACT_NAME}`, `Deploys the UniswapRepayAdapter contract`)
.addFlag('verify', 'Verify UniswapRepayAdapter contract via Etherscan API.')
task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
.setAction(async ({ verify }, localBRE) => {
await localBRE.run('set-DRE');
@ -15,7 +15,7 @@ task(`deploy-${CONTRACT_NAME}`, `Deploys the UniswapRepayAdapter contract`)
throw new Error('INVALID_CHAIN_ID');
}
console.log(`\n- UniswapRepayAdapter deployment`);
console.log(`\n- ${CONTRACT_NAME} deployment`);
const args = [
'0x88757f2f99175387aB4C6a4b3067c77A695b0349', // lending provider kovan address
'0xfcd87315f0e4067070ade8682fcdbc3006631441', // uniswap router address
@ -25,8 +25,10 @@ task(`deploy-${CONTRACT_NAME}`, `Deploys the UniswapRepayAdapter contract`)
args[1]
);
await uniswapRepayAdapter.deployTransaction.wait();
console.log('uniswapRepayAdapter.address', uniswapRepayAdapter.address);
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
await verifyContract(uniswapRepayAdapter.address, args);
console.log(`\tFinished UiPoolDataProvider proxy and implementation deployment`);
console.log(
`\tFinished ${CONTRACT_NAME}${CONTRACT_NAME}lDataProvider proxy and implementation deployment`
);
});