合同核查
Remix has a plugin for contract verification. With this plugin, you can verify your contracts on Sourcify, Etherscan, Blockscout and Routescan.
The plugin is called: CONTRACT VERIFICATION.
您可以通过插件管理器访问它。
The plugin has 4 pages, the Verify page, the Receipts page, the Lookup page, and the Settings page.
Verify page
This is the home view of the plugin where you can verify your contracts.
You can select which verification services you want to use. By default, all that have a valid configuration are selected. On Ethereum Mainnet, this will be all but Etherscan. In order to enable Etherscan, you need to input an API key in the Settings page.
核查的前提条件是
公共网络上已部署合同的地址
Remix 中汇编的同一份合同
构造函数参数与部署过程中使用的参数相同(如需要)
收据页面
验证收据可在收据页面找到。
You can hover over the status symbols to get more information about failed verifications.
Lookup page
The Lookup page is used to check if a contract is verified on the verification services, and to download its source code into the file editor.
Settings page
In the settings page, you can configure custom API URLs for the verification services, and add your own API keys. For Etherscan, adding an API key is mandatory.
The settings are always stored per chain, meaning that if you change the settings for a chain, it will not affect other chains. If you want to verify or lookup contracts on Etherscan's instances on multiple chains (Explorer as a Service), you need to add an API key for each chain separately.
Verifying with constructor arguments
当合约的构造函数中有参数时,会显示一个文本框,用于输入与已部署合约相同的构造函数输入。
验证代理合同
If your contract is behind a proxy, you can verify also the proxy with the implementation contract. You just need to check the "The deployed contract is behind a proxy" checkbox, and provide the address of the proxy contract.
The plugin will first verify the implementation contract, and then verify the proxy contract.
Proxies can only be verified on Etherscan and Blockscout.