[
"autonomous agent",
{
"bounce_fees": {
"base": 10000
},
"init": "{
$amount = trigger.data.amount;
$destination = trigger.data.destination_address;
$hash = trigger.data.hash_of_secret;
}",
"messages": {
"cases": [
{
"if": "{ !!$amount and !!$destination and !!$hash }",
"init": "{
$asset = trigger.data.asset_id otherwise "base";
$duration = trigger.data.duration_in_hours otherwise 1;
$deadline = timestamp + (json_parse($duration) * 60 * 60);
}",
"messages": [
{
"app": "definition",
"payload": {
"definition": [
"autonomous agent",
{
"base_aa": "{"
JH3LOA27OOP443BAGJYBHONKCK6NPLAB"}",
"params": {
"asset_id": "{$asset}",
"amount": "{$amount}",
"destination_address": "{$destination}",
"deadline": "{$deadline}",
"hash_of_secret": "{$hash}"
}
}
]
}
},
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{trigger.address}",
"amount": "{balance[base]}"
}
]
}
},
{
"app": "state",
"state": "{
response['message'] = "A lock box as been created for '"||$destination||"'by the following unit: "||response_unit;
}"
}
]
},
{
"messages": [
{
"app": "state",
"state": "{
bounce("I need: 'amount', 'destination_address' and 'hash_of_secret' and optionally 'asset_id' and 'duration_in_hours'.");
}"
}
]
}
]
}
}
]