| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "init": "{\r |
| 8 | \r |
| 9 | $nom_AA = 'Acces';\r |
| 10 | $versio = '2';\r |
| 11 | \r |
| 12 | $AA_PF = trigger.data.AA_PF;\r |
| 13 | $adr__ = trigger.initial_address;\r |
| 14 | $args = trigger.data;\r |
| 15 | $qt = trigger.output[[asset=base]] - 10000; |
| 16 | \r |
| 17 | $unitat = 'base';\r |
| 18 | $AA_Activacions = var[ $AA_PF ][ '_AA_Activacions' ];\r |
| 19 | \r |
| 20 | if ( ! $args.accio ) { bounce ( $nom_AA || ': Cal proporcionar el valor de "accio"' ); }\r |
| 21 | \r |
| 22 | $opcio = $args.opcio;\r |
| 23 | $accio = $args.accio;\r |
| 24 | \r |
| 25 | $info_general = "Info general vàlida per a tots";\r |
| 26 | \r |
| 27 | $info = {\r |
| 28 | Aportacions: "Info necessària per a fer una Aportacio",\r |
| 29 | Activacions: "Info necessària per a fer una Activacio",\r |
| 30 | Capacitacions: "Info necessària per a fer una Capacitacio",\r |
| 31 | Compensacions: "Info necessària per a fer una Compensacio",\r |
| 32 | Contribucions: "Info necessària per a fer una Contribucio",\r |
| 33 | Diposits: "Info necessària per a fer un Diposit",\r |
| 34 | Generacions: "Info necessària per a fer una Generacio",\r |
| 35 | Gratificacions: "Info necessària per a fer una Gratificacio",\r |
| 36 | Liquidacions: "Info necessària per a fer una Liquidacio",\r |
| 37 | Renovacions: "Info necessària per a fer una Renovacio",\r |
| 38 | Subscripcions: "Info necessària per a fer una Subscripcio",\r |
| 39 | Transfers: "Info necessària per a fer una Transfer",\r |
| 40 | cap: "Info intro",\r |
| 41 | };\r |
| 42 | \r |
| 43 | |
| 44 | \r |
| 45 | |
| 46 | if ( $accio != "Activacio" AND $accio != 'acti') {\r |
| 47 | $activacio = var[ $AA_Activacions ][ 'activacio_' || $adr__ ];\r |
| 48 | if ( ! $activacio ) { bounce ( ' Adreça no activa ' || $adr__ ); }\r |
| 49 | }\r |
| 50 | \r |
| 51 | $params = { AA_PF : $AA_PF };\r |
| 52 | $txt_comu = 'Cal proporcionar el valor de ';\r |
| 53 | \r |
| 54 | if ( $accio == 'Aportacio' OR $accio == 'apor' ) { $AA = 'Aportacions'; }\r |
| 55 | \r |
| 56 | if ( $accio == 'Activacio' OR $accio == 'acti' ) { \r |
| 57 | $AA = 'Activacions'; \r |
| 58 | if ( ! $args.nom ) { bounce ( $txt_comu || '"nom"' ); }\r |
| 59 | $params.nom = $args.nom;\r |
| 60 | }\r |
| 61 | \r |
| 62 | if ( $accio == 'Capacitacio' OR $accio == 'capa' ) { \r |
| 63 | $AA = 'Capacitacions'; \r |
| 64 | if ( ! $args.adr ) { bounce ($txt_comu || '"adr"' ); }\r |
| 65 | if ( ! $args.tipus ) { bounce ( $txt_comu || '"tipus"' ); }\r |
| 66 | if ( ! $args.estat ) { bounce ( $txt_comu || '"estat"' ); }\r |
| 67 | $params.adr = $args.adr;\r |
| 68 | $params.tipus = $args.tipus;\r |
| 69 | $params.estat = $args.estat;\r |
| 70 | }\r |
| 71 | \r |
| 72 | if ( $accio == 'Compensacio' OR $accio == 'comp' ) { \r |
| 73 | $AA = 'Compensacions'; \r |
| 74 | if ( ! $args.receptora ) { bounce ( $txt_comu || '"receptora"' ); }\r |
| 75 | $params.qt = $qt;\r |
| 76 | $params.receptora = $args.receptora;\r |
| 77 | }\r |
| 78 | \r |
| 79 | if ( $accio == 'Contribucio' OR $accio == 'cont' ) { \r |
| 80 | $AA = 'Contribucions'; \r |
| 81 | $params.qt = $qt;\r |
| 82 | }\r |
| 83 | \r |
| 84 | if ( $accio == 'Diposit' OR $accio == 'dipo' ) { \r |
| 85 | $AA = 'Diposits'; \r |
| 86 | $params.qt = $qt;\r |
| 87 | }\r |
| 88 | \r |
| 89 | if ( $accio == 'Generacio' OR $accio == 'gene' ) { \r |
| 90 | $AA = 'Generacions'; \r |
| 91 | if ( ! $args.ref ) { bounce ( $txt_comu || '"ref"' ); }\r |
| 92 | $params.ref = $args.ref;\r |
| 93 | }\r |
| 94 | \r |
| 95 | if ( $accio == 'Gratificacio' OR $accio == 'grat' ) { \r |
| 96 | $AA = 'Gratificacions'; \r |
| 97 | if ( ! $args.ordinal ) { bounce ( $txt_comu || '"ordinal"' ); }\r |
| 98 | $params.ordinal = $args.ordinal;\r |
| 99 | }\r |
| 100 | \r |
| 101 | if ( $accio == 'Liquidacio' OR $accio == 'liqu' ) { \r |
| 102 | $AA = 'Liquidacions'; \r |
| 103 | if ( ! $args.ordinal ) { bounce ( $txt_comu || '"ordinal"' ); }\r |
| 104 | $params.ordinal = $args.ordinal; \r |
| 105 | }\r |
| 106 | \r |
| 107 | if ( $accio == 'Renovacio' OR $accio == 'reno' ) { $AA = 'Renovacions'; }\r |
| 108 | \r |
| 109 | if ( $accio == 'Subscripcio' OR $accio == 'subs' ) {\r |
| 110 | $AA = 'Subscripcions';\r |
| 111 | if ( ! $args.nom ) { bounce ( $txt_comu || '"nom"' ); }\r |
| 112 | if ( ! $args.aFOP ) { bounce ( $txt_comu || '"aFOP"' ); }\r |
| 113 | $params.nom = $args.nom;\r |
| 114 | $params.aFOP = $args.aFOP;\r |
| 115 | }\r |
| 116 | \r |
| 117 | if ( $accio == 'Transfer' OR $accio == 'tran' ) { \r |
| 118 | $AA = 'Transfers'; \r |
| 119 | if ( ! $args.receptora ) { bounce ( $txt_comu || '"receptora"' ); }\r |
| 120 | $params.accio = $AA;\r |
| 121 | $params.qt = $qt;\r |
| 122 | $params.receptora = $args.receptora;\r |
| 123 | }\r |
| 124 | \r |
| 125 | if ( $accio == 'cap' OR $accio == '' ) { $AA = 'cap'; }\r |
| 126 | \r |
| 127 | if ( !! $opcio AND $opcio == 'info' ) { bounce ( $info[ $AA ] ); } \r |
| 128 | \r |
| 129 | $adr_AA = var[ $AA_PF ][ '_AA_' || $AA ];\r |
| 130 | \r |
| 131 | }", |
| 132 | "messages": [ |
| 133 | { |
| 134 | "app": "data", |
| 135 | "payload": "{ $params }" |
| 136 | }, |
| 137 | { |
| 138 | "app": "payment", |
| 139 | "payload": { |
| 140 | "asset": "{ $unitat }", |
| 141 | "outputs": [ |
| 142 | { |
| 143 | "address": "{ $adr_AA }", |
| 144 | "amount": "{ $qt }" |
| 145 | } |
| 146 | ] |
| 147 | } |
| 148 | }, |
| 149 | { |
| 150 | "app": "state", |
| 151 | "state": "{\r |
| 152 | response['accio'] = $accio;\r |
| 153 | }" |
| 154 | } |
| 155 | ] |
| 156 | } |
| 157 | ] |