6DQ6CCQGLQYACVWGADBEXRWTB4BPCQ45
[
"autonomous agent",
{
"init": "{
// attestor address and name
$attestor = 'BK54UAWZ6KTI3K7PWH7PRPHVYWTIZZXH';
$attestor_name = 'email';
// general variables
$return_fee = 1000;
$attested_user_id = attestation[[attestors=$attestor, address=trigger.address]].user_id;
if (!$attested_user_id) bounce("Your address is not attested by "||$attestor_name||" attestor "|| $attestor);
$balance_key = "user_id_"||$attested_user_id||"_balance";
}",
"messages": {
"cases": [
{
"if": "{!trigger.data.withdraw}",
"messages": [
{
"app": "state",
"state": "{
var[$balance_key] = var[$balance_key] + trigger.output[[asset=base]];
response['message'] = "Total balance for your "||$attestor_name||" attested addresses will be " || var[$balance_key] || " bytes.";
}"
}
]
},
{
"init": "{
if (!var[$balance_key]) bounce("Your address is attested but the balance for your account is not found");
if (typeof(trigger.data.withdraw)!='number') bounce("Please enter number of bytes in the 'withdraw' data field. Your balance is " || var[$balance_key] || " bytes.");
if (var[$balance_key] < trigger.data.withdraw) bounce('Not enough funds. The maximum amount you can withdraw is ' || var[$balance_key] || ' bytes.');
if (trigger.output[[asset=base]] < $return_fee) bounce('The sending amount is less than the transaction fee '|| $return_fee ||' bytes. Please increase it.');
}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{trigger.address}",
"amount": "{trigger.data.withdraw + trigger.output[[asset=base]] - $return_fee}"
}
]
}
},
{
"app": "state",
"state": "{
response['message'] = 'You will receive ' || (trigger.data.withdraw + trigger.output[[asset=base]] - $return_fee) || ' bytes to your account (' || trigger.data.withdraw || ' bytes from your account + '|| trigger.output[[asset=base]] || ' bytes bounced back - '|| $return_fee || ' bytes transaction fee)';
var[$balance_key] = var[$balance_key] - trigger.data.withdraw;
}"
}
]
}
]
}
}
]
MCI: 1113542 Not bounced Response unit: Response: {
"responseVars": {
"message": "You will receive 169000 bytes to your account (160000 bytes from your account + 10000 bytes bounced back - 1000 bytes transaction fee)"
}
} MCI: 1113501 Not bounced Response unit: Response: {
"responseVars": {
"message": "You will receive 49000 bytes to your account (40000 bytes from your account + 10000 bytes bounced back - 1000 bytes transaction fee)"
}
} MCI: 1113471 Not bounced Response: {
"responseVars": {
"message": "Total balance for your email attested addresses will be 200000 bytes."
},
"error": "no messages after filtering"
} Show transactions in assets: All bytes
No transactions found, it may be worth changing the filter
Unit ID
Date
From
Direction
To
Amount
22.10.2019 09:20:06
6DQ6CCQGLQYACVWGADBEXRWTB4BPCQ45
out
22.10.2019 09:20:06
in
6DQ6CCQGLQYACVWGADBEXRWTB4BPCQ45
22.10.2019 09:09:12
6DQ6CCQGLQYACVWGADBEXRWTB4BPCQ45
out
22.10.2019 09:09:12
in
6DQ6CCQGLQYACVWGADBEXRWTB4BPCQ45
22.10.2019 08:50:28
in
6DQ6CCQGLQYACVWGADBEXRWTB4BPCQ45