NLNLQVGXMDV6O57ODZPD5YZSKPRNZQTW
[
"autonomous agent",
{
"init": "{
$release_fee = 1000;
$balance_key = 'balance_'||trigger.address;
}",
"messages": {
"cases": [
{
"if": "{trigger.data.keep}",
"messages": [
{
"app": "state",
"state": "{
var[$balance_key] = var[$balance_key] + trigger.output[[asset=base]];
response['message'] = trigger.output[[asset=base]] || ' bytes will be keeped.';
}"
}
]
},
{
"if": "{trigger.data.release}",
"init": "{
if(!var[$balance_key]) bounce('No bytes to release for this address.');
if(var[$balance_key] <= $release_fee) bounce('Bytes amount is less than ' || $release_fee || ' bytes fee.');
}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{trigger.address}",
"amount": "{ var[$balance_key] - $release_fee}"
}
]
}
},
{
"app": "state",
"state": "{
response['message'] = var[$balance_key] || ' bytes will be released minus ' || $release_fee || ' bytes transaction fee';
var[$balance_key] = 0;
}"
}
]
},
{
"messages": [
{
"app": "state",
"state": "{
bounce("Welcome user! This AA allows to keep your bytes. Please add 'keep' data field with any value if you want to store bytes or 'release' data field if you want to withdraw previously deposited bytes.");
}"
}
]
}
]
}
}
]
- MCI: 1054315
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"message": "40000 bytes will be released minus 1000 bytes transaction fee"
}
}
- MCI: 1054285
- Not bounced
- Response: {
"responseVars": {
"message": "10000 bytes will be keeped."
},
"error": "no messages after filtering"
}
- MCI: 1054229
- Not bounced
- Response: {
"responseVars": {
"message": "30000 bytes will be keeped."
},
"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
11.09.2019 14:32:57
NLNLQVGXMDV6O57ODZPD5YZSKPRNZQTW
out
11.09.2019 14:32:57
in
NLNLQVGXMDV6O57ODZPD5YZSKPRNZQTW
11.09.2019 14:19:14
in
NLNLQVGXMDV6O57ODZPD5YZSKPRNZQTW
11.09.2019 14:01:52
in
NLNLQVGXMDV6O57ODZPD5YZSKPRNZQTW