Verifying Contracts
Source code verification provides transparency for users interacting with smart contracts. By uploading the source code, Polygonscan will match the compiled code with that on the blockchain. Just like contracts, a "smart contract" should provide end users with more information on what they are "digitally signing" for and give users an opportunity to audit the code to independently verify that it actually does what it is supposed to do.
Please be informed that advanced settings (e.g. bytecodeHash: "none" or viaIR: "true") can be accessed via Solidity (Standard-Json-Input) verification method. More information can be found under Solidity's "Compiler Input and Output JSON Description" documentation section.
To update token information on Polygonscan, the contract address code for the token must be verified. This is to ensure that the contract code is exactly what is being deployed onto the blockchain and also allows the public to audit and read the contract. Polygonscan ensures that all token contract must be verified before they can be updated with information submitted by the contract owner.
If you are the contract owner and would like to verify your contract, kindly follow the steps below:
1. Verify and Publish
Under the contract address page, next to the “Token Transfers” tab, you will be able to find the “Contract” tab. Then click on “Verify And Publish.”
2. Verify Contract Code
For Truffle deployed contracts, contract owner can use Polygonscan’s Contract Source Code Verifier.
Please enter the required information, including the contract name, compiler version, and the complete contract code. Ensure that the contract code is in its deployed form, as a single file (flattened), with all imports removed.
You can also input the optimization options, constructor arguments, and any other libraries at the bottom of the same page.
2a. Contract Verification Success
Upon successful contract verification, you can
- Suggest name tag & label for the contract address, and link to website
- Prompt our AI-powered Code Reader for security sanity checks (use this for reference only)
- View a summary of your verified contract
If you have deployed the same contract (with same address) on other chains, you can now verify your contract on multiple chains with a single API key from Etherscan, instead of creating a new API key on each explorer.
Learn more about multichain contract verification:
https://docs.etherscan.io/contract-verification/multichain-verification
And the supported chains:
https://docs.etherscan.io/contract-verification/supported-chains
2b. Contract Verification Error
In case of verification error, you'll get details on where it failed with:
- Compiler warnings & debug log
- Breakdown for difference in bytecode
3. Confirm Contract Details
When the contract has been verified, the “Contract” page will be filled with the contract details. The source code of the contract is now publicly available on Polygonscan.