| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "init": "{ |
| 8 | if (!$FOREVER_CONSTANT){ // FOREVER CONSTANTS (the if(!) is trick to be able to create blocks) |
| 9 | $owner = 'MYESSCFGDERS3YIEGNZDOG2BI5HKQHLU'; |
| 10 | $domain_creation_fee = 500000; // 500,000.0 bytes |
| 11 | $requesting_reputation_fee = 10000; // 10,000.0 bytes |
| 12 | $reward_pourcentage = 1; // 1% of the balance for an evalution of an attested address |
| 13 | $symbolic_reward= 10; // for evaluation of not attested address |
| 14 | $evaluation_delay = 2*24*60*60; // 1 days |
| 15 | |
| 16 | $default_domain = 'base'; |
| 17 | $default_attestor = '35IT3ZYKEPQSCXG2F7A7KWNRAD3SZXN4'; //'UOYYSPEE7UUW3KJAB5F4Y4AWMYMDDB4Y'; // official attestor |
| 18 | } |
| 19 | if (!$TRIGGER_INFO){ // info coming from the triggering transaction |
| 20 | $user_address = trigger.address; // Attested user (if evaluator) |
| 21 | $evaluated_address = trigger.data.adress otherwise trigger.data.ad; |
| 22 | $domain = trigger.data.domain otherwise trigger.data.do otherwise $default_domain; // Evaluation domain |
| 23 | $evaluation = trigger.data.evaluation otherwise trigger.data.ev; // Evaluation: 0-5 or ? |
| 24 | $attestor = trigger.data.attestor otherwise trigger.data.at otherwise $default_attestor; |
| 25 | $input_is_test_mode = trigger.data.testmode otherwise trigger.data.tm otherwise false; |
| 26 | |
| 27 | $TRIGGER_INFO = 'At the begining there was a user ('||$user_address_hash||') interested in a seller('|| $evaluated_address ||') in a given domain ('|| $domain ||') in the scope of an attestor ('|| $attestor ||') the user could try to initial the test mode ('|| $input_is_test_mode ||'). '; |
| 28 | } |
| 29 | if (!$HASHES){ // hashing to avoid to store the reputation openely in the dag (euh why?) |
| 30 | $user_address_hash = sha256($user_address); |
| 31 | $evaluated_address_hash = sha256($evaluated_address); |
| 32 | $domain_hash = sha256($domain); |
| 33 | $attestor_hash = sha256($attestor); |
| 34 | $attested_domain = sha256($domain_hash and $attestor_hash); |
| 35 | $evaluation_hash = sha256($attested_domain and $evaluated_address_hash and $user_address_hash); |
| 36 | $reputation_hash = sha256(($attested_domain and $evaluated_address_hash) || 'reputation'); |
| 37 | $evaluation_count_hash = sha256(($attested_domain and $evaluated_address_hash) || 'count'); |
| 38 | |
| 39 | // confuse attested address in the dag to avoid to gather information for free |
| 40 | // is it even possible ? $evaluated_address_confused = $evaluated_address(2); |
| 41 | |
| 42 | $HASHES= 'user hash is ('|| $user_address_hash ||') seller ('|| $evaluated_address_hash ||') domain ('|| $domain_hash ||') attestor ('|| $attestor_hash ||') attested_domain ('|| $attested_domain ||'). The evaluation hash for the AD and this pair of user is ('|| $evaluation_hash ||') seller reputation hash is ('|| $reputation_hash ||') number of evaluation for this seller hash is ('|| $evaluation_count_hash ||'). '; |
| 43 | } |
| 44 | if (!$INITIAL_DAG_STATE){ // aka state variables |
| 45 | $state_var_is_test_mode = var['is_test_mode']; |
| 46 | $attested_domain_exist = var['coad('||$attested_domain] otherwise false; |
| 47 | $balance_in_attestor_scope = var['bo('||$attestor_hash] otherwise 0; |
| 48 | $reputation = var['ro('||$reputation_hash] otherwise -1; |
| 49 | $eval_count = var['eco('||$evaluation_count_hash] otherwise 0; |
| 50 | $previous_evaluation = var['le(=)'||$evaluation_hash] otherwise -1; |
| 51 | $is_re_evaluation = var['leo('||$evaluation_hash] otherwise false; // this return false if the var doesn't exist |
| 52 | |
| 53 | $INITIAL_DAG_STATE = 'Is test mode activated to allow unattested user to vote? ('|| $state_var_is_test_mode || '). It is ('|| $attested_domain_exist || '/' || var['coad('||$attested_domain] ||') that the attested domain exist. The balance for this attestor scope is ('|| $balance_in_attestor_scope || '/' || var['bo('||$attestor_hash] || '). The reputation of the seller is ('|| $reputation || '/' || var['ro('||$reputation_hash] || ') with ('|| $eval_count|| '/' || var['eco('||$evaluation_count_hash] ||') votes. The previous evalutaion of the seller from this user is ('|| $previous_evaluation|| '/' || var['le(=)'||$evaluation_hash] ||') so it is ('|| $is_re_evaluation || ') to says that it is a re-evaluation. '; |
| 54 | } |
| 55 | if (!$PRELIMINARY_CHECKS){ // Preliminary checks and deductions |
| 56 | |
| 57 | // test mode? |
| 58 | if ($user_address==$owner) |
| 59 | $is_test_mode = $input_is_test_mode otherwise $state_var_is_test_mode otherwise false; |
| 60 | else |
| 61 | $is_test_mode = var['is_test_mode'] otherwise false; |
| 62 | |
| 63 | // function? |
| 64 | $is_requesting = $evaluation == '?'; |
| 65 | $is_contributing = (!$is_requesting)? $evaluation >= 0 and $evaluation <= 5 : false; |
| 66 | |
| 67 | // attested domain? |
| 68 | $attested_default_domain = ($domain == $default_domain) and ($attestor == $default_attestor); |
| 69 | |
| 70 | // Preliminary checks |
| 71 | if(!$is_requesting and !$is_contributing) |
| 72 | bounce('Sorry, You have to specify a \'evaluation\' field in the data section. Use \'0\' to \'5\' to evaluate an address or use \'?\' to request the reputation of an address.'); // (money - bounce fee) is return automatically |
| 73 | if(!$evaluated_address) |
| 74 | bounce('Sorry, You have to specify which address you want to find reputation for. Please add an \'address\' field in the data section.'); |
| 75 | |
| 76 | // Fee checks |
| 77 | $fee_received = trigger.output[[asset=base]].amount; |
| 78 | $is_creation_fee_received = $fee_received > $domain_creation_fee; |
| 79 | $is_requesting_fee_received = $fee_received > $requesting_reputation_fee; |
| 80 | |
| 81 | $PRELIMINARY_CHECKS= 'The test mode is set to ('|| $is_test_mode ||') requesting mode to ('|| $is_requesting ||') contributing mode to ('|| $is_contributing ||') this is ('|| $attested_default_domain ||') to say that we will work with the default attested domain. The fee received is ('|| $fee_received ||') ok for creation ('|| $is_creation_fee_received ||') ok for requesting a reputation ('|| $is_requesting_fee_received ||'). '; |
| 82 | } |
| 83 | if (!$ATTESTATIONS){ // Attestation checks |
| 84 | $evaluated_is_attested = attestation[[attestors=$attestor, address=$evaluated_address, ifnone=0]]; |
| 85 | $user_is_attested = attestation[[attestors=$attestor, address=$user_address, ifnone=0]]; |
| 86 | |
| 87 | $ATTESTATIONS = 'User attestation is ('|| $user_is_attested ||') and seller attestation is ('|| $evaluated_is_attested ||'). '; |
| 88 | } |
| 89 | |
| 90 | }", |
| 91 | "messages": { |
| 92 | "cases": [ |
| 93 | { |
| 94 | "if": "{$is_requesting}", |
| 95 | "init": "{ |
| 96 | |
| 97 | if (!$REQUESTING_CHECKS){ // |
| 98 | if (!$attested_domain_exist and !$attested_default_domain) |
| 99 | bounce('Sorry, You have requested reputation for a domain-attestor pair that do not exist.'); |
| 100 | $reputationExists = ($reputation != -1); |
| 101 | if (!$reputationExists) |
| 102 | bounce('Sorry, the address (user) do not have reputation in this domain-attestor pair yet. Please consider to rate this user once you interacted with him/her.'); |
| 103 | if (!$is_requesting_fee_received) |
| 104 | bounce('Sorry, The fee to request a reputation is '|| $requesting_reputation_fee || 'bytes'); |
| 105 | } |
| 106 | |
| 107 | if (!$RETURNING_REPUTATION){ // Respond |
| 108 | |
| 109 | $reputation_to_show = round($reputation,1); |
| 110 | $message_about_reputation ='Reputation for domain \''|| $domain ||'\' is '||$reputation_to_show||'/5 from ' || $eval_count || 'votes '; |
| 111 | if ($evaluated_is_attested) |
| 112 | $message_about_attestation = 'and the address is attested by \''||$attestor_address||'\').'; |
| 113 | else |
| 114 | $message_about_attestation = 'BUT the address is NOT attested by \''||$attestor_address||'\')!'; |
| 115 | |
| 116 | response['message'] = $message_about_reputation || $message_about_attestation; |
| 117 | response['domain'] = $domain; |
| 118 | response['attestor'] = $attestor; |
| 119 | response['reputation'] = $reputation_to_show; |
| 120 | response['evaluation_count'] = $eval_count; |
| 121 | response['attested'] = $evaluated_is_attested; |
| 122 | } |
| 123 | }", |
| 124 | "messages": [ |
| 125 | { |
| 126 | "app": "data", |
| 127 | "payload": { |
| 128 | "message": "{$message}", |
| 129 | "domain": "{$domain}", |
| 130 | "attestor": "{$attestor}", |
| 131 | "reputation": "{$reputation}", |
| 132 | "evaluation_count": "{$evaluation_count}", |
| 133 | "attested": "{$attested}" |
| 134 | } |
| 135 | }, |
| 136 | { |
| 137 | "app": "state", |
| 138 | "state": "{ |
| 139 | |
| 140 | if (!$FINAL_DAG_STATE){ // |
| 141 | $saved_fee = trigger.output[[asset=base]].amount - 1000; // 1000 is the data transfert fee approximation |
| 142 | var['bo('||$attestor_hash] += $saved_fee; |
| 143 | var['is_test_mode'] = $is_test_mode; |
| 144 | |
| 145 | $FINAL_DAG_STATE = 'After the requesting, the new balance for this attestor scope is('|| var['bo('||$attestor_hash] ||') bytes, it added ('|| $saved_fee ||') bytes. The test mode will be activated? ('|| $is_test_mode ||'). '; |
| 146 | } |
| 147 | |
| 148 | var['debug_message_1'] =$FOREVER_CONSTANT||$TRIGGER_INFO||$HASHES||$INITIAL_DAG_STATE||$PRELIMINARY_CHECKS||$ATTESTATIONS; |
| 149 | var['debug_message_2'] =$REQUESTING_CHECKS||$RETURNING_REPUTATION||$FINAL_DAG_STATE; |
| 150 | }" |
| 151 | } |
| 152 | ] |
| 153 | }, |
| 154 | { |
| 155 | "if": "{$is_contributing}", |
| 156 | "init": "{ |
| 157 | |
| 158 | if (!$CONTRIBUTION_CHECKING){ // |
| 159 | |
| 160 | if (!$attested_domain_exist and !$is_creation_fee_received and !$attested_default_domain){ |
| 161 | bounce('Sorry, the domain-attestor pair do not exists. It can be created but the fee is \''||$domain_creation_fee || '\' bytes, this money will be used to reward the evaluators');} |
| 162 | |
| 163 | if (!$user_is_attested) |
| 164 | { |
| 165 | if(!$is_test_mode) |
| 166 | bounce('Sorry, to be able to give an evaluation you need to be attested by the following attestor: \''|| $attestor || '\' or it will be too easy to pump a reputation.'); |
| 167 | else |
| 168 | $warning ='Normally, a user not attested by the attestor linked to a domain should not be able to vote, but as you are in test mode you will be able to vote. '; |
| 169 | $message_about_testing = $warning otherwise ''; |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | if (!$REWARD_COMPUTATION){ // calculating reward |
| 174 | $reward = $evaluated_is_attested? round($balance_in_attestor_scope* $reward_pourcentage /100) : $symbolic_reward; |
| 175 | |
| 176 | $REWARD_COMPUTATION = 'The reward will be ('|| $reward ||'). '; |
| 177 | } |
| 178 | |
| 179 | if (!$REPUTATION_COMPUTATION){ // compute new reputation |
| 180 | $total_score=($reputation * $eval_count); |
| 181 | |
| 182 | if ($is_re_evaluation){ |
| 183 | $new_reputation = ($total_score + ($evaluation-$previous_evaluation) / ($eval_count)); |
| 184 | $message_about_re_evaluation = 'Your evaluation was changed from '||$previous_evaluation||' to '||$evaluation||'. '; |
| 185 | $new_eval_count = $eval_count; |
| 186 | $message_about_number_of_eval = 'The number of votes for this address is still '||$new_eval_count||'. '; |
| 187 | } |
| 188 | else{ |
| 189 | $new_reputation = ($total_score + $evaluation) / ($eval_count+1); |
| 190 | $message_about_re_evaluation = ''; |
| 191 | $new_eval_count = $eval_count+1; |
| 192 | $message_about_number_of_eval = 'There is now '||$new_eval_count||' votes for this address. '; |
| 193 | } |
| 194 | $reputation_to_show = round($new_reputation,1); |
| 195 | |
| 196 | $REPUTATION_COMPUTATION = 'the new reputation is ('|| $new_reputation ||'-'|| $reputation_to_show ||'). '; |
| 197 | } |
| 198 | |
| 199 | if (!$RESPONSE_CREATION){ // create message |
| 200 | // Domain creation? |
| 201 | if (!$attested_domain_exist) |
| 202 | $message_about_domain = 'The domain \''||$domain||'\' has been created in the scope of the attestor \''||$attestor||'\'. '; |
| 203 | else |
| 204 | $message_about_domain = ''; |
| 205 | |
| 206 | $message = $message_about_testing||$message_about_domain||'Thank you for your contribution, a reward of '||$reward||' byte have been sent to you ('||$user_address||'). The new reputation of '||$evaluated_address||' is now'||$reputation_to_show||'/5. '|| $message_about_re_evaluation || $message_about_number_of_eval; |
| 207 | |
| 208 | response['message'] = $message; |
| 209 | response['domain'] = $domain; |
| 210 | response['attestor'] = $attestor; |
| 211 | response['vote_from'] = $user_address; |
| 212 | if ($is_re_evaluation) |
| 213 | { |
| 214 | response['old_evaluation'] = $previous_evaluation; |
| 215 | response['new_evaluation'] = $evaluation; |
| 216 | } |
| 217 | else |
| 218 | response['evaluation'] = $evaluation; |
| 219 | response['old_reputation'] = $reputation; |
| 220 | response['new_reputation'] = $new_reputation; |
| 221 | response['attested'] = $evaluated_is_attested; |
| 222 | |
| 223 | $RESPONSE_CREATION = 'The message to the user will be ('|| $message ||'). '; |
| 224 | } |
| 225 | }", |
| 226 | "messages": [ |
| 227 | { |
| 228 | "app": "payment", |
| 229 | "payload": { |
| 230 | "asset": "{'base'}", |
| 231 | "outputs": [ |
| 232 | { |
| 233 | "address": "{trigger.address}", |
| 234 | "amount": "{$reward}" |
| 235 | } |
| 236 | ] |
| 237 | } |
| 238 | }, |
| 239 | { |
| 240 | "app": "state", |
| 241 | "state": "{ |
| 242 | |
| 243 | if (!$FINAL_DAG_STATE){ // |
| 244 | |
| 245 | if (!$attested_domain_exist) |
| 246 | var['coad('||$attested_domain]=$user_address_hash; // creating the var. |
| 247 | |
| 248 | var['ro('||$reputation_hash] = $new_reputation; |
| 249 | var['eco('||$evaluation_count_hash] = $new_eval_count; |
| 250 | var['leo('||$evaluation_hash] = $evaluation; // last evaluation for later revote |
| 251 | var['bo('||$attestor_hash] = $balance_in_attestor_scope - $reward; // attestor balance |
| 252 | var['is_test_mode'] = $is_test_mode; |
| 253 | |
| 254 | $FINAL_DAG_STATE = 'Finally the state of the DAG is: the new reputation of the seller is ('|| $new_reputation ||') with a number of vote of ('|| $new_eval_count ||'), the last evaluation saved from this user will be ('|| $evaluation ||'). The new balance available in the scope is ('|| var['bo('||$attestor_hash] ||'). The test mode will be activated? ('|| $is_test_mode ||'). '; |
| 255 | |
| 256 | |
| 257 | } |
| 258 | |
| 259 | var['debug_message_1'] = $FOREVER_CONSTANT||$TRIGGER_INFO||$HASHES||$INITIAL_DAG_STATE||$PRELIMINARY_CHECKS||$ATTESTATIONS; |
| 260 | var['debug_message_2'] = $CONTRIBUTION_CHECKING||$REWARD_COMPUTATION||$REPUTATION_COMPUTATION; |
| 261 | var['debug_message_3'] = $FINAL_DAG_STATE; |
| 262 | |
| 263 | }" |
| 264 | } |
| 265 | ] |
| 266 | } |
| 267 | ] |
| 268 | } |
| 269 | } |
| 270 | ] |
| Message | formula if (!$FINAL_DAG_STATE){ // if (!$attested_domain_exist) var['coad('||$attested_domain]=$user_address_hash; // creating the var. var['ro('||$reputation_hash] = $new_reputation; var['eco('||$evaluation_count_hash] = $new_eval_count; var['leo('||$evaluation_hash] = $evaluation; // last evaluation for later revote var['bo('||$attestor_hash] = $balance_in_attestor_scope - $reward; // attestor balance var['is_test_mode'] = $is_test_mode; $FINAL_DAG_STATE = 'Finally the state of the DAG is: the new reputation of the seller is ('|| $new_reputation ||') with a number of vote of ('|| $new_eval_count ||'), the last evaluation saved from this user will be ('|| $evaluation ||'). The new balance available in the scope is ('|| var['bo('||$attestor_hash] ||'). The test mode will be activated? ('|| $is_test_mode ||'). '; } var['debug_message_1'] = $FOREVER_CONSTANT||$TRIGGER_INFO||$HASHES||$INITIAL_DAG_STATE||$PRELIMINARY_CHECKS||$ATTESTATIONS; var['debug_message_2'] = $CONTRIBUTION_CHECKING||$REWARD_COMPUTATION||$REPUTATION_COMPUTATION; var['debug_message_3'] = $FINAL_DAG_STATE; failed: state var value too long: falseAt the begining there was a user (false) interested in a seller(MPG4MHVYUAP3B5IQX44LTINTSUKYB6JA) in a given domain (base) in the scope of an attestor (35IT3ZYKEPQSCXG2F7A7KWNRAD3SZXN4) the user could try to initial the test mode (false). user hash is (3RkXiF0c07S6kbEiDAg4ysZiCs9wQmQ7VuyGtmAb4Uc=) seller (7jgsn10D9KVoFZkMK2UEEe9tpJeZJaA/NOff41mqhm0=) domain (yuZiFy/UULsM1xCnaQecBb/F2ONe+mV27cfQN3r91KI=) attestor (TQUajuSEprUa5FyA805QIYP2I5klFffe9/R2hocX3NQ=) attested_domain (tb6kG2xiP3wJ8b8k3K5Y66s8DN2QrZZrxDpFtEhn4Ss=). The evaluation hash for the AD and this pair of user is (tb6kG2xiP3wJ8b8k3K5Y66s8DN2QrZZrxDpFtEhn4Ss=) seller reputation hash is (zdkNM0To04qfHxV3cWGVZfBxVBaX7D1+vDsWaQbM718=) number of evaluation for this seller hash is (tnJTWheS+QUv2W4DrZRkvteUyM0j/ssC7sX3nfnRTTM=). Is test mode activated to allow unattested user to vote? (false). It is (false/false) that the attested domain exist. The balance for this attestor scope is (0/false). The reputation of the seller is (-1/false) with (0/false) votes. The previous evalutaion of the seller from this user is (-1/false) so it is (false) to says that it is a re-evaluation. The test mode is set to (false) requesting mode to (false) contributing mode to (true) this is (true) to say that we will work with the default attested domain. The fee received is (20000) ok for creation (false) ok for requesting a reputation (true). User attestation is (true) and seller attestation is (true). |
|---|
| Message | formula { if (!$FOREVER_CONSTANT){ // FOREVER CONSTANTS (the if(!) is trick to be able to create blocks) $owner = 'MYESSCFGDERS3YIEGNZDOG2BI5HKQHLU'; $domain_creation_fee = 500000; // 500,000.0 bytes $requesting_reputation_fee = 10000; // 10,000.0 bytes $reward_pourcentage = 1; // 1% of the balance for an evalution of an attested address $symbolic_reward= 10; // for evaluation of not attested address $evaluation_delay = 2*24*60*60; // 1 days $default_domain = 'base'; $default_attestor = '35IT3ZYKEPQSCXG2F7A7KWNRAD3SZXN4'; //'UOYYSPEE7UUW3KJAB5F4Y4AWMYMDDB4Y'; // official attestor } if (!$TRIGGER_INFO){ // info coming from the triggering transaction $user_address = trigger.address; // Attested user (if evaluator) $evaluated_address = trigger.data.adress otherwise trigger.data.ad; $domain = trigger.data.domain otherwise trigger.data.do otherwise $default_domain; // Evaluation domain $evaluation = trigger.data.evaluation otherwise trigger.data.ev; // Evaluation: 0-5 or ? $attestor = trigger.data.attestor otherwise trigger.data.at otherwise $default_attestor; $input_is_test_mode = trigger.data.testmode otherwise trigger.data.tm otherwise false; $TRIGGER_INFO = 'At the begining there was a user ('||$user_address_hash||') interested in a seller('|| $evaluated_address ||') in a given domain ('|| $domain ||') in the scope of an attestor ('|| $attestor ||') the user could try to initial the test mode ('|| $input_is_test_mode ||'). '; } if (!$HASHES){ // hashing to avoid to store the reputation openely in the dag (euh why?) $user_address_hash = sha256($user_address); $evaluated_address_hash = sha256($evaluated_address); $domain_hash = sha256($domain); $attestor_hash = sha256($attestor); $attested_domain = sha256($domain_hash and $attestor_hash); $evaluation_hash = sha256($attested_domain and $evaluated_address_hash and $user_address_hash); $reputation_hash = sha256(($attested_domain and $evaluated_address_hash) || 'reputation'); $evaluation_count_hash = sha256(($attested_domain and $evaluated_address_hash) || 'count'); // confuse attested address in the dag to avoid to gather information for free // is it even possible ? $evaluated_address_confused = $evaluated_address(2); $HASHES= 'user hash is ('|| $user_address_hash ||') seller ('|| $evaluated_address_hash ||') domain ('|| $domain_hash ||') attestor ('|| $attestor_hash ||') attested_domain ('|| $attested_domain ||'). The evaluation hash for the AD and this pair of user is ('|| $evaluation_hash ||') seller reputation hash is ('|| $reputation_hash ||') number of evaluation for this seller hash is ('|| $evaluation_count_hash ||'). '; } if (!$INITIAL_DAG_STATE){ // aka state variables $state_var_is_test_mode = var['is_test_mode']; $attested_domain_exist = var['coad('||$attested_domain] otherwise false; $balance_in_attestor_scope = var['bo('||$attestor_hash] otherwise 0; $reputation = var['ro('||$reputation_hash] otherwise -1; $eval_count = var['eco('||$evaluation_count_hash] otherwise 0; $previous_evaluation = var['le(=)'||$evaluation_hash] otherwise -1; $is_re_evaluation = var['leo('||$evaluation_hash] otherwise false; // this return false if the var doesn't exist $INITIAL_DAG_STATE = 'Is test mode activated to allow unattested user to vote? ('|| $state_var_is_test_mode || '). It is ('|| $attested_domain_exist || '/' || var['coad('||$attested_domain] ||') that the attested domain exist. The balance for this attestor scope is ('|| $balance_in_attestor_scope || '/' || var['bo('||$attestor_hash] || '). The reputation of the seller is ('|| $reputation || '/' || var['ro('||$reputation_hash] || ') with ('|| $eval_count|| '/' || var['eco('||$evaluation_count_hash] ||') votes. The previous evalutaion of the seller from this user is ('|| $previous_evaluation|| '/' || var['le(=)'||$evaluation_hash] ||') so it is ('|| $is_re_evaluation || ') to says that it is a re-evaluation. '; } if (!$PRELIMINARY_CHECKS){ // Preliminary checks and deductions // test mode? if ($user_address==$owner) $is_test_mode = $input_is_test_mode otherwise $state_var_is_test_mode otherwise false; else $is_test_mode = var['is_test_mode'] otherwise false; // function? $is_requesting = $evaluation == '?'; $is_contributing = (!$is_requesting)? $evaluation >= 0 and $evaluation <= 5 : false; // attested domain? $attested_default_domain = ($domain == $default_domain) and ($attestor == $default_attestor); // Preliminary checks if(!$is_requesting and !$is_contributing) bounce('Sorry, You have to specify a \'evaluation\' field in the data section. Use \'0\' to \'5\' to evaluate an address or use \'?\' to request the reputation of an address.'); // (money - bounce fee) is return automatically if(!$evaluated_address) bounce('Sorry, You have to specify which address you want to find reputation for. Please add an \'address\' field in the data section.'); // Fee checks $fee_received = trigger.output[[asset=base]].amount; $is_creation_fee_received = $fee_received > $domain_creation_fee; $is_requesting_fee_received = $fee_received > $requesting_reputation_fee; $PRELIMINARY_CHECKS= 'The test mode is set to ('|| $is_test_mode ||') requesting mode to ('|| $is_requesting ||') contributing mode to ('|| $is_contributing ||') this is ('|| $attested_default_domain ||') to say that we will work with the default attested domain. The fee received is ('|| $fee_received ||') ok for creation ('|| $is_creation_fee_received ||') ok for requesting a reputation ('|| $is_requesting_fee_received ||'). '; } if (!$ATTESTATIONS){ // Attestation checks $evaluated_is_attested = attestation[[attestors=$attestor, address=$evaluated_address, ifnone=0]]; $user_is_attested = attestation[[attestors=$attestor, address=$user_address, ifnone=0]]; $ATTESTATIONS = 'User attestation is ('|| $user_is_attested ||') and seller attestation is ('|| $evaluated_is_attested ||'). '; } } failed: booleans cannot be compared with other types |
|---|
| Message | formula if (!$FINAL_DAG_STATE){ // if (!$attested_domain_exist) var['coad('||$attested_domain]=$user_address_hash; // creating the var. var['ro('||$reputation_hash] = $new_reputation; var['eco('||$evaluation_count_hash] = $new_eval_count; var['leo('||$evaluation_hash] = $evaluation; // last evaluation for later revote var['bo('||$attestor_hash] = $balance_in_attestor_scope - $reward; // attestor balance var['is_test_mode'] = $is_test_mode; $FINAL_DAG_STATE = 'Finally the state of the DAG is: the new reputation of the seller is ('|| $new_reputation ||') with a number of vote of ('|| $new_eval_count ||'), the last evaluation saved from this user will be ('|| $evaluation ||'). The new balance available in the scope is ('|| var['bo('||$attestor_hash] ||'). The test mode will be activated? ('|| $is_test_mode ||'). '; } var['debug_message_1'] = $FOREVER_CONSTANT||$TRIGGER_INFO||$HASHES||$INITIAL_DAG_STATE||$PRELIMINARY_CHECKS||$ATTESTATIONS; var['debug_message_2'] = $CONTRIBUTION_CHECKING||$REWARD_COMPUTATION||$REPUTATION_COMPUTATION; var['debug_message_3'] = $FINAL_DAG_STATE; failed: state var value too long: falseAt the begining there was a user (false) interested in a seller(MPG4MHVYUAP3B5IQX44LTINTSUKYB6JA) in a given domain (base) in the scope of an attestor (35IT3ZYKEPQSCXG2F7A7KWNRAD3SZXN4) the user could try to initial the test mode (false). user hash is (3RkXiF0c07S6kbEiDAg4ysZiCs9wQmQ7VuyGtmAb4Uc=) seller (7jgsn10D9KVoFZkMK2UEEe9tpJeZJaA/NOff41mqhm0=) domain (yuZiFy/UULsM1xCnaQecBb/F2ONe+mV27cfQN3r91KI=) attestor (TQUajuSEprUa5FyA805QIYP2I5klFffe9/R2hocX3NQ=) attested_domain (tb6kG2xiP3wJ8b8k3K5Y66s8DN2QrZZrxDpFtEhn4Ss=). The evaluation hash for the AD and this pair of user is (tb6kG2xiP3wJ8b8k3K5Y66s8DN2QrZZrxDpFtEhn4Ss=) seller reputation hash is (zdkNM0To04qfHxV3cWGVZfBxVBaX7D1+vDsWaQbM718=) number of evaluation for this seller hash is (tnJTWheS+QUv2W4DrZRkvteUyM0j/ssC7sX3nfnRTTM=). Is test mode activated to allow unattested user to vote? (false). It is (false/false) that the attested domain exist. The balance for this attestor scope is (0/false). The reputation of the seller is (-1/false) with (0/false) votes. The previous evalutaion of the seller from this user is (-1/false) so it is (false) to says that it is a re-evaluation. The test mode is set to (false) requesting mode to (false) contributing mode to (true) this is (true) to say that we will work with the default attested domain. The fee received is (20000) ok for creation (false) ok for requesting a reputation (true). User attestation is (true) and seller attestation is (true). |
|---|