VUZ4FXA72UKINNI4BFRQAN36JCHG7647
[
"autonomous agent",
{
"init": "{
$lock_time = 1200;
$registry_aa = "
O6H6ZIFI57X3PLTYHOCVYPP5A553CYFQ";
$address = trigger.address;
if (is_aa($address))
bounce("Asset must be sent from a plain wallet, not an AA");
if (trigger.output[[asset=base]].amount > 10000)
bounce("Bytes amount should be only 10000");
}",
"messages": {
"cases": [
{
"if": "{trigger.output[[asset!=base]].amount > 0}",
"init": "{
$received_asset = trigger.output[[asset!=base]].asset;
if ($received_asset == "ambiguous")
bounce("Different assets cannot be handled at same time");
}",
"messages": [
{
"app": "state",
"state": "{
var["amount_" || $received_asset || "_" || $address] += trigger.output[[asset!=base]].amount;
var["ts_" || $received_asset || "_" || $address] = timestamp;
response['info'] = "This asset will be locked until " || timestamp_to_string(timestamp + $lock_time);
}"
}
]
},
{
"if": "{trigger.data.withdraw}",
"init": "{
if (asset[trigger.data.withdraw].exists)
$asset = trigger.data.withdraw;
else {
$asset = var[$registry_aa]["a2s_" || trigger.data.withdraw];
if (!$asset)
bounce("unknown symbol");
}
$amount_available = var["amount_" || $asset || "_" || $address];
if (!$amount_available)
bounce("You don't have deposit for this asset");
$lock_timestamp = var["ts_" || $asset || "_" || $address];
if ($lock_timestamp AND $lock_timestamp > timestamp - $lock_time)
bounce("This asset is still locked, retry in " || round(($lock_timestamp + $lock_time - timestamp) / 3600) || " hours");
if (!$amount_available)
bounce("Nothing available for withdraw");
if (trigger.data.amount){
if (!is_valid_amount(trigger.data.amount))
bounce("Invalid amount");
if(trigger.data.amount < $amount_available)
bounce("Only " || $amount_available || " available for withdraw");
$amount = trigger.data.amount;
} else {
$amount = $amount_available;
}
}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "{$asset}",
"outputs": [
{
"address": "{$address}",
"amount": "{ $amount }"
}
]
}
},
{
"app": "state",
"state": "{
var["amount_" || $asset || "_" || $address] -= $amount;
var["ts_" || $asset || "_" || $address] = false;
}"
}
]
}
]
}
}
]
- MCI: 1669557
- Not bounced
- Response: {
"responseVars": {
"info": "This asset will be locked until 2020-10-08T03:29:30Z"
},
"info": "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
08.10.2020 03:09:30
in
VUZ4FXA72UKINNI4BFRQAN36JCHG7647
08.10.2020 03:09:30
in
VUZ4FXA72UKINNI4BFRQAN36JCHG7647