Unit ID
kToGXZg8OXv5Mxk80C1tR0JorQ08E0d2bhtO0gPgn2g=
Received
26.08.2019 22:16:33
Confirmation delay (full node)
12 minutes 5 seconds
Confirmation delay (light node)
16 minutes 40 seconds
Messages
Payments
Definition
Definition: [ "autonomous agent", { "messages": { "cases": [ { "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$addr}", "amount": "{$to_send + $base_inp}" } ] } }, { "app": "payment", "payload": { "asset": "{$asset_ct}", "outputs": [ { "address": "{$addr}", "amount": "{$to_send}" } ] }, "if": "{!$asset}" }, { "app": "state", "state": "{var['price'] = false;response['message'] = 'exchanged ('||($asset ? 'assets': 'bytes')||') at '||$ratio||' bytes per token';}" } ], "if": "{$addr != $addr_ct and $asset_ct}", "init": "{if(!$ratio) bounce('Exchange already done');if(!$asset and var['wanted']) bounce('AA owner wants assets');if($asset and !var['wanted']) bounce('AA owner wants bytes');$available = $asset ? $balance : balance[$asset_ct];if($available <= 0) bounce('Not enough funds');$to_send = $asset ? ($asset_inp * $ratio) : (($base_inp - ($base_inp % $ratio)) / $ratio);if($available < $to_send) bounce('Not enough funds');}" }, { "messages": [ { "app": "payment", "payload": { "asset": "{$asset_ct}", "outputs": [ { "address": "{$addr}", "amount": "{balance[$asset_ct]}" } ] }, "if": "{balance[$asset_ct] > 0}" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$addr}" } ] } }, { "app": "state", "state": "{response['message'] = 'withdrawn all assets and/or bytes';}" } ], "if": "{$addr == $addr_ct and trigger.data.withdraw}" }, { "messages": [ { "app": "payment", "payload": { "asset": "{$asset}", "outputs": [ { "address": "{$addr}", "amount": "{$asset_inp}" } ] }, "if": "{$asset}" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$addr}", "amount": "{$base_inp}" } ] } }, { "app": "state", "state": "{var['price'] = trigger.data.price;if($asset or trigger.data.asset)var['asset'] = $asset otherwise trigger.data.asset;var['wanted'] = trigger.data.wanted ? true : false;response['message'] = 'exchange box configured!';}" } ], "if": "{$addr == $addr_ct and trigger.data.configure}" }, { "messages": [ { "app": "state", "state": "{response['message'] = 'amount deposited correctly';}" } ], "if": "{$addr == $addr_ct}" } ] }, "init": "{$addr_ct = 'JBGMJI7XSKLKNHZF26BUBWHVUZSDV3P5';$addr = trigger.address;$fee = 1000;if(var['asset']){$ratio = var['price'];$asset_ct = var['asset'];}else{if($addr != $addr_ct) bounce('Not configured yet');}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($addr != $addr_ct and $asset != $asset_ct) bounce('Asset not allowed, please send ' || $asset_ct);$asset_inp = trigger.output[[asset!=base]];}$base_inp = trigger.output[[asset=base]] - $fee;$balance = balance[base] - $base_inp + $fee;}" } ]
Technical information
Fees:
2,408 bytes
(265 headers, 2143 payload)
Level:1027254
Witnessed level:1027244
Main chain index:1026083
Latest included mc index:1026066
Status:stable/confirmed/final