| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | $unlock_date = '2027-12-01'; |
| 6 | $owner = 'B74PLANYUJTAJS22KES5OZDTCY7ASU6P'; |
| 7 | }", |
| 8 | "messages": { |
| 9 | "cases": [ |
| 10 | { |
| 11 | "if": "{trigger.data.withdraw}", |
| 12 | "init": "{ |
| 13 | require(timestamp_to_string(timestamp, 'date') >= $unlock_date, "your balance unlocks on " || $unlock_date); |
| 14 | }", |
| 15 | "messages": [ |
| 16 | { |
| 17 | "app": "payment", |
| 18 | "payload": { |
| 19 | "asset": "{trigger.data.asset OTHERWISE 'base'}", |
| 20 | "outputs": [ |
| 21 | { |
| 22 | "address": "{$owner}", |
| 23 | "amount": "{trigger.data.amount}" |
| 24 | } |
| 25 | ] |
| 26 | } |
| 27 | }, |
| 28 | { |
| 29 | "app": "state", |
| 30 | "state": "{ |
| 31 | response['message'] = 'Withdrawn'; |
| 32 | }" |
| 33 | } |
| 34 | ] |
| 35 | }, |
| 36 | { |
| 37 | "messages": [ |
| 38 | { |
| 39 | "app": "state", |
| 40 | "state": "{ |
| 41 | response['message'] = 'Accepted deposit'; |
| 42 | }" |
| 43 | } |
| 44 | ] |
| 45 | } |
| 46 | ] |
| 47 | } |
| 48 | } |
| 49 | ] |