[
"autonomous agent",
{
"init": "{
$num_max = 5;
}",
"messages": {
"cases": [
{
"if": "{trigger.data.depo}",
"messages": [
{
"app": "state",
"state": "{
var['num'] = 1;
}"
}
]
},
{
"if": "{trigger.data.with}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{trigger.address}",
"amount": "{balance[base]-1000}"
}
]
}
}
]
},
{
"if": "{var['num'] < $num_max }",
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "
XBW7NYW64YHIUWDINQK4T7GTPHLQE64M",
"amount": "{trigger.output[[asset=base]]-500}"
}
]
}
},
{
"app": "state",
"state": "{
var['num'] = var['num']+1;
}"
}
]
},
{
"if": "{var['num'] == $num_max }",
"messages": [
{
"app": "state",
"state": "{
var['num'] = 1;
}"
}
]
}
]
}
}
]