| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "messages": { |
| 8 | "cases": [ |
| 9 | { |
| 10 | "if": "{ trigger.data.action == 'deploy' }", |
| 11 | "init": "{ |
| 12 | $base = 'IBPZHH5MMPHSTRVMAL472VIOMA5PMU6T'; |
| 13 | require(trigger.data.unlock_date, "unlock_date required"); |
| 14 | $ud_ts = parse_date(trigger.data.unlock_date); |
| 15 | require($ud_ts, "invalid unlock_date"); |
| 16 | $ud = timestamp_to_string($ud_ts, 'date'); |
| 17 | $owner = trigger.address; |
| 18 | |
| 19 | $def = ["autonomous agent", { base_aa: $base, params: { owner: $owner, unlock_date: $ud } }]; |
| 20 | $new_aa = chash160($def); |
| 21 | }", |
| 22 | "messages": [ |
| 23 | { |
| 24 | "app": "definition", |
| 25 | "payload": { |
| 26 | "definition": "{ $def }" |
| 27 | } |
| 28 | }, |
| 29 | { |
| 30 | "app": "state", |
| 31 | "state": "{ |
| 32 | response['message'] = 'instance deployed'; |
| 33 | response['new_aa'] = $new_aa; |
| 34 | response['owner'] = $owner; |
| 35 | response['unlock_date'] = $ud; |
| 36 | }" |
| 37 | } |
| 38 | ] |
| 39 | }, |
| 40 | { |
| 41 | "messages": [ |
| 42 | { |
| 43 | "app": "state", |
| 44 | "state": "{ response['error'] = 'send action=deploy & unlock_date'; }" |
| 45 | } |
| 46 | ] |
| 47 | } |
| 48 | ] |
| 49 | } |
| 50 | } |
| 51 | ] |