Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify proxy/implementation on etherscan #541

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
}
};
export default func;
func.tags = ['New', 'Verify'];
func.tags = ['New', 'Verify', 'VerifyContracts'];
jordaniza marked this conversation as resolved.
Show resolved Hide resolved
func.runAtTheEnd = true;
func.skip = (hre: HardhatRuntimeEnvironment) =>
Promise.resolve(isLocal(hre.network));
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {
collectProxyWithImplementation,
generateExplorerIsThisAProxyURL,
handleLinkProxyRequest,
} from '../../../utils/etherscan';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

/**
* This script runs after contract verification.
* It searches deployments for proxies and their implementations and links them on Etherscan.
* This avoids the need to call 'Is this a proxy?' for each contract using the UI.
* This script can also be run as a standalone by invoking the 'VerifyProxies' tag.
*/
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log('\nLinking Proxies on Etherscan');

const url = generateExplorerIsThisAProxyURL(hre);
const verifyData = collectProxyWithImplementation(
await hre.deployments.all()
);

console.log(
`Linking ${verifyData.length} proxies on Etherscan, please be patient.`
);

for (const {proxy, implementation} of verifyData) {
await handleLinkProxyRequest(url, proxy, implementation);
}
};
export default func;
func.tags = ['New', 'Verify', 'VerifyProxies'];
func.dependencies = ['VerifyContracts'];
func.runAtTheEnd = true;
func.skip = (hre: HardhatRuntimeEnvironment) =>
Promise.resolve(
hre.network.name === 'localhost' ||
hre.network.name === 'hardhat' ||
hre.network.name === 'coverage'
);
Loading
Loading