Unit ID
8RHHA7+O7JkHtjtMM+DCsoCGK+k3cTFjg6HtHu5SX40=
Received
21.12.2024 13:09:58
Confirmation delay (full node)
12 minutes 36 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $team_creation_fee = 1000; $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.50){ 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 > 1 }", "init": "{ $share = $asset_amount / var['team' || $winner || 'amount']; $founder_tax = var['team' || $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'] = 0; }" } ] } ] } } ]
Technical information
Fees:
3,567 bytes
(405 headers, 3162 payload)
TPS fee:
0 bytes
Actual TPS fee:
0 bytes
Level:11434880
Witnessed level:11434871
Main chain index:11045826
Latest included mc index:11045825
Status:stable/confirmed/final