| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | $aa_name = "DANAA"; |
| 6 | $owner = "O7NYCFUL5XIJTYE3O4MKGMGMTN6ATQAJ"; |
| 7 | |
| 8 | $asset_unit_id = trigger.data.unit_id otherwise false; |
| 9 | $asset_new_name = trigger.data.new_name otherwise false; |
| 10 | $asset_author = trigger.address; |
| 11 | }", |
| 12 | "messages": { |
| 13 | "cases": [ |
| 14 | { |
| 15 | "if": "{ $asset_unit_id and $asset_new_name }", |
| 16 | "init": "{ |
| 17 | |
| 18 | if (var[$asset_unit_id]) |
| 19 | if (trigger.address != var[$asset_unit_id||"_author"]) |
| 20 | bounce ("Already registered and not by you!"); |
| 21 | }", |
| 22 | "messages": [ |
| 23 | { |
| 24 | "app": "state", |
| 25 | "state": "{ |
| 26 | var[$asset_unit_id||"_name"] = $asset_new_name; |
| 27 | var[$asset_unit_id||"_author"] = $asset_author; |
| 28 | }" |
| 29 | } |
| 30 | ] |
| 31 | }, |
| 32 | { |
| 33 | "messages": [ |
| 34 | { |
| 35 | "app": "state", |
| 36 | "state": "{ |
| 37 | bounce ("Specify a 'unit_id' and a 'new_name'"); |
| 38 | }" |
| 39 | } |
| 40 | ] |
| 41 | } |
| 42 | ] |
| 43 | } |
| 44 | } |
| 45 | ] |