| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | // |
| 6 | // ========================================== |
| 7 | // OBYTE STACK GAME from Whistling Frogs |
| 8 | // ========================================== |
| 9 | // Written by Crypto Girl on 21 Sep 2019 |
| 10 | // ========================================== |
| 11 | // Version: 0.3 - 27 Sept 2019 |
| 12 | // ========================================== |
| 13 | // Can be used with OBYTE STACK GAME BOT v0.1 |
| 14 | // =========================================== |
| 15 | // |
| 16 | // TThe object of the game is to win the Stack. |
| 17 | // Users make bids. Min bid is 100,000 bytes. |
| 18 | // 1st bid initiates the Stack. |
| 19 | // Each subsequent bid starts the 5 min timer. |
| 20 | // If more than 5 min has passed since the previous |
| 21 | // bid, the (stack - commission) is shared equally |
| 22 | // between the last bidder and the 1st bidder. |
| 23 | // The new stack is initiated with the current bid. |
| 24 | // A commission of 10,000 bytes is charged on each bid. |
| 25 | // |
| 26 | // Setting Game parameters |
| 27 | // |
| 28 | $min_bid_amnt = 100000; // 100,000 is about £0.02 to be increaded to £0.50 |
| 29 | $fee = 10000; // 10,000 for now to be replaced with 1% of the pot |
| 30 | $seed_amnt = 10000; |
| 31 | $commission = var['commisson'] otherwise 0; |
| 32 | $commission_address = 'B7KF2F5AP6BZLXOE2EGHH6BKZWVNIKWF'; //testnet |
| 33 | $commission_payout_threshold = 10000; // amount kept small for testing |
| 34 | // |
| 35 | // Initilising Game variables |
| 36 | // |
| 37 | $game_status = var['game_status'] otherwise 'not started'; |
| 38 | $bid_amnt = trigger.output[[asset=base]]; |
| 39 | $bid_status = ($bid_amnt >= $min_bid_amnt) otherwise false; |
| 40 | if ($bid_status == false AND trigger.initial_address != $bot_address) |
| 41 | bounce('Your bid is too small and will be returned to you - fees'); |
| 42 | if (trigger.initial_address == $bot_address) |
| 43 | $bot_command = 'stop the game'; |
| 44 | else |
| 45 | $bot_command = 'keep on playing'; |
| 46 | }", |
| 47 | "messages": [ |
| 48 | { |
| 49 | "app": "payment", |
| 50 | "if": "{$bot_command == 'stop the game'}", |
| 51 | "payload": { |
| 52 | "asset": "base", |
| 53 | "outputs": [ |
| 54 | { |
| 55 | "address": "{ var['leader'] }", |
| 56 | "amount": "{ var['stack_amnt']/2 }" |
| 57 | } |
| 58 | ] |
| 59 | } |
| 60 | }, |
| 61 | { |
| 62 | "app": "payment", |
| 63 | "if": "{$bot_command == 'stop the game'}", |
| 64 | "payload": { |
| 65 | "asset": "base", |
| 66 | "outputs": [ |
| 67 | { |
| 68 | "address": "{ var['author'] }", |
| 69 | "amount": "{ var['stack_amnt']/2 }" |
| 70 | } |
| 71 | ] |
| 72 | } |
| 73 | }, |
| 74 | { |
| 75 | "app": "payment", |
| 76 | "if": "{ $commission >= $commission_payout_threshold }", |
| 77 | "payload": { |
| 78 | "asset": "base", |
| 79 | "outputs": [ |
| 80 | { |
| 81 | "address": "{ $commission_address }", |
| 82 | "amount": "{ var['commission'] }" |
| 83 | } |
| 84 | ] |
| 85 | } |
| 86 | }, |
| 87 | { |
| 88 | "app": "state", |
| 89 | "state": "{ |
| 90 | // game not started |
| 91 | if ($bid_status AND $game_status == 'not started') { |
| 92 | var['stack_amnt'] = $bid_amnt - $fee; |
| 93 | var['author'] = trigger.initial_address; |
| 94 | var['leader'] = trigger.initial_address; |
| 95 | var['game_status'] = 'running'; |
| 96 | response['status'] = var['game_status']; |
| 97 | } |
| 98 | // game is running |
| 99 | if ($bid_status == true AND $game_status == 'running') { |
| 100 | var['stack_amnt'] += ($bid_amnt - $fee); |
| 101 | var['leader'] = trigger.initial_address; |
| 102 | var['game_status'] = 'running'; |
| 103 | response['status'] = var['game_status']; |
| 104 | } |
| 105 | // game is finished |
| 106 | if ($bot_command == 'stop the game') { |
| 107 | var['commission'] = balance[base] - $seed_amnt; |
| 108 | var['stack_amnt'] = 0; |
| 109 | var['leader'] = ''; |
| 110 | var['author'] = ''; |
| 111 | var['game_status'] = 'not started'; |
| 112 | response['commisson'] = var['commisson']; |
| 113 | } |
| 114 | }" |
| 115 | } |
| 116 | ] |
| 117 | } |
| 118 | ] |
| Message | formula { // // ========================================== // OBYTE STACK GAME from Whistling Frogs // ========================================== // Written by Crypto Girl on 21 Sep 2019 // ========================================== // Version: 0.3 - 27 Sept 2019 // ========================================== // Can be used with OBYTE STACK GAME BOT v0.1 // =========================================== // // TThe object of the game is to win the Stack. // Users make bids. Min bid is 100,000 bytes. // 1st bid initiates the Stack. // Each subsequent bid starts the 5 min timer. // If more than 5 min has passed since the previous // bid, the (stack - commission) is shared equally // between the last bidder and the 1st bidder. // The new stack is initiated with the current bid. // A commission of 10,000 bytes is charged on each bid. // // Setting Game parameters // $min_bid_amnt = 100000; // 100,000 is about £0.02 to be increaded to £0.50 $fee = 10000; // 10,000 for now to be replaced with 1% of the pot $seed_amnt = 10000; $commission = var['commisson'] otherwise 0; $commission_address = 'B7KF2F5AP6BZLXOE2EGHH6BKZWVNIKWF'; //testnet $commission_payout_threshold = 10000; // amount kept small for testing // // Initilising Game variables // $game_status = var['game_status'] otherwise 'not started'; $bid_amnt = trigger.output[[asset=base]]; $bid_status = ($bid_amnt >= $min_bid_amnt) otherwise false; if ($bid_status == false AND trigger.initial_address != $bot_address) bounce('Your bid is too small and will be returned to you - fees'); if (trigger.initial_address == $bot_address) $bot_command = 'stop the game'; else $bot_command = 'keep on playing'; } failed: booleans cannot be compared with other types |
|---|
| Message | formula { // // ========================================== // OBYTE STACK GAME from Whistling Frogs // ========================================== // Written by Crypto Girl on 21 Sep 2019 // ========================================== // Version: 0.3 - 27 Sept 2019 // ========================================== // Can be used with OBYTE STACK GAME BOT v0.1 // =========================================== // // TThe object of the game is to win the Stack. // Users make bids. Min bid is 100,000 bytes. // 1st bid initiates the Stack. // Each subsequent bid starts the 5 min timer. // If more than 5 min has passed since the previous // bid, the (stack - commission) is shared equally // between the last bidder and the 1st bidder. // The new stack is initiated with the current bid. // A commission of 10,000 bytes is charged on each bid. // // Setting Game parameters // $min_bid_amnt = 100000; // 100,000 is about £0.02 to be increaded to £0.50 $fee = 10000; // 10,000 for now to be replaced with 1% of the pot $seed_amnt = 10000; $commission = var['commisson'] otherwise 0; $commission_address = 'B7KF2F5AP6BZLXOE2EGHH6BKZWVNIKWF'; //testnet $commission_payout_threshold = 10000; // amount kept small for testing // // Initilising Game variables // $game_status = var['game_status'] otherwise 'not started'; $bid_amnt = trigger.output[[asset=base]]; $bid_status = ($bid_amnt >= $min_bid_amnt) otherwise false; if ($bid_status == false AND trigger.initial_address != $bot_address) bounce('Your bid is too small and will be returned to you - fees'); if (trigger.initial_address == $bot_address) $bot_command = 'stop the game'; else $bot_command = 'keep on playing'; } failed: booleans cannot be compared with other types |
|---|
| Message | formula { // // ========================================== // OBYTE STACK GAME from Whistling Frogs // ========================================== // Written by Crypto Girl on 21 Sep 2019 // ========================================== // Version: 0.3 - 27 Sept 2019 // ========================================== // Can be used with OBYTE STACK GAME BOT v0.1 // =========================================== // // TThe object of the game is to win the Stack. // Users make bids. Min bid is 100,000 bytes. // 1st bid initiates the Stack. // Each subsequent bid starts the 5 min timer. // If more than 5 min has passed since the previous // bid, the (stack - commission) is shared equally // between the last bidder and the 1st bidder. // The new stack is initiated with the current bid. // A commission of 10,000 bytes is charged on each bid. // // Setting Game parameters // $min_bid_amnt = 100000; // 100,000 is about £0.02 to be increaded to £0.50 $fee = 10000; // 10,000 for now to be replaced with 1% of the pot $seed_amnt = 10000; $commission = var['commisson'] otherwise 0; $commission_address = 'B7KF2F5AP6BZLXOE2EGHH6BKZWVNIKWF'; //testnet $commission_payout_threshold = 10000; // amount kept small for testing // // Initilising Game variables // $game_status = var['game_status'] otherwise 'not started'; $bid_amnt = trigger.output[[asset=base]]; $bid_status = ($bid_amnt >= $min_bid_amnt) otherwise false; if ($bid_status == false AND trigger.initial_address != $bot_address) bounce('Your bid is too small and will be returned to you - fees'); if (trigger.initial_address == $bot_address) $bot_command = 'stop the game'; else $bot_command = 'keep on playing'; } failed: booleans cannot be compared with other types |
|---|