Unit ID
oPhB+rb8yme5h9pPHBV/PYt3bwLdij543ezWepk1EsY=
Received
23.09.2019 20:14:14
Confirmation delay (full node)
3 minutes 4 seconds
Confirmation delay (light node)
3 minutes 35 seconds
Messages
Definition
Definition: [ "autonomous agent", { "bounce_fees": { "base": 10000 }, "init": "{ // forever constantes $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).!"; $AA_OWNER = "O7NYCFUL5XIJTYE3O4MKGMGMTN6ATQAJ"; $ATTESTATOR = '35IT3ZYKEPQSCXG2F7A7KWNRAD3SZXN4'; // see all possible inputs here: $register = trigger.data.register; $aa_address = trigger.data.address; $like = trigger.data.like; $dislike = trigger.data.dislike; $aa_version = trigger.data.version; $need_help = trigger.data.help otherwise trigger.data.h; // define var that are use in each use cases $name = trigger.data.register otherwise trigger.data.like otherwise trigger.data.dislike otherwise bounce ($INSTRUCTIONS); $key = $name||"_"; $popular_version = var[$key||"popular_version"]; $popular_version_number = var[$key||"popular_version_number"]; }", "messages": { "cases": [ { "if": "{ !!$register }", "init": "{ if (!!var[$key||"owner"]) if (var[$key||"owner"] != trigger.address) bounce ("You are not the owner !"); if (!$aa_address) bounce ("Please specify 'address' !"); $version = var[$key||"popular_last_number"] + 1 otherwise 1; }", "messages": [ { "app": "state", "state": "{ // for each AA we want to keep: var[$key||"owner"] = trigger.address; // only user allow to update the AA var[$key||"last_version_number"] = $version; var[$key||"last_version"] = $aa_address; var[$key||"popular_version"] = $popular_version otherwise $aa_address; var[$key||"popular_version_number"] = $popular_version_number otherwise $version; // for each version we want to keep var[$key||$version||"_address"] = $aa_address; var[$key||$version||"_likes"] = 0; var[$key||$version||"_dislikes"] = 0; var[$key||$version||"_date"] = timestamp_to_string(timestamp); // response response['message'] = "New version of your aa has been registered ^^"; }" } ] }, { "if": "{ !!$like or !!$dislike}", "init": "{ if (attestation[[attestors=$ATTESTATOR, address=trigger.address, ifnone=false]] == false) bounce ("To like or dislike you must be attested by "||$ATTESTATOR); $version = $aa_version otherwise bounce ("Please specify 'version'"); if (!var[$key||$version||"_address"]) bounce ($key||$version||" do not exist !"); }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{ trigger.output[[asset=base]]-1000 }" } ] } }, { "app": "state", "state": "{ // proceed voting if ($b_want_to_like) var[$key||$version||"_likes"] +=1; if ($b_want_to_dislike) var[$key||$version||"_dislikes"] -=1; // check if it became the most popular version if (var[$key||$version||"_likes"] > var[$key||$popular_version_number||"_likes"]) { var[$key||"popular_version_number"] = var[$key||$version]; var[$key||"popular_version"] = var[$key||$version||"_address"]; } response['message'] = "You vote has been taken into account ^^ "; }" } ] }, { "messages": [ { "app": "state", "state": "{ bounce ($INSTRUCTIONS); }" } ] } ] } } ]
Technical information
Fees:
3,810 bytes
(353 headers, 3457 payload)
Level:1073509
Witnessed level:1073502
Main chain index:1072274
Latest included mc index:1072273
Status:stable/confirmed/final