Search code examples
blockchainethereumsolidityetherscan

Sol-verifier Constructor Arguments - Fail - Unable to verify


I am using ether.js for solidity smart contract deployment, and sol-verifier library verifying the smart contract on etherscan.io.

The github link for sol-verifier is - https://github.com/Aniket-Engg/sol-verifier.

The verification process fails when contract needs constructor arguments during verification. I have deployed my contract using ether.js library. The verification process fails only for the contracts having constructor with arguments.

Here is the contract deployment script using Ether.js:

let factory = new ethers.ContractFactory(contractABI, contractBytecode, wallet);
let contract = await factory.deploy(tokenSymbol, projectName, numOfTokens);

Here, tokenSymbol, projectName, numOfTokens are the arguments for contract constructor

Inputs for sol-verifier:

var data = {
                key: etherscanAPIKey,
                path : path.join(__dirname, '../../ERC20-Mintable-Contract/erc20_mintable_contract.sol'),
                contractAddress:  contractAddress,
                network  : contractConfig.PROVIDER,
                contractName: contractName,
                cvalues: [tokenSymbol, projectName, numOfTokens],
                optimizationFlag: false
};

The same arguments I am passing while verification as that while deploying smart contract.

Output:

{
    "status": false,
    "message": "Fail - Unable to verify"
}

Contracts for reference:

0xa7a3373419dc09740a6D5c7c308230aB37581984 [Manually Verified with etherscan.io] 0x5Cb0832FA136486E15a2271E06f341c81f7d8602 [Fails to verify using sol-verifier]

I am sure this fails because of constructor arguments, because I tried one without arguments and it passed.

Thanks!


Solution

  • This has been resolved in latest release. Try it again: https://www.npmjs.com/package/sol-verifier