ERC-20 Token, my new money?
After investing in Ethereum, the next step was obviously to invest in altcoins. And after holding them back for a while, 💎🙌.
I had a simple question in mind, and if I could pay anything with the ERC-20 token, and if it was my new money?
So the first step would be to have a quick and easy to use way to transfer them.

The Idea
The idea is simple, give the possibility to anyone to transfer specific tokens to me. A QRCode, a link and an easy to understand interface.
And later provide a tool for anyone to create these links and QrCode
The Project
https://www.plo4ox.com/tmp-project/ERC20Transfer2022/?d=me
This must be structured in two parts, the transfer and the creation of the url/qrcode.
The second part will come later as I’m more interested in interacting with an Ethereum contract.
The Transfer
The first step is to validate the behavior of a token’s transfer function.
My first token
Before creating the transfer dApp, I had to understand how the transfer function of an ERC-20 token work. So I followed the simple documentation of:
https://ethereum.org/en/developers/tutorials/create-and-deploy-a-defi-app/
To start, I created my first contract, my first token named OxToken.
Surprisingly, I didn’t have to do much to get a simple ERC-20 token 🤷♂️
pragma solidity ^0.8.0;import "@openzeppelin/contracts/token/ERC20/ERC20.sol";contract OxToken is ERC20 {
constructor() public ERC20("OxToken", "OTKN"){
_mint(msg.sender, 1000000000000000000000000);
}
}
Of course, I didn’t deploy it to the mainnet, I used Ganache and created a simple dApp that performs the forwarding function and logs everything.
The transfer function is mandatory for all ERC-20 tokens, so the code can be the same for any token.
await currentContract.methods
.transfer(queryData.receiver, price)
.send({ from: account })
.once('sent', function(payload) {
console.log("[TRANSACTION PROGRESS] Request Sent")
})
.once('sending', function(payload) {
console.log("[TRANSACTION PROGRESS] Sending")
})
.once('transactionHash', function(hash) {
console.log("[TRANSACTION PROGRESS] Get transaction hash: " + hash)
})
.on('confirmation', function(confNumber, receipt, latestBlockHash) {
console.log("[TRANSACTION PROGRESS] Confirmation number: " + confNumber)
console.log("[TRANSACTION PROGRESS] Confirmation latestBlockHash: " + latestBlockHash)
console.log("[TRANSACTION PROGRESS] Confirmation receipt: " + JSON.stringify(receipt))
})
.on('error', function(error) {
console.log("[TRANSACTION PROGRESS] Failure with error: " + error.message)
});
And here is my first transfer transaction on Ganache!
So I’m ready to create my own meme token now! 🐶😄

The transfer
Here is the flow for the transfer
- Retrieve token information from GET url parameters
- Select a token
- Connect a wallet
- Enter the token amount
- Transfer tokens
Not much of a web3 challenge here. I mostly reused what I learned from the previous project
The tokens price
For the price of the tokens, the coingecko api is used, here is the url to ask for information on the INARI contract.
https://api.coingecko.com/api/v3/coins/ethereum/contract/0xca75c43f8c9afd356c585ce7aa4490b48a95c466
This makes it easier to get the price in USD as the work is done by Coingecko.
The contracts
To perform a transfer function, a contract must be loaded. On the previous project, it was loaded locally. Now Etherscan is used to obtain the contract ABI which will allow the execution of the transfer function. Here is the url to request to obtain the INARI contract ABI
https://api.etherscan.io/api?module=contract&action=getabi&address=0xca75c43f8c9afd356c585ce7aa4490b48a95c466
The account icon
To give the account user a bit more life, I switched from Jdenticon to Multiavatar. Here is an example
https://api.multiavatar.com/0x18BB8a31E6BbeC410458a9209ECaE4105af36128

What’s the result?
An interface allowing anyone with a metamask wallet to transfer tokens to me.

The URL and the QrCode
To date, the code to generate the URL and the QRCode does not exist. Only a POC and the models/ideas exist.

Conclusion
I learned how to create an ERC-20 token and configure Ganache to use test accounts. I am now looking to see if there are any APIs for mobile apps.
As a mobile developer, it will be a great bridge to build a mobile app using Web3 capabilities.
If you have KUMA / KAWA / INARI / PLAY to share do not hesitate to scan the following QrCode or click on the following link
The QrCode

The link
A little big because it contains data, I might look for a way to create a url shortener on the Ethereum chain.