duality-labs / duality-web-app

2 stars 2 forks source link

Add split trade with Astroport feature #535

Open dib542 opened 6 months ago

dib542 commented 6 months ago

If a token pair has a low amount of TVL liquidity in pool, there is a risk of high price-slippage when larger trades are executed.

To reduce the amount of price-slippage when swapping, we can pass a specific amount through Duality low-slippage pairs and the remainder through Astroport pairs. This depends on the actual pool sizes and prices of the pair in question at the point of time of trade execution, so an algorithm (likely a stepping algorithm) should be used to calculate the optimum split to put through each platform.

The implementation should be that if selected (by default?), the generated dex tx should go from an array of placeLimitOrder type Msgs, to an array of placeLimitOrder and AstroPort swap Msgs (the final solution is likely to be one of each type). On initial investigation it seems like the main issue will be determining the contract_addr of the Astroport token to swap.

Astroport docs:

dib542 commented 5 months ago

In a discussion around the new Neutron App UI, it was discussed that we could complete this task by routing trade through Skip API (if they can provide this feature of using Duality and Astroport) rather than implementing our own splitting logic between Astroport and Duality routes.