| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "init": "{ |
| 8 | |
| 9 | $nom_AA = 'Portal'; |
| 10 | $versio = '1'; |
| 11 | |
| 12 | $adr__ = trigger.address; |
| 13 | $accio = trigger.data.accio; |
| 14 | $resp_unit = trigger.data.resp_unit; |
| 15 | $receptora = trigger.data.receptora; |
| 16 | $autoritzada = trigger.data.autoritzada; |
| 17 | $qt = trigger.data.qt; |
| 18 | $ref = trigger.data.ref; |
| 19 | $val = trigger.data.val; |
| 20 | |
| 21 | $AUT_0 = 'XD7FVUM442NPIIMLRIT2FYWJEDQ4ILLJ'; |
| 22 | |
| 23 | $AUT_A = var[ '_AUT_A' ]; |
| 24 | $AUT_B = var[ '_AUT_B' ]; |
| 25 | $AUT_C = var[ '_AUT_C' ]; |
| 26 | |
| 27 | if ( $adr__ != $AUT_0 ) { |
| 28 | if ( ! $AUT_A OR $adr__ != $AUT_A ) { |
| 29 | if ( ! $AUT_B OR $adr__ != $AUT_B ) { |
| 30 | if ( ! $AUT_C OR $adr__ != $AUT_C ) { |
| 31 | bounce ( 'No autoritzada' ); |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | if ( $accio == "autoritzacio" ) { |
| 38 | if ( ! $autoritzada ) { bounce ( $nom_AA || ': Cal proporcionar el valor de: autoritzada' ); } |
| 39 | } |
| 40 | }", |
| 41 | "messages": { |
| 42 | "cases": [ |
| 43 | { |
| 44 | "if": "{ $accio == "definicio" }", |
| 45 | "messages": [ |
| 46 | { |
| 47 | "app": "asset", |
| 48 | "payload": { |
| 49 | "cap": "{ trigger.data.cap otherwise 1e9 }", |
| 50 | "is_private": false, |
| 51 | "is_transferrable": true, |
| 52 | "auto_destroy": "{ !! trigger.data.auto_destroy }", |
| 53 | "fixed_denominations": false, |
| 54 | "issued_by_definer_only": true, |
| 55 | "cosigned_by_definer": false, |
| 56 | "spender_attested": false |
| 57 | } |
| 58 | }, |
| 59 | { |
| 60 | "app": "state", |
| 61 | "state": "{ var[response_unit] = trigger.address; }" |
| 62 | } |
| 63 | ] |
| 64 | }, |
| 65 | { |
| 66 | "if": "{ $accio == "emissio" AND $resp_unit AND var[$resp_unit] == trigger.address }", |
| 67 | "messages": [ |
| 68 | { |
| 69 | "app": "payment", |
| 70 | "payload": { |
| 71 | "asset": "{ $resp_unit }", |
| 72 | "outputs": [ |
| 73 | { |
| 74 | "address": "{ $receptora }", |
| 75 | "amount": "{ $qt }" |
| 76 | } |
| 77 | ] |
| 78 | } |
| 79 | } |
| 80 | ] |
| 81 | }, |
| 82 | { |
| 83 | "if": "{ $accio == "autoritzacio" }", |
| 84 | "messages": [ |
| 85 | { |
| 86 | "app": "state", |
| 87 | "state": "{ |
| 88 | response['ref'] = $ref; |
| 89 | response['val'] = $val; |
| 90 | var[ $ref ] = $val; |
| 91 | }" |
| 92 | } |
| 93 | ] |
| 94 | } |
| 95 | ] |
| 96 | } |
| 97 | } |
| 98 | ] |