Unit ID
ZHfHWBMHQO3CsmbNogrn4WpWrvywTw2UY8QTteE4geI=
Received
23.08.2019 21:30:51
Confirmation delay (full node)
7 minutes 53 seconds
Confirmation delay (light node)
11 minutes 17 seconds
Messages
Definition
Definition: [ "autonomous agent", { "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$addr}", "amount": "{$withdraw_asset ? $base_inp : ($withdraw_amount + $base_inp)}" } ] } }, { "app": "payment", "payload": { "asset": "{$asset_ct}", "outputs": [ { "address": "{$addr}", "amount": "{$withdraw_amount}" } ] }, "if": "{$withdraw_asset}" }, { "app": "state", "state": "{var[$w_total_key] -= $withdraw_amount;if(var[$w_total_key] == 0)var[$w_total_key] = false;var[$withdraw_key] -= $withdraw_amount;if(var[$withdraw_key] == 0)var[$withdraw_key] = false;var[$key] -= $withdraw_asset ? ($withdraw_amount * $ratio) : ($withdraw_amount / $ratio);if(var[$key] == 0)var[$key] = false;response['message'] = 'withdrawn exchanged amount ('||$withdraw_asset ? 'assets': 'bytes' ||') at '||$ratio||' bytes per token';}" } ], "init": "{$asset_ct = 'U0rLnB4lXupOc1u1woZzzrr0xscmOc50wvrpXAMWq3Q=';if(!var['-Last price'] and !trigger.data.price){bounce('Price must be defined before first exchange');}if(trigger.data.price){$ratio = round(trigger.data.price);if($ratio <= 0){bounce('Price not allowed');}}else{$ratio = var['-Last price'];}$addr = trigger.address;$base_inp = trigger.output[[asset=base]] - 700;if(trigger.output[[asset!=base]].asset != 'none')$asset = trigger.output[[asset!=base]].asset;if($asset){if($asset == 'ambiguous')bounce('Only 1 asset per tx');if($asset != $asset_ct)bounce('Asset not allowed, please send ' || $asset_ct);$asset_inp = (trigger.output[[asset!=base]] != 0) ? trigger.output[[asset!=base]] : bounce('Zero asset tx');}$base_key = $addr || $ratio || 'b';$asset_key = $addr || $ratio;$total_key = 'b' || $ratio;$total_asset_key = 'a' || $ratio;$exch_key = 'b_' || $ratio ;$exch_asset_key = 'a_' || $ratio ;$max_b_to_exchange = var[$total_key] - var[$exch_key];$max_a_to_exchange = var[$total_asset_key] - var[$exch_asset_key];$base_inp_round = ($base_inp - ($base_inp % $ratio));$base_inp_in_asset = $base_inp_round/$ratio;$asset_inp_in_bytes = $asset_inp*$ratio;$withdraw_asset = var[$exch_asset_key] and var[$base_key] and var[$exch_asset_key] > 0 and var[$base_key] > 0;$withdraw_base = var[$exch_key] and var[$asset_key] and var[$exch_key] > 0 and var[$asset_key] > 0;$exchange_asset = $asset and $byte_amount and !var[$base_key];$exchange_base = !$asset and $asset_amount and !var[$asset_key];$cancel_asset = trigger.data.cancel and var[$asset_key] and var[$asset_key] > 0;$cancel_base = trigger.data.cancel and var[$base_key] and var[$base_key] > 0;}" } ]
Technical information
Fees:
2,970 bytes
(265 headers, 2705 payload)
Level:1022048
Witnessed level:1022038
Main chain index:1020877
Latest included mc index:1020860
Status:stable/confirmed/final