AthanorLabs / atomic-swap

💫 ETH-XMR atomic swap implementation
GNU Lesser General Public License v3.0
341 stars 44 forks source link

Chaining Offers #498

Open stubbrn opened 1 year ago

stubbrn commented 1 year ago

It might be more practical for makers if their offers would somehow be more akin to liquidity pools that takers can draw from, instead of a one-of operation where 1 offer always incur 1 swap.

A maker may prefer to essentially be able to say to the network: "Here's 25 XMR of liquidity at this rate." once and then let different takers consume arbitrary-sized bites of that offer.

The simplest way to achieve this could be to automatically recreate an offer after a successful swap with a taker (when a new parameter is set to true) if the taker didn't consume all the liquidity.

In the case that the taker didn't consume all the liquidity and that the remaining liquidity is less to the min amount required by the offer, we can automatically create one last offer where both the min and max amounts are the remaining liquidity.

noot commented 1 year ago

I like this idea, I think it shouldn't be too hard to implement like you said - just make a new offer after the swap completes with the remaining liquidity. you could even do this before the swap completes, but then if the swap doesn't complete successfully we'd need to delete the auto-created offer with the leftover liquidity.