Tutorial: mint and trade your own ERC-20 tokens
Deploy an ERC-20 contract and trade the tokens on Uniswap on Oasis Ethereum ParaTime!
Last updated
Deploy an ERC-20 contract and trade the tokens on Uniswap on Oasis Ethereum ParaTime!
Last updated
This tutorial will walk you through the following tasks.
How to issue an ERC20 token on Oasis Ethereum ParaTime. You will get 100 to 500 ROSE after completing this step.
Build a liquidity pool on Uniswap, trade your ERC20 tokens and OETH, you will get 400 ROSE.
Oasis Ethereum ParaTime is fully compatible with Ethereum, so ERC20 contracts written in solidity can be deployed directly to Oasis Ethereum ParaTime without any changes.
This part can still be developed using the development tool, BUIDL, that has been configured for the development environment.
:warning: Warning: Pasting the private key of an account with a lot of value (i.e. a holding account) is not recommended whatsoever. Instead, please only transfer a tiny amount of value to a new one-off development account address and only use this new development account when writing and deploying your contracts. After all, you only need enough value to pay for gas; nothing else. Keep your holding account safe by never sharing its private keys.
It is recommended that the third challenge to be completed with MetaMask wallet because our newly issued ERC20 token is under the created address, which is easier.
Open MetaMask, and select custom RPC. Enter the network name and add the RPC link of Oasis Ethereum: https://rpc.oasiseth.org:8545, and make sure that MetaMask is in the Oasis Ethereum environment.
Then deposit 1 OETH to this MetaMask account from the OETH developer faucet.
Click to open “account”, select Import, import the MetaMask private key just set up into the BUIDL account, and prepare for the deployment of ERC20 contracts to pay gas fees.
You can load the web-based IDE by going to the link below. There is no software to download!
Select the ERC-20 sample project from the menu.
Tips: Now you can choose the solidity language version on BUIDL.
The smart contract source code is as follows.
At the end of the contract code, contract TestToken
is the specifics of ERC20 tokens. Here, tweak the code to customize the name of the ERC20 token to your preferences, symbol, decimal, and total supply.
Click the Compile button and select TestToken to deploy to the blockchain.
After the deployment is successful, the task of issuing ERC 20 tokens on Oasis Ethereum ParaTime is nailed. Please note that the token address here needs to be saved and used when adding tokens in MetaMask. Also, this address also needs to be submitted to the organizer when filling this form.
The next step is to complete the task for bonus rewards: building a liquidity pool for your ERC20 tokens on Uniswap, and start transactions.
To create a liquidity pool for tokens on Uniswap, you need to work with MetaMask. Please ensure that MetaMask is connected to the beta version of the Oasis Ethereum mainnet.
Under the current account, slide to the end, click Add Token—>Custom Token, and fill the token address just saved before. The decimal **and symbol of your token will be automatically added.
Open Website: https://uniswap.oasiseth.org/swap, go to Pool.
https://uniswap.oasiseth.org/swap
Click Add Liquidity, select Create Exchange in the pop-up option box, and then add the token address just saved. Then click Create Exchange and click Confirm to pay the gas fee.
Return to the Pool page, click Add Liquidity, and select Add Liquidity in the opened options. Select the token issued by yourself at the deposit place below and click Unlock.
After clicking Unlock, MetaMask will automatically launch a transaction prompt. Here, MetaMask is authorized to manage the previous MFT of Uniswap.
After the word “unlock” disappears, you can set any exchange ratio between the token you issued and OETH, and finally, click Add Liquidity at the bottom to generate a liquidity pool.
Go to Swap, enter the amount of OETH you want to exchange, and Uniswap will automatically convert the amount at the ratio set immediately. Click the Swap button to trade the token you just issued with OETH in Uniswap.
Now you have minted and traded your own tokens on the Oasis Ethereum ParaTime! You can watch the YouTube video below to review the entire process.
Happy coding!