Unit ID
6C/TM7oSW1T4m7hOPkScHc3rW6ZetirSq3gGg15x4Wk=
Received
13.09.2019 20:53:49
Confirmation delay (full node)
2 minutes 8 seconds
Confirmation delay (light node)
6 minutes 12 seconds
Messages
Definition
Definition: [ "autonomous agent", { "bounce_fees": { "base": 10000 }, "init": "{ // Instructions bounced to user $INSTRUCTIONS_TO_VOTE = "To vote, use 'evaluate' = <evaluated address> + 'score' = < 0 to 5 > and optionaly 'domain' = < domain name > to vote in a specific domain. "; $INSTRUCTIONS_TO_CREATE_A_DOMAIN = 'A new domain can be created if you ' || $message_creation_howto || ' but the fee is \''||$DOMAIN_CREATION_FEE || '\' bytes, this money will be used to reward the evaluators. '|| $PRELIMINARY_CHECKS; // FOREVER CONSTANTS $AA_OWNER = 'SX66Y36BOU77S7MWML6JQQA3CJLX4COR'; $DEFAULT_DOMAIN = 'base'; $DEFAULT_ATTESTOR = '35IT3ZYKEPQSCXG2F7A7KWNRAD3SZXN4'; // official attestor $DEFAULT_CREATION_FEE = 500000; // 500,000.0 bytes $DEFAULT_REWARD = 1; // in percentage $DEFAULT_FORGIVING_DELAY = 36500; // in days, to be use // variable depending on the aa state and the input $i = trigger.data; $user = trigger.address; $anonym_user = sha256($user); $target = $i.evaluate; $score = $i.score otherwise -1; // Evaluation: 0-5 $domain = $i.domain otherwise $DEFAULT_DOMAIN; $balance = var[$domain||"_balance"] otherwise trigger.output[[asset=base]].amount - 1000; $count = var[$domain||"_count"] otherwise 0; $last_eval = var[$domain||"_"||$anonym_user] otherwise false; $last_eval_time = var[$domain||"_eval_time"] otherwise timestamp; $attestor = var[$domain||"_attestor"] otherwise $i.attestor otherwise $DEFAULT_ATTESTOR; $reward = var[$domain||"_reward"] otherwise $i.reward otherwise $DEFAULT_REWARD; $use_balance_weigth = var[$domain||"_use_balance_weigth"] otherwise $i.use_balance_weigth; $forgiving_delay = var[$domain||"_forgive_delay"] otherwise $i.forgive otherwise $DEFAULT_FORGIVING_DELAY; $creation_fee = $i.creation_fee otherwise $DEFAULT_CREATION_FEE; }", "messages": { "cases": [ { "if": "{ !!$target }", "init": "{ // bouncing if (!$score) bounce ($INSTRUCTIONS_TO_VOTE); if ($score < 0 or $score > 5) bounce('Score must be set between 0 and 5 !'); if ($target == $user) bounce('You can NOT vote for yourself !'); if (!var[$domain]) bounce('Domain do NOT exist !'); if (attestation[[attestors=$attestor, address=$user, ifnone=0]]) bounce ("You must be attested by "||$attestor); // reputation computation $reputation_corrected = ($reputation == -1)? 0: $reputation; $total_score=($reputation * $eval_count); if ($is_re_evaluation){ $new_reputation = ($total_score + ($evaluation-$previous_evaluation) / ($eval_count)); $new_eval_count = $eval_count; } else{ $new_reputation = ($total_score + $evaluation) / ($eval_count+1); $new_eval_count = $eval_count+1; } $reputation_to_show = round($new_reputation,1); // calculating reward if ($user_is_attested){ $reward = round($balance_in_attestor_scope* $reward_pourcentage /100); $message_about_the_reward = 'The reward is '||$reward_pourcentage||'% of the attested scope which is '|| $balance_in_attestor_scope ||" bytes. "; } else{ $reward = $symbolic_reward; $message_about_the_reward = 'The reward is symbolic because you are not attested by '|| $attestor_address||'. '; } if ($AA_in_debug_mode){ $REWARD_COMPUTATION = 'The reward will be ('|| $reward ||'). '|| $message_about_the_reward ||'. '; response['REWARD_COMPUTATION'] = $REWARD_COMPUTATION; } }", "messages": [ { "app": "payment", "payload": { "asset": "{'base'}", "outputs": [ { "address": "{trigger.address}", "amount": "{$reward}" } ] } }, { "app": "state", "state": "{ var[$domain||"_balance"] = $balance; var[$domain||"_count"] = $count otherwise 0; var[$domain||"_"||$anonym_user] = $last_eval; var[$domain||"_eval_time"] = $last_eval_time; var[$domain||"_attestor"] = $attestor; var[$domain||"_reward"] = $reward; var[$domain||"_use_balance_weigth"] = $use_balance_weigth; var[$domain||"_forgive_delay"] = $forgiving_delay; }" } ] }, { "if": "{$is_creating}", "init": "{ if (!$DOMAIN_CREATION){ // // Domain exist? bounce if ($attested_domain_exist) bounce('Sorry, The domain \''||$domain||'\' in the scope of the attestor \''||$attestor_address||'\' already exist. '); // fee paied? if (!$is_creation_fee_received) bounce('Sorry, The fee to create a domain is '|| $DOMAIN_CREATION_FEE ||'bytes. '); // prepare meesages $message_about_creation_requirements = 'In creation mode you should have '||$message_creation_howto||' and you should not specify any \'evaluation\'. '; // to much param? bounce if($is_requesting or $is_contributing) bounce('Sorry, '|| $message_about_creation_requirements); // check if creation mode ok $moa = $mode_of_average_for_creation; if(($moa != $AVERAGING_MODE_UNWEIGHTED) and ($moa != $AVERAGING_MODE_TIME_WEIGHTED) and ($moa != $mode_cbwa) and ($moa != $AVERAGING_MODE_REPUTATION_WEIGHTED)) bounce('Sorry, '|| $message_about_creation_requirements); $ok_to_create_domain=true; $message_about_creation = 'The domain \''||$domain||'\' has been created in the scope of the attestor \''||$attestor_address||'\' with the average mode \''||$mode_of_average_for_creation||'\'. '; response['message'] = $message_about_creation; if ($AA_in_debug_mode){ $DOMAIN_CREATION = $message_about_creation; response['DOMAIN_CREATION'] = $DOMAIN_CREATION; } } }", "messages": [ { "app": "data", "payload": { "domain": "{$domain}", "attestor": "{$attestor_address}" } }, { "app": "state", "state": "{ if (!$FINAL_DAG_STATE){ // $saved_fee = trigger.output[[asset=base]].amount - 1000; // 1000 is the data transfert fee approximation var['coad('||$attested_domain]=$user_address_hash; // creating the var. var['moa('||$attested_domain]=$mode_of_average_for_creation; var['bo('||$attestor_hash] += $saved_fee; if ($AA_in_debug_mode){ $FINAL_DAG_STATE = 'After creation of the new, domain the new balance for this attestor scope is('|| var['bo('||$attestor_hash] ||') bytes, it added ('|| $saved_fee ||') bytes. '; response['FINAL_DAG_STATE'] = $FINAL_DAG_STATE; } } }" } ] }, { "messages": [ { "app": "state", "state": "{ bounce ($INSTRUCTIONS_TO_VOTE || " " ||$INSTRUCTIONS_TO_CREATE_A_DOMAIN); }" } ] } ] } } ]
Technical information
Fees:
6,752 bytes
(353 headers, 6399 payload)
Level:1059306
Witnessed level:1059299
Main chain index:1058079
Latest included mc index:1058078
Status:stable/confirmed/final