stellar / soroban-examples

Example Soroban Contracts
Apache License 2.0
65 stars 68 forks source link

Rewrite liqpool contract #246

Open leighmcculloch opened 1 year ago

leighmcculloch commented 1 year ago

The liqpool contract uses strict-receive semantics. It requires the user performing a swap to specify an exact amount to receive, and then takes up to a maximum amount to fulfill it.

We should rewrite the liqpool contract such that it uses strict-send semantics. i.e. The user performing a swap chooses the amount to send in and gets a variable amount out inside a range defined by the user.

Why: Strict-send is more common in AMMs. It's also easier to code for since there isn't a undetermined transfer amount to move out of the users wallet.

Related conversation is at: https://discord.com/channels/897514728459468821/1108150361136566322