How to determine the correct constructor argument during contract source code verification on Etherscan
This article will go over the steps to take when a contract source code verification failed due to an incorrect constructor argument parameter.
During a contract verification, Etherscan will attempt to "estimate" and prefill the constructor argument field. The constructor argument estimated by Etherscan is at best estimate effort and can be incorrect. The user is recommended to check and replace them in case of the verification failing.
When a contract source code verification failed as shown below, you will be given the bytecode deployed on-chain and the compilation results from the source code you have provided.
Highlighted on top is the bytecode on-chain, which is essentially the bytecode we are trying to match (what we are looking for).
The compilation results are shown on the box under "what we got."
For the next step, you would need to copy and compare the bytecode between "what we are looking for" and the contract you are trying to verify under "what we got." When comparing side by side as below, you can spot the differences in the bytecode.
From the comparison, we found some extra constructor arguments appended in the compilation input estimated by Etherscan.
Kindly also note that there might be extra constructor arguments from the deployed bytecode that might be missing from the compilation input where you can copy and add them during compilation.
You can then select the additional constructor argument parameter and remove them from the constructor argument field, arriving with the final constructor argument as below:
Kindly check all the other settings before submitting again for verification.
With the correct constructor argument, the contract can be verified as shown above.