Unit ID
hQDAaGK8ugLPjcf7XA7wcATovewIZaKBJsL6fI7mK0Y=
Received
11.04.2023 17:31:21
Confirmation delay (full node)
6 minutes 45 seconds
Confirmation delay (light node)
8 minutes 53 seconds
Messages
Definition
Definition: [ "autonomous agent", { "doc_url": "https://pyth.ooo/perpetual-factory.json", "init": "{ $base_aa = 'X2JI6DDZR3IB6HPOHOSA25K34Z76PIBB'; }", "messages": { "cases": [ { "init": "{ $reserve_asset = trigger.data.reserve_asset OTHERWISE 'base'; if ($reserve_asset != 'base') require(asset[$reserve_asset].exists, "reserve_asset does not exist"); $params = { reserve_asset: $reserve_asset, }; $names = [ 'swap_fee', 'arb_profit_tax', 'adjustment_period', 'presale_period', 'auction_price_halving_period', 'token_share_threshold', 'min_s0_share', ]; foreach($names, 7, $name => { $value = trigger.data[$name]; if (exists($value)) { require(typeof($value) == 'number' AND $value >= 0, $name||" must be a nonnegative number"); if ($name == 'swap_fee' OR $name == 'token_share_threshold' OR $name == 'min_s0_share') // however >100% tax allowed for arb_profit_tax require($value < 1, $name||" must be < 1"); if ($name == 'adjustment_period' OR $name == 'presale_period' OR $name == 'auction_price_halving_period') require(is_integer($value), $name||" must be integer"); $params[$name] = $value; } }); // staking AA params foreach(['challenging_period', 'max_term', 'min_term', 'decay_factor'], 4, $p => { $value = trigger.data[$p]; if (exists($value)) { require(typeof($value) == 'number' AND $value > 0, $p||" must be a positive number"); if ($p == 'challenging_period' OR $p == 'max_term' OR $p == 'min_term') require(is_integer($value), $p||" must be integer"); if ($p == 'decay_factor') require($value > 1, "decay factor must be >1"); $params[$p] = $value; } }); $aa = [ 'autonomous agent', { base_aa: $base_aa, params: $params } ]; $aa_address = chash160($aa); require(!definition[$aa_address], "such an AA already exists: "||$aa_address); }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $aa_address }", "amount": 5000 } ] } }, { "app": "data", "payload": { "define": 1, "factory": "{this_address}" } }, { "app": "definition", "payload": { "definition": "{$aa}" } }, { "app": "state", "state": "{ var['perp_' || $aa_address] = $params; response['address'] = $aa_address; }" } ] } ] } } ]
Technical information
Fees:
3,123 bytes
(452 headers, 2671 payload)
Level:3032633
Witnessed level:3032626
Main chain index:3007581
Latest included mc index:3007580
Status:stable/confirmed/final