[
"autonomous agent",
{
"bounce_fees": {
"base": 10000
},
"init": "{
// forever constantes
$AA_NAME = "";
$AA_OWNER = ""; // could withdraw the dust is calculable.
$INSTRUCTIONS = "use ...";
$HOLAA = "
PCSXT7BVVTWVX6233OTILWEIWHV4ZO5W"; // to store jury and entries lists
$i = trigger.data;
$id = $i.contest_name otherwise bounce ("Need the 'contest_name' ! ");
}",
"messages": {
"cases": [
{
"if": "{
!!$i.create and
!!$i.contest_name and
!!$i.entry_dead_line and !!$i.decision_dead_line}",
"init": "{
if (!!$i.debug) bounce ("variables you want to watch when you set 'debug' in preview mode of the wallet");
}",
"messages": [
{
"app": "state",
"state": "{
var[$id||"_price"] = trigger.output[[asset=base]].amount - 2000;
var[$id||"_entry_dead_line"] = $i.entry_dead_line ;
var[$id||"_decision_dead_line"] = $i.decision_dead_line ;
}"
}
]
},
{
"if": "{ $i.jury }",
"init": "{ $list = $id||"_jury"; }",
"messages": [
{
"app": "data",
"payload": {
"list": "{ $list }",
"add": "{ $i.jury }"
}
},
{
"app": "payment",
"payload": {
"outputs": [
{
"address": "{$HOLAA}",
"amount": "{200}"
}
]
}
},
{
"app": "state",
"state": "{ response['added jury'] = var[$HOLAA][$list||"_"||var[$HOLAA][$list||"_count"]];}"
}
]
},
{
"messages": [
{
"app": "state",
"state": "{ bounce ($INSTRUCTIONS);}"
}
]
}
]
}
}
]