bancorprotocol / carbon-app

https://app.carbondefi.xyz
MIT License
23 stars 14 forks source link

Show balances on token selection modal #1333

Open Costa769 opened 2 weeks ago

Costa769 commented 2 weeks ago

Overview

On both SEI and Ethereum apps, when a user connects their wallet and opens a token selection modal, we want to expose the balances of the tokens users have in their wallet directly within the modal, eliminating the need for the user to open their wallet in order to check their token balances.

Implementation

On both SEI and Ethereum apps, when a user opens a token selection modal on the "create strategy" or "simulate" pages:

IF the wallet is not connected, the modal will retain its current behavior unchanged.

ELSE, IF the wallet is connected, tokens that the user holds in their wallet will be identified and their balances and values will be displayed in the token selection modal as follows:

IF a token held by the user has no market price available, it will be shown at the bottom of the list of identified tokens, sorted in descending order by token amount.

Example

User connects his wallet
The following tokens were identified in the users wallet 

100 USDC (token value=$100)
1 ETH (token value = $3200)
10 TKN1 (token value is unknown)
1000 TKN2 (token value is unknown)

Token selection modal will display the tokens in the following order:

ETH- 1(3200$)
USDC - 100($100)
TKN2 - 1000(...)
TKN1 - 10(...)
Other tokens that are not held in the user's wallet