IZEA5ZL5K3KBPMNK2OIH5WXRTVKB2OFE
[
"autonomous agent",
{
"init": "{
$AA_NAME= "AAAA"; // Dynamic Asset Names Autonomous Agent;
$AA_OWNER = "
O7NYCFUL5XIJTYE3O4MKGMGMTN6ATQAJ"; // could withdraw the dust is calculable.
$i = trigger.data;
$l = $i.list;
if (!$l) bounce ("Need 'list = <list_name>'!");
$l_owner = var[$l||"_owner"] otherwise trigger.address;
$l_count = var[$l||"_count"] otherwise 0;
$l_public_mode = var[$l||"_public_mode"] otherwise $i.public;
}",
"messages": {
"cases": [
{
"if": "{ $i.add }",
"init": "{
if (!$l_public_mode)
if (trigger.address != $l_owner)
bounce ("You don't own this private list");
$e = $i.add;
}",
"messages": [
{
"app": "state",
"state": "{
var[$l||"_owner"] = $l_owner;
var[$l||"_count"] = $l_count + 1;
var[$l||"_public_mode"] = $l_public_mode;
var[$l||"_"||$e] = $i.value;
var[$l||"_"||$e||"_position"] = var[$l||"_count"];
var[$l||"_"||var[$l||"_count"]] = $e;
response['message']= $e||" added ^^.";
}"
}
]
},
{
"if": "{ $i.delete }",
"init": "{
$l = $i.delete;
if (!(var[$l]))
bounce ("'"||$i.list_name||"' did not exist at the first place!");
if (trigger.address != var[$l])
bounce ("Must be owner to delete the list");
if (var[$l||"_count"] > 0)
bounce ("List must be empty to be deleted, use 'remove_last' as much as needed");
}",
"messages": [
{
"app": "state",
"state": "{
var[$l] = false;
var[$l||"_count"] = false;
response['message']= $l||" delete ^^.";
}"
}
]
},
{
"if": "{ $i.remove_last }",
"init": "{
$l = $i.remove_last;
if (!(var[$l]))
bounce ("'"||$i.list_name||"' did not exist !");
if (trigger.address != var[$l])
bounce ("Must be owner to remove last entry of the list");
if (var[$l||"_count"] == 0)
bounce ("List is empty!");
}",
"messages": [
{
"app": "state",
"state": "{
// get last entry
$last_entry = var[$l||"_"||var[$l||"_count"]];
// remove it
var[$l||"_"||$last_entry] = false;
var[$l||"_"||var[$l||"_count"]] = false;
var[$l||"_count"] -= 1;
response['message']= $last_entry||" removed ^^.";
}"
}
]
},
{
"messages": [
{
"app": "state",
"state": "{
bounce ("default case");
}"
}
]
}
]
}
}
]
Show transactions in assets:
No transactions found, it may be worth changing the filter
Unit ID
Date
From
Direction
To
Amount