JIFGYXEC7ZVUAU6KFQ5YQSCHT6W56RO2
[
"autonomous agent",
{
"init": "{
$department = var['department'];
$default_asset = var['default_asset'];
$sent_asset = trigger.output[[asset!=base]].asset;
$address = trigger.data.address;
$amount = trigger.data.amount;
if ($sent_asset == 'ambiguous') {
bounce('multiple assets sent, send only one');
}
}",
"messages": {
"cases": [
{
"if": "{$department AND $address AND $amount}",
"init": "{
$asset = ($sent_asset != 'none') ? $sent_asset : $default_asset;
$allowance_now = var[trigger.address || '_' || $asset] otherwise 50;
$sent_amount = trigger.output[[asset=$sent_asset]].amount;
$allowance_left = $allowance_now + $sent_amount - $amount;
if ($allowance_left < 0) {
bounce('cannot spend that much');
}
}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "{$asset}",
"outputs": [
{
"address": "{$address}",
"amount": "{$amount}"
}
]
}
},
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{trigger.address}",
"amount": "{trigger.output[[asset=base]] - 1000}"
}
]
}
},
{
"app": "state",
"state": "{
var[trigger.address || '_' || $asset] = $allowance_left;
}"
}
]
},
{
"if": "{!!$department != true OR $asset != 'none'}",
"messages": [
{
"app": "state",
"state": "{
var['department'] = trigger.address;
var['default_asset'] = $sent_asset;
}"
}
]
}
]
}
}
]
- MCI: 1048028
- Not bounced
- Response: {
"error": "no messages after filtering"
}
Show transactions in assets:
No transactions found, it may be worth changing the filter
Unit ID
Date
From
Direction
To
Amount
06.09.2019 11:52:12
in
JIFGYXEC7ZVUAU6KFQ5YQSCHT6W56RO2
06.09.2019 11:52:12
in
JIFGYXEC7ZVUAU6KFQ5YQSCHT6W56RO2