A use case for ERC-20 token advanced features (Part II)
In the first part, we explained how to create an ERC-20 token easily using WP Smart Contracts (WPSC) WordPress plugin. For that, we created an advanced ERC-20 token with all features — Chocolate flavor — for a fictional software license control system called Terabyte Online Media.
If you are familiar with ERC-20 Ethereum tokens for sure you know how to transfer funds from one account to another, but even advanced users are not always familiar with some other features of ERC-20 tokens.
We are going to review some of these features using the WP Smart Contracts wallet included in this WordPress plugin. To sign every transaction we will be using Metamask browser extension.
Transfer
For sure the most common and basic function of a token protocol is to transfer funds from your account to another.
Following the Tom token example, imagine that we have a new customer for our software and we want to transfer one license to the account of the new customer. To achieve this you need to be logged-in in Metamask with your owner account, and then go to your wallet section in the Block Explorer, and click “Transfer”.
You need to specify the Ethereum address of your customer. For this, you can click “Scan” to get the address directly from your smartphone or any other image. Show the QR code of the destination address to your camera and after a few seconds, you will get the full address in the form, then specify the number of tokens, in this example, licenses, you want to transfer. Click “transfer”, confirm the transaction in Metamask.
That’s it.
After a few minutes, you will see the transaction in your block explorer.
Approve, allowance and transfer from other accounts
The ERC-20 standard token specification gives you a set of functions that allows you to allow a third-party account to use a fraction of your token holdings.
Imagine that you want to give a reseller, the right to sell 20 licenses of Tom. That means that you are going to approve the reseller account to spend a maximum of 20 tokens on your behalf.
For this simply go to your wallet and click on “Approve”. Type or scan the address of the destination account. Then fill the number of tokens, or licenses you want to approve to the destination account, 20 in this example, click “Approve” and confirm your transaction.
Now your reseller is ready to distribute licenses with his account. He will also be able to query the allowance or amount of tokens approved from your account.
To do this your reseller just need to click on your account in the WPSC Block Explorer.
Your reseller can use the “Transfer from” option to transfer a license from your account to a final customer.
For a detailed explanation on how to do this please take a look at the following video.
So far we have seen the most basic features of the ERC-20 token, in the next chapter we are going to see how to mint, burn and pause token activity.