enruzh-hansbgJoin the conversation: https://t.me/fabric_token
TokenGen 3.0 is now live: https://tokengen.io/

How to Verify Your Smart Contracts on Etherscan [TokenGen Tutorial]

Since we have been receiving several requests over the last few days regarding the verification of deployed TokenGen smart contracts, I decided to write a tutorial on the matter. Here’s how you can verify your TokenGen smart contract code on Etherscan, once it is deployed.

As previously mentioned, TokenGen can create up to 5 separate smart contracts depending on the features selected by the user:

  • Fundraiser – deals with the crowdsale and pre-sale.
  • Token – the token itself.
  • Token safe – the token safe where tokens can be locked for the core team, advisors, etc.
  • Refund safe – the token safe where funds will be kept during the fundraiser and sent to the beneficiary if the soft cap is reached or refunded to participants if it is not reached.
  • Whitelist – deals with the whitelisting/blacklisting of addresses for the participation in the fundraiser.

The fundraiser is the easiest and only one you can verify on Etherscan since they do not support the verification of contracts deployed by other contracts. And since the fundraiser contract is the “root” of all contracts generated by TokenGen, it is the one that deploys the rest of them along with its deployment. Thus, it is the only one you can verify on Etherscan.

Now that shouldn’t be a problem as it is the contract that you will mostly be interacting with during your TGE. That being said, let’s go over the contract verification process, which, by the way, is a child’s play.

You need to open the contract’s page on Etherscan and then go to the Code tab. You will be able to see the contract’s bytecode as it was provided by TokenGen. Next, you just need to click the Verify and Publish link at the top of the tab:

Etherscan Verify & Publish Contract

This is the basic form that you need to fill-in in order to verify your smart contract on Etherscan. Start by entering the contract name as it is provided in the TokenGen package – should be something like [ExampleToken]Fundraiser. Then, you need to provide the compiler version, which you can find in your project’s page on TokenGen in both the Project Overview and Build tabs (after the 3.0 update).

For people who want to verify their fundraiser contract before we release TokenGen 3.0, you can find the compiler version for each build in the root of your TokenGen package in the [ExampleToken]Fundraiser.json file. Simply search for “compiler” and you will find it. The section in the code looks something like this:

TokenGen Package Compiler Version

Next, find that version in the dropdown input in the Etherscan contract verification form above and select it. Lastly, just copy the contents of the Project.sol file from your TokenGen project package into the Contract Code textarea of the form.

After that, you can scroll to the bottom and click the Verify and Publish button and voilà, your fundraiser smart contract should then be verified. If you go back to the fundraiser contract page on Etherscan, you should now be seeing a check mark next to the Code tab label and you should also be seeing two additional tabs – Read Contract and Write Contract.

The Read Contract tab allows you to check the current values of fundraiser variables such as start and end dates, conversion rate, owner address, etc, while the Write Contract tab allows you to change some of these values.

Keep in mind that this Write Contract functionality is still in beta, but in any case, you won’t really need it because the new TokenGen 3.0 update comes with a contract management interface specifically geared towards TokenGen projects that allows you to control your contracts without the need to go to Etherscan, MyEtherWallet, or anywhere else. It all happens right into the TokenGen interface.

And that’s pretty much it for this tutorial. Again, you can only verify the fundraiser contract on Etherscan since the app doesn’t allow verification of contracts deployed by other contracts. But, you don’t really need to verify the rest of the contracts anyway as the fundraiser contract is the hub of your project and it is the only one that will be exposed to your potential investors.

Leave a Reply