| 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 | 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 | $_Capsa = $__dada( '_Capsa' ); |
| 23 | }", |
| 24 | "messages": { |
| 25 | "cases": [ |
| 26 | { |
| 27 | "if": "{ $proces == "emissio" }", |
| 28 | "messages": [ |
| 29 | { |
| 30 | "app": "data", |
| 31 | "payload": "{ $args }" |
| 32 | }, |
| 33 | { |
| 34 | "app": "payment", |
| 35 | "payload": { |
| 36 | "asset": "{ $idgeto }", |
| 37 | "outputs": [ |
| 38 | { |
| 39 | "address": "{ $_Capsa }", |
| 40 | "amount": "{ $args.total_emissio }" |
| 41 | } |
| 42 | ] |
| 43 | } |
| 44 | }, |
| 45 | { |
| 46 | "app": "state", |
| 47 | "state": "{ |
| 48 | response[ 'Romanent en ' || $args.geto ] = balance[ $idgeto ]; |
| 49 | response[ 'Romanent en bytes' ] = balance[ base ] || ' bytes'; |
| 50 | }" |
| 51 | } |
| 52 | ] |
| 53 | }, |
| 54 | { |
| 55 | "if": "{ $proces == 'configuracio' }", |
| 56 | "messages": [ |
| 57 | { |
| 58 | "app": "state", |
| 59 | "state": "{ |
| 60 | $unitat = trigger.output[[ asset != base ]].asset; |
| 61 | $qt = trigger.output[[ asset = $unitat ]]; |
| 62 | $geto = $args.geto; |
| 63 | $unit_ID = $args.unit_ID; |
| 64 | var[ 'geto_' || $unit_ID ] = $geto; |
| 65 | var[ $geto || '_id' ] = $unit_ID; |
| 66 | response[ 'Ref' ] = $geto; |
| 67 | response[ 'Id' ] = $unit_ID; |
| 68 | response[ 'Qt' ] = $qt; |
| 69 | response[ 'Unitat ' ] = $unitat; |
| 70 | }" |
| 71 | } |
| 72 | ] |
| 73 | } |
| 74 | ] |
| 75 | } |
| 76 | } |
| 77 | ] |