Unit ID
DjrKucsj3om44j467LXV5ZHk8RYBEPIqMJuHm7drWc4=
Received
27.10.2019 15:03:01
Confirmation delay (full node)
3 minutes 6 seconds
Confirmation delay (light node)
4 minutes 48 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": "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": "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,435 bytes
(353 headers, 3082 payload)
Level:1124975
Witnessed level:1124968
Main chain index:1123732
Latest included mc index:1123731
Status:stable/confirmed/final