2.7.2. ChainIDE Flattener Plugin
ChainIDE offers contract flattener plugin that combines all the imports from the original file into a single contract
If you're new to smart contract development and are encountering issues with file organization when trying to get your code verified on platforms such as Etherscan.io, ChainIDE's Flattener plug-in can help you simplify the verification process and ensure that your smart contract is properly organized and ready for verification.
To use ChainIDE's Flattener plug-in, first, navigate to the "PLUGIN Manager" section of the ChainIDE platform. From there, select the Flattener plug-in and click "Install" to add it to your workspace. Once you have activated the Flattener plug-in, you can use it to create a flattened file for your smart contract. To do this, simply right-click on the smart contract file you wish to flatten and select "Flatten Contract" from the button. This will generate a flattened file under the "EXPLORER" panel and the flattened file combines all the imports from the original file into a single contract. The flattened file can then be used for verification on platforms such as Etherscan.io or for deployment to a blockchain network.
Following are the steps to create a flattened file for your smart contract:
Activate the Flattener plugin
Choose a contract file you want to flatten.
Before selecting the contract, you need to compile the contract.
Save the flattened file to directory under Explorer panel
View the flattened file and use it for verifying a smart contract.
Overall, using ChainIDE's Flattener plug-in can help streamline the development and verification process for your smart contracts, making it easier to ensure that your code is properly organized and ready for verification.
To verify a smart contract, you need to access the corresponding blockchain explorer (such as EtherScan). After deploying the contract, click the button below to automatically navigate to the browser page for the corresponding contract.
Click on the verify and publish link shown under the contract section.
Once you click on the verify and publish link, you will be asked for the following:
Contract Address: The address of a deployed smart contract that you want to verify
Compiler Type: Either you want to verify a single file or multiple files
Compiler Version: The compiler version that you used to compile the smart contract
License: Open-source license type that you used for your source code
After that, you need to paste the flattened file you created in step 3, and make sure that Optimization is on or off during the compilation process, click OK, and your smart contract will be verified.
If there are no issues with your smart contract, it would be verified, and you'll be able to see an image similar to the one that is shown below.
Your smart contract is verified.
Last updated