Unit ID
JDZaKNmRnXlBHmqupdU48YLlJyrrilPXVLLKhxMK27o=
Received
24.10.2019 16:59:04
Confirmation delay (full node)
3 minutes 19 seconds
Confirmation delay (light node)
6 minutes 26 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ // ============================================================ // 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; $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; } }", "messages": { "cases": [ { "if": "{$day_nb == 0}", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $obyfit_wallet }", "amount": "{ $commission }" } ] } }, { "app": "state", "state": "{ var[$user_wallet] = $prize; response['message'] = 'Starting your walking challenge.'; }" } ] }, { "if": "{$day_nb > 0 AND $day_nb < $duration AND $user_steps > 0}", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $user_wallet }", "amount": "{ $user_steps * 10 }" } ] } }, { "app": "state", "state": "{ var[$user_wallet] -= $user_steps * 10; response['message'] = 'Keep on walking'; }" } ] }, { "if": "{$day_nb == $duration}", "messages": [ { "app": "payment", "payload": { "cases": [ { "if": "{ ( $user_total_steps >= $total_goal ) }", "payload": { "asset": "base", "outputs": [ { "address": "{ $user_wallet }", "amount": "{ var[$user_wallet] }" } ] } }, { "if": "{ ( $user_total_steps < $total_goal AND $user_steps > 0 ) }", "payload": { "asset": "base", "outputs": [ { "address": "{ $user_wallet }", "amount": "{ $user_steps * 10 }" } ] } } ] } }, { "app": "state", "state": "{ var[$user_wallet] = ''; response['message'] = 'Challenge finished.'; }" } ] } ] } } ]
Technical information
Fees:
3,791 bytes
(353 headers, 3438 payload)
Level:1120670
Witnessed level:1120663
Main chain index:1119428
Latest included mc index:1119427
Status:stable/confirmed/final