WZCLMSGLXJ4VHD3G6OKT32KU4YQY5MA2
[
"autonomous agent",
{
"init": "{
// =========================================
// === EmailBank by Vik
// === To use with another attestor change $attestor_address and $attestor_name
// =========================================
$attestor_address = 'EN3JFYJJXVJHE7Z2AY6P5YDVN322LA6L';
$attestor_name = 'email';
// =========================================
$return_fee = 1000;
$attested_user_id = attestation[[attestors=$attestor_address, address=trigger.address]].user_id;
if (!$attested_user_id) bounce ("Your address is not attested by "||$attestor_name||" attestor "|| $attestor_address);
$balance_key = "user_id_"||$attested_user_id||"_balance";
}",
"messages": {
"cases": [
{
"if": "{!trigger.data.withdraw}",
"messages": [
{
"app": "state",
"state": "{
$b_message = var[$balance_key] ? "Current balance: " || var[$balance_key] ||" bytes. ":""; var[$balance_key] = var[$balance_key] + trigger.output[[asset=base]];
response['message'] = "You are going to deposit from " || $attestor_name ||" attested address. " || $b_message || "Balance after deposit: " || var[$balance_key] || " bytes.";
}"
}
]
},
{
"init": "{
if (!var[$balance_key]) bounce ("Your address is attested by "|| $attestor_name ||" attestor 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 current 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'] = 'Current balance: '||var[$balance_key]|| ' bytes. Balance after withdrawal: ' || (var[$balance_key] - trigger.data.withdraw) || ' bytes. Transaction fee: '||$return_fee|| ' bytes.';
var[$balance_key] = var[$balance_key] - trigger.data.withdraw;
}"
}
]
}
]
}
}
]
MCI: 1116989 Not bounced Response unit: Response: {
"responseVars": {
"message": "Current balance: 130000 bytes. Balance after withdrawal: 90000 bytes. Transaction fee: 1000 bytes."
}
} MCI: 1116973 Not bounced Response: {
"responseVars": {
"message": "You are going to deposit from email attested address. Current balance: 120000 bytes. Balance after deposit: 130000 bytes."
},
"error": "no messages after filtering"
} MCI: 1116936 Not bounced Response: {
"responseVars": {
"message": "You are going to deposit from email attested address. Balance after deposit: 120000 bytes."
},
"error": "no messages after filtering"
} MCI: 1116903 Not bounced Response: {
"responseVars": {
"message": "You are going to deposit from email attested address. Balance after deposit: 60000 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
23.10.2019 18:12:33
WZCLMSGLXJ4VHD3G6OKT32KU4YQY5MA2
out
23.10.2019 18:12:33
in
WZCLMSGLXJ4VHD3G6OKT32KU4YQY5MA2
23.10.2019 18:07:47
in
WZCLMSGLXJ4VHD3G6OKT32KU4YQY5MA2
23.10.2019 18:02:15
in
WZCLMSGLXJ4VHD3G6OKT32KU4YQY5MA2
23.10.2019 17:57:40
in
WZCLMSGLXJ4VHD3G6OKT32KU4YQY5MA2