| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | $_Registre = 'SSFZKAWP3D7ZX72GQU5H2R6JLZWGSMS7'; |
| 6 | |
| 7 | |
| 8 | $__dada = $refdada => |
| 9 | data_feed [[ |
| 10 | oracles = $_Registre, |
| 11 | feed_name = $refdada, |
| 12 | ifnone = 0 |
| 13 | ]]; |
| 14 | |
| 15 | if ( $__dada( '_Portal' ) != trigger.address |
| 16 | AND $__dada( '_Implementacions' ) != trigger.address ) |
| 17 | bounce( 'Accés interdit' ); |
| 18 | |
| 19 | $args = trigger.data; |
| 20 | $proces = $args.proces; |
| 21 | $idgeto = $args.idgeto; |
| 22 | }", |
| 23 | "messages": { |
| 24 | "cases": [ |
| 25 | { |
| 26 | "if": "{ $proces == "emissio" }", |
| 27 | "messages": [ |
| 28 | { |
| 29 | "app": "data", |
| 30 | "payload": "{ $args }" |
| 31 | }, |
| 32 | { |
| 33 | "app": "payment", |
| 34 | "payload": { |
| 35 | "asset": "{ $idgeto }", |
| 36 | "outputs": [ |
| 37 | { |
| 38 | "address": "{ $args._Capsa }", |
| 39 | "amount": "{ $args.total_emissio }" |
| 40 | } |
| 41 | ] |
| 42 | } |
| 43 | }, |
| 44 | { |
| 45 | "app": "state", |
| 46 | "state": "{ |
| 47 | response[ 'Romanent en ' || $args.geto ] = balance[ $idgeto ]; |
| 48 | response[ 'Romanent en bytes' ] = balance[ base ] || ' bytes'; |
| 49 | }" |
| 50 | } |
| 51 | ] |
| 52 | }, |
| 53 | { |
| 54 | "if": "{ $proces == 'configuracio' }", |
| 55 | "messages": [ |
| 56 | { |
| 57 | "app": "state", |
| 58 | "state": "{ |
| 59 | $unitat = trigger.output[[ asset != base ]].asset; |
| 60 | $qt = trigger.output[[ asset = $unitat ]]; |
| 61 | $geto = $args.geto; |
| 62 | $resp_unit = $args.resp_unit; |
| 63 | var[ 'geto_' || $resp_unit ] = $geto; |
| 64 | var[ $geto || '_id' ] = $resp_unit; |
| 65 | response[ 'Ref' ] = $geto; |
| 66 | response[ 'Id' ] = $resp_unit; |
| 67 | response[ 'Qt' ] = $qt; |
| 68 | response[ 'Unitat ' ] = $unitat; |
| 69 | }" |
| 70 | } |
| 71 | ] |
| 72 | } |
| 73 | ] |
| 74 | } |
| 75 | } |
| 76 | ] |