UH2LGC6GFIYFYU55OZUSDGFXFVQBYAY2
[
"autonomous agent",
{
"init": "{
$nom_AA = 'Portal';
$versio = '0.6';
$_AUT_000 = 'C4KIJSUWVM7BGWTLXKX3K4PNRXV7OY4W';
$adr__ = trigger.address;
$args = trigger.data;
// Funcions auxiliars
$__bota = $txt => bounce ( $nom_AA || ' >>> ' || $txt );
// Si no s'ha lliurat l'argument especificat bota l'accés
$__arg = $arg =>
$args[ $arg ] ?
$args[ $arg ] :
$__bota( 'Cal proporcionar el valor de: ' || $arg );
$__autoritzada = ( $x ) => {
$aut = var[ '_AUT_' || $x ];
$aut AND $aut == $adr__
};
if ( ! $args ) { $__bota( ': Cal proporcionar-ne els arguments' ); }
$args._Portal = this_address;
$args._FOP = var[ '_FOP' ];
$args._Estels = var[ '_Estels' ];
$args.geto = trigger.output[[ asset != base ]].asset;
$args.qt = trigger.output[[ asset = $args.geto ]];
if ( !! $args.admin ) {
$_a = $__arg( 'ref' );
$_b = $__arg( 'val' );
if ( $adr__ != $_AUT_000
AND ! $__autoritzada( '0' )
AND ! $__autoritzada( 'A' )
AND ! $__autoritzada( 'B' )
AND ! $__autoritzada( 'C' )
) { $__bota( 'No autoritzada' ); }
// _AUT_000 pot saltar-se el tràmit mentre no existeixi _AUT_0
$es_AUT_000 = $adr__ == $_AUT_000;
if ( ! $es_AUT_000 OR ( !! $es_AUT_000 AND !! var[ '_AUT_0' ] ) ) {
// Es tracta com a confirmació si s'hi proporciona la ref de la proposta
if ( $args.ref == 'ref_proposta' ) {
$proposta = var[ $args.val ];
// L'ordinal de la proposta ha de coincidir amb el del darrer
if ( $proposta.ordinal != var[ 'prop_' || $proposta.ref ] )
{ $__bota( 'Ref incorrecta' ); }
// La confirmació l'ha de fer una AUT diferent a la proposant
if ( $proposta.proposant == $adr__ )
{ $__bota( 'Ja hi consta la teva proposta' ); }
// La confirmació només es pot fer quan ha transcorregut el lapse especificat
if ( timestamp - $proposta.temps > var[ 'Lapse' ] )
{ $__bota( 'Encara no es pot confirmar la proposta' ); }
// La proposta ha de constar com a validada a _Validacions
if ( ! var[ $args._Validacions ][ $args.val ] )
{ $__bota( 'Encara no ha estat validada' ); }
$acc = 'confirmacio';
} else { $acc = 'proposta'; }
} else { $acc = 'confirmacio'; }
} else { $acc = 'acces'; }
}",
"messages": [
{
"app": "data",
"payload": "{ $args }"
},
{
"if": "{ ! $args.admin }",
"app": "payment",
"payload": {
"asset": "{ $args.geto }",
"outputs": [
{
"address": "{ var[ '_Acces' ] }",
"amount": "{ $args.qt }"
}
]
}
},
{
"if": "{ !! $args.admin }",
"app": "state",
"state": "{
if ( $acc == 'confirmacio' ) {
var[ $args.ref ] = $args.val;
response[ 'ref' ] = $args.ref;
response[ 'val' ] = $args.val;
}
if ( $acc == 'proposta' ) {
$ref_ordinal = 'prop_' || $args.ref;
if ( ! var[ $ref_ordinal ] ) { $ordinal = 1; }
else { $ordinal = var[ $ref_ordinal ] + 1; }
var[ $ref_ordinal ] = $ordinal;
$ref_proposta = 'proposta_' || $args.ref || '_' || $ordinal;
var[ $ref_proposta ] =
{
ref: $args.ref,
val: $args.val,
ordinal: $ordinal,
proposant: $adr__,
temps: timestamp,
};
response[ 'proposta' ] = $ref_proposta;
response[ 'proposta ref' ] = $args.ref;
response[ 'proposta val' ] = $args.val;
response[ 'data per a la confirmació'] =
timestamp_to_string( timestamp + var[ 'Lapse' ] , 'datetime' );
}
response[ 'acc' ] = $acc;
}"
}
]
}
]
- MCI: 1775563
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"proposta": "proposta_Lapse_1",
"proposta ref": "Lapse",
"proposta val": 600,
"data per a la confirmació": "2020-12-01T09:10:14Z",
"acc": "proposta"
}
}
- MCI: 1775552
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"ref": "Lapse",
"val": 500,
"acc": "confirmacio"
}
}
- MCI: 1774926
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"ref": "lapse",
"val": 1000,
"acc": "confirmacio"
}
}
- MCI: 1774876
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"ref": "_AA_Acces",
"val": "VZ6H3PONL7ZKZYCDHGWX7PO35GTO4XZ4",
"acc": "confirmacio"
}
}
- MCI: 1774827
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"ref": "_AUT_A",
"val": "GIIYFJXPZW3KH5MPQKRLZTWO4LIXX25R",
"acc": "confirmacio"
}
}
- MCI: 1774769
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"ref": "_AA_Acces",
"val": "VZ6H3PONL7ZKZYCDHGWX7PO35GTO4XZ4",
"acc": "confirmacio"
}
}
Show transactions in assets:
No transactions found, it may be worth changing the filter
Unit ID
Date
From
Direction
To
Amount
01.12.2020 09:01:54
UH2LGC6GFIYFYU55OZUSDGFXFVQBYAY2
out
UH2LGC6GFIYFYU55OZUSDGFXFVQBYAY2
01.12.2020 09:01:54
in
UH2LGC6GFIYFYU55OZUSDGFXFVQBYAY2
01.12.2020 09:01:54
in
UH2LGC6GFIYFYU55OZUSDGFXFVQBYAY2
01.12.2020 08:59:56
UH2LGC6GFIYFYU55OZUSDGFXFVQBYAY2
out
UH2LGC6GFIYFYU55OZUSDGFXFVQBYAY2
01.12.2020 08:59:56
in
UH2LGC6GFIYFYU55OZUSDGFXFVQBYAY2
01.12.2020 08:59:56
in
UH2LGC6GFIYFYU55OZUSDGFXFVQBYAY2
30.11.2020 19:30:19
UH2LGC6GFIYFYU55OZUSDGFXFVQBYAY2
out
UH2LGC6GFIYFYU55OZUSDGFXFVQBYAY2