Skip to content

Dex Aggregator #1979

@ashachaf

Description

@ashachaf

Goal

To improve the trading service we offer our users when visiting the app by allowing them to trade on any available liquidity that is available on chain IF carbon defi doesnt offer trade option

Details

Mockup

Flow:

  • user arrive at swap interface
  • select base and quote tokens
  • input source token or target token amount

current flow:

  • fetch all available liquidity for the pair
  • calculate the best trade path using this information
  • display
    • calculated value
    • routing -> the list of strategies the trade will route through

updated flow:
pick the best of these two options:
IF returnAmount.option1 >= returnAmount.option2, use option1.
ELSE use option 2
option 1:

  • apply current flow as is to generate price benchmark or to identify if carbon defi cannot support this trade
    option 2:
  • call a dexAgg api (exposed by the backend)
  • receive a trade path back with some additional details
  • display:
    • calculated value (source or target) in the swap widget
    • routing -> the path and pools that the trade will be routed through.

Backend API

New api will be exposed to generate a trade path.
required information:

  • slippage -> api should receive the user slippage tolerance to
  • dexAggregator fee -> identify this value from the contract and apply it on calculating the expected response

Expected behavior:

  • App to call the api endpoint and receive a payload with trade information

App behavior

Aside of the process in which the trade path is fetched and compared to decide which option to choose, there is a slight difference in cases where carbon defi path is selected (option 1)

  • New routing behavior
    Mockup
    Current:
  • click on the routing, open a popup modal that allows users to select between the trading strategies in the trade details.

Updated:

  • click on the routing, expose the route path below the swap widget
  • swap widget will display the information and path to better suite the dex-aggregator solution in mind
  • IF trade path only use carbon defi (and no other dex), expose an edit icon which by clicking it will trigger the same popup we have today

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions