| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "init": "{ |
| 8 | $loopaa = "XYK5Q3T57HEZO46ANT2ZLVDHZTM6DDD4"; |
| 9 | $to_aa_price = 1000; |
| 10 | $from_aa_price = 3000; |
| 11 | $to_user_price = 1000; |
| 12 | |
| 13 | |
| 14 | $from_aa = trigger.address == $loopaa; |
| 15 | $from_user = !$from_randomiser; |
| 16 | $user = ($from_aa) ? trigger.data.address : trigger.address; |
| 17 | $count = var['count'] otherwise 0; |
| 18 | }", |
| 19 | "messages": { |
| 20 | "cases": [ |
| 21 | { |
| 22 | "if": "{ $from_user OR ($from_aa AND ($count<3) ) }", |
| 23 | "init": "{}", |
| 24 | "messages": [ |
| 25 | { |
| 26 | "app": "data", |
| 27 | "payload": { |
| 28 | "input": "{trigger.data.input}", |
| 29 | "address": "{$user}" |
| 30 | } |
| 31 | }, |
| 32 | { |
| 33 | "app": "payment", |
| 34 | "payload": { |
| 35 | "asset": "base", |
| 36 | "outputs": [ |
| 37 | { |
| 38 | "address": "{$loopaa}", |
| 39 | "amount": "{$from_aa_price}" |
| 40 | } |
| 41 | ] |
| 42 | } |
| 43 | }, |
| 44 | { |
| 45 | "app": "state", |
| 46 | "state": "{ |
| 47 | var['count'] = $count +1; |
| 48 | }" |
| 49 | } |
| 50 | ] |
| 51 | }, |
| 52 | { |
| 53 | "init": "{}", |
| 54 | "messages": [ |
| 55 | { |
| 56 | "app": "data", |
| 57 | "payload": { |
| 58 | "input": "{trigger.data.input}" |
| 59 | } |
| 60 | }, |
| 61 | { |
| 62 | "app": "payment", |
| 63 | "payload": { |
| 64 | "asset": "base", |
| 65 | "outputs": [ |
| 66 | { |
| 67 | "address": "{$user}", |
| 68 | "amount": "{balance[base]}" |
| 69 | } |
| 70 | ] |
| 71 | } |
| 72 | }, |
| 73 | { |
| 74 | "app": "state", |
| 75 | "state": "{ |
| 76 | var['count'] = false; |
| 77 | }" |
| 78 | } |
| 79 | ] |
| 80 | } |
| 81 | ] |
| 82 | } |
| 83 | } |
| 84 | ] |