| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | // ============================================================ |
| 6 | // OBYFIT AA from Whistling Frogs - v 0.1 24 Oct 2019 |
| 7 | // ============================================================ |
| 8 | // Deposit 1,020,000 bytes and allow connection to Google Fit. |
| 9 | // visit obyfit.whistlingfrogs.com |
| 10 | // ============================================================ |
| 11 | // Production settings: |
| 12 | // Duration of the challange: 7 days / periods |
| 13 | // Walk 10,000 steps a day to earn back up to 10,000 bytes a day. |
| 14 | // Walk 70,000 steps in 7 days to earn back 30,000 bytes bonus. |
| 15 | // (change period_goal and total_goal parameters) |
| 16 | // ============================================================ |
| 17 | // Test settings: |
| 18 | // Duration of the challange: 7 hours / periods |
| 19 | // Walk 1,000 steps an hour to earn back up to 10,000 bytes. |
| 20 | // Walk 7,000 steps in 7 hous to earn back 30,000 bytes bonus. |
| 21 | // ============================================================ |
| 22 | |
| 23 | // challenge parameters |
| 24 | $obyfit_wallet = 'WXJIHWMUYHRQRPP2MTRWC6PQHPFBO7HG'; |
| 25 | $fees = 5000; // should be enough for AA to pay for 8 transactions |
| 26 | $commission = 20000 - $fees; // 20,000 bytes - $5,000 bytes |
| 27 | $prize = 1000000; // 1,000,000 bytes |
| 28 | $expected_amnt = $prize + $commission + $fees; // amount that user has to sent to start |
| 29 | $period_goal = 1000; // period goal is 1,000 steps an hour in test // 10,000 steps in a day in prod |
| 30 | $duration = 7; // challenge duration is 7 periods (days) |
| 31 | $total_goal = $period_goal * $duration; // total goad is 7,000 steps in test / 70,000 steps in prod |
| 32 | |
| 33 | // challenge variables |
| 34 | // prize money from user |
| 35 | if (trigger.initial_address != $obyfit_wallet) { |
| 36 | // checking user input |
| 37 | if ( var[trigger.initial_address] ) bounce('Prize already received'); |
| 38 | if ( trigger.output[[asset=base]] < $expected_amnt ) bounce('Prize is too small.'); |
| 39 | if ( trigger.output[[asset=base]] > $expected_amnt ) bounce('Prize is too big.'); |
| 40 | // setting variables |
| 41 | $user_wallet = trigger.initial_address; |
| 42 | $day_nb = 0; |
| 43 | } |
| 44 | // data message from ObyFit |
| 45 | else { |
| 46 | $user_wallet = trigger.data.user_wallet; |
| 47 | if (trigger.data.user_steps <= $period_goal) { |
| 48 | $user_steps = trigger.data.user_steps; |
| 49 | } |
| 50 | else $user_steps = $period_goal; |
| 51 | //$user_steps = (trigger.data.user_steps <= $period_goal) ? trigger.data.user_steps : $period_goal; |
| 52 | $day_nb = trigger.data.day_nb; |
| 53 | $user_total_steps = trigger.data.user_total_steps; |
| 54 | $new_challenge = false; |
| 55 | } |
| 56 | }", |
| 57 | "messages": { |
| 58 | "cases": [ |
| 59 | { |
| 60 | "if": "{$day_nb == 0}", |
| 61 | "messages": [ |
| 62 | { |
| 63 | "app": "payment", |
| 64 | "payload": { |
| 65 | "asset": "base", |
| 66 | "outputs": [ |
| 67 | { |
| 68 | "address": "{ $obyfit_wallet }", |
| 69 | "amount": "{ $commission }" |
| 70 | } |
| 71 | ] |
| 72 | } |
| 73 | }, |
| 74 | { |
| 75 | "app": "state", |
| 76 | "state": "{ |
| 77 | var[$user_wallet] = $prize; |
| 78 | response['message'] = 'Starting your walking challenge.'; |
| 79 | }" |
| 80 | } |
| 81 | ] |
| 82 | }, |
| 83 | { |
| 84 | "if": "{$day_nb > 0 AND $day_nb < $duration AND $user_steps > 0}", |
| 85 | "messages": [ |
| 86 | { |
| 87 | "app": "payment", |
| 88 | "payload": { |
| 89 | "asset": "base", |
| 90 | "outputs": [ |
| 91 | { |
| 92 | "address": "{ $user_wallet }", |
| 93 | "amount": "{ $user_steps * 10 }" |
| 94 | } |
| 95 | ] |
| 96 | } |
| 97 | }, |
| 98 | { |
| 99 | "app": "state", |
| 100 | "state": "{ |
| 101 | var[$user_wallet] -= $user_steps * 10; |
| 102 | response['message'] = 'Keep on walking'; |
| 103 | }" |
| 104 | } |
| 105 | ] |
| 106 | }, |
| 107 | { |
| 108 | "if": "{$day_nb == $duration}", |
| 109 | "messages": [ |
| 110 | { |
| 111 | "app": "payment", |
| 112 | "payload": { |
| 113 | "cases": [ |
| 114 | { |
| 115 | "if": "{ ( $user_total_steps >= $total_goal ) }", |
| 116 | "payload": { |
| 117 | "asset": "base", |
| 118 | "outputs": [ |
| 119 | { |
| 120 | "address": "{ $user_wallet }", |
| 121 | "amount": "{ var[$user_wallet] }" |
| 122 | } |
| 123 | ] |
| 124 | } |
| 125 | }, |
| 126 | { |
| 127 | "if": "{ ( $user_total_steps < $total_goal AND $user_steps > 0 ) }", |
| 128 | "payload": { |
| 129 | "asset": "base", |
| 130 | "outputs": [ |
| 131 | { |
| 132 | "address": "{ $user_wallet }", |
| 133 | "amount": "{ $user_steps * 10 }" |
| 134 | } |
| 135 | ] |
| 136 | } |
| 137 | } |
| 138 | ] |
| 139 | } |
| 140 | }, |
| 141 | { |
| 142 | "app": "state", |
| 143 | "state": "{ |
| 144 | var[$user_wallet] = ''; |
| 145 | response['message'] = 'Challenge finished.'; |
| 146 | }" |
| 147 | } |
| 148 | ] |
| 149 | } |
| 150 | ] |
| 151 | } |
| 152 | } |
| 153 | ] |
| Message | formula { // ============================================================ // OBYFIT AA from Whistling Frogs - v 0.1 24 Oct 2019 // ============================================================ // Deposit 1,020,000 bytes and allow connection to Google Fit. // visit obyfit.whistlingfrogs.com // ============================================================ // Production settings: // Duration of the challange: 7 days / periods // Walk 10,000 steps a day to earn back up to 10,000 bytes a day. // Walk 70,000 steps in 7 days to earn back 30,000 bytes bonus. // (change period_goal and total_goal parameters) // ============================================================ // Test settings: // Duration of the challange: 7 hours / periods // Walk 1,000 steps an hour to earn back up to 10,000 bytes. // Walk 7,000 steps in 7 hous to earn back 30,000 bytes bonus. // ============================================================ // challenge parameters $obyfit_wallet = 'WXJIHWMUYHRQRPP2MTRWC6PQHPFBO7HG'; $fees = 5000; // should be enough for AA to pay for 8 transactions $commission = 20000 - $fees; // 20,000 bytes - $5,000 bytes $prize = 1000000; // 1,000,000 bytes $expected_amnt = $prize + $commission + $fees; // amount that user has to sent to start $period_goal = 1000; // period goal is 1,000 steps an hour in test // 10,000 steps in a day in prod $duration = 7; // challenge duration is 7 periods (days) $total_goal = $period_goal * $duration; // total goad is 7,000 steps in test / 70,000 steps in prod // challenge variables // prize money from user if (trigger.initial_address != $obyfit_wallet) { // checking user input if ( var[trigger.initial_address] ) bounce('Prize already received'); if ( trigger.output[[asset=base]] < $expected_amnt ) bounce('Prize is too small.'); if ( trigger.output[[asset=base]] > $expected_amnt ) bounce('Prize is too big.'); // setting variables $user_wallet = trigger.initial_address; $day_nb = 0; } // data message from ObyFit else { $user_wallet = trigger.data.user_wallet; if (trigger.data.user_steps <= $period_goal) { $user_steps = trigger.data.user_steps; } else $user_steps = $period_goal; //$user_steps = (trigger.data.user_steps <= $period_goal) ? trigger.data.user_steps : $period_goal; $day_nb = trigger.data.day_nb; $user_total_steps = trigger.data.user_total_steps; $new_challenge = false; } } failed: booleans cannot be compared with other types |
|---|
| Message | formula { // ============================================================ // OBYFIT AA from Whistling Frogs - v 0.1 24 Oct 2019 // ============================================================ // Deposit 1,020,000 bytes and allow connection to Google Fit. // visit obyfit.whistlingfrogs.com // ============================================================ // Production settings: // Duration of the challange: 7 days / periods // Walk 10,000 steps a day to earn back up to 10,000 bytes a day. // Walk 70,000 steps in 7 days to earn back 30,000 bytes bonus. // (change period_goal and total_goal parameters) // ============================================================ // Test settings: // Duration of the challange: 7 hours / periods // Walk 1,000 steps an hour to earn back up to 10,000 bytes. // Walk 7,000 steps in 7 hous to earn back 30,000 bytes bonus. // ============================================================ // challenge parameters $obyfit_wallet = 'WXJIHWMUYHRQRPP2MTRWC6PQHPFBO7HG'; $fees = 5000; // should be enough for AA to pay for 8 transactions $commission = 20000 - $fees; // 20,000 bytes - $5,000 bytes $prize = 1000000; // 1,000,000 bytes $expected_amnt = $prize + $commission + $fees; // amount that user has to sent to start $period_goal = 1000; // period goal is 1,000 steps an hour in test // 10,000 steps in a day in prod $duration = 7; // challenge duration is 7 periods (days) $total_goal = $period_goal * $duration; // total goad is 7,000 steps in test / 70,000 steps in prod // challenge variables // prize money from user if (trigger.initial_address != $obyfit_wallet) { // checking user input if ( var[trigger.initial_address] ) bounce('Prize already received'); if ( trigger.output[[asset=base]] < $expected_amnt ) bounce('Prize is too small.'); if ( trigger.output[[asset=base]] > $expected_amnt ) bounce('Prize is too big.'); // setting variables $user_wallet = trigger.initial_address; $day_nb = 0; } // data message from ObyFit else { $user_wallet = trigger.data.user_wallet; if (trigger.data.user_steps <= $period_goal) { $user_steps = trigger.data.user_steps; } else $user_steps = $period_goal; //$user_steps = (trigger.data.user_steps <= $period_goal) ? trigger.data.user_steps : $period_goal; $day_nb = trigger.data.day_nb; $user_total_steps = trigger.data.user_total_steps; $new_challenge = false; } } failed: booleans cannot be compared with other types |
|---|
| Message | formula { // ============================================================ // OBYFIT AA from Whistling Frogs - v 0.1 24 Oct 2019 // ============================================================ // Deposit 1,020,000 bytes and allow connection to Google Fit. // visit obyfit.whistlingfrogs.com // ============================================================ // Production settings: // Duration of the challange: 7 days / periods // Walk 10,000 steps a day to earn back up to 10,000 bytes a day. // Walk 70,000 steps in 7 days to earn back 30,000 bytes bonus. // (change period_goal and total_goal parameters) // ============================================================ // Test settings: // Duration of the challange: 7 hours / periods // Walk 1,000 steps an hour to earn back up to 10,000 bytes. // Walk 7,000 steps in 7 hous to earn back 30,000 bytes bonus. // ============================================================ // challenge parameters $obyfit_wallet = 'WXJIHWMUYHRQRPP2MTRWC6PQHPFBO7HG'; $fees = 5000; // should be enough for AA to pay for 8 transactions $commission = 20000 - $fees; // 20,000 bytes - $5,000 bytes $prize = 1000000; // 1,000,000 bytes $expected_amnt = $prize + $commission + $fees; // amount that user has to sent to start $period_goal = 1000; // period goal is 1,000 steps an hour in test // 10,000 steps in a day in prod $duration = 7; // challenge duration is 7 periods (days) $total_goal = $period_goal * $duration; // total goad is 7,000 steps in test / 70,000 steps in prod // challenge variables // prize money from user if (trigger.initial_address != $obyfit_wallet) { // checking user input if ( var[trigger.initial_address] ) bounce('Prize already received'); if ( trigger.output[[asset=base]] < $expected_amnt ) bounce('Prize is too small.'); if ( trigger.output[[asset=base]] > $expected_amnt ) bounce('Prize is too big.'); // setting variables $user_wallet = trigger.initial_address; $day_nb = 0; } // data message from ObyFit else { $user_wallet = trigger.data.user_wallet; if (trigger.data.user_steps <= $period_goal) { $user_steps = trigger.data.user_steps; } else $user_steps = $period_goal; //$user_steps = (trigger.data.user_steps <= $period_goal) ? trigger.data.user_steps : $period_goal; $day_nb = trigger.data.day_nb; $user_total_steps = trigger.data.user_total_steps; $new_challenge = false; } } failed: booleans cannot be compared with other types |
|---|
| Message | formula { // ============================================================ // OBYFIT AA from Whistling Frogs - v 0.1 24 Oct 2019 // ============================================================ // Deposit 1,020,000 bytes and allow connection to Google Fit. // visit obyfit.whistlingfrogs.com // ============================================================ // Production settings: // Duration of the challange: 7 days / periods // Walk 10,000 steps a day to earn back up to 10,000 bytes a day. // Walk 70,000 steps in 7 days to earn back 30,000 bytes bonus. // (change period_goal and total_goal parameters) // ============================================================ // Test settings: // Duration of the challange: 7 hours / periods // Walk 1,000 steps an hour to earn back up to 10,000 bytes. // Walk 7,000 steps in 7 hous to earn back 30,000 bytes bonus. // ============================================================ // challenge parameters $obyfit_wallet = 'WXJIHWMUYHRQRPP2MTRWC6PQHPFBO7HG'; $fees = 5000; // should be enough for AA to pay for 8 transactions $commission = 20000 - $fees; // 20,000 bytes - $5,000 bytes $prize = 1000000; // 1,000,000 bytes $expected_amnt = $prize + $commission + $fees; // amount that user has to sent to start $period_goal = 1000; // period goal is 1,000 steps an hour in test // 10,000 steps in a day in prod $duration = 7; // challenge duration is 7 periods (days) $total_goal = $period_goal * $duration; // total goad is 7,000 steps in test / 70,000 steps in prod // challenge variables // prize money from user if (trigger.initial_address != $obyfit_wallet) { // checking user input if ( var[trigger.initial_address] ) bounce('Prize already received'); if ( trigger.output[[asset=base]] < $expected_amnt ) bounce('Prize is too small.'); if ( trigger.output[[asset=base]] > $expected_amnt ) bounce('Prize is too big.'); // setting variables $user_wallet = trigger.initial_address; $day_nb = 0; } // data message from ObyFit else { $user_wallet = trigger.data.user_wallet; if (trigger.data.user_steps <= $period_goal) { $user_steps = trigger.data.user_steps; } else $user_steps = $period_goal; //$user_steps = (trigger.data.user_steps <= $period_goal) ? trigger.data.user_steps : $period_goal; $day_nb = trigger.data.day_nb; $user_total_steps = trigger.data.user_total_steps; $new_challenge = false; } } failed: booleans cannot be compared with other types |
|---|