| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "init": "{ |
| 8 | |
| 9 | $AA_NAME = "prova_02"; |
| 10 | $AA_OWNER = "astraia"; |
| 11 | $INSTRUCTIONS = "les instruccions operatives"; |
| 12 | |
| 13 | $fonsRossinyol = "K5XXDVOHMEW45LSGTXGU5DK3VG75ZSHV"; |
| 14 | $fonsOperatiu = "BXYGHGW5K62P32UHHBNVFN4NPOJZAPNY"; |
| 15 | $i = trigger.data; |
| 16 | $aportacio_inicial = $i.aportacio_inicial; |
| 17 | $nom = $i.nom; |
| 18 | |
| 19 | |
| 20 | if (!$i.nom) { bounce ("Un nom o referència per a aquesta adreça?");} |
| 21 | if (!$i.aportacio_inicial) { bounce ("Aquest pot ser un bon moment per fer també la teva aportació inicial al Fons Operatiu");} |
| 22 | }", |
| 23 | "messages": { |
| 24 | "cases": [ |
| 25 | { |
| 26 | "if": "{ $aportacio_inicial <= trigger.output[[asset=base]] }", |
| 27 | "init": "{ }", |
| 28 | "messages": [ |
| 29 | { |
| 30 | "app": "data_feed", |
| 31 | "payload": { |
| 32 | "aportacio_inicial": "{$aportacio_inicial}", |
| 33 | "nom": "{$nom}", |
| 34 | "addreça": "{trigger.address}" |
| 35 | } |
| 36 | }, |
| 37 | { |
| 38 | "app": "payment", |
| 39 | "payload": { |
| 40 | "asset": "{'base'}", |
| 41 | "outputs": [ |
| 42 | { |
| 43 | "address": "{$fonsRossinyol}", |
| 44 | "amount": "{trigger.output[[asset=base]] - $aportacio_inicial}" |
| 45 | }, |
| 46 | { |
| 47 | "address": "{$fonsOperatiu}", |
| 48 | "amount": "{$aportacio_inicial}" |
| 49 | } |
| 50 | ] |
| 51 | } |
| 52 | } |
| 53 | ] |
| 54 | }, |
| 55 | { |
| 56 | "messages": [ |
| 57 | { |
| 58 | "app": "state", |
| 59 | "state": "{ bounce ($INSTRUCTIONS);}" |
| 60 | } |
| 61 | ] |
| 62 | } |
| 63 | ] |
| 64 | } |
| 65 | } |
| 66 | ] |