Unit ID
44MCIvlpBvNrRn9tygm4YqmG3SNIUm3A3tljv7pSNeY=
Received
06.06.2021 11:18:43
Confirmation delay (full node)
1 minute 49 seconds
Confirmation delay (light node)
4 minutes 38 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $nom_AA = 'Emissions'; // Portal //$_Portal = '5WVBJQHTEP54AEYUJGTQKWTXTXZSJQWA'; $_Portal = trigger.address; // * només x tests if ( $_Portal != trigger.address ) bounce ( 'Portal no reconegut' ); // Principals $args = trigger.data; $adr__ = trigger.initial_address; $unitat = trigger.output[[ asset != base ]].asset; $qt = trigger.output[[ asset = $unitat ]]; $_Registre = $args._Registre; $dades = $args.dades otherwise {}; $refgeto = $args.refgeto; $ordinal = $args.ordinal; // Funcions // Retorna una dada del Registre $__dada = $refval => data_feed[[ oracles = $_Registre, feed_name = $refval, ifnone = '' ]]; // Retorna una dada del getó referenciat $dada_geto = $refval => $__dada( $refgeto || '_' || $refval ); //... // 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__ AND $_AUT_B != $adr__ AND $_AUT_C != $adr__; if ( $autoritzacio ) bounce ( 'No autoritzada per administrar el getó' ); // Quantitat superior a mínima establerta $minim = $__dada( 'Generacio_Minima' ); if ( $qt < $minim ) bounce ( 'Cal aportar-hi si més no ' || $minim || ' estels' ); //... $idgeto = $dada_geto( 'id' ); $_FOP = $dada_geto( '_FOP' ); $factor_conversio = $dada_geto( 'factor_conversio' ); $total_emissio = $qt * $factor_conversio; $total_emissions = $__dada( 'total_emissions_' || $refgeto ) otherwise 0; $dades[ 'total_emissions_' || $refgeto ] = $total_emissions + $qt; $ref_emissio = 'emissio_' || $ordinal; $dades[ $ref_emissio || '_data' ] = timestamp; $dades[ $ref_emissio || '_geto' ] = $refgeto; $dades[ $ref_emissio || '_emissor' ] = $adr__; $registre = {}; $registre.dades = $dades; }", "messages": [ { "app": "payment", "payload": { "asset": "{ $idgeto }", "outputs": [ { "address": "{ $_FOP }", "amount": "{ $total_emissio }" } ] } }, { "app": "data", "payload": "{ $registre }" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_Registre }", "amount": "{ $__dada( 'Provisio' ) }" } ] } }, { "app": "state", "state": "{ response[ 'Emissio' ] = $ordinal; response[ 'Getó' ] = $refgeto; response[ 'Emissor' ] = $adr__; response[ 'FOP' ] = $_FOP; response[ 'Estels aportats' ] = $qt; response[ 'Factor de conversió' ] = $factor_conversio; response[ 'Unitats emeses' ] = $total_emissio; response[ 'Total emissions' ] = $total_emissions; }" } ] } ]
Technical information
Fees:
3,800 bytes
(452 headers, 3348 payload)
Level:2034931
Witnessed level:2034924
Main chain index:2026939
Latest included mc index:2026938
Status:stable/confirmed/final