2VTWEHV5MJX5IJN52O6RIHT7AJ6IT4HP
[
"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;
$unitat = trigger.output[[ asset != base ]].asset;
$qt_bytes = trigger.output[[ asset = base ]];
$qt = $qt_bytes otherwise trigger.output[[ asset = $unitat ]];
// $_Portal = $__dada( '_Portal' );
$_Portal = trigger.address; // * només x tests
if ( $_Portal != trigger.address
AND $__dada( '_Accions' ) != trigger.address )
bounce( 'Accés interdit' );
$qt_entrada = $qt;
$qt_sortida = $args.qt;
$unitat_entrada = $unitat otherwise 'base';
$unitat_sortida = $args.unitat;
$rebedora = $args.rebedora;
$sentit = $args.sentit;
$ord_moviment = $__dada( 'ordinal_' || $sentit ) + 1;
$ref_moviment = $sentit || '_' || $ord_moviment;
$total_entrades = $__dada( 'total_entrades_' || $unitat_entrada );
$total_sortides = $__dada( 'total_sortides_' || $unitat_sortida );
$registre = {};
$dades = {};
$dades[ $ref_moviment || '_data' ] = timestamp;
if ( $sentit == 'entrada' ) {
$dades[ $ref_moviment || '_qt' ] = $qt_entrada;
$dades[ $ref_moviment || '_unitat' ] = $unitat_entrada;
$nou_total_entrades = $total_entrades + $qt_entrada;
$dades[ $ref_moviment || '_emissora' ] = $adr__;
$dades[ 'total_entrades_' || $unitat_entrada ] = $nou_total_entrades;
}
if ( $sentit == 'sortida' ) {
$dades[ $ref_moviment || '_qt' ] = $qt_sortida;
$dades[ $ref_moviment || '_unitat' ] = $unitat_sortida;
$nou_total_sortides = $total_sortides + $qt_sortida;
$dades[ $ref_moviment || '_rebedora' ] = $rebedora;
$dades[ 'total_sortides_' || $unitat_sortida ] = $nou_total_sortides;
}
$dades[ 'ordinal_' || $sentit ] = $ord_moviment;
$registre.dades = $dades;
}",
"messages": [
{
"if": "{ $sentit == 'sortida' }",
"app": "payment",
"payload": {
"asset": "{ $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": "{
response[ 'Ref moviment' ] = $ref_moviment;
if ( $sentit == 'entrada' ) {
response[ 'Emissora' ] = $adr__;
response[ 'Qt' ] = $qt_entrada;
response[ 'Unitat' ] = $unitat_entrada;
}
if ( $sentit == 'sortida' ) {
response[ 'Rebedora' ] = $rebedora;
response[ 'Qt' ] = $qt_sortida;
response[ 'Unitat' ] = $unitat_sortida;
}
response[ 'Total entrades' ] = $nou_total_entrades otherwise $total_entrades;
response[ 'Total sortides' ] = $nou_total_sortides otherwise $total_sortides;
}"
}
]
}
]
- MCI: 2059837
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"Ref moviment": "entrada_3",
"Emissora": "XD7FVUM442NPIIMLRIT2FYWJEDQ4ILLJ",
"Qt": 10000,
"Unitat": "XXPIjIRs9k3CBoTyiod2NdCGMK6YmryF+w9SR63yUGw=",
"Total entrades": 10000,
"Total sortides": 0
}
}
- MCI: 2059809
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"Ref moviment": "entrada_2",
"Emissora": "XD7FVUM442NPIIMLRIT2FYWJEDQ4ILLJ",
"Qt": 20000,
"Unitat": "none",
"Total entrades": 20000,
"Total sortides": 0
}
}
Show transactions in assets:
No transactions found, it may be worth changing the filter
Unit ID
Date
From
Direction
To
Amount
09.07.2021 09:46:11
2VTWEHV5MJX5IJN52O6RIHT7AJ6IT4HP
out
09.07.2021 09:46:11
in
2VTWEHV5MJX5IJN52O6RIHT7AJ6IT4HP
09.07.2021 09:46:11
in
2VTWEHV5MJX5IJN52O6RIHT7AJ6IT4HP
09.07.2021 09:35:29
2VTWEHV5MJX5IJN52O6RIHT7AJ6IT4HP
out
09.07.2021 09:35:29
in
2VTWEHV5MJX5IJN52O6RIHT7AJ6IT4HP