AthanorLabs/atomic-swap

Trick for Swaps with XMR as Takers

stubbrn opened this issue · 1 comments

Sorry in advance if I'm forgetting something essential:

Wouldn't it be possible to achieve "XMR as taker" swaps without any downside by adding a step/layer to the beginning of the "XMR as Maker" protocol, instead of trying to create a "mirror" process from scratch ?

Meaning that an ETH maker would be able to essentially say to the network "Hey, I have 10 ETH, and would like to exchange them at this rate; if any of you XMR makers create an offer with my parameters I promise that I'll take it instantly".

So ETH "Makers" could advertise a "promise-offer" to XMR "Takers", that will still end up being regular offers created by the XMR side but with parameters defined by the ETH side (in the "promise").

Before creating the offer to respond to the "promise", the XMR side could verify that the ETH side has the funds (Either the ETH or the Token by requesting the concerned contract), with the ETH address contained in the "promise", but as the ETH side is the one that needs to lock the funds first, this may not be necessary.

Different possible scenarios:

  • If someone creates a Promise and cancels it before anything happened then nobody lost anything.
  • If a Promise is created, and an offer is purposely created to respond to that Promise, but the Promise author does not take the offer, then it's just equivalent to a regular offer. We could make the offers that respond to a Promise have a short timeout by default, as the XMR side's offer is supposed to be taken almost instantly by the Promise author.
  • If a Promise is created and an adequate offer matches the Promise's parameters, then the Promise author takes the offer and the regular XMR maker protocol is launched.

It might be even better to do this instead of the "real thing" because it reuses the same process.

What's the catch ?

Here's the catch:

The ETH provider pays the gas to create the swap on chain. If the ETH provider were to create the swap automatically, and the XMR provider could trigger this gas commitment from the ETH provider at no cost to himself, someone can write a bot that will just bleed out the funds from all the ETH providers.

Suggestions on how to get around this problem are welcome from anyone reading this.