Unit ID
BEgDzUpRK6yF9Y22+ZlEztCmRAqQhzycL3xwI2t0aAc=
Received
30.08.2019 19:49:11
Confirmation delay (full node)
1 minute 44 seconds
Messages
Definition
Definition: [ "autonomous agent", { "bounce_fees": { "base": 10000 }, "init": "{ $OWNER = "O7NYCFUL5XIJTYE3O4MKGMGMTN6ATQAJ"; $DANAA = "LLAVLVFN3CPBHTAB62NOIZLAMPABR2YF"; }", "messages": { "cases": [ { "if": "{ !!trigger.data.help and !!trigger.data.helper }", "init": "{ $reward = trigger.output[[asset!=base]].amount otherwise trigger.output[[asset=base]].amount otherwise 0; $reward_asset = trigger.output[[asset!=base]].asset != "none" ? trigger.output[[asset!=base]].asset : "base"; $asset_nice_name = var[$DANAA][$reward_asset||"_shortName"] otherwise $reward_asset; $time = trigger.data.time otherwise 0; }", "messages": [ { "app": "data", "payload": { "message": "{"Get "||$reward||" "||$reward_asset||" if you are first to reply to me after "||$time||" with 'aa' = < helped_aa >" }", "me": "{this_address}", "helped_aa": "{trigger.address}" } }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.data.helper}", "amount": "{1000}" } ] } }, { "app": "state", "state": "{ $key = sha256(trigger.data.helper||"_"||trigger.address); var[$key||"_reward"] = $reward; var[$key||"_asset"] = $reward_asset; var[$key||"_time"] = $time; response['message'] = trigger.data.helper||" has been asked for help ^^"; }" } ] }, { "if": "{ !!trigger.data.help and !trigger.data.helper }", "init": "{ $reward = trigger.output[[asset!=base]].amount otherwise trigger.output[[asset=base]].amount-1000 otherwise 0; $reward_asset = trigger.output[[asset!=base]].asset otherwise "base"; $time = trigger.data.time otherwise 0; $acceptable_delay = trigger.data.acceptable_delay otherwise 0; $good_guys_count = var["good_guys_count"] otherwise 0; if ($good_guys_count == 0 ) bounce ("No 'helper' registered !"); $good_guy = var["good_guys_"||number_from_seed(timestamp,0,$good_guys_count)]; }", "messages": [ { "app": "data", "payload": { "message": "{"Get "||$reward||" "||$reward_asset||" if you are first to reply to me after "||$time||" with 'aa' = < helped_aa >" }", "me": "{this_address}", "helped_aa": "{trigger.address}" } }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$good_guy}", "amount": "{1000}" } ] } }, { "app": "state", "state": "{ $key = trigger.address; var[$key||"_reward"] = $reward; var[$key||"_asset"] = $reward_asset; var[$key||"_time"] = $time; response['message'] = $good_guy||" has been asked for help ^^"; }" } ] }, { "if": "{ trigger.data.subscribe}", "init": "{ if (var[trigger.address]) bounce ("You are motivated, but once is enough!"); }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{trigger.output[[asset=base]].amount - 1000}" } ] } }, { "app": "state", "state": "{ var["good_guys_count"] += 1; var[trigger.address] = var["good_guys_count"]; var["good_guys_"||$good_guys_count] = trigger.address; response['message'] = "Subscribed"; }" } ] }, { "if": "{ trigger.data.unsubscribe }", "init": "{ if (!(var[trigger.address])) bounce ("You were not subscribed at the first place !"); }", "messages": [ { "app": "state", "state": "{ var["good_guys_count"] -=1; $good_guy_number = var[trigger.address]; var["good_guys_"||$good_guy_number] = false; var[trigger.address] = false; response['message'] = "Unsubscribed"; }" } ] }, { "if": "{ !!trigger.data.aa }", "init": "{ // been overtaken? if (!var[trigger.data.aa||"_reward"]) { $key = sha256(trigger.data.helper||"_"||trigger.address); if (!var[$key||"_reward"]) bounce ("Reward not available, you have been overtaken or you specified the wrong 'aa'!"); } else { $key = trigger.data.aa; } // too early? if (var[$key||"_time"] > timestamp) bounce ("Too early, try in "||(var[$key||"_time"] - timestamp)); }", "messages": [ { "app": "data", "payload": { "help_from": "{trigger.address}" } }, { "if": "{ var[$key||"_asset"] != "base" }", "app": "payment", "payload": { "asset": "{var[$key||"_asset"]}", "outputs": [ { "address": "{trigger.address}", "amount": "{var[$key||"_reward"]}" } ] } }, { "if": "{ var[$key||"_asset"] != "base" }", "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.data.aa}", "amount": "{1}" } ] } }, { "if": "{ var[$key||"_asset"] == "base" }", "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{var[$key||"_reward"]}" }, { "address": "{trigger.data.aa}", "amount": "{1}" } ] } }, { "app": "state", "state": "{ var[$key||"_reward"] = false; var[$key||"_asset"] = false; var[$key||"_time"] = false; response['message'] = trigger.address||" has been rewarded ^^"; }" } ] }, { "messages": [ { "app": "state", "state": "{ bounce ("Input not expected, please read the doc at https://github.com/pascalSAINVITU/THAANKS"); }" } ] } ] } } ]
Technical information
Fees:
5,408 bytes
(353 headers, 5055 payload)
Level:1035112
Witnessed level:1035105
Main chain index:1033923
Latest included mc index:1033922
Status:stable/confirmed/final