ERC20 Messaging dApp
It is time to make your first steps with the Topos Testnet
and get familiar with it. To do so, you will use a basic dApp provided by Topos: the Topos ERC20 Messaging dApp. It is a sample application that allows you to experience Topos as a user. Later, you can find out more about the actions that are triggered and executed on the Testnet
during your test.
Visit the ERC20 Messaging dApp
Please make sure you have installed MetaMask before continuing.
With MetaMask installed, you can navigate to ERC20 Messaging:
You are now going to complete a cross-subnet, fungible token transfer from the Topos Subnet to the Incal subnet.
First, you must connect MetaMask with the ERC20 Messaging dApp:
The ERC20 Messaging dApp will display your address in the right top corner after the ERC20 dApp is connected to your wallet:
Each time you pick up a sending subnet it will be automatically added to MetaMask, if it is the first time you attempt to do so.
Add Topos to your networks:
Add Incal too:
If the network is already added to MetaMask, it will just ask for permission to switch the network if you pick up a subnet. For example, for Topos:
Or for Incal:
Register a token, here named testToken
:
In order to register tokens on the subnets, you will need to pay fees on both subnets. Use the Topos Faucet:
Make sure that the tokens are sent:
Now you can pay the necessary fee for a token registration (e.g., for the Incal subnet):
Repeat these steps for the Topos Subnet.
The ERC20 Messaging dApp will list the different steps involved in the cross-subnet transfer process:
First, approve the actions:
A cross-subnet ERC20 token transfer involves you approving several actions:
- Make allowance for token burn by sending an approve transaction to the token contract you deployed during registration of a new token. This step is not always required (for example, if you did not hit the maximum you set in this step during the next step).
- Burn tokens on the Incal subnet and emit an event by sending a sendToken transaction to ERC20Messaging contract.
The ERC20 Messaging dApp will wait for the transaction to be executed:
It should give you a success message, like the following:
Congratulations! You have completed your first cross-subnet token transfer.
Under the hood
The following steps describe what actually happened:
- The ERC20 Messaging frontend deployed a token contract on each subnet for the token you registered on it.
- It submitted a transaction to the Incal subnet in order to burn the transferred tokens on the Incal subnet.
- It made a request on the executor service. It submitted the Merkle proof of the transaction (proof of inclusion of its receipt in the receipt trie of the certified state transition) and the root of the transaction trie to the executor service, which is used by the ERC20Messaging contract to retrieve the certificate from the ToposCore contract.
- This certificate was emitted and then stored on-chain by the Topos Subnet.
- The Topos Subnet minted your transferred tokens.
Up next
You have invoked your first cross-subnet token transfer with Topos. In the next section, you will use Topos Explorer to see the certificates that were created.