Unit ID
up87oa9UZkNuKgg9bAL4X1OykwywbBYnDmyhaY7JioY=
Received
10.06.2021 17:44:11
Confirmation delay (full node)
3 minutes 4 seconds
Confirmation delay (light node)
5 minutes 2 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $nom_AA = 'Emissions'; //$_Registre = '5WVBJQHTEP54AEYUJGTQKWTXTXZSJQWA'; $_Registre = trigger.data[ '_Registre' ]; // * només x tests // Retorna una dada del Registre $__dada = $refdada => data_feed[[ oracles = $_Registre, feed_name = $refdada, ifnone = '' ]]; //$_Portal = $__dada( '_Portal' ); $_Portal = trigger.address; // * només x tests if ( $_Portal != trigger.address ) bounce ( 'Portal no reconegut' ); //... $args = trigger.data; $adr__ = trigger.initial_address; $unitat = trigger.output[[ asset != base ]].asset; $qt = trigger.output[[ asset = $unitat ]]; $proces = $args.proces; $dades = $args.dades otherwise {}; $refgeto = 'geto_' || $args.nomgeto; // Retorna una dada del getó referenciat $dada_geto = $refval => $__dada( $refgeto || '_' || $refval ); $topall = $dada_geto( 'topall' ); if ( $proces == 'emissio' ) { // L'aportació ha de ser en estels if ( $unitat != $args.id_estels ) bounce ( 'Cal aportar-hi estels' ); // Només les admins... $_AUT_A = $dada_geto( '_AUT_A' ) otherwise ''; $_AUT_B = $dada_geto( '_AUT_B' ) otherwise ''; $_AUT_C = $dada_geto( '_AUT_C' ) otherwise ''; $autoritzacio = $_AUT_A == $adr__ OR $_AUT_B == $adr__ OR $_AUT_C == $adr__; if ( ! $autoritzacio ) bounce ( 'No autoritzada per administrar el getó' ); // La quantitat ha de ser superior a la mínima establerta $minim = $__dada( 'Generacio_Minima' ); if ( $qt < $minim ) bounce ( 'Cal aportar-hi si més no ' || $minim || ' estels' ); // No es pot excedir el topall d'emissions establert $total_emissions = $__dada( 'total_emissions_' || $refgeto ) otherwise 0; if ( $topall < $total_emissions + $qt ) bounce ( 'Topall de ' || $topall || ' excedit. Total emissions: ' || $total_emissions ); //... $idgeto = $dada_geto( 'id' ); $_FOP = $dada_geto( '_FOP' ); $factor_conversio = $dada_geto( 'factor_conversio' ); $total_emissio = $qt * $factor_conversio; $dades[ 'Total_emissions_' || $refgeto ] = $total_emissions + $total_emissio; $ref_emissio = 'emissio_' || $args.ordinal; $dades[ $ref_emissio || '_data' ] = timestamp; $dades[ $ref_emissio || '_geto' ] = $refgeto; $dades[ $ref_emissio || '_emissora' ] = $adr__; } $registre = {}; $registre.dades = $dades; }", "messages": [ { "if": "{ $proces == 'emissio' }", "app": "data", "payload": "{ $registre }" }, { "if": "{ $proces == 'emissio' }", "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_Registre }", "amount": "{ $__dada( 'Provisio' ) }" } ] } }, { "if": "{ $proces == 'emissio' }", "app": "payment", "payload": { "asset": "{ $idgeto }", "outputs": [ { "address": "{ $_FOP }", "amount": "{ $total_emissio }" } ] } }, { "app": "state", "state": "{ response[ 'Getó' ] = $refgeto; if ( $proces == 'emissio' ) { response[ 'Emissió' ] = $args.ordinal; response[ 'Adreça emissora' ] = $adr__; response[ 'FOP destinatari' ] = $_FOP; response[ 'Estels aportats' ] = $qt; response[ 'Factor de conversió' ] = $factor_conversio; response[ 'Unitats emeses' ] = $total_emissio; response[ 'Total emissions getó' ] = $total_emissions; } if ( $proces == 'dotacio' ) { response[ 'Procés' ] = $proces; } response[ 'Topall' ] = $topall; }" } ] } ]
Technical information
Fees:
4,644 bytes
(452 headers, 4192 payload)
Level:2040368
Witnessed level:2040361
Main chain index:2032376
Latest included mc index:2032375
Status:stable/confirmed/final