MIP3SGULVUJCAUTWRMUVLTQP4Z2TX2YG
[
"autonomous agent",
{
"init": "{
$f = 1000;
if(!trigger.data.scope) bounce ('please specifcy a scope');
$balance = 'balance_' || trigger.data.scope;
$secret_hashed = 'secret_' || trigger.data.scope;
$input = trigger.output[[asset=base]];
}",
"messages": {
"cases": [
{
"if": "{trigger.data.set_proof}",
"init": "{ if (var[$secret_hashed]) bounce ("Safe already exists"); }",
"messages": [
{
"app": "state",
"state": "{
var[$secret_hashed] = trigger.data.set_proof;
response['sec'] = 'Secret set for account' || trigger.data.scope;
var[$balance] = var[$balance] + $input;
response['message'] = 'accepted on account ' || trigger.data.scope || ': ' || $input || ' bytes';
}"
}
]
},
{
"if": "{trigger.data.secret}",
"init": "{
if (!var[$secret_hashed]) bounce ("scope doesn't exists");
if (sha256(trigger.data.secret) != var[$secret_hashed]) bounce ("Wrong secret!");
}",
"messages": [
{
"init": "{
$total = var[$balance] + $input - $f;
}",
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{trigger.address}",
"amount": "{$total}"
}
]
}
},
{
"app": "state",
"state": "{
var[$balance] = 0;
var[$secret_hashed] = false;
response['message'] = 'withdrawn from account ' || trigger.data.scope || '. ';
}"
}
]
}
]
}
}
]
MCI: 1000936 Bounced Response: {
"error": "Wrong secret!"
} MCI: 1000897 Bounced Response: {
"error": "Safe already exists"
} MCI: 1000891 Not bounced Response: {
"responseVars": {
"sec": "Secret set for accountbaba",
"message": "accepted on account baba: 10000 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
15.08.2019 21:36:25
in
MIP3SGULVUJCAUTWRMUVLTQP4Z2TX2YG
15.08.2019 21:19:40
in
MIP3SGULVUJCAUTWRMUVLTQP4Z2TX2YG
15.08.2019 21:18:49
in
MIP3SGULVUJCAUTWRMUVLTQP4Z2TX2YG