Unit ID
XLN8nLNu8+twvxYQRJ/aHGPcWPQaW8ve8/8eS4JlHzU=
Received
02.08.2019 06:52:44
Confirmation delay (full node)
4 minutes 44 seconds
Confirmation delay (light node)
5 minutes 57 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $expiration = 86400 * 30; // 30 days $threshold = ceil(var['vested_total'] / 2); $senderVest = var['vested_' || trigger.address]; }", "bounce_fees": { "base": 10000 }, "messages": { "cases": [ { "if": "{trigger.data.vest}", "init": "{ if (trigger.output[[asset=base]] <= 10000) bounce('You need to send more than the bouce fees'); $vestAmount = (trigger.output[[asset=base]] - 10000); }", "messages": [ { "app": "state", "state": "{ var['vested_' || trigger.address] += $vestAmount; var['vested_total'] += $vestAmount; response['message'] = 'invested ' || $vestAmount || ' bytes into the DAO'; response['vest_amount'] = $vestAmount; }" } ] }, { "if": "{trigger.data.proposal AND trigger.data.amount AND trigger.data.amount > 1}", "init": "{ $nextProposal = (var['last_proposal'] + 1); }", "messages": [ { "app": "state", "state": "{ var['proposal_' || $nextProposal] = true; var['proposal_' || $nextProposal || '_url'] = trigger.data.proposal; var['proposal_' || $nextProposal || '_expiration'] = timestamp + $expiration; var['proposal_' || $nextProposal || '_amount'] = trigger.data.amount; var['proposal_' || $nextProposal || '_author'] = trigger.address; var['last_proposal'] = $nextProposal; response['message'] = 'submitted proposal id ' || $nextProposal; response['proposal_id'] = $nextProposal; response['proposal_expiration'] = timestamp + $nextProposal; }" } ] }, { "if": "{trigger.data.vote AND trigger.data.proposal}", "init": "{ if (!var['proposal_' || trigger.data.proposal]) bounce('This proposal does not exist'); if (timestamp > var['proposal_' || trigger.data.proposal || '_expiration']) bounce('This proposal has expired, you can not vote for it'); if (var['proposal_' || trigger.data.proposal || '_vote_' || trigger.address]) bounce('You already voted for this proposal'); if (!$senderVest) bounce('You need vest to vote for a proposal'); }", "messages": [ { "app": "state", "state": "{ var['proposal_' || trigger.data.proposal || '_vote_' || trigger.address] = true; var['proposal_' || trigger.data.proposal || '_vest'] += $senderVest; if ( var['proposal_' || trigger.data.proposal || '_expiration'] > (var['vested_' || trigger.address || '_expiration'] otherwise 0) ) { var['vested_' || trigger.address || '_expiration'] = var['proposal_' || trigger.data.proposal || '_expiration']; } response['message'] = trigger.address || 'voted for proposal id ' || trigger.data.proposal; }" } ] }, { "if": "{trigger.data.claim AND trigger.data.proposal}", "init": "{ if (var['proposal_' || trigger.data.proposal || '_author'] != trigger.address) bounce('You can not claim funds from someone else proposal'); if (var['proposal_' || trigger.data.proposal || '_vest'] < $threshold) bounce('You can not claim funds if your proposal has not reached the threshold'); if (var['proposal_' || trigger.data.proposal || '_paid']) bounce('You already claimed the fund from this proposal'); }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{var['proposal_' || trigger.data.proposal || '_amount']}" } ] } }, { "app": "state", "state": "{ var['proposal_' || trigger.data.proposal || '_paid'] = true; response['message'] = 'claimed funds from proposal ' || trigger.data.proposal; }" } ] }, { "if": "{trigger.data.profit AND trigger.data.proposal}", "init": "{ if (!var['proposal_' || trigger.data.proposal]) bounce('This proposal does not exist'); }", "messages": [ { "app": "state", "state": "{ var['proposal_' || trigger.data.proposal || '_profit'] += trigger.output[[asset=base]]; response['message'] = 'sent profit to proposal ' || trigger.data.proposal; }" } ] }, { "if": "{trigger.data.unvest}", "init": "{ if (var['vested_' || trigger.address] == 0) bounce('Your vesting balance is empty'); if (timestamp < var['vested_' || trigger.address || '_expiration']) bounce('You need to wait proposal to expire to unvest'); $amount = ceil((var['vested_' || trigger.address] / var['vested_total']) * balance[base]); }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{$amount}" } ] } }, { "app": "state", "state": "{ var['vested_total'] -= var['vested_' || trigger.address]; var['vested_' || trigger.address] = 0; response['message'] = 'withdraw funds from vest in bytes'; response['amount'] = $amount; }" } ] } ] } } ]
Technical information
Fees:
4,805 bytes
(353 headers, 4452 payload)
Level:980798
Witnessed level:980791
Main chain index:979618
Latest included mc index:979617
Status:stable/confirmed/final