Created
June 13, 2023 19:38
-
-
Save ryestew/8f3141e6ebcdc7a0131ff5cc5d04a647 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} apikey - etherscan api key | |
* @param {string} contractAddress - Address of the contract to verify | |
* @param {string} contractArguments - Parameters used in the contract constructor during the initial deployment. It should be the hex encoded value | |
* @param {string} contractName - Name of the contract | |
* @param {string} contractFile - File where the contract is located | |
* @param {number | string} chainRef - Network chain id or API URL (optional) | |
* @param {boolean} isProxyContract - true, if contract is a proxy contract (optional) | |
* @param {string} expectedImplAddress - Implementation contract address, in case of proxy contract verification (optional) | |
* @returns {{ guid, status, message, succeed }} verification result | |
*/ | |
export const verify = async (apikey: string, contractAddress: string, contractArguments: string, contractName: string, contractFile: string, chainRef?: number | string, isProxyContract?: boolean, expectedImplAddress?: string) => { | |
const compilationResultParam = await remix.call('compilerArtefacts' as any, 'getCompilerAbstract', contractFile) | |
console.log('verifying.. ' + contractName) | |
// update apiKey and chainRef to verify contract on multiple networks | |
return await remix.call('etherscan' as any, 'verify', apikey, contractAddress, contractArguments, contractName, compilationResultParam, chainRef, isProxyContract, expectedImplAddress) | |
} | |
const result = verify("3WKEVV76IPDIXBNCCI15Q514FGT86R51HB", "0x2f620507893f28C39830332fDCFABA0516A8DAA4","", "Owner", "../../contracts/2_Owner.sol", 5 ).then( | |
response => response | |
).catch(error => console.log(error)) | |
console.log("result: ", result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment