| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | $_Registre = '6UDN6TJX7AM3CTT6RSBVWW6K57WAKX4U'; |
| 6 | |
| 7 | |
| 8 | $__dada = $refdada => |
| 9 | data_feed [[ |
| 10 | oracles = $_Registre, |
| 11 | feed_name = $refdada, |
| 12 | ifnone = 0 |
| 13 | ]]; |
| 14 | |
| 15 | $adr__ = trigger.initial_address; |
| 16 | $args = trigger.data; |
| 17 | $proces = $args.proces; |
| 18 | $qt = $__dada( 'Topall_Emissions' ) otherwise 1e6; |
| 19 | |
| 20 | if ( $proces != "generacio" AND |
| 21 | $__dada( '_Portal' ) != trigger.address ) |
| 22 | bounce( 'Portal no reconegut' ); |
| 23 | }", |
| 24 | "messages": { |
| 25 | "cases": [ |
| 26 | { |
| 27 | "if": "{ $proces == "generacio" }", |
| 28 | "messages": [ |
| 29 | { |
| 30 | "app": "asset", |
| 31 | "payload": { |
| 32 | "cap": "{ $qt }", |
| 33 | "is_private": false, |
| 34 | "is_transferrable": true, |
| 35 | "auto_destroy": false, |
| 36 | "fixed_denominations": false, |
| 37 | "issued_by_definer_only": true, |
| 38 | "cosigned_by_definer": false, |
| 39 | "spender_attested": false |
| 40 | } |
| 41 | }, |
| 42 | { |
| 43 | "app": "state", |
| 44 | "state": "{ var[ response_unit ] = $adr__; }" |
| 45 | } |
| 46 | ] |
| 47 | }, |
| 48 | { |
| 49 | "if": "{ $proces == "configuracio" }", |
| 50 | "init": "{ |
| 51 | $_Emissions = $__dada( '_Emissions' ); |
| 52 | $resp_unit = $args.resp_unit; |
| 53 | $_configuradora = var[ $resp_unit ] otherwise '_'; |
| 54 | |
| 55 | if( $_configuradora != $adr__ ) |
| 56 | bounce( 'No autoritzada. Configuradora: ' || $_configuradora ); |
| 57 | |
| 58 | |
| 59 | $__arg = $arg => |
| 60 | $args[ $arg ] otherwise |
| 61 | bounce( "Cal proporcionar el valor de: " || $arg ); |
| 62 | |
| 63 | $geto = |
| 64 | $__arg( 'geto' ) != 'Estels' ? |
| 65 | $args.geto : |
| 66 | bounce( 'Nom incorrecte' ); |
| 67 | |
| 68 | $estat_geto = $__dada( $geto || '_estat' ) otherwise ''; |
| 69 | |
| 70 | |
| 71 | if ( $estat_geto == 'pendent_inscripcio' ) |
| 72 | bounce( "Aquest getó consta com a pendent d'inscripció" ); |
| 73 | |
| 74 | |
| 75 | if ( $estat_geto == 'operatiu' ) |
| 76 | bounce( 'Aquest getó consta com a operatiu' ); |
| 77 | |
| 78 | $ordinal_geto = $__dada( 'ordinal_geto' ) otherwise 0; |
| 79 | $nou_ordinal_geto = $ordinal_geto + 1; |
| 80 | |
| 81 | $dades = {}; |
| 82 | $dades[ 'ordinal_geto' ] = $nou_ordinal_geto; |
| 83 | $dades[ 'geto_' || $resp_unit ] = $geto; |
| 84 | $dades[ $geto ] = $nou_ordinal_geto; |
| 85 | $dades[ $geto || '_data' ] = timestamp; |
| 86 | $dades[ $geto || '_id' ] = $resp_unit; |
| 87 | $dades[ $geto || '__AUT_A' ] = $__arg( '_AUT_A' ); |
| 88 | $dades[ $geto || '__AUT_B' ] = $__arg( '_AUT_B' ); |
| 89 | $dades[ $geto || '__AUT_C' ] = $__arg( '_AUT_C' ); |
| 90 | $dades[ $geto || '_topall' ] = |
| 91 | $qt otherwise $__dada( 'Topall_Emissions' ); |
| 92 | $dades[ $geto || '_estat' ] = 'pendent_inscripcio'; |
| 93 | $dades[ $geto || '_factor_conversio' ] = |
| 94 | $__arg( 'factor_conversio' ) |
| 95 | otherwise $__dada( 'Factor_Conversio' ); |
| 96 | $dades[ $geto || '_taxa_conversio' ] = |
| 97 | $__arg( 'taxa_conversio' ) |
| 98 | otherwise $__dada( 'Taxa_Conversio' ); |
| 99 | $dades[ $geto || '_diposit_minim' ] = |
| 100 | $__arg( 'diposit_minim' ) |
| 101 | otherwise $__dada( 'Diposit_Minim' ); |
| 102 | $dades[ $geto || '_derivacio' ] = |
| 103 | $__arg( 'derivacio' ) |
| 104 | otherwise $__dada( 'Derivacio' ); |
| 105 | $dades[ $geto || '_import_activacio' ] = |
| 106 | $__arg( 'import_activacio' ) |
| 107 | otherwise $__dada( 'Import_Activacio' ); |
| 108 | $dades[ $geto || '_import_subscripcio' ] = |
| 109 | $__arg( 'import_subscripcio' ) |
| 110 | otherwise $__dada( 'Import_Subscripcio' ); |
| 111 | $dades[ $geto || '_import_renovacio' ] = |
| 112 | $__arg( 'import_renovacio' ) |
| 113 | otherwise $__dada( 'Import_Renovacio' ); |
| 114 | $dades[ $geto || '_cicles_diposit' ] = |
| 115 | $__arg( 'cicles_diposit' ) |
| 116 | otherwise $__dada( 'Cicles_Diposit' ); |
| 117 | |
| 118 | $dades[ $geto || '_redefinible' ] = |
| 119 | $__arg( 'redefinible' ) |
| 120 | otherwise $__dada( 'Redefinible' ); |
| 121 | |
| 122 | $dades[ $geto || '_llistats_editables' ] = |
| 123 | $__arg( 'llistats_editables' ) |
| 124 | otherwise $__dada( 'Llistats_Editables' ); |
| 125 | $dades[ $geto || '_bloqueig_permes' ] = |
| 126 | $__arg( 'bloquejos_permesos' ) |
| 127 | otherwise $__dada( 'Bloquejos_Permesos' ); |
| 128 | $dades[ $geto || '_activacions_restringides' ] = |
| 129 | $__arg( 'activacions_restringides' ) |
| 130 | otherwise $__dada( 'Activacions_Restringides' ); |
| 131 | $dades[ $geto || '_subscripcions_restringides' ] = |
| 132 | $__arg( 'subscripcions_restringides' ) |
| 133 | otherwise $__dada( 'Subscripcions_Restringides' ); |
| 134 | $dades[ $geto || '_recepcions_restringides' ] = |
| 135 | $__arg( 'recepcions_restringides' ) |
| 136 | otherwise $__dada( 'Recepcions_Restringides' ); |
| 137 | $dades[ $geto || '_conversions_restringides' ] = |
| 138 | $__arg( 'conversions_restringides' ) |
| 139 | otherwise $__dada( 'Conversions_Restringides' ); |
| 140 | $dades[ $geto || '_contribucions_permeses' ] = |
| 141 | $__arg( 'contribucions_permeses' ) |
| 142 | otherwise $__dada( 'Contribucions_Permeses' ); |
| 143 | $dades[ $geto || '_bonificacions_permeses' ] = |
| 144 | $__arg( 'bonificacions_permeses' ) |
| 145 | otherwise $__dada( 'Bonificacions_Permeses' ); |
| 146 | $dades[ $geto || '_atribucions_permeses' ] = |
| 147 | $__arg( 'atribucions_permeses' ) |
| 148 | otherwise $__dada( 'Atribucions_Permeses' ); |
| 149 | |
| 150 | $registre = {}; |
| 151 | $registre.dades = $dades; |
| 152 | $args.geto = $geto; |
| 153 | }", |
| 154 | "messages": [ |
| 155 | { |
| 156 | "app": "data", |
| 157 | "payload": "{ $args || $registre }" |
| 158 | }, |
| 159 | { |
| 160 | "app": "payment", |
| 161 | "payload": { |
| 162 | "asset": "{ $resp_unit }", |
| 163 | "outputs": [ |
| 164 | { |
| 165 | "address": "{ $_Emissions }", |
| 166 | "amount": "{ $qt }" |
| 167 | } |
| 168 | ] |
| 169 | } |
| 170 | }, |
| 171 | { |
| 172 | "app": "payment", |
| 173 | "payload": { |
| 174 | "asset": "base", |
| 175 | "outputs": [ |
| 176 | { |
| 177 | "address": "{ $args._Registre }", |
| 178 | "amount": "{ $__dada( 'Provisio' ) }" |
| 179 | } |
| 180 | ] |
| 181 | } |
| 182 | }, |
| 183 | { |
| 184 | "app": "state", |
| 185 | "state": "{ |
| 186 | response[ 'Procés' ] = $proces; |
| 187 | }" |
| 188 | } |
| 189 | ] |
| 190 | } |
| 191 | ] |
| 192 | } |
| 193 | } |
| 194 | ] |