Unit ID
01Ig1x+3hloyvPZFNlORPYQW8snrQV4i9WdL2pUch+k=
Received
18.11.2019 14:35:48
Confirmation delay (full node)
5 minutes 13 seconds
Confirmation delay (light node)
9 minutes 33 seconds
Authors
SPV5WIBQQT4DMW7UU5GWCMLYDVNGKECD
Definition
Messages
Payments
Data
order1: { "authors": [ { "address": "EDMS22PYWN5NE7F34R5CLNTJSVNLLGLS", "authentifiers": { "r": "S6q7+yBDJv9Miat5xSGI3tQXn0bs+pm1Y0wFfP7cfi5r6gW7BOYoTc5MTK/KrF36ox+J7n58Mz+K0BfT/qjvcg==" } } ], "last_ball_unit": "FnL0EcK+O3HTm2mL6lKW1940FwRFTYCTEYxFtWuWVvI=", "signed_message": { "address": "EDMS22PYWN5NE7F34R5CLNTJSVNLLGLS", "buy_asset": "base", "matcher": "SPV5WIBQQT4DMW7UU5GWCMLYDVNGKECD", "matcher_fee": 2000, "matcher_fee_asset": "UccpQo12uLmufihkzdK7Kcrb5BlHp8GcMrSEA7NVdNw=", "price": 50, "sell_amount": 2000000, "sell_asset": "UccpQo12uLmufihkzdK7Kcrb5BlHp8GcMrSEA7NVdNw=" }, "version": "2.0t" }
order2: { "authors": [ { "address": "EJC4A7WQGHEZEKW6RLO7F26SAR4LAQBU", "authentifiers": { "r": "IDyc4B4Hbl6Cc5SGn5Qy10n3WpKEB1NCc5MUCLT7Hdoi2uYVrJCf90HeEl0W6jhaEDNzRFoKd9flESCEyh/DyQ==" } } ], "last_ball_unit": "FnL0EcK+O3HTm2mL6lKW1940FwRFTYCTEYxFtWuWVvI=", "signed_message": { "address": "EJC4A7WQGHEZEKW6RLO7F26SAR4LAQBU", "buy_asset": "UccpQo12uLmufihkzdK7Kcrb5BlHp8GcMrSEA7NVdNw=", "matcher": "SPV5WIBQQT4DMW7UU5GWCMLYDVNGKECD", "matcher_fee": 2000, "matcher_fee_asset": "UccpQo12uLmufihkzdK7Kcrb5BlHp8GcMrSEA7NVdNw=", "price": 0.02, "sell_amount": 100000000, "sell_asset": "base" }, "version": "2.0t" }
AA responses
From ESRS6QGH2NOCRCXJBTVMTOFF56D3IHPQ
  • Bounced
  • Response: { "error": "formula { $order1 = trigger.data.order1.signed_message; $order2 = trigger.data.order2.signed_message; if (!$order1.sell_asset OR !$order2.sell_asset) return false; if ($order1.sell_asset != $order2.buy_asset OR $order1.buy_asset != $order2.sell_asset) bounce('assets do not match'); if ($order1.matcher != trigger.address) bounce('wrong matcher in order1'); if ($order2.matcher != trigger.address) bounce('wrong matcher in order2'); if ($order1.expiry_ts AND $order1.expiry_ts <= timestamp) bounce("order1 expired"); if ($order2.expiry_ts AND $order2.expiry_ts <= timestamp) bounce("order2 expired"); $sell_key1 = 'balance_' || $order1.address || '_' || $order1.sell_asset; $sell_key2 = 'balance_' || $order2.address || '_' || $order2.sell_asset; $id1 = sha256($order1.address || $order1.sell_asset || $order1.buy_asset || $order1.sell_amount || $order1.price || trigger.data.order1.last_ball_unit); $id2 = sha256($order2.address || $order2.sell_asset || $order2.buy_asset || $order2.sell_amount || $order2.price || trigger.data.order2.last_ball_unit); if (var['executed_' || $id1]) bounce('order1 already executed'); if (var['executed_' || $id2]) bounce('order2 already executed'); $amount_left1 = var['amount_left_' || $id1] otherwise $order1.sell_amount; $amount_left2 = var['amount_left_' || $id2] otherwise $order2.sell_amount; // check balances if ($amount_left1 > var[$sell_key1]) bounce('not sufficient balance in sell asset to complete order1'); if ($amount_left2 > var[$sell_key2]) bounce('not sufficient balance in sell asset to complete order2'); // check if prices match $buy_amount1 = round($amount_left1 * $order1.price); if ($buy_amount1 > $amount_left2){ // order2 is the smaller one $order_smaller = $order2; $order_larger = $order1; $id_smaller = $id2; $id_larger = $id1; $amount_left_smaller = $amount_left2; $amount_left_larger = $amount_left1; $buy_amount2 = round($amount_left2 * $order2.price); $buy_amount_smaller = $buy_amount2; $amount_sold2 = $amount_left2; $amount_sold1 = $buy_amount2; } else{ // order1 is the smaller one $order_smaller = $order1; $order_larger = $order2; $id_smaller = $id1; $id_larger = $id2; $amount_left_smaller = $amount_left1; $amount_left_larger = $amount_left2; $buy_amount_smaller = $buy_amount1; $amount_sold1 = $amount_left1; $amount_sold2 = $buy_amount1; } $expected_buy_amount_larger = round($buy_amount_smaller * $order_larger.price); if ($expected_buy_amount_larger > $amount_left_smaller) bounce("price mismatch: larger user doesn't like the price, he gets less than expects"); // matcher fees $max_matcher_fee1 = round($order1.matcher_fee * $amount_sold1/$order1.sell_amount); $max_matcher_fee2 = round($order2.matcher_fee * $amount_sold2/$order2.sell_amount); // the formula will fail if matcher_fee1/matcher_fee2 is not passed in or is not a number if (trigger.data.matcher_fee1 > $max_matcher_fee1) bounce('matcher_fee1 is too large'); if (trigger.data.matcher_fee2 > $max_matcher_fee2) bounce('matcher_fee2 is too large'); // affiliates if ($order1.affiliate){ if (!$order1.affiliate_fee_asset) bounce('no affiliate_fee_asset in order1'); if ($order1.affiliate_fee < 0) // will error if none or not a number bounce('affiliate_fee < 0 in order1'); $affiliate_fee1 = trigger.data.affiliate_fee1 otherwise 0; $max_affiliate_fee1 = round($order1.affiliate_fee * $amount_sold1/$order1.sell_amount); if ($affiliate_fee1 > $max_affiliate_fee1) bounce('affiliate_fee1 is too large'); } if ($order2.affiliate){ if (!$order2.affiliate_fee_asset) bounce('no affiliate_fee_asset in order2'); if ($order2.affiliate_fee < 0) // will error if none or not a number bounce('affiliate_fee < 0 in order2'); $affiliate_fee2 = trigger.data.affiliate_fee2 otherwise 0; $max_affiliate_fee2 = round($order2.affiliate_fee * $amount_sold2/$order2.sell_amount); if ($affiliate_fee2 > $max_affiliate_fee2) bounce('affiliate_fee2 is too large'); } if (!is_valid_signed_package(trigger.data.order1, $order1.address)) bounce('bad signature of order1'); if (!is_valid_signed_package(trigger.data.order2, $order2.address)) bounce('bad signature of order2'); true } failed: booleans cannot be compared with other types" }
Technical information
Fees:
1,347 bytes
(400 headers, 947 payload)
Level:1142770
Witnessed level:1142763
Main chain index:1141509
Latest included mc index:1141508
Status:stable/confirmed/final