apollodao / cw-dex

CosmWasm abstractions for decentralized exchanges.
Mozilla Public License 2.0
5 stars 4 forks source link

Implement balancing provide_liquidity #17

Closed apollo-sturdy closed 1 year ago

apollo-sturdy commented 2 years ago

Most of the time we want the behavior that when providing liquidity, if we don't have the correct ratio of assets, we should swap to the correct ratio before providing liquidity. Currently our Osmosis implementation has this behavior by using two single sided joins, but our Juno implementation does not support this. For clarity, I personally think we should separate this balancing behavior into a separate function with another name, perhaps balance_and_provide_liquidity, or provide_liquidity_unbalanced.

apollo-sturdy commented 1 year ago

This proved to be tricky since both the Astroport and Osmosis implementations needed callbacks in order to correctly perform several subsequent simulations. We have opted instead to create separate helper contracts for this functionality.