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

Adding router from FE to on chain router (WIP) #94

Open
DuriSK opened this issue Feb 29, 2024 · 0 comments
Open

Adding router from FE to on chain router (WIP) #94

DuriSK opened this issue Feb 29, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@DuriSK
Copy link

DuriSK commented Feb 29, 2024

When user specify assetIn and assetOut on trade page
And best route is found by SDK
We should check on runtime, if route for specified pair is also existing on on chain router.
If route is not existing, check should be done if this is best route also for assetIn value 1% of liquidity for specified asset.
Add to on chain router route, which is best one for 1% of liquidity.

Example:
assetIn (10)
assetOut (0)

Screenshot 2024-02-29 at 17 43 52

route found by SDK:

route:[
0:{
pool:{
Stableswap:"102"
}
assetIn:"10"
assetOut:"102"
}
1:{
pool:"Omnipool"
assetIn:"102"
assetOut:"0"
}
  1. Check if route for specified pair is on runtime router:
    router.routes(10,0)=>route was not found

  2. Check if route is best also for 1% of liquidity (check SDK for same asset combination, but assetIn will be amount of 1% of liquidity of specific asset)
    How to find out how much liquidity is for specified asset?
    Find in which pool assetIn is- either omnipool,stablepool or xyk
    Get token balance tokens.accounts(accountId,assetid)

  3. Add best route returned by SDK (for 1% of liquidity) to on chain router

Screenshot 2024-02-29 at 18 00 42
  1. Batch add route with trade extrinsic
@nohaapav nohaapav added the enhancement New feature or request label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants