Unit ID
6lIWBEclTIX16vfzK6H4VfeKnWBTkbjpZanfEwrFnwE=
Received
08.09.2020 22:51:33
Confirmation delay (full node)
5 minutes 11 seconds
Confirmation delay (light node)
7 minutes 33 seconds
Messages
Definition
Definition: [ "autonomous agent", { "bounce_fees": { "base": 10000 }, "init": "{ // cste $dust_collector = "B2UMBICLZSBVDHRC7BYM6BBU4AQEXL2F"; // params $htlc_destination_address = params.destination_address; $htlc_hash_of_secret = params.hash_of_secret; $htlc_amount = params.amount; $htlc_asset = params.asset_id; $htlc_deadline = json_parse(params.deadline); // states $htlc_refunded = var["refunded"]; $htlc_withdrawn = var["withdrawn"]; $htlc_funded = var["funded"]; $htlc_funder = var["funder"]; $htlc_fund_amount = json_parse(var["fund_amount"]); // trigger values $user = trigger.initial_address; $temp = trigger.output[[asset!=base]].asset; $received_asset = $temp != "none" ? $temp : "base"; $received_amount = trigger.output[[asset=$received_asset]].amount; // case selection $is_timed_out = timestamp > $htlc_deadline ; $is_recipient = $user == $htlc_destination_address; $is_help_from_funder = ($user == $htlc_funder) and !!trigger.data.open; }", "messages": { "cases": [ { "if": "{ !!$htlc_refunded or !!$htlc_withdrawn}", "messages": [ { "if": "{$user == $dust_collector}", "app": "payment", "payload": { "asset": "{"base"}", "outputs": [ { "address": "{$dust_collector}", "amount": "{balance[base]-600}" } ] } }, { "app": "state", "state": "{ response['message'] = 'Thank you for this donation!'; }" } ] }, { "if": "{ !!$is_timed_out or !!$is_recipient or !!$is_help_from_funder}", "init": "{ if (!!$is_recipient) { $message = "You have been recognized but "; if (!!$is_timed_out) bounce ($message||"the time is out"); if (!trigger.data.secret) bounce ($message||"you have to provide the 'secret' revealed on the other chain"); if (sha256(trigger.data.secret) != params.hash_of_secret) bounce ($message||"the secret is not good."); } $transfert_recipient = !!$is_recipient? $htlc_destination_address: $htlc_funder; $transfert_asset = $htlc_asset; $transfert_amount = $htlc_fund_amount; }", "messages": [ { "app": "payment", "payload": { "asset": "{$transfert_asset}", "outputs": [ { "address": "{$transfert_recipient}", "amount": "{$transfert_amount}" } ] } }, { "if": "{ $transfert_asset != 'base'}", "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$transfert_recipient}", "amount": "{balance[base]-1000}" } ] } }, { "app": "state", "state": "{ var["withdrawn"] = $is_recipient; var["refunded"] = !$is_recipient; response['message'] = !!$is_recipient ? 'Withdrawn' : 'Refunded'; response['donate'] = 'Please donate by sending Gbytes to this address to support developpers'; }" } ] }, { "messages": [ { "app": "state", "state": "{ // tests if (!!$htlc_funded) bounce ("Already funded, and your are not the funder or the recipient"); if ($received_asset != $htlc_asset) bounce ("Wrong asset, "||$htlc_asset||" wanted (not "||$received_asset||")."); if ($htlc_amount!= 0) if ($received_amount != $htlc_amount) bounce ("Wrong amount, "||$htlc_amount||" wanted (not "||$received_amount||")."); $estimated_storage_fee = 100; // states var["funded"] = true; var["funder"] = $user; var["fund_amount"] = $received_amount - $estimated_storage_fee; // responses response['message'] = 'HTLC funded'; }" } ] } ] } } ]
Technical information
Fees:
4,605 bytes
(452 headers, 4153 payload)
Level:1605884
Witnessed level:1605877
Main chain index:1598564
Latest included mc index:1598563
Status:stable/confirmed/final