Q3MBZJDPCHVWMLRP5MZI5GF6UFULKBL2
[
"autonomous agent",
{
"init": "{
$nom_AA = 'FOP';
$versio = '0.01';
//$_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 = 0 ]];
$adr__ = trigger.address;
$args = trigger.data;
$proces = $args.proces;
if ( $__dada( '_Portal' ) != trigger.address
AND $__dada( '_Accions' ) != trigger.address )
bounce( 'Accés interdit' );
$qt = $args.qt;
$unitat = $args.unitat == 'bytes' ? 'base' : $__dada( 'Estels' );
$emissora = $args.emissora;
$rebedora = $args.rebedora;
$sentit = $args.sentit;
$ord_moviment = $__dada( 'ordinal_' || $sentit ) + 1;
$ref_moviment = $sentit || '_' || $ord_moviment;
$total_entrades = $__dada( 'total_entrades' );
$total_sortides = $__dada( 'total_sortides' );
$registre = {};
$dades = {};
$dades[ $ref_moviment || '_data' ] = timestamp;
$dades[ $ref_moviment || '_qt' ] = $qt;
$dades[ $ref_moviment || '_unitat' ] = $unitat;
if ( $sentit == 'entrada' ) {
$nou_total_entrades = $total_entrades + $qt;
$dades[ $ref_moviment || '_emissora' ] = $emissora;
$dades[ 'total_entrades' ] = $nou_total_entrades;
}
if ( $sentit == 'sortida' ) {
$nou_total_sortides = $total_sortides + $qt;
$dades[ $ref_moviment || '_rebedora' ] = $rebedora;
$dades[ 'total_sortides' ] = $nou_total_sortides;
}
$dades[ 'ordinal_' || $sentit ] = $ord_moviment;
$registre.dades = $dades;
}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "{ $unitat }",
"outputs": [
{
"address": "{ $rebedora }",
"amount": "{ $args.qt }"
}
]
}
},
{
"app": "data",
"payload": "{ $registre }"
},
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{ $_Registre }",
"amount": "{ $__dada( 'Provisio' ) }"
}
]
}
},
{
"app": "state",
"state": "{
response[ 'Ref moviment' ] = $ref_moviment;
response[ 'Unitat' ] = $unitat;
response[ 'Qt' ] = $qt;
response[ 'Total entrades' ] = $nou_total_entrades otherwise $total_entrades;
response[ 'Total sortides' ] = $nou_total_sortides otherwise $total_sortides;
if ( $sentit == 'entrada' ) response[ 'Emissora' ] = $emissora;
if ( $sentit == 'sortida' ) response[ 'Rebedora' ] = $rebedora;
}"
}
]
}
]
Show transactions in assets:
No transactions found, it may be worth changing the filter
Unit ID
Date
From
Direction
To
Amount