Skip to content

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

@DuriSK

Description

@DuriSK

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions