[
"autonomous agent",
{
"init": "{
$ad= "
7RFMRICEP6J53GCBKCG37M7QMD5WMFPW";
}",
"messages": {
"cases": [
{
"if": "{trigger.data.numMax}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{$ad}",
"amount": "{trigger.output[[asset=base]]-600}"
}
]
}
},
{
"app": "state",
"state": "{
var['numMax'] = trigger.data.numMax;
var['num'] = 1;
var['sender'] = trigger.address;
}"
}
]
},
{
"if": "{var['num'] < var['numMax'] }",
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{$ad}",
"amount": "{trigger.output[[asset=base]]-600}"
}
]
}
},
{
"app": "state",
"state": "{
var['num'] = var['num']+1;
}"
}
]
},
{
"if": "{var['num'] == var['numMax'] }",
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{var['sender']}",
"amount": "{trigger.output[[asset=base]]-600}"
}
]
}
}
]
},
{
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{trigger.address}",
"amount": "{trigger.output[[asset=base]]-600}"
}
]
}
}
]
}
]
}
}
]