Junior — Middle+
Determining the optimal token pair for exchange in a crypto wallet
livecode
Task condition
It is necessary to implement a function that selects an appropriate pair of tokens for a swap in a user's wallet.
- The function takes one parameter – the wallet address (for example,
walletAddress). - The function returns two token symbols: the token from which the swap will be made and the token to which it will be directed.
- The token from which the swap is performed is chosen as the one with the largest balance.
- Supported exchange pairs are:
ETH ↔ USDCandUSDT ↔ USDC. - The exchange rate is fixed: 1 ETH = 2000 USDC (or USDT).