Unit ID
dlryxcJVDGo70xNKjbHoJTB6eXTTfMmXkMOigesClL0=
Received
18.08.2019 00:53:24
Confirmation delay (full node)
4 minutes 48 seconds
Confirmation delay (light node)
5 minutes 47 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $fee = 4000; $addr = trigger.address; $inp = trigger.output[[asset=base]]; $time_btw_draw = 3600; $buyin = 10000; }", "messages": { "cases": [ { "if": "{ var['Start'] AND var[$addr||var['Start']] AND timestamp > (var['Start']+$time_btw_draw) }", "messages": [ { "init": "{ $num = var['Start']+timestamp; $last_lucky = number_from_seed($num||var['Seed'],var['Number']-1); $winner_addr = var[$last_lucky||var['Start']]; $total_pot = $buyin*var['Number']; if($winner_addr == $addr){ $winner_amount = 0; $trigger_amount = $total_pot+ $inp- $fee ; } else{ $winner_amount = $total_pot - $buyin - $fee; $trigger_amount = $buyin + $inp; } }", "app": "payment", "payload": { "asset": "base", "outputs": [ { "if": "{$winner_amount > 0}", "address": "{$winner_addr}", "amount": "{$winner_amount}" }, { "if": "{$trigger_amount > 0}", "address": "{$addr}", "amount": "{$trigger_amount}" } ] } }, { "app": "state", "state": "{ var['Start'] = false; var['Number'] = 0; response['message'] = 'You triggered draw calculation!'; }" } ] }, { "if": "{ $inp == $buyin AND (!var['Start'] OR timestamp < (var['Start']+$time_btw_draw)) }", "messages": [ { "app": "state", "state": "{ if(!var['Start']){ var['Number'] = 0; var['Start'] = timestamp; var['Seed'] = sha256($addr); } $num = var['Number']; var[$num||var['Start']] = $addr; var[$addr||var['Start']] = true; var['Seed'] = sha256(var['Seed']||$addr); var['Number'] += 1; response['message'] = 'you bought one participation, your number: '|| $num ; }" } ] }, { "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$addr}", "amount": "{$inp-1000}" } ] } } ] } ] } } ]
Technical information
Fees:
2,050 bytes
(353 headers, 1697 payload)
Level:1006656
Witnessed level:1006649
Main chain index:1005474
Latest included mc index:1005473
Status:stable/confirmed/final