Unit ID
YJbDsNf2OjrknKVIv9A1yPuyl5WSbcljN5u8RHLOZp0=
Received
08.09.2019 23:23:47
Confirmation delay (full node)
3 minutes 59 seconds
Confirmation delay (light node)
6 minutes 54 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $asset = var['asset']; $destination_aa = ''; $team = ''; }", "messages": { "cases": [ { "if": "{trigger.data.start AND !$asset}", "messages": [ { "app": "asset", "payload": { "is_private": false, "is_transferrable": true, "auto_destroy": false, "fixed_denominations": false, "issued_by_definer_only": true, "cosigned_by_definer": false, "spender_attested": false } }, { "app": "state", "state": "{ var[response_unit || '_status'] = 'open'; var['asset'] = response_unit; response['asset'] = response_unit; }" } ] }, { "if": "{trigger.output[[asset=base]] >= 1e5 AND $asset}", "init": "{ if (var[$destination_aa]['finished']) bounce('game over'); $amount = trigger.output[[asset=base]] - 2000; // to account for fees we need to respond now and to refund bytes or pay shares later $total_raised = var['total_raised'] + $amount; $missing_amount = ceil((balance[$destination_aa][base] + $total_raised)*0.51) - var[$destination_aa]['team_' || $team || '_amount']; $bDone = ($total_raised > $missing_amount); }", "messages": [ { "app": "payment", "payload": { "asset": "{$asset}", "outputs": [ { "address": "{trigger.address}", "amount": "{$amount}" } ] } }, { "if": "{$bDone}", "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$destination_aa}", "amount": "{$total_raised}" } ] } }, { "if": "{$bDone}", "app": "data", "payload": { "team": "{$team}" } }, { "app": "state", "state": "{ if ($bDone) var[$asset || '_status'] = 'raised'; else var['total_raised'] = $total_raised; }" } ] }, { "if": "{trigger.output[[asset=var[$destination_aa]['team_' || $team || '_asset']]] AND $asset}", "messages": [ { "app": "state", "state": "{ var[$asset || '_status'] = 'done'; var['asset'] = false; var['total_raised'] = false; }" } ] }, { "if": "{$asset AND trigger.output[[asset=$asset]] > 0}", "init": "{ $amount = trigger.output[[asset=$asset]]; }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{$amount}" } ] } }, { "app": "state", "state": "{ var['total_raised'] -= $amount; }" } ] }, { "if": "{ $in_asset = trigger.output[[asset!=base]].asset; var[$in_asset || '_status'] == 'done' }", "messages": [ { "app": "payment", "payload": { "asset": "{var[$destination_aa]['team_' || $team || '_asset']}", "outputs": [ { "address": "{trigger.address}", "amount": "{trigger.output[[asset=$in_asset]]}" } ] } } ] } ] } } ]
Technical information
Fees:
2,233 bytes
(353 headers, 1880 payload)
Level:1052216
Witnessed level:1052209
Main chain index:1050989
Latest included mc index:1050988
Status:stable/confirmed/final