2021-01-27 14:43:34 +00:00
|
|
|
import { task } from 'hardhat/config';
|
|
|
|
import { verifyContract, checkVerification } from '../../helpers/etherscan-verification';
|
2020-08-20 15:35:05 +00:00
|
|
|
|
|
|
|
interface VerifyParams {
|
|
|
|
contractName: string;
|
|
|
|
address: string;
|
|
|
|
constructorArguments: string[];
|
|
|
|
libraries: string;
|
|
|
|
}
|
|
|
|
|
2020-11-05 12:44:20 +00:00
|
|
|
task('verify-sc', 'Inits the DRE, to have access to all the plugins')
|
2020-08-20 15:35:05 +00:00
|
|
|
.addParam('address', 'Ethereum address of the smart contract')
|
|
|
|
.addOptionalParam(
|
|
|
|
'libraries',
|
|
|
|
'Stringified JSON object in format of {library1: "0x2956356cd2a2bf3202f771f50d3d14a367b48071"}'
|
|
|
|
)
|
|
|
|
.addOptionalVariadicPositionalParam(
|
|
|
|
'constructorArguments',
|
|
|
|
'arguments for contract constructor',
|
|
|
|
[]
|
|
|
|
)
|
2021-01-27 14:43:34 +00:00
|
|
|
.setAction(async ({ address, constructorArguments = [], libraries }: VerifyParams, localBRE) => {
|
2020-11-10 12:11:33 +00:00
|
|
|
await localBRE.run('set-DRE');
|
2020-08-20 15:35:05 +00:00
|
|
|
|
2020-11-10 12:11:33 +00:00
|
|
|
checkVerification();
|
2020-08-20 15:35:05 +00:00
|
|
|
|
2020-11-10 12:11:33 +00:00
|
|
|
const result = await verifyContract(address, constructorArguments, libraries);
|
|
|
|
return result;
|
|
|
|
});
|