Unit ID
2yon2/iel4azx5ydB0ZNryAXI90VyFMXE3DZ8iNW3qU=
Received
08.10.2019 10:31:28
Confirmation delay (full node)
2 minutes 46 seconds
Confirmation delay (light node)
6 minutes 33 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ // ================= OBYSTACK ================= // ============================================ // OBYTE STACK GAME from Whistling Frogs // ============================================ // First published by Crypto Girl on 21 Sep 2019 // ============================================ // Version: 1.0 - 8 Oct 2019 // ============================================ // Can be used with OBYTE STACK GAME BOT v1.0 // Pairing code: // [email protected]/bb-test#StackGame // ============================================ // The 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 50 sec timer. // If more than 50 sec 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. // ============================================ // Visit https://whistling-frogs.herokuapp.com/obyStack // for a full description of the game. // ============================================ // // setting game parameters $bot_address_back = 'QUONK7CUHPTGLNTZ6JE57SDVSFVDBCMM'; $commission_payout_threshold = 50000; $commission = 10000; $seed_amnt = 10000; $min_bid_amnt = 100000; $fees = 1000; // setting game variables $bid_amnt = trigger.output[[asset=base]]; $game_finished = (trigger.initial_address == $bot_address) otherwise false; if ( ($game_finished == false) AND ($bid_amnt < $min_bid_amnt) ) bounce('Your bid is too small.'); $game_status = var['game_status'] otherwise 'not started'; }", "messages": { "cases": [ { "if": "{$game_finished == false AND $game_status == 'not started'}", "messages": [ { "app": "state", "state": "{ var['stack_amnt'] = $bid_amnt - $commission; var['commission_pot'] += $commission - $fees; var['author'] = trigger.initial_address; var['leader'] = trigger.initial_address; var['game_status'] = 'running'; response['message'] = 'Thank you for playing'; }" } ] }, { "if": "{$game_finished == false AND $game_status == 'running'}", "messages": [ { "app": "state", "state": "{ var['stack_amnt'] += ($bid_amnt - $commission); var['commission_pot'] += $commission; var['leader'] = trigger.initial_address; response['message'] = 'Thank you for playing'; }" } ] }, { "if": "{$game_finished}", "messages": [ { "app": "payment", "payload": { "cases": [ { "if": "{(var['author'] == var['leader']) AND (var['commission_pot'] >= $commission_payout_threshold)}", "payload": { "asset": "base", "outputs": [ { "address": "{ var['leader'] }", "amount": "{ var['stack_amnt'] }" }, { "address": "{ $bot_address }", "amount": "{ balance[base] - var['stack_amnt'] - $seed_amnt }" } ] } }, { "if": "{(var['author'] == var['leader']) AND (var['commission_pot'] < $commission_payout_threshold)}", "payload": { "asset": "base", "outputs": [ { "address": "{ var['leader'] }", "amount": "{ var['stack_amnt'] }" } ] } }, { "if": "{(var['author'] != var['leader']) AND (var['commission_pot'] >= $commission_payout_threshold)}", "payload": { "asset": "base", "outputs": [ { "address": "{ var['author'] }", "amount": "{ var['stack_amnt'] / 2 }" }, { "address": "{ var['leader'] }", "amount": "{ var['stack_amnt'] / 2 }" }, { "address": "{ $bot_address }", "amount": "{ balance[base] - var['stack_amnt'] - $seed_amnt }" } ] } }, { "if": "{(var['author'] != var['leader']) AND (var['commission_pot'] < $commission_payout_threshold)}", "payload": { "asset": "base", "outputs": [ { "address": "{ var['author'] }", "amount": "{ var['stack_amnt'] / 2 }" }, { "address": "{ var['leader'] }", "amount": "{ var['stack_amnt'] / 2 }" } ] } } ] } }, { "app": "state", "state": "{ // game is finished var['game_status'] = 'not started'; if (var['commission_pot'] >= $commission_payout_threshold) var['commission_pot'] = 0; var['commission_pot'] += $bid_amnt; // add money from the bot to the commission pot var['stack_amnt'] = 0; var['author'] = ''; var['leader'] = ''; response['message'] = 'Game finished.'; }" } ] } ] } } ]
Technical information
Fees:
4,388 bytes
(353 headers, 4035 payload)
Level:1097484
Witnessed level:1097477
Main chain index:1096244
Latest included mc index:1096243
Status:stable/confirmed/final