| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "init": "{ |
| 8 | $owner = params.address; |
| 9 | }", |
| 10 | "messages": { |
| 11 | "cases": [ |
| 12 | { |
| 13 | "if": "{trigger.data.get_owner}", |
| 14 | "messages": [ |
| 15 | { |
| 16 | "app": "state", |
| 17 | "state": "{ |
| 18 | response['owner'] = $owner; |
| 19 | }" |
| 20 | } |
| 21 | ] |
| 22 | }, |
| 23 | { |
| 24 | "if": "{trigger.data.save_post AND trigger.data.post}", |
| 25 | "init": "{ |
| 26 | $index = var['index'] OTHERWISE 1; |
| 27 | }", |
| 28 | "messages": [ |
| 29 | { |
| 30 | "app": "state", |
| 31 | "state": "{ |
| 32 | var['post_' || $index] = { |
| 33 | p: trigger.data.post, |
| 34 | t: timestamp, |
| 35 | l: {}, |
| 36 | }; |
| 37 | var['index'] = $index + 1; |
| 38 | response['status'] = 'ok'; |
| 39 | }" |
| 40 | } |
| 41 | ] |
| 42 | }, |
| 43 | { |
| 44 | "if": "{trigger.data.like AND trigger.data.index}", |
| 45 | "init": "{ |
| 46 | $post = var['post_' || trigger.data.index]; |
| 47 | if (!$post) { |
| 48 | bounce("post not found"); |
| 49 | } |
| 50 | }", |
| 51 | "messages": [ |
| 52 | { |
| 53 | "app": "state", |
| 54 | "state": "{ |
| 55 | $post['l'][trigger.address] = 1; |
| 56 | response['status'] = 'ok'; |
| 57 | }" |
| 58 | } |
| 59 | ] |
| 60 | } |
| 61 | ] |
| 62 | } |
| 63 | } |
| 64 | ] |