Unit ID
aPI6fWwcxfnVVrjZ6dkbuYrIPAW+hwYe1Tuoy/xq6Vg=
Received
19.07.2021 15:02:41
Confirmation delay (full node)
10 minutes 47 seconds
Confirmation delay (light node)
18 minutes 48 seconds
Messages
Definition
Definition: [ "autonomous agent", { "bounce_fees": { "base": 25000 }, "init": "{ $nom_AA = 'Portal'; $_AUT_000 = 'XD7FVUM442NPIIMLRIT2FYWJEDQ4ILLJ'; //$_Registre = '5WVBJQHTEP54AEYUJGTQKWTXTXZSJQWA'; $_Registre = trigger.data._Registre; // * només x tests // Principals $adr__ = trigger.address; $args = trigger.data; $ref_asset = trigger.output[[ asset != base ]].asset; $unitat = $ref_asset == 'none' ? 'base' : $ref_asset; $resp_unit = trigger.data.resp_unit; $qt = trigger.output[[ asset = $unitat ]]; $geto = $args.geto; $actuant_es_AUT_000 = $adr__ == $_AUT_000; $dades = {}; $registre = {}; // Abreviacions $admin = $args.admin; $proces = $args.proces; $ref = $args.ref; $val = $args.val; $idprop = $args.idprop; $adr = $args.adr; $estat = $args.estat; $qt_args = $args.qt; // Funcions $__dada = $refval => data_feed[[ oracles = $_Registre, feed_name = $refval, ifnone = false ]]; /* // Retorna missatge referenciat $_Missatges = $args._Missatges otherwise $__dada( '_Missatges' ); $__msg = $ordmsg => var[ $_Missatges ][ 'Portal_' || $ordmsg ]; */ // Retorna valor argument lliurat si el troba. Altrament, rebota. $__arg = $arg => $args[ $arg ] otherwise bounce( 'Cal proporcionar el valor de: ' || $arg ); // Provisions $provisio = $__dada( 'Provisio' ) otherwise 2000; $romanent_minim = $__dada( 'Romanent_Minim' ) otherwise 10000; $__provisio = $rf => { $romanent = balance[ $rf ][ base ]; $romanent < $romanent_minim ? $provisio * 10 : $romanent > $romanent_minim * 5 ? $provisio / 10 : $provisio }; // Autoritzacions $procesos_auxiliars = "generacio, configuracio, convocatoria, validacio_directa_TEST"; $procesos_critics = "definicio, assignacio, inscripcio, estat_geto," || " nou_estat_isox, nou_vincle, nou_estat_vincle"; $procesos_admin_getons = "emissio, nou_definidor_geto, capacitacio, avis"; $autoritzacio_basica = contains( $procesos_auxiliars, $proces ); $autoritzacio_critica = contains( $procesos_critics, $proces ); $autoritzacio_getons = contains( $procesos_admin_getons, $proces ); $_AUT_0 = $__dada( '_AUT_0' ) otherwise ''; $_AUT_A = $__dada( '_AUT_A' ) otherwise ''; $_AUT_B = $__dada( '_AUT_B' ) otherwise ''; $_AUT_C = $__dada( '_AUT_C' ) otherwise ''; $actuant_autoritzada = $adr__ == $_AUT_0 OR $adr__ == $_AUT_A OR $adr__ == $_AUT_B OR $adr__ == $_AUT_C; if ( $autoritzacio_basica OR $autoritzacio_critica ) { $excepcio_provisional = $actuant_es_AUT_000 AND $_AUT_0 == ''; if ( ! $actuant_autoritzada AND ! $excepcio_provisional ) bounce( 'No autoritzada' ); } if ( $autoritzacio_getons ) { $excepcio_provisional = ( $actuant_autoritzada OR $actuant_es_AUT_000 ) AND ! $__dada( $geto || '_AUT_0' ); $_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 AND ! $excepcio_provisional ) bounce( 'No autoritzada per administrar el getó' ); } // Valors funcionals $_Inicialitzacio = $__dada( '_Inicialitzacio' ); $_Accions = $__dada( '_Accions' ); $_Convocatories = $__dada( '_Convocatories' ); $_Pronunciaments = $__dada( '_Pronunciaments' ); $_Validacio_TEST = $__dada( '_Validacio_TEST' ); $_Getons = $__dada( '_Getons' ); $_Implicacions = $__dada( '_Implicacions' ); $_Implementacions = $__dada( '_Implementacions' ); $_Emissions = $__dada( '_Emissions' ); $id_estels = $__dada( 'Estels' ); $_FOP = $__dada( '_FOP' ); $provisio_registre = $__provisio( $_Registre ); $ordinal_proces = $__dada( 'ordinal_' || $proces ) + 1; $estat_geto = $__dada( $geto || '_estat' ) otherwise ''; $args._Registre = $_Registre; // * només x tests // Operativitat getó if ( $ref_asset != $id_estels AND $estat_geto != 'operatiu' AND $proces != 'estat_geto' AND $proces != 'inscripcio' ) bounce( 'Getó desconegut o no operatiu' ); // Sistema Validació if ( $autoritzacio_critica OR $autoritzacio_getons ) { if ( $excepcio_provisional ) { $ordinal_drecera = $__dada( 'ordinal_drecera' ) + 1; $nova_iddrec = 'drecera_' || $ordinal_drecera; $dades[ 'ordinal_drecera' ] = $ordinal_drecera; $dades[ 'ordinal_' || $proces ] = $ordinal_proces; $dades[ $nova_iddrec ] = timestamp; $dades[ $nova_iddrec || '_actuant' ] = $adr__; $operacio = 'drecera'; } else if ( !! $args.operacio AND $args.operacio == 'confirmacio' ) { // La proposta ha d'existir $temps_idprop = $__dada( $idprop ) otherwise bounce( "No hi ha cap proposta amb aquesta ref" ); // La confirmació l'ha de fer una AUT diferent a la proposant if ( $__dada( $idprop || '_proposant' ) == $adr__ ) bounce( "El procés de confirmació l'ha d'endegar una altra AUT" ); // La confirmació només es pot fer quan ha transcorregut el lapse especificat if ( $__dada( 'Lapse' ) > timestamp - $temps_idprop ) bounce( "Encara no es pot confirmar la proposta" ); // La proposta no pot constar com a refusada if ( !! $__dada( 'refus_' || $idprop )) bounce( "La proposta ha estat refusada" ); // La proposta ha de constar com a validada if ( ! $__dada( 'validacio_' || $idprop )) bounce( "La proposta encara no ha estat validada" ); $dades[ 'confirmacio_' || $idprop ] = timestamp; $dades[ 'confirmacio_' || $idprop || '_confirmant' ] = $adr__; $dades[ 'ordinal_' || $proces ] = $ordinal_proces; $operacio = 'confirmacio'; } else { $ordinal_proposta = $__dada( 'ordinal_proposta' ) + 1; $nova_idprop = 'proposta_' || $ordinal_proposta; $dades[ 'ordinal_proposta' ] = $ordinal_proposta; $dades[ $nova_idprop ] = timestamp; $dades[ $nova_idprop || '_proposant' ] = $adr__; $dades[ $nova_idprop || '_proces' ] = $proces; $operacio = 'proposta'; } } // Valor canvi Bytes/Estels * Cal perfeccionar-lo per evitar fraus!!! $canvi_actual = $args.valorGbyte * 100; $mitjana_actual = $__dada( 'mitjana_canvi' ) otherwise $canvi_actual; $ord_canvi = $__dada( 'ordinal_canvi' ) otherwise 1; $ref_canvi = 'canvi_' || ( $ord_canvi + 1 ); $nova_mitjana = ceil( ( ( $mitjana_actual * $ord_canvi ) + $canvi_actual ) / ( $ord_canvi + 1 ) ); $dades[ 'mitjana_canvi' ] = $nova_mitjana; $dades[ 'ordinal_canvi' ] = $ord_canvi + 1; $dades[ $ref_canvi ] = $canvi_actual; }", "messages": { "cases": [ { "if": "{ $proces == 'inicialitzacio' AND $actuant_es_AUT_000 }", "messages": [ { "app": "data", "payload": "{ $args }" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $args._Inicialitzacio }", "amount": "{ 8000 }" } ] } }, { "app": "state", "state": "{ response[ 'Procés' ] = $proces; }" } ] }, { "if": "{ $proces == 'definicio' }", "init": "{ if ( $operacio == 'proposta' ) { $dades[ $nova_idprop || '_ref' ] = $ref; $dades[ $nova_idprop || '_val' ] = $val; } else { $nova_ref = $__dada( $idprop || '_ref' ) otherwise $ref; $nou_val = $__dada( $idprop || '_val' ) otherwise $val; $dades[ $nova_ref ] = $nou_val; } $registre.dades = $dades; }", "messages": [ { "app": "data", "payload": "{ $registre }" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_Registre }", "amount": "{ $provisio_registre }" } ] } }, { "app": "state", "state": "{ response[ 'Nova ref' ] = $nova_ref otherwise $ref; response[ 'Nou valor' ] = $nou_val otherwise $val; response[ 'Proposta' ] = $nova_idprop otherwise $idprop otherwise 'drecera'; response[ 'Procés' ] = $proces; response[ 'Operació' ] = $operacio; }" } ] }, { "if": "{ $proces == 'acces_accions' }", "init": "{ // Consulta si hi ha cap avís per a adr__ $ref_avis = 'avis_' || $geto || '_' || $adr__; $ord_avis = $__dada( $ref_avis ); $rebot = $__dada( $ord_avis || '_rebot' ); $temps_avis = $__dada( $ord_avis || '_data' ); $avis_es_actual = !! $temps_avis AND $temps_avis + ( $__dada( 'Lapse' ) * 2 ) < timestamp; if ( $avis_es_actual AND $rebot ) bounce( $__dada( $ord_avis || '_text' ) ); }", "messages": [ { "app": "data", "payload": "{ $args }" }, { "app": "payment", "payload": { "asset": "{ 'base' }", "outputs": [ { "address": "{ $_Accions }", "amount": "{ $__provisio( $_Accions ) }" } ] } }, { "app": "payment", "payload": { "asset": "{ $unitat }", "outputs": [ { "address": "{ $_Accions }", "amount": "{ $qt }" } ] } }, { "app": "state", "state": "{ if ( $avis_es_actual ) response[ 'AVÍS !' ] = $__dada( $ref_avis || '_text' ); response[ 'Procés' ] = $proces; }" } ] }, { "if": "{ $proces == 'assignacio' OR $proces == 'donacio' }", "init": "{ if ( $proces == 'assignacio' ) { $ref_assignacio = 'assignacio_' || $args.requeriment; $rebedora = $args.rebedora; $id_unitat_sortida = $args.unitat == 'Estels' ? $id_estels : 'base'; $unitat_sortida = $args.unitat == 'Estels' ? 'Estels' : 'Bytes'; $qt_assignacio = $__dada( $idprop || '_qt' ) otherwise $qt_args; if ( !! $__dada( $ref_assignacio )) bounce( 'Assignació ja realitzada' ); if ( $operacio == 'proposta' ) { $dades[ $nova_idprop || '_rebedora' ] = $rebedora; $dades[ $nova_idprop || '_requeriment' ] = $args.requeriment; $dades[ $nova_idprop || '_qt' ] = $qt_args; $dades[ $nova_idprop || '_unitat' ] = $unitat_sortida; } else { $ord_assignacio = 'assignacio_' || $ordinal_proces; $id_unitat = $__dada( $idprop || '_unitat' ) otherwise $unitat_sortida; $total_assignacions = $__dada( 'total_assignacions' ) otherwise 0; $dades[ $ref_assignacio ] = $ord_assignacio; $dades[ $ord_assignacio || '_data' ] = timestamp; $dades[ $ord_assignacio || '_unitat' ] = $id_unitat; $dades[ $ord_assignacio || '_rebedora' ] = $__dada( $idprop || '_rebedora' ) otherwise $rebedora; $dades[ $ord_assignacio || '_requeriment' ] = $__dada( $idprop || '_requeriment' ) otherwise $args.requeriment; $dades[ $ord_assignacio || '_qt' ] = $qt_assignacio; $dades[ 'total_assignacions' ] = $total_assignacions + $qt_assignacio; $args.qt = $qt_assignacio; $args.rebedora = $rebedora; $args.sentit = 'sortida'; $args.unitat_sortida = $unitat_sortida; $args.id_unitat_sortida = $id_unitat_sortida; } } if ( $proces == 'donacio' ) { $ref_donacio = 'donacio_' || $adr__; $ord_donacio = 'donacio_' || $ordinal_proces; $total_donacions = $__dada( 'total_donacions' ) otherwise 0; $dades[ $ref_donacio ] = $ord_donacio; $dades[ $ord_donacio || '_donant' ] = $adr__; $dades[ $ord_donacio || '_data' ] = timestamp; $dades[ $ord_donacio || '_qt' ] = $qt; $dades[ 'total_donacions' ] = $total_donacions + $qt; $args.qt = floor( $qt / $nova_mitjana / 100 ); $args.rebedora = $adr__; $args.sentit = 'ambdos'; $args.unitat_sortida = 'Estels'; $args.id_unitat_sortida = $id_estels; } $registre.dades = $dades; }", "messages": [ { "app": "data", "payload": "{ $registre || $args }" }, { "if": "{ $proces == 'assignacio' AND $operacio != 'proposta' }", "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_FOP }", "amount": "{ $__provisio( $_FOP ) }" }, { "address": "{ $_Registre }", "amount": "{ $provisio_registre }" } ] } }, { "if": "{ $proces == 'assignacio' AND $operacio == 'proposta' }", "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_Registre }", "amount": "{ $provisio_registre }" } ] } }, { "if": "{ $proces == 'donacio' }", "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_FOP }", "amount": "{ $qt - 25000 }" }, { "address": "{ $_Registre }", "amount": "{ $provisio_registre }" } ] } }, { "app": "state", "state": "{ response[ 'Procés' ] = $proces; if ( $proces == 'assignacio' ) { response[ 'Operació' ] = $operacio; response[ 'Proposta' ] = $nova_idprop otherwise $ref otherwise 'drecera'; response[ 'Quantitat' ] = $args.qt || ' ' || $unitat_sortida; response[ 'Rebedora' ] = $args.rebedora; } if ( $proces == 'donacio' ) { response[ 'Bytes donats' ] = $qt; response[ 'Estels generats' ] = $args.qt; } }" } ] }, { "if": "{ $proces == 'pronunciament' OR $proces == 'convocatoria' OR $proces == 'validacio_directa_TEST' }", "init": "{ if ( $proces == 'pronunciament' ) $adr_aa = $_Pronunciaments; if ( $proces == 'convocatoria' ) $adr_aa = $_Convocatories; if ( $proces == 'validacio_directa_TEST' ) $adr_aa = $_Validacio_TEST; }", "messages": [ { "app": "data", "payload": "{ $args }" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $adr_aa }", "amount": "{ $__provisio( $adr_aa ) }" } ] } }, { "if": "{ $proces == 'convocatoria' }", "app": "payment", "payload": { "asset": "{ $id_estels }", "outputs": [ { "address": "{ $_Convocatories }", "amount": "{ 20 }" } ] } } ] }, { "if": "{ $proces == 'generacio' OR $proces == 'configuracio' }", "init": "{ $ref_proces = $proces || '_' || $__dada( 'ordinal_' || $proces ) + 1; $dades[ $ref_proces || '_data' ] = timestamp; $registre.dades = $dades; }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_Implementacions }", "amount": "{ $__provisio( $_Implementacions ) }" } ] } }, { "app": "data", "payload": "{ $registre }" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_Registre }", "amount": "{ $provisio }" } ] } }, { "app": "state", "state": "{ response[ 'Procés' ] = $ref_proces; }" } ] }, { "if": "{ $proces == 'inscripcio' }", "init": "{ // Ha de constar com a pendent d'inscripció if ( $estat_geto != 'pendent_inscripcio' ) bounce( "Aquest getó no consta com a pendent d'inscrpció" ); if ( $operacio == 'proposta' ) { $dades[ $nova_idprop || '_estat' ] = 'operatiu'; $dades[ $nova_idprop || '_proposant' ] = $adr__; } else { $dades[ $geto || '_estat' ] = 'operatiu'; $dades[ $geto || '_confirmant' ] = $adr__; $dades[ $geto || '_proposant' ] = $operacio == 'confirmacio' ? $__dada( $idprop || '_proposant' ) : $adr__; } $registre.dades = $dades; }", "messages": [ { "app": "data", "payload": "{ $registre }" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_Registre }", "amount": "{ $provisio }" } ] } }, { "app": "state", "state": "{ response[ 'Procés' ] = $proces; response[ 'Operació' ] = $operacio; }" } ] }, { "if": "{ $proces == 'estat_geto' }", "init": "{ // El getó ha d'existir if ( ! $__dada( $geto || '_id' )) bounce( 'Getó inexistent' ); // No ha de constar com a pendent d'inscripció if ( $estat_geto == 'pendent_inscripcio' ) bounce( "Aquest getó consta com a pendent d'inscrpció" ); //... if ( $operacio == 'proposta' ) { $dades[ $nova_idprop || '_geto' ] = $geto; $dades[ $nova_idprop || '_estat' ] = $estat; } else { $nou_estat = $__dada( $idprop || '_estat' ) otherwise $estat; $dades[ $geto || '_estat' ] = $nou_estat; } $registre.dades = $dades; }", "messages": [ { "app": "data", "payload": "{ $registre }" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_Registre }", "amount": "{ $provisio_registre }" } ] } }, { "app": "state", "state": "{ response[ 'Nou estat' || $geto ] = $nou_estat otherwise $estat; response[ 'Proposta' ] = $nova_idprop otherwise $ref otherwise 'drecera'; response[ 'Procés' ] = $proces; response[ 'Operació' ] = $operacio; }" } ] }, { "if": "{ $proces == 'emissio' }", "init": "{ // S'hi han d'aportar Estels if ( $unitat != $id_estels ) bounce( 'Cal aportar-hi Estels' ); // 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' ); $ordinal_emissio = $__dada( 'ordinal_emissio' ) + 1; $ref_emissio = 'emissio_' || $ordinal_emissio; $factor_conversio = $__dada( $geto || '_factor_conversio' ); $total_emissio = $qt * $factor_conversio; // No es pot excedir el topall d'emissions establert $total_convertits = $__dada( 'total_estels_convertits_' || $geto ) otherwise 0; $nou_total = $total_convertits + $qt; $dades[ 'total_estels_convertits_' || $geto ] = $nou_total; $dades[ $ref_emissio || '_data' ] = timestamp; $dades[ $ref_emissio || '_geto' ] = $geto; $dades[ $ref_emissio || '_estels' ] = $qt; $dades[ $ref_emissio || '_emesos' ] = $total_emissio; $dades[ $ref_emissio || '_emissora' ] = $adr__; $registre.dades = $dades; $args.idgeto = $__dada( $geto || '_id' ); $args._FOP = $__dada( $geto || '__FOP' ); $args.total_emissio = $total_emissio; }", "messages": [ { "app": "data", "payload": "{ $args || $registre }" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_Registre }", "amount": "{ $provisio }" }, { "address": "{ $_Emissions }", "amount": "{ $__provisio( $_Emissions ) }" } ] } }, { "app": "payment", "payload": { "asset": "{ $unitat }", "outputs": [ { "address": "{ $_Emissions }", "amount": "{ 1 }" }, { "address": "{ $_FOP }", "amount": "{ $qt - 1 }" } ] } }, { "app": "state", "state": "{ response[ 'Getó' ] = $geto; response[ 'Emissió' ] = $ordinal_emissio; response[ 'Adreça emissora' ] = $adr__; response[ 'FOP destinatari' ] = $_FOP; response[ 'Unitats del getó emeses' ] = $total_emissio; response[ 'Factor de conversió' ] = $factor_conversio; response[ 'Estels convertits' ] = $qt; response[ "Total d'Estels convertits" ] = $total_convertits; response[ 'Procés' ] = $proces; }" } ] }, { "if": "{ $args.admin_geto }", "init": "{ $args.operacio = $operacio; $args.nova_idprop = $nova_idprop; $args.idprop = $idprop; $args.ordinal_proces = $ordinal_proces; }", "messages": [ { "app": "data", "payload": "{ $args }" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_Getons }", "amount": "{ $__provisio( $_Getons ) }" } ] } } ] }, { "if": "{ $args.admin_vincles OR $proces == 'nova_isox' OR $proces == 'nou_estat_isox' OR $proces == 'nova_delegacio' OR $proces == 'final_delegacio' }", "init": "{ if ( $autoritzacio_critica ) { $args.operacio = $operacio; $args.nova_idprop = $nova_idprop; $args.idprop = $idprop; } }", "messages": [ { "app": "data", "payload": "{ $args }" }, { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $_Implicacions }", "amount": "{ $__provisio( $_Implicacions ) }" } ] } } ] } ] } } ]
Technical information
Fees:
23,356 bytes
(452 headers, 22904 payload)
Level:2088883
Witnessed level:2088874
Main chain index:2080564
Latest included mc index:2080563
Status:stable/confirmed/final