[
"autonomous agent",
{
"init": "{
if(trigger.output[[asset!=base]].asset != 'none'){
$asset = trigger.output[[asset!=base]].asset;
if($asset and $asset == 'ambiguous')
bounce('Only 1 asset per tx');
}
$curveAA = 'TGEKFP4PFQT43CGUNZSM4GHRMNBWPAVE';
$deAA = var[$curveAA]['decision_engine_aa'];
$fundAA = var[$curveAA]['fund_aa'];
$myaddr = 'QF3NOVWHY2ZBVZZ2QHCUW7IPYXKLGIGG';
if(trigger.initial_address != $myaddr)
bounce('');
}",
"messages": {
"cases": [
{
"if": "{trigger.data.action == 'withdraw'}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "{trigger.data.asset otherwise 'base'}",
"outputs": [
{
"address": "{trigger.address}"
}
]
}
}
]
},
{
"if": "{trigger.address == $myaddr}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{$deAA}",
"amount": 400000000000
}
]
}
}
]
},
{
"if": "{trigger.address == $fundAA AND !var['sfass']}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{$curveAA}",
"amount": 400000000000
}
]
}
},
{
"app": "state",
"state": "{
var['sfass'] = $asset;
}"
}
]
},
{
"if": "{trigger.address == $curveAA and !var['igb']}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "{var['sfass']}",
"outputs": [
{
"address": "{$deAA}"
}
]
}
},
{
"app": "state",
"state": "{
var['igb'] = $asset;
}"
}
]
},
{
"if": "{trigger.address == $fundAA}",
"messages": [
{
"app": "data",
"payload": {
"to": "{trigger.initial_address}"
}
},
{
"app": "payment",
"payload": {
"asset": "{var['igb']}",
"outputs": [
{
"address": "{$curveAA}"
}
]
}
},
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{trigger.initial_address}",
"amount": "{balance[base]-10000}"
}
]
}
}
]
}
]
}
}
]