MWOX4AAN3D5HA3SCMSMQSYPKHNG3YWO5
[
"autonomous agent",
{
"init": "{
$nom_AA = 'FOP';
$versio = '0.02';
//$_Registre = '5WVBJQHTEP54AEYUJGTQKWTXTXZSJQWA';
$_Registre = trigger.data._Registre; // * només x tests
$adr__ = trigger.initial_address;
$args = trigger.data;
$unitat_entrant = trigger.output[[ asset != base ]].asset;
// Retorna una dada del Registre
$__dada = $refdada =>
data_feed[[ oracles = $_Registre, feed_name = $refdada, ifnone = 0 ]];
// $_Portal = $__dada( '_Portal' );
$_Portal = trigger.address; // * només x tests
if ( $_Portal != trigger.address
AND $__dada( '_Accions' ) != trigger.address )
bounce( 'Accés interdit' );
$id_estels = $__dada( 'Estels' );
$id_unitat_entrada = $unitat_entrant == 'none' ? 'base' : $unitat_entrant;
$unitat_entrada =
$id_unitat_entrada == 'base' ?
'Bytes' :
$id_unitat_entrada == $id_estels ?
'Estels' :
$__dada( 'geto_' || $id_unitat_entrada );
$unitat_sortida = $args.unitat_sortida;
$sentit = $args.sentit;
$total_entrades = $__dada( 'total_entrades_' || $unitat_entrada ) otherwise 0;
$total_sortides = $__dada( 'total_sortides_' || $unitat_sortida ) otherwise 0;
$registre = {};
$dades = {};
if ( $sentit == 'entrada' OR $sentit == 'ambdos' ) {
$qt_entrada = trigger.output[[ asset = $id_unitat_entrada ]];
$nou_total_entrades = $total_entrades + $qt_entrada;
$ord_entrada = $__dada( 'ordinal_entrada' ) + 1;
$ref_entrada = 'entrada_' || $ord_entrada;
$dades[ $ref_entrada || '_data' ] = timestamp;
$dades[ $ref_entrada || '_emissora' ] = $adr__;
$dades[ $ref_entrada || '_unitat' ] = $unitat_entrada;
$dades[ 'total_entrades_' || $unitat_entrada ] = $nou_total_entrades;
$dades[ 'ordinal_entrada' ] = $ord_entrada;
}
if ( $sentit == 'sortida' OR $sentit == 'ambdos' ) {
$qt_sortida = $args.qt;
$rebedora = $args.rebedora;
$ord_sortida = $__dada( 'ordinal_sortida' ) + 1;
$ref_sortida = 'sortida_' || $ord_sortida;
$nou_total_sortides = $total_sortides + $qt_sortida;
$dades[ $ref_sortida || '_data' ] = timestamp;
$dades[ $ref_sortida || '_actuant' ] = $adr__;
$dades[ $ref_sortida || '_rebedora' ] = $rebedora;
$dades[ $ref_sortida || '_unitat' ] = $unitat_sortida;
$dades[ 'total_sortides_' || $unitat_sortida ] = $nou_total_sortides;
$dades[ 'ordinal_sortida' ] = $ord_sortida;
}
$registre.dades = $dades;
}",
"messages": [
{
"if": "{ $sentit == 'sortida' OR $sentit == 'ambdos' }",
"app": "payment",
"payload": {
"asset": "{ $args.id_unitat_sortida }",
"outputs": [
{
"address": "{ $rebedora }",
"amount": "{ $qt_sortida }"
}
]
}
},
{
"app": "data",
"payload": "{ $registre }"
},
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{ $_Registre }",
"amount": "{ $__dada( 'Provisio' ) }"
}
]
}
},
{
"app": "state",
"state": "{
if ( $sentit == 'entrada' OR $sentit == 'ambdos' ) {
response[ $ref_entrada ] =
$qt_entrada || ' ' || $unitat_entrada || ' de ' || $adr__;
response[ 'Total entrades en ' || $unitat_entrada ] = $nou_total_entrades;
if( $unitat_entrada == 'Bytes' )
response[ 'Total entrades en MBytes' ] =
round ( $nou_total_entrades / 1e6 );
else if( $unitat_entrada != 'Estels' )
response[ 'Romanent en ' || $unitat_entrada ] =
balance[ this_address ][ $args.id_unitat_entrada ];
}
if ( $sentit == 'sortida' OR $sentit == 'ambdos' ) {
response[ $ref_sortida ] =
$qt_sortida || ' ' || $unitat_sortida || ' a ' || $rebedora;
response[ 'Total sortides en ' || $unitat_sortida ] = $nou_total_sortides;
}
response[ 'Romanent en Bytes' ] = balance[ this_address ][ base ];
response[ 'Romanent en MBytes' ] = round( balance[ this_address ][ base ] / 1e6 );
response[ 'Romanent en Estels' ] = balance[ this_address ][ $id_estels ];
}"
}
]
}
]
- MCI: 2077231
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"entrada_3": "100 Estels de XD7FVUM442NPIIMLRIT2FYWJEDQ4ILLJ",
"Total entrades en Estels": 100,
"Romanent en Bytes": 50007098,
"Romanent en MBytes": 50,
"Romanent en Estels": 100
}
}
- MCI: 2077166
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"entrada_2": "50000000 Bytes de XD7FVUM442NPIIMLRIT2FYWJEDQ4ILLJ",
"Total entrades en Bytes": 50000000,
"Total entrades en MBytes": 50,
"Romanent en Bytes": 50000000,
"Romanent en MBytes": 50,
"Romanent en Estels": 0
}
}
Show transactions in assets:
No transactions found, it may be worth changing the filter
Unit ID
Date
From
Direction
To
Amount
15.07.2021 11:09:24
MWOX4AAN3D5HA3SCMSMQSYPKHNG3YWO5
out
15.07.2021 11:09:24
in
MWOX4AAN3D5HA3SCMSMQSYPKHNG3YWO5
15.07.2021 11:09:24
in
MWOX4AAN3D5HA3SCMSMQSYPKHNG3YWO5
15.07.2021 10:47:27
MWOX4AAN3D5HA3SCMSMQSYPKHNG3YWO5
out
15.07.2021 10:47:27
in
MWOX4AAN3D5HA3SCMSMQSYPKHNG3YWO5