Unit ID
MhAp0PXYu37yEXjAz5pVFyQTNbAIqkClOENSls2qZsU=
Received
28.07.2019 19:36:55
Confirmation delay (full node)
1 minute 45 seconds
Confirmation delay (light node)
3 minutes 34 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $admin = 'JBGMJI7XSKLKNHZF26BUBWHVUZSDV3P5'; $min = 2000; $addr = trigger.address; $inp = trigger.output[[asset=base]]; $time_btw_draw = 86400000; }", "messages": { "cases": [ { "if": "{ $allowed = balance[base] - $inp - var['Total pot'] - $min; $total = $allowed + $inp; $admin == $addr AND trigger.data.withdraw AND trigger.data.withdraw == 'left' AND $allowed > 0 }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$addr}", "amount": "{$total}" } ] } } ] }, { "if": "{ var['Last draw'] AND timestamp > (var['Last draw']+$time_btw_draw) }", "messages": [ { "init": "{ $num1 = data_feed[[oracles='F4KHJUCLJKY4JV7M5F754LAJX4EB7M4N', feed_name='TOTAL_CAP']]; $num2 = data_feed[[oracles='F4KHJUCLJKY4JV7M5F754LAJX4EB7M4N', feed_name='GBYTE_USD']]; $num3 = $num1 + $num2 + var['Last draw']; $last_lucky = number_from_seed($num3||mc_unit,var['Number']-1); $winner_addr = var[$last_lucky||var['Last draw']]; }", "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$winner_addr}", "amount": "{var['Total pot']-$min}" } ] } }, { "app": "state", "state": "{ var['Last draw'] = timestamp; var['Total pot']= 0; var['Number'] = 0; $num = var['Number']; var[$num||var['Last draw']] = $addr; var['Number'] += 1;//not allowed ($inp % 10000) var['Total pot'] += $inp; response['message'] = 'you bought one participation, your number: '|| $num ; }" } ] }, { "if": "{ $inp == 10000 }", "messages": [ { "app": "state", "state": "{ if(!var['Number']){ var['Number'] = 0; var['Last draw'] = timestamp; } $num = var['Number']; var[$num||var['Last draw']] = $addr; var['Number'] += 1;//not allowed ($inp % 10000) var['Total pot'] += $inp; response['message'] = 'you bought one participation, your number: '|| $num ; }" } ] }, { "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{trigger.output[[asset=base]] - 1000}" } ] } } ] } ] } } ]
Technical information
Fees:
2,291 bytes
(353 headers, 1938 payload)
Level:973669
Witnessed level:973660
Main chain index:972664
Latest included mc index:972663
Status:stable/confirmed/final