Unit ID
jZwdoBDqU8E+aG3ie1/snnJ2lDAxCzon0vXLkJQqIW0=
Received
27.10.2019 14:40:14
Confirmation delay (full node)
3 minutes 11 seconds
Confirmation delay (light node)
6 minutes 0 seconds
Messages
Definition
Definition: [ "autonomous agent", { "bounce_fees": { "base": 10000 }, "init": "{ $aa_name = "CODAA_ASSET_MANAGER"; $howto = "I'm made to be used by machine, just review my code to know more"; $DEBUG = true; $PERCENT = 0.01; $SECOND = 1; $MINUTES = 60; $HOUR = 60 * $MINUTES; $DAY = 24 * $HOUR; $WEEK = 7 * $DAY; $YEAR = 364.25 * $DAY; }", "messages": { "cases": [ { "if": "{ !!trigger.data.create}", "init": "{ if (!!var[trigger.data.name]) bounce ("Already used!"); }", "messages": [ { "app": "asset", "payload": { "cap": "{ trigger.data.cap }", "is_private": false, "is_transferrable": true, "fixed_denominations": false, "auto_destroy": false, "cosigned_by_definer": false, "issued_by_definer_only": true, "spender_attested": false } }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{ trigger.output[[asset=base]].amount - 2000 }" } ] } }, { "app": "state", "state": "{ var[trigger.data.name||"_id"] = response_unit; var[trigger.data.name||"_owner"] = trigger.address; var[trigger.data.name||"_creation_time"] = timestamp_to_string(timestamp); var[trigger.data.name||"_balance"] = trigger.data.cap otherwise 1e15; var[trigger.data.name||"_last_return_time"] = timestamp_to_string(timestamp); var[trigger.data.name||"_return_period"] = trigger.data.period otherwise 1 * $YEAR; var[trigger.data.name||"_return_percentage"] = trigger.data.percentage otherwise 4 * $PERCENT; var[trigger.data.name||"_next_return"] = var[trigger.data.name||"_balance"] * var[trigger.data.name||"_return_percentage"]; response["message"] = "Asset created"; }" } ] }, { "if": "{ !!trigger.data.do_accounting }", "init": "{ if (!!var[trigger.data.name]) bounce ("name needed!"); if (var[trigger.data.name||"_owner"] !=trigger.address and !$DEBUG) bounce ("Not owner!"); if (timestamp< parse_date(var[trigger.data.name||"_last_return_time"]) + var[trigger.data.name||"_return_period"]) bounce ("too early"); $return = var[trigger.data.name||"_balance"] * var[trigger.data.name||"_return_percentage"]; }", "messages": [ { "app": "payment", "payload": { "asset": "{ var[trigger.data.name||"_id"] }", "outputs": [ { "address": "{trigger.address}", "amount": "{ $return }" } ] } }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{trigger.address}", "amount": "{ trigger.output[[asset=base]].amount - 1000 }" } ] } }, { "app": "state", "state": "{ var[trigger.data.name||"_balance"] -= $return; var[trigger.data.name||"_last_return_time"] = timestamp_to_string(timestamp); var[trigger.data.name||"_last_return_time"] = timestamp_to_string(timestamp); var[trigger.data.name||"_next_return"] = var[trigger.data.name||"_balance"] * var[trigger.data.name||"_return_percentage"]; response["message"] = "return percentage sent."; }" } ] }, { "messages": [ { "app": "state", "state": "{ bounce($howto); }" } ] } ] } } ]
Technical information
Fees:
3,583 bytes
(353 headers, 3230 payload)
Level:1124908
Witnessed level:1124901
Main chain index:1123665
Latest included mc index:1123664
Status:stable/confirmed/final