KYYZDTV4LZLDFIPUB4EOV5GDBLDC4PN2
[
"autonomous agent",
{
"init": "{
$hold = 1640995200;
if (trigger.output[[asset!=base]].asset != 'none')
bounce('only bytes');
$base_key = 'balance_'||trigger.address||'_'||'base';
}",
"messages": {
"cases": [
{
"if": "{
trigger.data.withdraw
}",
"init": "{
if($hold > timestamp)
bounce('no one can withdraw until '||timestamp_to_string($hold));
if(!var[$base_key])
bounce('nothing to withdraw');
}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{trigger.address}",
"amount": "{var[$base_key]-1000}"
}
]
}
},
{
"app": "state",
"state": "{
var[$base_key] = false;
}"
}
]
},
{
"messages": [
{
"app": "state",
"state": "{
var[$base_key] = var[$base_key] + trigger.output[[asset=base]];
response['message'] = 'accepted '||trigger.output[[asset=base]]||' bytes for holding until '||timestamp_to_string($hold);
}"
}
]
}
]
}
}
]
Show transactions in assets:
No transactions found, it may be worth changing the filter
Unit ID
Date
From
Direction
To
Amount