Tutorial: The Oasis Second State Community Hackathon #3

Complete this tutorial, you will win 500 - 900 ROSE tokens from Oasis Foundation!

The hackathon jointly initiated by the Oasis Foundation and Second State has been underway for a week. How many of the following three challenges have you completed? We have published a tutorial on how to complete the first challenge and get 50 ROSE. Developers who have not completed it can refer to "Article Name" to follow some simple steps to get ROSE. This tutorial will walk you through the steps to complete the third challenge: 1. How to issue an ERC20 token on Oasis Ethereum ParaTime. You will get 100 to 500 ROSE after completing this step. 2. Build a liquidity pool on Uniswap, trade your ERC20 tokens and OETH, you will get 400 ROSE.

Deploy the ERC20 smart contract

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, but it should be noted that BUIDL currently does not support solidity’s versions above 0.6.0.

Step 1 Set up MetaMask

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.

Step 2 Import the MetaMask account address into the BUIDL Account image.png

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.

Step 3 compile and deploy the smart contract

Tips: Now you can choose the solidity language version on BUIDL.

If you do not have a readily available ERC20 contract code, you can refer to the following one.

https://gist.github.com/alabulei1/66c6601787e9ab874cdf27e19c052008

contract TestToken is PausableToken { string public name = "Test Token"; string public symbol = "TTT"; uint public decimals = 10; uint public totalSupply = 100000000000000000000; constructor () public { balances[msg.sender] = totalSupply; } } 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.

Depoly the ERC20 Token

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.

Add a Liquidity pool on Uniswap

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.

Step 1 Add the ERC20 token you just issued in MetaMask

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.

Step 2 Create Exchange for your Token

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.

Create Exchange

Step 3 Create a liquidity pool

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.

Unlock your Token

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.

Step 4 Swap with OETH

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.

At this point, the third challenge is complete, and you will get 500 to 900 ROSE.

You can also follow this YouTube Video to complete your third challenge.

Learn more about the hackathon: https://blog.secondstate.io/post/oasis-secondstate-hackathon/