| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "init": "{ |
| 8 | $how_to = "All data fields must be filled, I need: 'amount', 'destination_address' and 'hash_of_secret' and optionally 'asset_id', 'duration_in_hours' and 'optional_base_AA'."; |
| 9 | |
| 10 | $base_AA = trigger.data.optional_base_AA otherwise "JH3LOA27OOP443BAGJYBHONKCK6NPLAB"; |
| 11 | |
| 12 | $owner = trigger.address; |
| 13 | $amount = trigger.data.amount; |
| 14 | $asset = trigger.data.asset_id otherwise "base"; |
| 15 | $destination = trigger.data.destination_address; |
| 16 | $duration = trigger.data.duration_in_hours otherwise 1; |
| 17 | $hash = trigger.data.hash_of_secret; |
| 18 | }", |
| 19 | "messages": { |
| 20 | "cases": [ |
| 21 | { |
| 22 | "if": "{ !!$amount and !!$destination and !!$hash }", |
| 23 | "messages": [ |
| 24 | { |
| 25 | "app": "definition", |
| 26 | "payload": { |
| 27 | "definition": [ |
| 28 | "autonomous agent", |
| 29 | { |
| 30 | "base_aa": "{$base_AA}", |
| 31 | "params": { |
| 32 | "asset_id": "{$asset}", |
| 33 | "amount": "{$amount}", |
| 34 | "destination_address": "{$destination}", |
| 35 | "duration_in_hours": "{$duration}", |
| 36 | "hash_of_secret": "{$hash}", |
| 37 | "owner": "{$owner}" |
| 38 | } |
| 39 | } |
| 40 | ] |
| 41 | } |
| 42 | }, |
| 43 | { |
| 44 | "app": "state", |
| 45 | "state": "{ |
| 46 | response['message'] = "A lock box as been created for '"||$destination||"'by the following unit: "||response_unit; |
| 47 | }" |
| 48 | } |
| 49 | ] |
| 50 | }, |
| 51 | { |
| 52 | "messages": [ |
| 53 | { |
| 54 | "app": "state", |
| 55 | "state": "{bounce($how_to);}" |
| 56 | } |
| 57 | ] |
| 58 | } |
| 59 | ] |
| 60 | } |
| 61 | } |
| 62 | ] |