[
"autonomous agent",
{
"messages": {
"cases": [
{
"if": "{(trigger.data.puk) AND (!trigger.data.s) AND (!trigger.data.ad)}",
"messages": [
{
"app": "state",
"state": "{
var[trigger.data.puk||'_'||trigger.data.asset] += trigger.output[[asset=base]];
response['message'] = var[trigger.data.puk]||'_'||trigger.data.asset||' are safe under the puk '||trigger.data.puk;
}"
}
]
},
{
"if": "{(trigger.data.puk) AND (trigger.data.s) AND (trigger.data.ad)}",
"init": "{
$asset = trigger.data.as otherwise trigger.data.asset;
if (!var[trigger.data.puk||$asset]) bounce ("puk doesn\'t exists with asset "||$asset);
if (!is_valid_sig(trigger.data.ad, "-----BEGIN PUBLIC KEY-----"||trigger.data.puk||"-----END PUBLIC KEY-----", trigger.data.s)) bounce ("Wrong signature!");
}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "{trigger.data.asset}",
"outputs": [
{
"address": "{trigger.data.ad}",
"amount": "{var[trigger.data.puk]}"
}
]
}
},
{
"app": "state",
"state": "{
var[trigger.data.puk||'_'||trigger.data.asset] = false;
response['message'] = trigger.data.puk||'_'||trigger.data.asset||' sent to ' || trigger.data.ad;
}"
}
]
},
{
"messages": [
{
"app": "state",
"state": "{
bounce ("Set a 'puk' field to <a public key, for which you have the related private key> to safely store funds. To withdraw later, set the same 'puk', as well as a 'ad' field to <the Obyte adresse where you want to receive the funds> and a 's' field to <the signature of a message containing the address 'a'>.");
}"
}
]
}
]
}
}
]
Response: {
"responseVars": {
"message": "false_false are safe under the puk MEQCIA3df2YnWjDVlNoq+vQlSLRDhH+ESeaIWnMUHfoC/G6LAiAA+FUe6DaLG8h0"
},
"error": "no messages after filtering"
}
Response: {
"responseVars": {
"message": "false_false are safe under the puk MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE90U9sMxra8wxIaIBy87p09aM8n4rKe1e"
},
"error": "no messages after filtering"
}