Unit ID
XO8xOG0mWiILlvg33upqn20pzhOs9IaBcZho8zBGCs8=
Received
02.10.2020 11:18:45
Confirmation delay (full node)
10 minutes 40 seconds
Confirmation delay (light node)
14 minutes 3 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $lock_time = 7 * 24 * 3600; $registry_aa = "O6H6ZIFI57X3PLTYHOCVYPP5A553CYFQ"; $received = trigger.output[[asset!=base]]; if ($received.asset == 'ambiguous') bounce("Different assets cannot be handled at same time"); $address = trigger.address; if (is_aa($address)) bounce("Asset must be sent from a plain wallet, not an AA"); }", "messages": { "cases": [ { "if": "{$received.amount > 0}", "messages": [ { "app": "state", "state": "{ var["amount_" || $received.asset || "_" || $address] += $received.amount; var["ts_" || $received.asset || "_" || $address] = timestamp; response['info'] = "This asset will be locked until " || timestamp_to_string(timestamp + $lock_time); }" } ] }, { "if": "{trigger.data.withdraw}", "init": "{ if (asset[trigger.data.withdraw].exists) $asset = trigger.data.withdraw; else { $asset = var[$registry_aa]["s2a_" || trigger.data.withdraw]; if (!$asset) bounce("unknown symbol"); } $amount_available = var["amount_" || $received.asset || "_" || $address]; if (!$amount_available) bounce("You don't have deposit for this asset"); $lock_timestamp = var["ts_" || $received.asset || "_" || $address]; if ($lock_timestamp AND $lock_timestamp > timestamp - $lock_time) bounce("This asset is still locked, retry in " || $lock_time / 3600 || ' hours'); if (!$amount_available) bounce("Nothing available for withdraw"); if (trigger.data.amount){ if (!is_valid_amount(trigger.data.amount)) bounce("Invalid amount"); if(trigger.data.amount < $amount_available) bounce("Only " || $amount_available || " available for withdraw"); $amount = trigger.data.amount; } else { $amount = $amount_available; } }", "messages": [ { "app": "payment", "payload": { "asset": "{$asset}", "outputs": [ { "address": "{$address}", "amount": "{ $amount }" } ] } }, { "app": "state", "state": "{ var["amount_" || $received.asset || "_" || $address] -= $amount; var["ts_" || $received.asset || "_" || $address] = false; }" } ] } ] } } ]
Technical information
Fees:
2,891 bytes
(452 headers, 2439 payload)
Level:1667293
Witnessed level:1667286
Main chain index:1659851
Latest included mc index:1659850
Status:stable/confirmed/final