Generalizing Dex Selection for Margin Trades

Proposal: Add the ability to select different dexes to execute margin trades on.

The proposal is fairly straightforward but is a major upgrade in regards to user benefit. The proposal essentially is to allow for the execution of swaps on different DEXes. Currently, only one DEX is supported and this is not conducive to the current environment where that DEX may not be the best place to execute trades for a given pair. The proposal will initially include the support for sushiswap style DEXes, uniswap v3, and curve. Other DEXes can be added as desired through governance votes and the development of the generalized implementation for the specific DEX. This proposal will also be backward compatible in the sense that orders placed in the current format can continue to be placed as they are done, but they will automatically be diverted to a default DEX. This ensures integrations do not break from the introduction of this feature and the usage of it can be eased into. The best example of where this will benefit is for margin trades between stablecoins as curve provides the best rates for those, but curve is not currently being utilized due to the design limitations of the current swap module. Generalizing the module and having the ability to select a supported dex will allow for users to select curve for a stablecoin to stablecoin margin trade which can save a large amount. There are other pairs where it will be beneficial to execute on a specific dex, based on where the majority of liquidity resides. The process to add support for a new dex should the need arise is that a swap module would have to be created that is compliant with the design of the other modules. This is done to standardize the process and keep it efficient.


i support this proposal! nothing else to say haha🙋🏻‍♂️

Looking forward to see what you have build - hope it can solve slippage - which sometimes was killing the profits…