omnidex inverting buyoffers

Marv Schneider edited this page Nov 30, 2016 · 6 revisions

Why Does Omniwallet automatically invert my Buy Offer into a Sell Offer?

The short answer is that the Omni Protocol for the OmniDex only understands and supports Sell Offers. So, Omniwallet lets you create a Buy Offer, when that makes sense to you, and then converts it to the corresponding Sell Offer. The Sell Offer has the same terms of sale, as viewed from the other side.

Let's look at an example:

Order 1:

  • Bob wants to Sell 10 Bobcoins at a unit price of 0.5 OMNI per Bobcoin.
  • Using the Sell Bobcoin form he enters this information and the form automatically computes the Total Amount of OMNI he Desires: 5 OMNI
  • When Bob submits this order, Omniwallet creates and broadcasts the order as:
  • User: Bob, Selling: Bobcoins, Selling Amount:10, Desires: OMNI, Desired Amount: 5
  • The order goes out exactly as Bob input it
  • 10 Bobcoins are deducted from Bob's usable/available balance and marked as reserved by Omni Protocol.
  • So, when the order is matched, the protocol can automatically move the 10 Bobcoins between the matched users.

Order 2:

  • Jack sees Bob's order in the Orderbook and wants to Buy it.
  • He creates a Buy order for 10 Bobcoins at a price of 0.5 OMNI per Bobcoin.
  • The Buy order form automatically computes Jack's Total Cost as 5 OMNI.
  • When Jack submits this offer Omniwallet automatically inverts it to conform with the Omni Protocol requirements. It becomes
  • User: Jack, Selling: OMNI, Selling Amount: 5, Desires: Bobcoins, Desired Amount: 10
  • Note: In the inverted state the calculated unit price becomes 2 Bobcoins per OMNI
  • 5 OMNI are now deducted from Jack's usable/available balance and marked as reserved.
  • When Jack's order is confirmed on the blockchain, Omni Protocol will compare its terms with any corresponding active orders, in this case Bob's.

So what happens? Once Jack's order is confirmed on the blockchain, the Omni Protocol automatically matches it against Bob's Order:

  • Bob Wants to Sell 10 Bobcoins and Jack wants to buy 10 Bobcoins
  • Jack is effectively selling 5 OMNI and Bob is effectively buying 5 OMNI So the protocol matches the orders and since it has been granted authority to move the reserved balances it credits Jack with 10 Bobcoins and Bob gets credited with 5 OMNI.
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.