Unit ID
zVZw2KCdsfG28SM/5Sar10nOsRKahOJQhzsKvjkWxxM=
Received
30.07.2019 19:29:34
Confirmation delay (full node)
2 minutes 50 seconds
Confirmation delay (light node)
5 minutes 58 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $min = 2000; $addr = trigger.address; $inp = trigger.output[[asset=base]]; $time_btw_draw = 3600; }", "messages": { "cases": [ { "if": "{ var['Last draw'] AND var[$addr||var['Last draw']] AND timestamp > (var['Last draw']+$time_btw_draw) }", "messages": [ { "init": "{ $number = var['Number']; $percent_for_trigger = 100/$number; $percent_for_winner = 100 - $percent_for_trigger; $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,1,var['Number']-1); $winner_addr = var[$last_lucky||var['Last draw']]; $winner_amount = (var['Total pot']*$percent_for_winner/100)-$min; $trigger_amount = (var['Total pot']*$percent_for_trigger/100)+$inp-$min; }", "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['Last draw'] = false; var['Total pot']= 0; var['Number'] = 0; response['message'] = 'You triggered draw calculation!'; }" } ] }, { "if": "{ $inp == 10000 AND (!var['Last draw'] OR timestamp < (var['Last draw']+$time_btw_draw)) }", "messages": [ { "app": "state", "state": "{ if(!var['Last draw']){ var['Number'] = 0; var['Last draw'] = timestamp; } $num = var['Number']; var[$num||var['Last draw']] = $addr; var[$addr||var['Last draw']] = true; var['Number'] += 1; var['Total pot'] += $inp; 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,257 bytes
(353 headers, 1904 payload)
Level:976764
Witnessed level:976757
Main chain index:975584
Latest included mc index:975583
Status:stable/confirmed/final