Unit ID
fLw8Uh8KjxPCOVYkjOdqsF3z6xoa7/v+6jZBs2432vU=
Received
31.08.2024 23:13:37
Confirmation delay (full node)
9 minutes 5 seconds
Confirmation delay (light node)
18 minutes 46 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $team_creation_fee = 1; $challenging_period = 24*3600; $bFinished = var['finished']; }", "messages": { "cases": [ { "if": "{trigger.data.create_team AND !$bFinished}", "init": "{ if (var['team_' || trigger.address || '_amount']) bounce('you already have a team'); if (trigger.output[[asset=base]] < $team_creation_fee) bounce('not enough to pay for team creation'); }", "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": "payment", "if": "{trigger.output[[asset=base]] > $team_creation_fee}", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{trigger.output[[asset=base]] - $team_creation_fee}" } ] } }, { "app": "state", "state": "{ var['team_' || trigger.address || '_founder_tax'] = trigger.data.founder_tax otherwise 0; var['team_' || trigger.address || '_asset'] = response_unit; response['team_asset'] = response_unit; }" } ] }, { "if": "{trigger.data.team AND !$bFinished}", "init": "{ if (!var['team_' || trigger.data.team || '_asset']) bounce('no such team'); if (var['winner'] AND var['winner'] == trigger.data.team) bounce('contributions to candidate winner team are not allowed'); }", "messages": [ { "app": "payment", "payload": { "asset": "{var['team_' || trigger.data.team || '_asset']}", "outputs": [ { "address": "{trigger.address}", "amount": "{trigger.output[[asset=base]]}" } ] } }, { "app": "state", "state": "{ var['team_' || trigger.data.team || '_amount'] += trigger.output[[asset=base]]; if (var['team_' || trigger.data.team || '_amount'] > balance[base]*0.51){ var['winner'] = trigger.data.team; var['challenging_period_start_ts'] = timestamp; } }" } ] }, { "if": "{trigger.data.finish AND !$bFinished}", "init": "{ if (!var['winner']) bounce('no candidate winner yet'); if (timestamp < var['challenging_period_start_ts'] + $challenging_period) bounce('challenging period not expired yet'); }", "messages": [ { "app": "state", "state": "{ var['finished'] = 1; var['total'] = balance[base]; var['challenging_period_start_ts'] = false; response['winner'] = var['winner']; }" } ] }, { "if": "{ if (!$bFinished) return false; $winner = var['winner']; $winner_asset = var['team_' || $winner || '_asset']; $asset_amount = trigger.output[[asset=$winner_asset]]; $asset_amount > 0 }", "init": "{ $share = $asset_amount / var['WF3ZRL72GCTRSDU64GP42S3FB7GBT7XJ' || $winner || '_amount']; $founder_tax = var['WF3ZRL72GCTRSDU64GP42S3FB7GBT7XJ' || $winner || '_founder_tax']; $amount = round(( $share * (1-$founder_tax) + (trigger.address == $winner AND !var['founder_tax_paid'] ? $founder_tax : 0) ) * var['total']); }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{$amount}" } ] } }, { "app": "state", "state": "{ if (trigger.address == $winner) var['founder_tax_paid'] = 1; }" } ] } ] } } ]
Technical information
Fees:
3,684 bytes
(451 headers, 3233 payload)
Level:11218982
Witnessed level:11218962
Main chain index:10831846
Latest included mc index:10831845
Status:stable/confirmed/final