{
 "format": "zoobc-conformance-vectors/1",
 "edition": "0.6.1",
 "chapter": "15",
 "license": "CC BY 4.0, ZooBC Foundation",
 "cases": [
  {
   "id": "15-1-quote",
   "chapter": "15",
   "section": "1",
   "title": "The quote of 50,851,885,007 at 0.960271 and ten basis points of 10 ZBC",
   "kind": "15-quote",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "amount": "50851885007",
    "price": "96027100",
    "x": "1000000000",
    "bps": "10"
   },
   "expected": {
    "quote": "48831590467",
    "fee": "1000000"
   }
  },
  {
   "id": "15-1-markets",
   "chapter": "15",
   "section": "1",
   "title": "The markets view of a chain with one Active market M and no trade",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "markets": "{\"markets\":[{\"id\":\"<M as a signed decimal string>\",\"base_token_id\":13,\"quote_token_id\":0,\"deposit\":5010000000}]}",
    "trades": "{\"trades\":[]}"
   }
  },
  {
   "id": "15-2-open",
   "chapter": "15",
   "section": "2",
   "title": "An open offer of 1 ZETH for 1,030 ZBC, its id O from a hash beginning 6C697017F269E7BB",
   "kind": "15-swap-offer",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "050000000000000000e1f505000000000000000000000000004647fb170000000000000000000000",
    "hash": "6c697017f269e7bb"
   },
   "expected": {
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "expiry": "0",
    "counterparty": ""
   }
  },
  {
   "id": "15-2-counterparty",
   "chapter": "15",
   "section": "2",
   "title": "The same offer to one ZooBC account",
   "kind": "15-swap-offer",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "050000000000000000e1f505000000000000000000000000004647fb1700000000000000000000002400000000000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "hash": "6c697017f269e7bb"
   },
   "expected": {
    "counterparty": "00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807"
   }
  },
  {
   "id": "15-2-counterparty-eth",
   "chapter": "15",
   "section": "2",
   "title": "The same offer to one Ethereum account",
   "kind": "15-swap-offer",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "050000000000000000e1f505000000000000000000000000004647fb1700000000000000000000001800000004000000a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
    "hash": "6c697017f269e7bb"
   },
   "expected": {
    "counterparty": "04000000a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1"
   }
  },
  {
   "id": "15-2-bare-account",
   "chapter": "15",
   "section": "2",
   "title": "An account appended without its length",
   "kind": "15-swap-offer",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "050000000000000000e1f505000000000000000000000000004647fb17000000000000000000000000000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "hash": "6c697017f269e7bb"
   },
   "expected": {
    "error": "CreateSwapOffer: the body is 40 bytes, or 40 then a u32 length and the counterparty's typed account"
   }
  },
  {
   "id": "15-2-zbs-counterparty",
   "chapter": "15",
   "section": "2",
   "title": "A ZBS_ address cannot take an offer",
   "kind": "15-swap-offer",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "050000000000000000e1f505000000000000000000000000004647fb170000000000000000000000240000000a0000001111111111111111111111111111111111111111111111111111111111111111",
    "hash": "6c697017f269e7bb"
   },
   "expected": {
    "error": "CreateSwapOffer: the counterparty's address kind cannot sign, so nobody could take the offer"
   }
  },
  {
   "id": "15-2-full-key-counterparty",
   "chapter": "15",
   "section": "2",
   "title": "An Ethereum counterparty in its full-key form (112-byte body)",
   "kind": "15-swap-offer",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "050000000000000000e1f505000000000000000000000000004647fb170000000000000000000000440000000400000079be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",
    "hash": "6c697017f269e7bb"
   },
   "expected": {
    "error": "CreateSwapOffer: counterparty: a full-key account form (an Ethereum or Tron key, a Bitcoin key) is not an account: no transaction can be sent from it; name the 20-byte address (rule canonical_account_forms)"
   }
  },
  {
   "id": "15-2-twenty-byte-counterparty",
   "chapter": "15",
   "section": "2",
   "title": "The same counterparty in its 20-byte form (68-byte body) is accepted",
   "kind": "15-swap-offer",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "050000000000000000e1f505000000000000000000000000004647fb17000000000000000000000018000000040000007e5f4552091a69125d5dfcb7b8c2659029395bdf",
    "hash": "6c697017f269e7bb"
   },
   "expected": {
    "counterparty": "040000007e5f4552091a69125d5dfcb7b8c2659029395bdf"
   }
  },
  {
   "id": "15-2-zero-give",
   "chapter": "15",
   "section": "2",
   "title": "A give amount of 0",
   "kind": "15-swap-offer",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "050000000000000000000000000000000000000000000000004647fb170000000000000000000000",
    "hash": "6c697017f269e7bb"
   },
   "expected": {
    "error": "Swap amounts must be positive"
   }
  },
  {
   "id": "15-3-accept",
   "chapter": "15",
   "section": "3",
   "title": "A taker accepts the offer",
   "kind": "15-swap-op",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "6c697017f269e7bb",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "0",
    "expiry": "0",
    "type": "19",
    "sender": "taker"
   },
   "expected": {
    "status": "Filled",
    "sender_give": "100000000",
    "sender_want": "-103000000000",
    "maker_want": "103000000000"
   }
  },
  {
   "id": "15-3-clock-selection",
   "chapter": "15",
   "section": "3",
   "title": "An accept stamped before the expiry is admitted but not selected for a block whose clock has passed it",
   "kind": "15-swap-op",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "6c697017f269e7bb",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "0",
    "expiry": "1793715000",
    "type": "19",
    "sender": "taker",
    "timestamp": "1793714990",
    "block_timestamp": "1793715005"
   },
   "expected": {
    "error": "AcceptSwapOffer: offer expired at the block's clock"
   }
  },
  {
   "id": "15-3-clock-mined",
   "chapter": "15",
   "section": "3",
   "title": "Carried in a block whose timestamp is past the expiry, the accept is a paid no-op",
   "kind": "15-swap-op",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "6c697017f269e7bb",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "0",
    "expiry": "1793715000",
    "type": "19",
    "sender": "taker",
    "timestamp": "1793714990",
    "block_timestamp": "1793715005",
    "mined": "true"
   },
   "expected": {
    "status": "Open",
    "sender_give": "0",
    "sender_want": "0",
    "maker_want": "0"
   },
   "note": "The fee is charged; the offer stays open."
  },
  {
   "id": "15-3-clock-stamp",
   "chapter": "15",
   "section": "3",
   "title": "An accept stamped after the expiry is refused at admission",
   "kind": "15-swap-op",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "6c697017f269e7bb",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "0",
    "expiry": "1793715000",
    "type": "19",
    "sender": "taker",
    "timestamp": "1793715001"
   },
   "expected": {
    "error": "AcceptSwapOffer: offer expired"
   }
  },
  {
   "id": "15-3-clock-in-time",
   "chapter": "15",
   "section": "3",
   "title": "An accept stamped before the expiry in a block before the expiry fills the offer",
   "kind": "15-swap-op",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "6c697017f269e7bb",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "0",
    "expiry": "1793715000",
    "type": "19",
    "sender": "taker",
    "timestamp": "1793714990",
    "block_timestamp": "1793714995"
   },
   "expected": {
    "status": "Filled",
    "sender_give": "100000000",
    "sender_want": "-103000000000",
    "maker_want": "103000000000"
   }
  },
  {
   "id": "15-3-own",
   "chapter": "15",
   "section": "3",
   "title": "The maker cannot accept its own offer",
   "kind": "15-swap-op",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "6c697017f269e7bb",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "0",
    "expiry": "0",
    "type": "19",
    "sender": "maker"
   },
   "expected": {
    "error": "AcceptSwapOffer: cannot accept own offer"
   }
  },
  {
   "id": "15-3-own-mined",
   "chapter": "15",
   "section": "3",
   "title": "Mined, the maker's own accept is a paid no-op",
   "kind": "15-swap-op",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "6c697017f269e7bb",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "0",
    "expiry": "0",
    "type": "19",
    "sender": "maker",
    "mined": "true"
   },
   "expected": {
    "status": "Open",
    "sender_give": "0",
    "sender_want": "0",
    "maker_want": "0"
   }
  },
  {
   "id": "15-3-filled",
   "chapter": "15",
   "section": "3",
   "title": "An accept after the fill",
   "kind": "15-swap-op",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "6c697017f269e7bb",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "1",
    "expiry": "0",
    "type": "19",
    "sender": "taker"
   },
   "expected": {
    "error": "AcceptSwapOffer: offer not open"
   }
  },
  {
   "id": "15-3-unknown",
   "chapter": "15",
   "section": "3",
   "title": "An accept of offer 0",
   "kind": "15-swap-op",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "0000000000000000",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "0",
    "expiry": "0",
    "type": "19",
    "sender": "taker"
   },
   "expected": {
    "error": "AcceptSwapOffer: unknown offer"
   }
  },
  {
   "id": "15-3-unknown-mined",
   "chapter": "15",
   "section": "3",
   "title": "Mined, an accept of offer 0 makes the block invalid",
   "kind": "15-swap-op",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "0000000000000000",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "0",
    "expiry": "0",
    "type": "19",
    "sender": "taker",
    "mined": "true"
   },
   "expected": {
    "error": "Unknown swap offer"
   }
  },
  {
   "id": "15-4-cancel",
   "chapter": "15",
   "section": "4",
   "title": "The maker cancels the offer",
   "kind": "15-swap-op",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "6c697017f269e7bb",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "0",
    "expiry": "0",
    "type": "20",
    "sender": "maker"
   },
   "expected": {
    "status": "Cancelled",
    "sender_give": "100000000"
   }
  },
  {
   "id": "15-4-not-maker",
   "chapter": "15",
   "section": "4",
   "title": "Another account cannot cancel it",
   "kind": "15-swap-op",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "6c697017f269e7bb",
    "offer_id": "-4906836780500620948",
    "give_token": "5",
    "give_amount": "100000000",
    "want_token": "0",
    "want_amount": "103000000000",
    "status": "0",
    "expiry": "0",
    "type": "20",
    "sender": "taker"
   },
   "expected": {
    "error": "CancelSwapOffer: only the maker can cancel"
   }
  },
  {
   "id": "15-5-create",
   "chapter": "15",
   "section": "5",
   "title": "The ZUSDT/ZUSD market created at block 513, its id M from a hash beginning 2799E29A8DC13AFA",
   "kind": "15-create-market",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "0e0000000000000001000000000000000000000000000000",
    "hash": "2799e29a8dc13afa",
    "height": "513",
    "cost": "5000000000",
    "exists": "false"
   },
   "expected": {
    "market_id": "-415807201645258457",
    "base": "14",
    "quote": "1",
    "deposit": "5000000000",
    "paid_through_height": "513",
    "creator_change": "-5000000000"
   }
  },
  {
   "id": "15-5-same-token",
   "chapter": "15",
   "section": "5",
   "title": "A market of a token against itself",
   "kind": "15-create-market",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "0e000000000000000e000000000000000000000000000000",
    "hash": "2799e29a8dc13afa",
    "height": "513",
    "cost": "5000000000",
    "exists": "false"
   },
   "expected": {
    "error": "Market base and quote token must differ"
   }
  },
  {
   "id": "15-5-exists",
   "chapter": "15",
   "section": "5",
   "title": "The same pair while that market is Active",
   "kind": "15-create-market",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "0e0000000000000001000000000000000000000000000000",
    "hash": "2799e29a8dc13afa",
    "height": "513",
    "cost": "5000000000",
    "exists": "true"
   },
   "expected": {
    "error": "CreateMarket: market already exists for this pair"
   }
  },
  {
   "id": "15-6-post-only-bid",
   "chapter": "15",
   "section": "6",
   "title": "A post-only bid of 50,851,885,007 ZUSDC at 0.960271 with no crossing ask rests",
   "kind": "15-place-order",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "market_id": "-1822012396596789138",
    "base": "13",
    "quote": "0",
    "deposit": "5000000000",
    "cost": "5000000000",
    "fee_bps": "10",
    "earns": "true",
    "fee": "5000000",
    "book": "1 1 100754200 158612849098 M\n2 1 101357900 36948508905 M\n3 1 102637000 16553662538 M\n4 1 103746195 90769078148 M\n5 1 104180495 49162968450 M",
    "body": "6e807df460e9b6e600dc41b90500000000cf2f02d70b000000020000000000000000"
   },
   "expected": {
    "hold": "48831590467",
    "trades": "",
    "remaining": "50851885007",
    "status": "Open",
    "deposit": "5001000000"
   }
  },
  {
   "id": "15-6-book",
   "chapter": "15",
   "section": "6",
   "title": "The order book after ten such orders by A",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "bids": "[[99743200,38070622999],[98650000,9820168999],[97427000,42513945330],[96646200,156027154086],[96027100,50851885007]]",
    "asks": "[[100754200,158612849098],[101357900,36948508905],[102637000,16553662538],[103746195,90769078148],[104180495,49162968450]]",
    "deposit": "5010000000"
   }
  },
  {
   "id": "15-6-market-buy",
   "chapter": "15",
   "section": "6",
   "title": "A market buy of 2,000 ZUSDC up to 1.013579",
   "kind": "15-place-order",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "market_id": "-1822012396596789138",
    "base": "13",
    "quote": "0",
    "deposit": "5010000000",
    "cost": "5000000000",
    "fee_bps": "10",
    "earns": "true",
    "fee": "0",
    "book": "1 1 100754200 158612849098 M\n2 1 101357900 36948508905 M\n3 1 102637000 16553662538 M\n4 1 103746195 90769078148 M\n5 1 104180495 49162968450 M\n6 0 99743200 38070622999 M\n7 0 98650000 9820168999 M\n8 0 97427000 42513945330 M\n9 0 96646200 156027154086 M\n10 0 96027100 50851885007 M",
    "body": "6e807df460e9b6e6004c990a060000000000d0ed902e000000010000000000000000"
   },
   "expected": {
    "hold": "202715800000",
    "trades": "1 100754200 158612849098 159809107205 158612849\n2 101357900 36948508905 37450232707 36948508",
    "taker_base": "195365796646",
    "producer_fee": "195561357",
    "maker_quote": "197259339912",
    "refund": "5456460088",
    "remaining": "4438641997",
    "status": "Filled"
   }
  },
  {
   "id": "15-6-market-sell",
   "chapter": "15",
   "section": "6",
   "title": "A market sell of 500 ZUSDC down to 0.99",
   "kind": "15-place-order",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "market_id": "-1822012396596789138",
    "base": "13",
    "quote": "0",
    "deposit": "5010000000",
    "cost": "5000000000",
    "fee_bps": "10",
    "earns": "true",
    "fee": "0",
    "book": "1 1 100754200 158612849098 M\n2 1 101357900 36948508905 M\n3 1 102637000 16553662538 M\n4 1 103746195 90769078148 M\n5 1 104180495 49162968450 M\n6 0 99743200 38070622999 M\n7 0 98650000 9820168999 M\n8 0 97427000 42513945330 M\n9 0 96646200 156027154086 M\n10 0 96027100 50851885007 M",
    "body": "6e807df460e9b6e601c09ee6050000000000743ba40b000000010000000000000000"
   },
   "expected": {
    "trades": "6 99743200 38070622999 37972857639 37972857",
    "taker_quote": "37934884782",
    "producer_fee": "37972857",
    "maker_base": "38070622999",
    "refund": "11929377001",
    "remaining": "11929377001",
    "status": "Filled"
   }
  },
  {
   "id": "15-6-sell-carry",
   "chapter": "15",
   "section": "6",
   "title": "The same sell when the blocksmith does not earn: the ZBC fee goes to the lottery carry",
   "kind": "15-place-order",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "market_id": "-1822012396596789138",
    "base": "13",
    "quote": "0",
    "deposit": "5010000000",
    "cost": "5000000000",
    "fee_bps": "10",
    "earns": "false",
    "fee": "0",
    "book": "1 1 100754200 158612849098 M\n2 1 101357900 36948508905 M\n3 1 102637000 16553662538 M\n4 1 103746195 90769078148 M\n5 1 104180495 49162968450 M\n6 0 99743200 38070622999 M\n7 0 98650000 9820168999 M\n8 0 97427000 42513945330 M\n9 0 96646200 156027154086 M\n10 0 96027100 50851885007 M",
    "body": "6e807df460e9b6e601c09ee6050000000000743ba40b000000010000000000000000"
   },
   "expected": {
    "carry_fee": "37972857",
    "producer_fee": "0",
    "taker_quote": "37934884782"
   }
  },
  {
   "id": "15-6-buy-no-fee",
   "chapter": "15",
   "section": "6",
   "title": "The same buy when the blocksmith does not earn: no fee is taken in ZUSDC",
   "kind": "15-place-order",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "market_id": "-1822012396596789138",
    "base": "13",
    "quote": "0",
    "deposit": "5010000000",
    "cost": "5000000000",
    "fee_bps": "10",
    "earns": "false",
    "fee": "0",
    "book": "1 1 100754200 158612849098 M\n2 1 101357900 36948508905 M\n3 1 102637000 16553662538 M\n4 1 103746195 90769078148 M\n5 1 104180495 49162968450 M\n6 0 99743200 38070622999 M\n7 0 98650000 9820168999 M\n8 0 97427000 42513945330 M\n9 0 96646200 156027154086 M\n10 0 96027100 50851885007 M",
    "body": "6e807df460e9b6e6004c990a060000000000d0ed902e000000010000000000000000"
   },
   "expected": {
    "taker_base": "195561358003",
    "producer_fee": "0",
    "carry_fee": "0"
   }
  },
  {
   "id": "15-6-limit-buy",
   "chapter": "15",
   "section": "6",
   "title": "A limit buy of 10 ZUSDC at 0.995 rests",
   "kind": "15-place-order",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "market_id": "-1822012396596789138",
    "base": "13",
    "quote": "0",
    "deposit": "5010000000",
    "cost": "5000000000",
    "fee_bps": "10",
    "earns": "true",
    "fee": "0",
    "book": "1 1 100754200 158612849098 M\n2 1 101357900 36948508905 M\n3 1 102637000 16553662538 M\n4 1 103746195 90769078148 M\n5 1 104180495 49162968450 M\n6 0 99743200 38070622999 M\n7 0 98650000 9820168999 M\n8 0 97427000 42513945330 M\n9 0 96646200 156027154086 M\n10 0 96027100 50851885007 M",
    "body": "6e807df460e9b6e600e03fee050000000000ca9a3b00000000000000000000000000"
   },
   "expected": {
    "hold": "995000000",
    "trades": "",
    "refund": "0",
    "remaining": "1000000000",
    "status": "Open"
   }
  },
  {
   "id": "15-6-unit-first",
   "chapter": "15",
   "section": "6",
   "title": "A resting bid of 3 at 1.5, filled one unit at a time: the first fill",
   "kind": "15-fill",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "maker_remaining": "3",
    "price": "150000000",
    "fill": "1"
   },
   "expected": {
    "q": "1",
    "residue": "0"
   }
  },
  {
   "id": "15-6-unit-second",
   "chapter": "15",
   "section": "6",
   "title": "A resting bid of 3 at 1.5, filled one unit at a time: the second fill",
   "kind": "15-fill",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "maker_remaining": "2",
    "price": "150000000",
    "fill": "1"
   },
   "expected": {
    "q": "1",
    "residue": "1"
   }
  },
  {
   "id": "15-6-unit-third",
   "chapter": "15",
   "section": "6",
   "title": "A resting bid of 3 at 1.5, filled one unit at a time: the third fill",
   "kind": "15-fill",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "maker_remaining": "1",
    "price": "150000000",
    "fill": "1"
   },
   "expected": {
    "q": "1",
    "residue": "0"
   }
  },
  {
   "id": "15-6-rounds-to-zero",
   "chapter": "15",
   "section": "6",
   "title": "An order whose quote rounds to zero",
   "kind": "15-place-order",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "market_id": "-1822012396596789138",
    "base": "13",
    "quote": "0",
    "deposit": "5010000000",
    "cost": "5000000000",
    "fee_bps": "10",
    "earns": "true",
    "fee": "0",
    "book": "1 1 100754200 158612849098 M\n2 1 101357900 36948508905 M\n3 1 102637000 16553662538 M\n4 1 103746195 90769078148 M\n5 1 104180495 49162968450 M\n6 0 99743200 38070622999 M\n7 0 98650000 9820168999 M\n8 0 97427000 42513945330 M\n9 0 96646200 156027154086 M\n10 0 96027100 50851885007 M",
    "body": "6e807df460e9b6e6000100000000000000ffe0f50500000000000000000000000000"
   },
   "expected": {
    "error": "Order too small: the quote amount rounds to zero (raise the amount or the price)"
   }
  },
  {
   "id": "15-6-below-notional",
   "chapter": "15",
   "section": "6",
   "title": "An order of 0.02499999 ZBC notional",
   "kind": "15-place-order",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "market_id": "-1822012396596789138",
    "base": "13",
    "quote": "0",
    "deposit": "5010000000",
    "cost": "5000000000",
    "fee_bps": "10",
    "earns": "true",
    "fee": "0",
    "book": "1 1 100754200 158612849098 M\n2 1 101357900 36948508905 M\n3 1 102637000 16553662538 M\n4 1 103746195 90769078148 M\n5 1 104180495 49162968450 M\n6 0 99743200 38070622999 M\n7 0 98650000 9820168999 M\n8 0 97427000 42513945330 M\n9 0 96646200 156027154086 M\n10 0 96027100 50851885007 M",
    "body": "6e807df460e9b6e60000e1f505000000009f25260000000000000000000000000000"
   },
   "expected": {
    "error": "PlaceOrder: the order's quote notional is below the minimum of 0.025 units of the quote token"
   },
   "note": "A quote below 2,500,000 is refused by the stateless check, before any state is read."
  },
  {
   "id": "15-6-market-post-only",
   "chapter": "15",
   "section": "6",
   "title": "Market and post-only together",
   "kind": "15-place-order",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "market_id": "-1822012396596789138",
    "base": "13",
    "quote": "0",
    "deposit": "5010000000",
    "cost": "5000000000",
    "fee_bps": "10",
    "earns": "true",
    "fee": "0",
    "book": "1 1 100754200 158612849098 M\n2 1 101357900 36948508905 M\n3 1 102637000 16553662538 M\n4 1 103746195 90769078148 M\n5 1 104180495 49162968450 M\n6 0 99743200 38070622999 M\n7 0 98650000 9820168999 M\n8 0 97427000 42513945330 M\n9 0 96646200 156027154086 M\n10 0 96027100 50851885007 M",
    "body": "6e807df460e9b6e600e03fee050000000000ca9a3b00000000030000000000000000"
   },
   "expected": {
    "error": "PlaceOrder: market and post-only are mutually exclusive"
   }
  },
  {
   "id": "15-7-cancel",
   "chapter": "15",
   "section": "7",
   "title": "The maker cancels the first bid of the book (its id Q)",
   "kind": "15-cancel-order",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "669bafd065cd1f72",
    "order_id": "8223517281778375526",
    "side": "0",
    "price": "96027100",
    "remaining": "50851885007",
    "status": "0",
    "fee": "5000000",
    "deposit": "5010000000",
    "cost": "5000000000",
    "sender": "maker"
   },
   "expected": {
    "refund": "48831590467",
    "status": "Cancelled",
    "deposit": "5011000000"
   }
  },
  {
   "id": "15-7-not-owner",
   "chapter": "15",
   "section": "7",
   "title": "Another account cannot cancel it",
   "kind": "15-cancel-order",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "669bafd065cd1f72",
    "order_id": "8223517281778375526",
    "side": "0",
    "price": "96027100",
    "remaining": "50851885007",
    "status": "0",
    "fee": "5000000",
    "deposit": "5010000000",
    "cost": "5000000000",
    "sender": "other"
   },
   "expected": {
    "error": "CancelOrder: only the order owner can cancel"
   }
  },
  {
   "id": "15-7-not-owner-mined",
   "chapter": "15",
   "section": "7",
   "title": "Mined, that cancel makes the block invalid",
   "kind": "15-cancel-order",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "body": "669bafd065cd1f72",
    "order_id": "8223517281778375526",
    "side": "0",
    "price": "96027100",
    "remaining": "50851885007",
    "status": "0",
    "fee": "5000000",
    "deposit": "5010000000",
    "cost": "5000000000",
    "sender": "other",
    "mined": "true"
   },
   "expected": {
    "error": "Only the order owner can cancel"
   }
  },
  {
   "id": "15-8-first-period",
   "chapter": "15",
   "section": "8",
   "title": "The first rent period of the market created at 513",
   "kind": "15-market-rent",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "cost": "5000000000",
    "period": "172800",
    "deposit": "5000000000",
    "paid_through_height": "513",
    "height": "173313"
   },
   "expected": {
    "rate": "416666667",
    "deposit": "4583333333",
    "paid_through_height": "173313",
    "status": "Active",
    "pool": "416666667"
   }
  },
  {
   "id": "15-8-eleven-periods",
   "chapter": "15",
   "section": "8",
   "title": "After eleven periods",
   "kind": "15-market-rent",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "cost": "5000000000",
    "period": "172800",
    "deposit": "5000000000",
    "paid_through_height": "513",
    "height": "1901313"
   },
   "expected": {
    "deposit": "416666663",
    "status": "Active"
   }
  },
  {
   "id": "15-8-pruned",
   "chapter": "15",
   "section": "8",
   "title": "At the twelfth due height the market cannot pay and is pruned",
   "kind": "15-market-rent",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "cost": "5000000000",
    "period": "172800",
    "deposit": "416666663",
    "paid_through_height": "1901313",
    "height": "2074113"
   },
   "expected": {
    "status": "Pruned",
    "pool": "416666663",
    "deposit": "0"
   }
  },
  {
   "id": "15-8-cap",
   "chapter": "15",
   "section": "8",
   "title": "The deposit cap: 24 periods of rent",
   "kind": "15-market-rent",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "cost": "5000000000",
    "period": "172800",
    "deposit": "5010000000",
    "paid_through_height": "513",
    "height": "12467"
   },
   "expected": {
    "cap": "10000000008"
   }
  },
  {
   "id": "15-8-expiry",
   "chapter": "15",
   "section": "8",
   "title": "An order whose expiry is not after the previous block's timestamp expires",
   "kind": "15-order-expiry",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "side": "1",
    "price": "100000000",
    "remaining": "100000000",
    "expiry": "1793715000",
    "clock": "1793715097"
   },
   "expected": {
    "status": "Expired",
    "refund": "100000000"
   }
  }
 ]
}
