crypto-banker / bridgeless

GNU Affero General Public License v3.0
10 stars 1 forks source link

Consider adding support for cancelling orders #11

Open crypto-banker opened 2 years ago

crypto-banker commented 2 years ago

This has potential tradeoffs, but should probably be implemented in some form at least.

crypto-banker commented 2 years ago

Adding nonces to the base of orders (see commit here: https://github.com/crypto-banker/bridgeless/commit/adf9a9ff40f3921621554751128993c23e2ebb07) partially addresses this. If a user wants to cancel an order, they can just try to make sure a different order with the same nonce gets through first. Two options for order cancelling with this mechanism: 1) offer zero of some token for zero of another, fulfilling the order yourself 2) offer a small amount of tokens in exchange for zero tokens Option (2) is effectively a gasless version of the way cancelling transactions works in Ethereum.

crypto-banker commented 2 years ago

Adding nonces to the base of orders (see commit here: adf9a9f) partially addresses this. If a user wants to cancel an order, they can just try to make sure a different order with the same nonce gets through first. Two options for order cancelling with this mechanism:

1. offer zero of some token for zero of another, fulfilling the order yourself

2. offer a small amount of tokens in exchange for zero tokens
   Option (2) is effectively a gasless version of the way cancelling transactions works in Ethereum.

The above plan doesn't seem to mesh well with the current partial-fill orders architecture. See changes here: https://github.com/crypto-banker/bridgeless/pull/13; notably, orders that have only been partially filled are stored differently, with the original nonce being marked spent on first partial-fulfillment.