Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add external tokens to the Tokens section #1598

Open
parrot9design opened this issue Jan 20, 2025 · 3 comments
Open

Add external tokens to the Tokens section #1598

parrot9design opened this issue Jan 20, 2025 · 3 comments

Comments

@parrot9design
Copy link
Collaborator

parrot9design commented Jan 20, 2025

We're gonna need to update the Tokens section to support external tokens and make it clear what the limitations are:

Image

Image

Balanced uses intent-based trades to access crypto from external exchanges.

EDIT: Let's omit the market cap column to keep it consistent with the changes made in #1600:

Image

And if trendline support is possible, let's try to add that in.

@0xmilktea
Copy link
Collaborator

The solver needs to build an endpoint that returns the capabilities and limitations of the solver. and also basic token information.

[{
   chain: string
   ticker: string
   price: number/string
   maxTradeInDollar: number
   maxTradeInToken: number/string
}]

[{
   chain: Arbitrum
   ticker: ETH
   price: 3400
   maxTradeInDollar: 3000
   maxTradeInToken: 0.9
}]

@alexandre-chirouze
Copy link

alexandre-chirouze commented Jan 31, 2025

The solver cannot fulfil this requirement as it just does not work like this. The solver does not know about ticker or chain, it only work with addresses and xCall chain ID.

For example, if you need some ETH information, you need to tell the solver that you want information about address 0x0000000000000000000000000000000000000000. But this address can also be POL token on Polygon for example, so you need to also specify which chains we are talking about, so 0x0000000000000000000000000000000000000000 on 0xa4b1.arbitrum.

When an address and an xCall Chain ID is given to the solver, it then does not know the ticker, so ticker Information cannot be given.

The MaxTradeInDollar and maxTradeInToken is also a tricky data to get as it depends on the path of the swap. For instance, the solver has a hard cap of 5000$ per trade right now for any token on any chain. But, that cap can be lower depending on the bridge capabilities, so it is linked to the path the user wants.

Let say the user wants to swap ETH on Arbitrum to bnUSD on ICON. In that case, the max will always be the hard cap as there is no limitation on how many tokens we can send from Arbitrum to ICON. But the other way around is different, if a user wants to swap bnUSD to ETH on Arbitrum, the limitation depends on the xCall limitation about how many tokens can be sent to ethereum. There's even the Stability fund limitation to take into account in this example.

So what I suggest is :

We only show the hard cap as max trade, so it simplifies everything. The solver can have an endpoint and return you the hard cap as a dollar amount (5000 for instance right now).
You then need to use an oracle if you want to display that hard cap as a token amount.

@0xmilktea
Copy link
Collaborator

0xmilktea commented Jan 31, 2025

We need an endpoint that returns all your solver's supported tokens.

endpoint path: /tokens
return format:

{
   hardCap: 5000,
   tokens: [{
      chindId: '0x0xa4b1.arbitrum'
      tokenAddress: '0x000...'
      hardCap: 5000
    }]
}

Could you return the all supported tokens in this format?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants