[
"autonomous agent",
{
"init": "{
$I_ASSET = '/H3aURJJslUMAADH2Pl0lAramRAxkNslUVus1Zm0x3s=';
$OWNER_ADDR = 'QF3NOVWHY2ZBVZZ2QHCUW7IPYXKLGIGG';
$OGBIGB = 'L553WBVMGVOGK2CFPHDF4XJR74JBYHQG';
$OGBGBYTE = 'NKWC7MJO366YB3VNW33A4EQFUZCAE7WC';
$CURVEIGB = 'UH6SNZMZKHWMRM7IQZGFPD5PQULZZSBI';
}",
"messages": {
"cases": [
{
"if": "{(!trigger.data.action AND trigger.address == $OWNER_ADDR) OR var['index']}",
"init": "{
$ind = var['index'] otherwise 0;
$end = $ind == 1;
}",
"messages": [
{
"if": "{!$end}",
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{$OGBGBYTE}",
"amount": "{ trigger.output[[asset=base]]-10000 }"
}
]
}
},
{
"if": "{!$end}",
"app": "data",
"payload": {
"to_aa": "{$OGBIGB}",
"to": "{this_address}"
}
},
{
"if": "{$end}",
"app": "payment",
"payload": {
"asset": "{$I_ASSET}",
"outputs": [
{
"address": "{$CURVEIGB}"
}
]
}
},
{
"if": "{$end}",
"app": "data",
"payload": {
"to": "{trigger.initial_address}"
}
},
{
"app": "state",
"state": "{
if(!$end)
var['index'] = $ind + 1;
else
var['index'] = false;
}"
}
]
},
{
"if": "{trigger.address != $OWNER_ADDR}",
"messages": [
{
"app": "state",
"state": "{
response['message'] = 'received';
}"
}
]
},
{
"if": "{trigger.data.action == 'withdraw'}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "{trigger.data.asset otherwise 'base'}",
"outputs": [
{
"address": "{trigger.address}"
}
]
}
}
]
}
]
}
}
]