There are two easy steps:
- Decide how many screens we need to display.
- Tell the Eth App if more information is needed for a specific token.
To address 1, let’s think about what we want to display.
As we are simply swapping tokens, the useful information is the amount of ETH sent, the amount of tokens received, and the beneficiary.
It looks something like this:
| Swap | Receive Min | Beneficiary |
| ETH xx | USDT xx | 0x... |
The Eth App adds screens to "Accept" or "Reject" the transaction.
So, the answer to 1 is 3.
Now to answer 2: we need information about the token the user receives. We already have the information for Ethereum: The ticker is “ETH”, and the number of decimals is 18.
The code you need to change in
handle_finalize would look something like this:
msg->numScreens = 2;
msg->tokenLookup1 = context->token_received;
You can only request the information of two ERC20 tokens, using
tokenLookup2. There is no
This part is now done. The next is where the Ethereum App returns the requested information about the tokens.