| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | $nom_AA = 'Registre'; |
| 6 | $versio = '02'; |
| 7 | |
| 8 | |
| 9 | $_Portal_original = trigger.address; |
| 10 | |
| 11 | $_Portal_actual = |
| 12 | var[ 'portal_actual' ] otherwise $_Portal_original; |
| 13 | |
| 14 | if ( $_Portal_actual != trigger.address ) |
| 15 | bounce ( 'Portal no reconegut' ); |
| 16 | |
| 17 | $args = trigger.data; |
| 18 | $retorn_minim = 10000; |
| 19 | $qt_retorn = |
| 20 | balance[ base ] > 20000 ? |
| 21 | balance[ base ] - 10000 : |
| 22 | 0; |
| 23 | }", |
| 24 | "messages": [ |
| 25 | { |
| 26 | "if": "{ $qt_retorn > $retorn_minim }", |
| 27 | "app": "payment", |
| 28 | "payload": { |
| 29 | "asset": "base", |
| 30 | "outputs": [ |
| 31 | { |
| 32 | "address": "{ $_Portal_actual }", |
| 33 | "amount": "{ $qt_retorn }" |
| 34 | } |
| 35 | ] |
| 36 | } |
| 37 | }, |
| 38 | { |
| 39 | "app": "state", |
| 40 | "state": "{ |
| 41 | response[ 'Registre' ] = 'Dades desades'; |
| 42 | |
| 43 | $__fes = $ref => { |
| 44 | if ( !! $ref ) { |
| 45 | var[ $ref ] = $args[ $ref ]; |
| 46 | response[ $ref ] = $args[ $ref ]; |
| 47 | } |
| 48 | }; |
| 49 | |
| 50 | $m = map( keys( $args ), 50, $__fes ); |
| 51 | |
| 52 | response[ 'Romanent Registre' ] = balance[ base ] || ' bytes'; |
| 53 | if ( $qt_retorn > $retorn_minim ) |
| 54 | response[ 'Transferits a Portal' ] = $qt_retorn || ' bytes'; |
| 55 | }" |
| 56 | } |
| 57 | ] |
| 58 | } |
| 59 | ] |