| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "messages": { |
| 8 | "cases": [ |
| 9 | { |
| 10 | "if": "{trigger.data.type == 'add_me' AND trigger.data.pubkey_unit}", |
| 11 | "messages": [ |
| 12 | { |
| 13 | "app": "payment", |
| 14 | "payload": { |
| 15 | "asset": "base", |
| 16 | "outputs": [ |
| 17 | { |
| 18 | "address": "VTBMHHTE4JMUSMUEAC5N2ZFEN2GH3GC6", |
| 19 | "amount": "{trigger.output[[asset=base]] - 5000}" |
| 20 | } |
| 21 | ] |
| 22 | } |
| 23 | }, |
| 24 | { |
| 25 | "app": "state", |
| 26 | "state": "{ |
| 27 | if (exists(var['pk_' || trigger.address])) { |
| 28 | bounce('already init'); |
| 29 | } |
| 30 | |
| 31 | $pubkey_unit = trigger.data.pubkey_unit; |
| 32 | $pubkey = unit[$pubkey_unit].messages[[.app='data']][0].payload.pubkey; |
| 33 | if(!exists($pubkey)) { |
| 34 | bounce('Pubkey by unit not found'); |
| 35 | } |
| 36 | |
| 37 | var['pk_' || trigger.address] = $pubkey_unit; |
| 38 | response['added'] = trigger.address; |
| 39 | }" |
| 40 | } |
| 41 | ] |
| 42 | } |
| 43 | ] |
| 44 | } |
| 45 | } |
| 46 | ] |