Unit ID
bks2+qbjIfAS2XhMwB8oKYrFdln3dBrdW07iDQvbiDg=
Received
07.09.2019 10:05:12
Confirmation delay (full node)
3 minutes 6 seconds
Confirmation delay (light node)
5 minutes 56 seconds
Messages
Definition
Definition: [ "autonomous agent", { "bounce_fees": { "base": 10000 }, "init": "{ \r // forever constantes\r $INSTRUCTIONS = "Please use 'register' = <aa name> + 'address' = <aa address> to add your AA as a new entry or to update with a new version. Please use '(dis)like' = <aa name> + 'version' = <version> to give your opinion on a version of an AA (you need to be attested by the real name attestor).!";\r \r $AA_OWNER = "O7NYCFUL5XIJTYE3O4MKGMGMTN6ATQAJ";\r $ATTESTATOR = '35IT3ZYKEPQSCXG2F7A7KWNRAD3SZXN4';\r \r // see all possible inputs here:\r $i = trigger.data;\r $register = $i.register; $aa_address = $i.address;\r $like = $i.like; $dislike = $i.dislike; $aa_version = $i.version;\r $need_help = $i.help otherwise $i.h;\r \r // define var that are use in each use cases\r $name = $i.register otherwise $i.like otherwise $i.dislike otherwise bounce ($INSTRUCTIONS);\r $key = $name||"_";\r $popular_version = var[$key||"popular_version"];\r }", "messages": { "cases": [ { "if": "{ !!$register }", "init": "{ \r if (!!var[$key||"owner"])\r if (var[$key||"owner"] != trigger.address)\r bounce ("You are not the owner !");\r if (!$aa_address) bounce ("Please specify 'address' !"); \r $version = var[$key||"last_version"] + 1 otherwise 1;\r }", "messages": [ { "app": "state", "state": "{\r // for each AA we want to keep:\r var[$key||"owner"] = trigger.address; // only user allow to update the AA\r var[$key||"last_version"] = $version; \r var[$key||"popular_version"] = $popular_version otherwise $version;\r // for each version we want to keep\r var[$key||$version||"_address"] = $aa_address;\r var[$key||$version||"_likes"] = 0;\r var[$key||$version||"_dislikes"] = 0;\r var[$key||$version||"_date"] = timestamp_to_string(timestamp);\r // response\r response['message'] = "New version of your aa has been registered ^^";\r }" } ] }, { "if": "{ !!$like or !!$dislike}", "init": "{ \r if (attestation[[attestors=$ATTESTATOR, address=trigger.address, ifnone=false]] == false)\r bounce ("To like or dislike you must be attested by "||$ATTESTATOR);\r $version = $aa_version otherwise bounce ("Please specify 'version'");\r if (!var[$key||$version||"_address"])\r bounce ($key||$version||" do not exist !");\r }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{ trigger.output[[asset=base]]-1000 }" } ] } }, { "app": "state", "state": "{\r // proceed voting\r if ($b_want_to_like) var[$key||$version||"_likes"] +=1;\r if ($b_want_to_dislike) var[$key||$version||"_dislikes"] -=1;\r // check if it became the most popular version\r if (var[$key||$version||"_likes"] > var[$key||$popular_version||"_likes"])\r var[$key||"popular_version"] = var[$key||$version];\r response['message'] = "You vote has been taken into account ^^";\r }" } ] }, { "messages": [ { "app": "state", "state": "{\r if ($need_help) bounce ($INSTRUCTIONS);\r }" } ] } ] } } ]
Technical information
Fees:
3,394 bytes
(353 headers, 3041 payload)
Level:1050231
Witnessed level:1050224
Main chain index:1049004
Latest included mc index:1049003
Status:stable/confirmed/final