How to Deploy & Manage Smart Contracts [TokenGen Tutorial]

How to deploy & manage smart contracts [TokenGen tutorial]

Initially, the option to deploy and then manage your smart contracts was implemented as a feature into TokenGen. However, we later decided that this functionality is too vital to projects and thus modified it to be a part of the user interface. Now, everyone can use it to seamlessly deploy and manage their smart contracts. This tutorial will walk you, step-by-step, through the entire process of deployment and management.

Deploying Your Smart Contracts

Deployment is really simple. Once your project is in status Done, you just need to go to the Project Overview tab:

TokenGen Project Overview Tab

From there, just click the Deploy Smart Contracts button and confirm the generated MetaMask Transaction. It is important to note here that, you will not be able to make a deployment if the testing of the project has failed i.e. you have not provided all project details.

Another thing to note is the fact that, if you have provided correct project details, but some time has passed and, for example, the fundraiser start date is now in the past, you will get a warning when trying to make a deployment.

That being said, once you confirm the MetaMask deployment transaction, you will be redirected to the Deployments tab where you can track the progress of the deployment:

TokenGen Deployments Tab

There are a few statuses a deployment can be in:

  • When the Contract Address column is set to “Deploying…”, that means that TokenGen is waiting for the deployment transaction to be included in a block. This is also when the Transaction State is set to Pending.
  • When the Transaction State is set to Valid, it means that the transaction was included in a block and TokenGen is waiting for at least 12 confirmations.
  • Once those 12 confirmations are reached, the Transaction State will be changed to Confirmed at which point the Manage Contract icon button will become available.
  • If the transaction fails to be included into a block for whatever reason (MetaMask will wait for 750 seconds for that to happen), then the Transaction State will be changed to Failed.

If all is well, the transaction will reach the Confirmed state and then you can manage the deployed smart contracts by clicking the Manage Contract icon button across each specific deployment.

Managing Your Smart Contracts

Once you click the Manage Contract icon button, you will be redirected to the Manage Contract tab. First of all, you will need to wait for TokenGen to pull all the data for your smart contracts. Once that is done, you will be greeted by the following screen:

TokenGen Smart Contract Management Interface

A short overview of the deployment is shown at the very top of the page. After that come the token and fundraiser contract tables. TokenGen creates separate smart contracts for the token and fundraiser and both have some unique variables and actions that can be performed on them.

Actions is what you will mostly be focused on when on the Manage Contract tab since its main purpose is to manipulate the state of your deployed smart contracts. There are three types of actions that can be performed:

  • Actions that do not require any input from the user.
  • Actions that require input from the user.
  • Actions that read the state from the Ethereum network, for example, you can check the token balance of a certain address.

For instance, let’s say that we want to pause all transfers on our token – usually this is a good thing to do if a crowdsale is ongoing. In that case, all we need to do is click on the Pause icon button across the “paused” variable of the token contract table and then confirm the MetaMask transaction:

TokenGen Token Contract Updating

As you can see, the token contract’s state is now “Updating…” and will remain so until the contract method call transaction is confirmed by the Ethereum network. Once it is, the token contract table will be updated and we can then see that transfers on our token are no longer allowed:

TokenGen Paused Token Transfers

Another thing you can notice is that, the Pause icon button has become disabled while the Resume icon button is now available. So, whenever we want to allow transfers on our token, we can simply click the Unpause Transfers icon button and then confirm the MetaMask transaction.

As we already mentioned, there are three types of actions that can be performed via the TokenGen smart contract management interface. The example from above does not require any input provided by the user but there are those who required that. Let’s go through an example.

We will change the “conversionRate” variable of the fundraiser. Naturally, we will need to provide the new conversion rate. In order to receive that input, TokenGen will display a dialog window where the user can provide the necessary info:

TokenGen Change Fundraiser Conversion Rate Action

If you have noticed, the current fundraiser conversion rate is set to 10. Let’s change it to 20. We just enter 20 in the New Conversion Rate field and then click the Submit button. We confirm the generated MetaMask transaction and wait for the fundraiser contract to be updated:

TokenGen Changed Fundraiser Conversion Rate

And there you have it – the fundraiser conversion rate is now set to 20. One thing that is important to note here is that, it is not recommended to perform actions on a contract that is in a state of “Updating…”. It is a best practice to wait for it to go into a state of Ready before calling another action on it.

Now, we have shown examples of two of the three types of actions that can be performed, so let’s show one example of the last type – reading the state of the deployed smart contract. The simplest example of such an action is checking the token balance of a certain address. To that end, we use the Check Address Balance icon button across the “totalSupply” token contract variable.

Naturally, this action requires an input from the user (the address to check):

TokenGen Check Address Token Balance Action

Once we enter the address, we click the Submit button and wait for the response from the Ethereum network:

TokenGen Check Address Token Balance Response

That is pretty much all there is to the TokenGen smart contract management interface. We have tried to make it as intuitive and user-friendly as possible and it sure as hell beats the alternative way of interaction that includes MEW and several other complications.


Hopefully, you now see just how easy it is to deploy and manage your smart contracts using TokenGen, especially when compared to the previous way that included MyEtherWallet, manually providing the ABI for each contract, opening several tabs, among many other inconveniences. Fortunately, TokenGen users no longer need to deal with all of that and it is all thanks to the smart contract management interface.