Unit ID
OYHh8ah+ErS6Gr74oLMNXkxHpz6I9FDEgiaFQoVHw5w=
Received
14.08.2019 19:00:45
Confirmation delay (full node)
2 minutes 53 seconds
Confirmation delay (light node)
4 minutes 27 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $asset = var['asset']; $founder = var['founder']; $minutes_from_epoch = timestamp / 60; $hours_from_epoch = $minutes_from_epoch / 60; $days_from_epoch = $hours_from_epoch / 24; $weeks_from_epoch = $days_from_epoch / 7; $periods_from_epoch = floor($hours_from_epoch); // choose weeks, days, hours or minutes here $current_period = $periods_from_epoch - var['start'] + 1; $max_claim_per_period = 1e6; $max_crowdsale_periods = 720; }", "messages": { "cases": [ { "if": "{!$asset}", "messages": [ { "app": "asset", "payload": { "is_private": false, "is_transferrable": true, "auto_destroy": true, "fixed_denominations": false, "issued_by_definer_only": true, "cosigned_by_definer": false, "spender_attested": false } }, { "app": "state", "state": "{ var['asset'] = response_unit; var['founder'] = trigger.address; var['start'] = $periods_from_epoch; response['message'] = 'Crowdsale started'; }" } ] }, { "if": "{$asset AND trigger.address == $founder}", "init": "{ $founder_claim_amount = balance[base]-5000; }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$founder}", "amount": "{$founder_claim_amount}" } ] } }, { "app": "state", "state": "{ response['message'] = 'Founder claimed'; }" } ] }, { "if": "{$asset AND trigger.address != $founder AND trigger.data.claim_period}", "init": "{ if (trigger.data.claim_period >= $current_period) bounce('Claiming is only possible for previous periods.'); $claim_address = trigger.data.claim_address ? trigger.data.claim_address : trigger.address; $investor_claim_period = var['investor_' || $claim_address || '_' || trigger.data.claim_period]; if (!$investor_claim_period) bounce('Investor didn\'t invest on that period or already claimed that period.'); $total_raised_on_period = var['total_raised_' || trigger.data.claim_period] + $amount; $invesor_share = $investor_claim_period / $total_raised_on_period; $claim_amount = floor($invesor_share * $max_claim_per_period); }", "messages": [ { "app": "payment", "payload": { "asset": "{$asset}", "outputs": [ { "address": "{$claim_address}", "amount": "{$claim_amount}" } ] } }, { "app": "state", "state": "{ var['investor_' || $claim_address || '_' || trigger.data.claim_period] = false; response['message'] = 'Investor claimed'; }" } ] }, { "if": "{$asset AND trigger.address != $founder AND !trigger.data.claim_period AND $current_period <= $max_crowdsale_periods}", "init": "{ $investor_on_period = var['investor_' || trigger.address || '_' || $current_period]; $amount = trigger.output[[asset=base]]; $total_raised_on_period = var['total_raised_' || $current_period] + $amount; $total_investor_on_period = $investor_on_period + $amount; }", "messages": [ { "app": "state", "state": "{ var['total_raised_' || $current_period] = $total_raised_on_period; var['investor_' || trigger.address || '_' || $current_period] = $total_investor_on_period; response['message'] = 'Use claim_period=' || $current_period || ' and claim_address=' || trigger.address || ' in data.'; }" } ] } ] } } ]
Technical information
Fees:
3,133 bytes
(353 headers, 2780 payload)
Level:998978
Witnessed level:998971
Main chain index:997796
Latest included mc index:997795
Status:stable/confirmed/final