Comment on page
Create, deploy & mint a fungible token
A step-by-step tutorial on how to create, deploy and mint a ERC-20 fungible token with VORJ.
To follow this tutorial you must have completed the following:
The objective of this tutorial is to provide a simple jargon free step-by-step guide on how a user can create, deploy and mint fungible tokens.
To answer the question of what is an ERC-20 fungible token let's first break this question into two.
A fungible token is a form of digital asset that can be easily interchanged with other tokens of the same type because each token has the same value and properties. In other words, every token is identical to every other token, and they can be exchanged or traded without any difference in value or functionality.
For example, if you have two $1 dollar bills, they have the same value and can be used interchangeably. Similarly, if you have two fungible tokens, such as ERC-20 tokens they have the same value and can be used interchangeably.
Fungible tokens are often used as a form of currency or as a way to represent other digital property such as stocks, bonds or commodities on a blockchain. They are also commonly used a a means of exchange in decentralized applications and smart contracts, where they can represent anything from voting rights to loyalty points.
An Ethereum Request for Comment (ERC) is a document that outlines the rules that determine how data is formatted, transmitted and also what actions will take place when an event occurs.
The ERC-20 standard, which is one of the most popular token standards, determines the standards / rules that determine how data is formatted, transmitted and what actions will take place when an events occurs.
As vechain is compatible with the Ethereum Virtual Machine (EVM) and the ERC-20 standard is used across all EVM compatible chains for interoperability across chains it makes sense for vechain to use the ERC-20 fungible token standard.
Dashboard page with one testnet project.
Select the project that you created by pressing on it. This should redirect you to the project space. Your screen should now look similar to the one below.
Project page with no smart contracts.
To create a fungible token we must first assign some resources to the project. Select the Allocate Resources button. This will bring up a modal similar to what is show below. This modal allows you to assign resources to your project. Let's just max out the resources for this project. We can always reassign unused resources across projects.
Assign resources modal screen.
After having assigned all of the available resources to a project we should see a screen similar to the one below.
An example of a project with assigned resources.
Press the Create Smart Contract button in the top right hand corner to start. This will open a modal requesting you to select the smart contract standard that you want to create. Select the first option Fungible Token.
Smart contract options in VORJ.
After selecting the Fungible Token option you should now see a screen similar to the one presented below. This is the fungible token form. There are four fields that must be populated and two optional features. While there are information icons available on the page which should help you understand what is required in each field let's quickly talk through each of the six fields.
ERC-20 Fungible Token form.
Populate the fields with any values that you want and select the features that you would like for your specific smart contract implementation. Once you have populated the form press the Deploy button or if you prefer press Save and come back later and Deploy another time.
Once you have pressed Deploy you will see a screen similar to the below which is informing you that there will be a minimum of a two minute wait until your contract has been deployed and indexed by VORJ.
Deployment and indexing taking place.
Once the contract has been deployed and indexed by VORJ you can perform some Actions with your smart contract.
Once your fungible smart contract has been deployed you should see a screen similar to the below.
Deployed fungible token action tab.
There are some elements on this screen that we should discuss. The long hexadecimal string starting with 0x is the contract address of your deployed smart contract. Next to the contract address are two icons. The first icon copies the address to your clipboard. The second icon links out to the explorer to view your smart contracts transactions.
The form elements on this page will depend on the features that you implemented as part of your contract. From the image above we can see that the contract was deployed with the pausable feature. This means that the contract can be paused and unpaused with the press of a button.
The primary function on the Action tab is the ability to mint tokens. You can mint tokens from your fungible smart contract to any address with any given amount by populating the Address and Amount cells. We have provided a useful balance counter for the smart contract to inform the user how many tokens remain un-minted.
Double check that the address is correct. Once a transaction has been submitted it is irreversible and the funds cannot be recovered.
To do a test transaction you could send some of the tokens to the burn address `0x000000000000000000000000000000000000dEaD`. This is an address which is used to burn tokens, the funds in this address are lost forever as there is an almost zero percent likelihood that the key for this address can be generated.
You have successfully created and deployed a fungible token on the vechain blockchain.