Unit ID
ppnDRlfzV2mHeIXsjeQRbPB4TEIdV0FDNLkXJZ4EURw=
Received
25.12.2023 16:40:26
Confirmation delay (full node)
1 minute 30 seconds
Confirmation delay (light node)
3 minutes 28 seconds
Messages
Definition
Definition: [ "autonomous agent", { "doc_url": "https://pyth.ooo/perpetual-factory.json", "init": "{ $base_aa = 'LUXMFMYM2J6XBV3OG7G5R5XJFM3JPDBI'; }", "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"); require(is_aa(trigger.data.reserve_price_aa), "invalid reserve_price_aa"); $params = { reserve_asset: $reserve_asset, reserve_price_aa: trigger.data.reserve_price_aa, }; $names = [ 'swap_fee', 'arb_profit_tax', 'adjustment_period', 'presale_period', 'auction_price_halving_period', 'token_share_threshold', 'min_s0_share', 'max_drift_rate', ]; foreach($names, 8, $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,282 bytes
(452 headers, 2830 payload)
Level:3321407
Witnessed level:3321397
Main chain index:3295445
Latest included mc index:3295444
Status:stable/confirmed/final