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

Constructor Arguments - Fail - Unable to verify #22

Closed
digvjs opened this issue Apr 13, 2019 · 3 comments · Fixed by #26
Closed

Constructor Arguments - Fail - Unable to verify #22

digvjs opened this issue Apr 13, 2019 · 3 comments · Fixed by #26
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@digvjs
Copy link

digvjs commented Apr 13, 2019

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.

Contract Deployed using Ether.js:

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

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!

@Aniket-Engg
Copy link
Owner

Thanks for raising this @DigvijaySS . Let me check it.

@Aniket-Engg
Copy link
Owner

Aniket-Engg commented Apr 15, 2019

I checked contract 0xa7a3373419dc09740a6D5c7c308230aB37581984 verified as a similar match. I see you defined constructor with function contractName() syntax which got deprecated in Solidity v0.5.0 by new constructor() syntax which was introduced in v0.4.22.

Although we will provide support for old syntax too. This will be fixed in upcoming release.

@Aniket-Engg Aniket-Engg added bug Something isn't working good first issue Good for newcomers labels Apr 15, 2019
@digvjs
Copy link
Author

digvjs commented Apr 15, 2019

Good to hear that!
Thanks @Aniket-Engg

@Aniket-Engg Aniket-Engg self-assigned this Apr 16, 2019
Aniket-Engg added a commit that referenced this issue Apr 16, 2019
old constructor support added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants