Unit ID
8ymLriEydoTrAih1Q87FaCfcTnpYopr92ME+hL92TKU=
Received
24.09.2019 07:46:59
Confirmation delay (full node)
2 minutes 28 seconds
Confirmation delay (light node)
5 minutes 27 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $return_fee = 1000; $balance_key = 'balance_'||trigger.address; $timestamp_key = 'timestamp_'||trigger.address; }", "messages": { "cases": [ { "if": "{!trigger.data.operation}", "messages": [ { "app": "state", "state": "{ bounce("Welcome user! Please add 'operation' data field with 'keep' or 'return' values. Otherwise the transaction will be bounced."); }" } ] }, { "if": "{trigger.data.operation == 'keep'}", "init": "{ if (!var[$balance_key] AND !trigger.data.unlock_date) bounce("Warning! Please add 'unlock_date' data field."); if (!var[$balance_key] AND trigger.data.unlock_date AND typeof(parse_date(trigger.data.unlock_date)) != "number") bounce("Warning! The format of the 'unlock_date' field is YYYY-MM-DD."); if (var[$balance_key] AND parse_date(trigger.data.unlock_date) != var[$timestamp_key]) bounce("Warning! This address have been already deposited before with 'unlock_date' set to " || timestamp_to_string(var[$timestamp_key], 'date') || ". You can't change the date. To increase the balance of this address either remove 'unlock_date' data field or make it the same as before."); }", "messages": [ { "app": "state", "state": "{ if (!var[$balance_key]) var[$timestamp_key] = parse_date(trigger.data.unlock_date); var[$balance_key] = var[$balance_key] + trigger.output[[asset=base]]; response['message'] = "Total balance will be "|| var[$balance_key] || " bytes. The bytes will be locked till "|| trigger.data.unlock_date || " 0:00 UTC. You can withdraw your bytes only from the address you made this deposit: " || trigger.address || ". Please make a wallet backup and store it in a safe place."; }" } ] }, { "if": "{trigger.data.operation == 'return'}", "init": "{ if (!var[$balance_key]) bounce('Warning! No bytes to return for this address.'); if (var[$timestamp_key] > timestamp) bounce('Warning! The unlock date has not come yet. Bytes are locked till '|| timestamp_to_string(var[$timestamp_key], 'date') || ' 0:00 UTC.');// It is ' || (var[$timestamp_key] - timestamp)/86400 || ' days ' || (var[$timestamp_key] - timestamp)/3600) || ' hours' || (var[$timestamp_key] - timestamp)/60 || ' minutes left.' ); //if (var[$balance_key] <= $return_fee) bounce("Warning! Bytes balance amount is less than ' || $return_fee || ' bytes fee. Can't return."); }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{ var[$balance_key] - $return_fee}" } ] } }, { "app": "state", "state": "{ response['message'] = var[$balance_key] || ' bytes will be returned. Transaction fee is ' || $return_fee || ' bytes. You will receive ' || var[$balance_key] - $return_fee || ' bytes to your account.'; var[$balance_key] = false; var[$timestamp_key] = false; }" } ] }, { "messages": [ { "app": "state", "state": "{ bounce(" Warning! 'operation' data field can be either 'keep' or 'return' values. Otherwise the transaction will be bounced."); }" } ] } ] } } ]
Technical information
Fees:
3,326 bytes
(353 headers, 2973 payload)
Level:1074479
Witnessed level:1074472
Main chain index:1073243
Latest included mc index:1073242
Status:stable/confirmed/final