duality-labs / duality

Apache License 2.0
10 stars 5 forks source link

Implement swap with routing #238

Open PossibilityResult opened 1 year ago

PossibilityResult commented 1 year ago

takes as input an ordered list of token pairs and swaps into them consecutively

teddyknox commented 1 year ago

@eljhfx is this still needed for prod launch?

PossibilityResult commented 1 year ago

@teddyknox needed? not sure

Would it be useful and should it be a large lift: yeah it should come in handy and won't be a large life (is just defining a min price / min out for an entire route instead of a single pair).

Would pretty much just be another function that could be called and a little extra logic

teddyknox commented 1 year ago

Agreed it would be useful. Will keep it here then.

PossibilityResult commented 1 year ago

One question to ask ourselves is exactly what will this enable that wasn't previously.

Can it help us catch errors midway through routes? Will it help the UX of routing complex trades?

I know you can do some of this stuff w/ the cosmos SDK (compound txs) but not sure what is and isnt possible

teddyknox commented 1 year ago

@eljhfx I thought the advantage was that the best route can change between when you prepare the tx and when it executes.

PossibilityResult commented 1 year ago

Yeah but that isn't what's being specified in this issue although that'd also be useful for a function such as dynamicRoute() which checks a few default paths and chooses which is best (or whether some combination makes sense).