@panoptic-eng/sdk 1.0.35 → 1.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { BASE_CHAIN_ID, BASE_DEPLOYMENT, BASE_ETH_USDC_5BPS_MARKET, BASE_HYPOVAULT_ADDRESSES, BASE_HYPOVAULT_CORE_ADDRESSES, BASE_HYPOVAULT_MANAGER_ADDRESSES, BASE_HYPOVAULT_MANAGER_TURNKEY_SIGNERS, BASE_PANOPTIC_POOL_ADDRESSES, BASE_PANOPTIC_V2_ADDRESSES, BORROW_INDEX_BITS, BPS_SCALE, CHAIN_DEPLOYMENTS, MAINNET_CHAIN_ID, MAINNET_DEPLOYMENT, MAINNET_ETH_USDC_5BPS_V3_PANOPTIC_POOL_ADDRESSES, MAINNET_PANOPTIC_V2_ADDRESSES, MAINNET_RISK_ENGINES, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, Multicall3Abi, RATE_AT_TARGET_BITS, SECONDS_PER_YEAR, SEPOLIA_CHAIN_ID, SEPOLIA_DEPLOYMENT, SEPOLIA_ETH_USDC_5BPS_MARKET, SEPOLIA_HYPOVAULT_ADDRESSES, SEPOLIA_HYPOVAULT_CORE_ADDRESSES, SEPOLIA_HYPOVAULT_MANAGER_ADDRESSES, SEPOLIA_HYPOVAULT_MANAGER_TURNKEY_SIGNERS, SEPOLIA_PANOPTIC_POOL_ADDRESSES, SEPOLIA_PANOPTIC_V2_ADDRESSES, StateViewAbi, UNREALIZED_INTEREST_BITS, VAULT_DISPLAY_NAMES_PER_CHAIN, VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN, WAD$2 as WAD, annualizePerSecondRateWad, deriveSupplyRatePerSecWad, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, getAccountCollateral$1 as getAccountCollateral, getChainDeployment, getCollateralData$1 as getCollateralData, getEthUsdcMarket, getIrmCurrent, getIrmCurve, isSupportedChain, packMarketState, ratePerSecWadToAprPct, requireChainDeployment, resolveVaultDisplayName, utilizationBpsToWad, utilizationPctToWad } from "./irm-C02_oZwE.js";
2
- import { collateralTrackerV2Abi, getPoolMetadata, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi, panopticQueryAbi, riskEngineAbi, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi } from "./position-Ca57RRjN.js";
1
+ import { BASE_CHAIN_ID, BASE_DEPLOYMENT, BASE_ETH_USDC_5BPS_MARKET, BASE_HYPOVAULT_ADDRESSES, BASE_HYPOVAULT_CORE_ADDRESSES, BASE_HYPOVAULT_MANAGER_ADDRESSES, BASE_HYPOVAULT_MANAGER_TURNKEY_SIGNERS, BASE_PANOPTIC_POOL_ADDRESSES, BASE_PANOPTIC_V2_ADDRESSES, BORROW_INDEX_BITS, BPS_SCALE, CHAIN_DEPLOYMENTS, MAINNET_CHAIN_ID, MAINNET_DEPLOYMENT, MAINNET_ETH_USDC_5BPS_V3_PANOPTIC_POOL_ADDRESSES, MAINNET_PANOPTIC_V2_ADDRESSES, MAINNET_RISK_ENGINES, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, Multicall3Abi, RATE_AT_TARGET_BITS, SECONDS_PER_YEAR, SEPOLIA_CHAIN_ID, SEPOLIA_DEPLOYMENT, SEPOLIA_ETH_USDC_5BPS_MARKET, SEPOLIA_HYPOVAULT_ADDRESSES, SEPOLIA_HYPOVAULT_CORE_ADDRESSES, SEPOLIA_HYPOVAULT_MANAGER_ADDRESSES, SEPOLIA_HYPOVAULT_MANAGER_TURNKEY_SIGNERS, SEPOLIA_PANOPTIC_POOL_ADDRESSES, SEPOLIA_PANOPTIC_V2_ADDRESSES, StateViewAbi, UNREALIZED_INTEREST_BITS, VAULT_DISPLAY_NAMES_PER_CHAIN, VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN, WAD$2 as WAD, annualizePerSecondRateWad, deriveSupplyRatePerSecWad, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, getAccountCollateral$1 as getAccountCollateral, getChainDeployment, getCollateralData$1 as getCollateralData, getEthUsdcMarket, getIrmCurrent, getIrmCurve, isSupportedChain, packMarketState, ratePerSecWadToAprPct, requireChainDeployment, resolveVaultDisplayName, utilizationBpsToWad, utilizationPctToWad } from "./irm-DnM96-X4.js";
2
+ import { collateralTrackerV2Abi, getPoolMetadata, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi, panopticQueryAbi$1 as panopticQueryAbi, riskEngineAbi, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi } from "./position-C8rkkKhi.js";
3
3
  import { tickToSqrtPriceX96 } from "./greeks-GysWXct-.js";
4
4
  import { BaseError, ContractFunctionExecutionError, ContractFunctionRevertedError, concat, encodeAbiParameters, encodeFunctionData, encodePacked, getAddress, keccak256, maxUint256, parseAbi, toBytes, zeroAddress } from "viem";
5
5
  import { getBlockNumber, readContract, simulateContract, writeContract } from "viem/actions";
@@ -15191,11 +15191,11 @@ const UsdcPlpVaultBaseProdConfig = {
15191
15191
 
15192
15192
  //#endregion
15193
15193
  //#region src/hypoVault/hypoVaultManagerConfigs/usdcPlpVaultMainnetProdConfig.ts
15194
- const MAINNET_DEPLOYMENT$5 = requireChainDeployment(MAINNET_CHAIN_ID);
15195
- const MAINNET_ETH_USDC_MARKET = getEthUsdcMarket(MAINNET_DEPLOYMENT$5);
15196
- const MAINNET_HYPOVAULT_ADDRESSES$1 = MAINNET_DEPLOYMENT$5.hypovault.vaults;
15197
- const MAINNET_HYPOVAULT_MANAGER_ADDRESSES$1 = MAINNET_DEPLOYMENT$5.hypovault.managers;
15198
- const MAINNET_PANOPTIC_POOL_ADDRESSES$1 = MAINNET_DEPLOYMENT$5.panoptic.pool;
15194
+ const MAINNET_DEPLOYMENT$6 = requireChainDeployment(MAINNET_CHAIN_ID);
15195
+ const MAINNET_ETH_USDC_MARKET = getEthUsdcMarket(MAINNET_DEPLOYMENT$6);
15196
+ const MAINNET_HYPOVAULT_ADDRESSES$1 = MAINNET_DEPLOYMENT$6.hypovault.vaults;
15197
+ const MAINNET_HYPOVAULT_MANAGER_ADDRESSES$1 = MAINNET_DEPLOYMENT$6.hypovault.managers;
15198
+ const MAINNET_PANOPTIC_POOL_ADDRESSES$1 = MAINNET_DEPLOYMENT$6.panoptic.pool;
15199
15199
  const MAINNET_LEGACY_PANOPTIC_POOL_ADDRESSES$1 = {
15200
15200
  panopticPool: "0x000000007588B488d180899cDEa2080a886D2441",
15201
15201
  collateralTracker0: "0x6cd0186Fb4c32B6fD23279bBE0022506958216f9",
@@ -15353,10 +15353,10 @@ const WethPlpVaultBaseProdConfig = {
15353
15353
 
15354
15354
  //#endregion
15355
15355
  //#region src/hypoVault/hypoVaultManagerConfigs/wethPlpVaultMainnetProdConfig.ts
15356
- const MAINNET_DEPLOYMENT$4 = requireChainDeployment(MAINNET_CHAIN_ID);
15357
- const MAINNET_HYPOVAULT_ADDRESSES = MAINNET_DEPLOYMENT$4.hypovault.vaults;
15358
- const MAINNET_HYPOVAULT_MANAGER_ADDRESSES = MAINNET_DEPLOYMENT$4.hypovault.managers;
15359
- const MAINNET_PANOPTIC_POOL_ADDRESSES = MAINNET_DEPLOYMENT$4.panoptic.pool;
15356
+ const MAINNET_DEPLOYMENT$5 = requireChainDeployment(MAINNET_CHAIN_ID);
15357
+ const MAINNET_HYPOVAULT_ADDRESSES = MAINNET_DEPLOYMENT$5.hypovault.vaults;
15358
+ const MAINNET_HYPOVAULT_MANAGER_ADDRESSES = MAINNET_DEPLOYMENT$5.hypovault.managers;
15359
+ const MAINNET_PANOPTIC_POOL_ADDRESSES = MAINNET_DEPLOYMENT$5.panoptic.pool;
15360
15360
  const MAINNET_LEGACY_PANOPTIC_POOL_ADDRESSES = {
15361
15361
  panopticPool: "0x000000007588B488d180899cDEa2080a886D2441",
15362
15362
  collateralTracker0: "0x6cd0186Fb4c32B6fD23279bBE0022506958216f9",
@@ -15503,11 +15503,11 @@ function getHypoVaultConfigForVault(vaultAddress, chainId, options) {
15503
15503
  //#region src/hypoVault/hypoVaultManagerArtifacts/poolInfosConfig.ts
15504
15504
  const SEPOLIA_DEPLOYMENT$1 = requireChainDeployment(SEPOLIA_CHAIN_ID);
15505
15505
  const BASE_DEPLOYMENT$1 = requireChainDeployment(BASE_CHAIN_ID);
15506
- const MAINNET_DEPLOYMENT$3 = requireChainDeployment(MAINNET_CHAIN_ID);
15506
+ const MAINNET_DEPLOYMENT$4 = requireChainDeployment(MAINNET_CHAIN_ID);
15507
15507
  const MAX_PRICE_DEVIATION = 100;
15508
15508
  const WSPCXX_USDC_MAX_PRICE_DEVIATION = 1e4;
15509
15509
  const DEFAULT_TRIGGER_TICK = 150;
15510
- const MAINNET_ETH_USDC_5BPS_V3_POOL = MAINNET_DEPLOYMENT$3.panoptic.additionalPools?.ethUsdc5bpsV3;
15510
+ const MAINNET_ETH_USDC_5BPS_V3_POOL = MAINNET_DEPLOYMENT$4.panoptic.additionalPools?.ethUsdc5bpsV3;
15511
15511
  if (MAINNET_ETH_USDC_5BPS_V3_POOL === void 0) throw new Error("Missing mainnet ETH/USDC 5bps v3 Panoptic pool deployment");
15512
15512
  const MAINNET_ETH_USDC_5BPS_V3_POOL_INFO = {
15513
15513
  maxPriceDeviation: MAX_PRICE_DEVIATION,
@@ -15531,9 +15531,9 @@ const BASE_DEFAULT_POOL_INFOS = [{
15531
15531
  const BASE_VAULT_ADDRESSES = BASE_DEPLOYMENT$1.hypovault.vaults;
15532
15532
  const MAINNET_DEFAULT_POOL_INFOS = [{
15533
15533
  maxPriceDeviation: MAX_PRICE_DEVIATION,
15534
- pool: MAINNET_DEPLOYMENT$3.panoptic.pool.panopticPool,
15535
- token0: getEthUsdcMarket(MAINNET_DEPLOYMENT$3).currency0,
15536
- token1: getEthUsdcMarket(MAINNET_DEPLOYMENT$3).currency1
15534
+ pool: MAINNET_DEPLOYMENT$4.panoptic.pool.panopticPool,
15535
+ token0: getEthUsdcMarket(MAINNET_DEPLOYMENT$4).currency0,
15536
+ token1: getEthUsdcMarket(MAINNET_DEPLOYMENT$4).currency1
15537
15537
  }, MAINNET_ETH_USDC_5BPS_V3_POOL_INFO];
15538
15538
  const MAINNET_USDC_PLP_POOL_INFOS = [
15539
15539
  MAINNET_DEFAULT_POOL_INFOS[0],
@@ -15548,10 +15548,10 @@ const MAINNET_USDC_PLP_POOL_INFOS = [
15548
15548
  const MAINNET_LEGACY_DEFAULT_POOL_INFOS = [{
15549
15549
  maxPriceDeviation: MAX_PRICE_DEVIATION,
15550
15550
  pool: "0x000000007588B488d180899cDEa2080a886D2441",
15551
- token0: getEthUsdcMarket(MAINNET_DEPLOYMENT$3).currency0,
15552
- token1: getEthUsdcMarket(MAINNET_DEPLOYMENT$3).currency1
15551
+ token0: getEthUsdcMarket(MAINNET_DEPLOYMENT$4).currency0,
15552
+ token1: getEthUsdcMarket(MAINNET_DEPLOYMENT$4).currency1
15553
15553
  }];
15554
- const MAINNET_VAULT_ADDRESSES = MAINNET_DEPLOYMENT$3.hypovault.vaults;
15554
+ const MAINNET_VAULT_ADDRESSES = MAINNET_DEPLOYMENT$4.hypovault.vaults;
15555
15555
  const MAINNET_LEGACY_VAULT_ADDRESSES = {
15556
15556
  wethPlpVault: "0x779a2aa634A004b3a3f3b322083744869BBC6D66",
15557
15557
  usdcPlpVault: "0x963Fe9c93bc353602656ee4051A75114bA74d6c5"
@@ -15648,809 +15648,279 @@ const SepoliaWETHPLPVaultPoolInfos = {
15648
15648
  };
15649
15649
 
15650
15650
  //#endregion
15651
- //#region src/hypoVault/hypoVaultManagerArtifacts/createStrategistLeavesArtifact.ts
15652
- const DIGEST_COMPOSITION = [
15653
- "Bytes20(DECODER_AND_SANITIZER_ADDRESS)",
15654
- "Bytes20(TARGET_ADDRESS)",
15655
- "Bytes1(CAN_SEND_VALUE)",
15656
- "Bytes4(TARGET_FUNCTION_SELECTOR)",
15657
- "Bytes{N*20}(ADDRESS_ARGUMENT_0,...,ADDRESS_ARGUMENT_N)"
15658
- ];
15659
- const EMPTY_DEFINITION = {
15660
- description: "",
15661
- target: zeroAddress,
15662
- functionSignature: "",
15663
- addressArguments: [],
15664
- canSendValue: false
15651
+ //#region src/hypoVault/mainnetVaultPoolHistory.ts
15652
+ const MAINNET_DEPLOYMENT$3 = requireChainDeployment(MAINNET_CHAIN_ID);
15653
+ const POOL_INFO_ARRAY_ABI$1 = {
15654
+ type: "tuple[]",
15655
+ components: [
15656
+ {
15657
+ name: "pool",
15658
+ type: "address"
15659
+ },
15660
+ {
15661
+ name: "token0",
15662
+ type: "address"
15663
+ },
15664
+ {
15665
+ name: "token1",
15666
+ type: "address"
15667
+ },
15668
+ {
15669
+ name: "maxPriceDeviation",
15670
+ type: "int24"
15671
+ }
15672
+ ]
15665
15673
  };
15666
- function efficientHash$1(a, b) {
15667
- return keccak256(encodePacked(["bytes32", "bytes32"], a < b ? [a, b] : [b, a]));
15668
- }
15669
- function nextPowerOfTwo(value) {
15670
- let capacity = 1;
15671
- while (capacity < value) capacity *= 2;
15672
- return capacity;
15673
- }
15674
- function functionSelector(signature) {
15675
- return keccak256(toBytes(signature)).slice(0, 10);
15674
+ function hashPoolInfos$1(poolInfos) {
15675
+ return keccak256(encodeAbiParameters([POOL_INFO_ARRAY_ABI$1], [poolInfos.map((poolInfo) => ({
15676
+ pool: getAddress(poolInfo.pool),
15677
+ token0: getAddress(poolInfo.token0),
15678
+ token1: getAddress(poolInfo.token1),
15679
+ maxPriceDeviation: poolInfo.maxPriceDeviation
15680
+ }))]));
15676
15681
  }
15677
- function buildLeaf(definition, decoderAndSanitizerAddress) {
15678
- const selector = functionSelector(definition.functionSignature);
15679
- const packedArgumentAddresses = definition.addressArguments.length === 0 ? "0x" : concat(definition.addressArguments.map((address) => getAddress(address)));
15680
- const rawDigest = concat([encodePacked([
15681
- "address",
15682
- "address",
15683
- "bool",
15684
- "bytes4"
15685
- ], [
15686
- getAddress(decoderAndSanitizerAddress),
15687
- getAddress(definition.target),
15688
- definition.canSendValue,
15689
- selector
15690
- ]), packedArgumentAddresses]);
15682
+ function poolConfiguration(activationBlockNumber, transactionHash, poolInfos) {
15691
15683
  return {
15692
- AddressArguments: definition.addressArguments,
15693
- CanSendValue: definition.canSendValue,
15694
- DecoderAndSanitizerAddress: getAddress(decoderAndSanitizerAddress),
15695
- Description: definition.description,
15696
- FunctionSelector: selector,
15697
- FunctionSignature: definition.functionSignature,
15698
- LeafDigest: keccak256(rawDigest),
15699
- PackedArgumentAddresses: packedArgumentAddresses,
15700
- TargetAddress: getAddress(definition.target)
15684
+ activationBlockNumber,
15685
+ transactionHash,
15686
+ poolInfos,
15687
+ poolHash: hashPoolInfos$1(poolInfos)
15701
15688
  };
15702
15689
  }
15703
- function buildMerkleTree(leafDigests) {
15704
- if (leafDigests.length === 0) throw new Error("Strategist Merkle tree requires at least one leaf digest");
15705
- const layersFromLeaves = [[...leafDigests]];
15706
- while (layersFromLeaves[layersFromLeaves.length - 1]?.length !== 1) {
15707
- const currentLayer = layersFromLeaves[layersFromLeaves.length - 1];
15708
- if (currentLayer === void 0 || currentLayer.length === 0) throw new Error("Strategist Merkle tree produced an empty layer");
15709
- if (currentLayer.length % 2 !== 0) throw new Error("Strategist Merkle tree layers must contain an even number of nodes");
15710
- const parentLayer = [];
15711
- for (let index = 0; index < currentLayer.length; index += 2) {
15712
- const left = currentLayer[index];
15713
- const right = currentLayer[index + 1];
15714
- if (left === void 0 || right === void 0) throw new Error("Strategist Merkle tree contains an incomplete pair");
15715
- parentLayer.push(efficientHash$1(left, right));
15690
+ const wethInitialPoolInfos = MainnetWETHPLPPreviousVaultPoolInfos.poolInfos;
15691
+ const usdcInitialPoolInfos = MainnetUSDCPLPPreviousVaultPoolInfos.poolInfos.slice(0, 1);
15692
+ const usdcTwoPoolInitialDeviation = MainnetUSDCPLPPreviousVaultPoolInfos.poolInfos.map((poolInfo, index) => index === 1 ? {
15693
+ ...poolInfo,
15694
+ maxPriceDeviation: 100
15695
+ } : poolInfo);
15696
+ /**
15697
+ * Mainnet production vault authorization history reconstructed from:
15698
+ * - every `updateHashes` call into the accountant (transaction traces), and
15699
+ * - every `ManageRootUpdated` event for each production strategist.
15700
+ *
15701
+ * Manager roots are retained as audit metadata. `computeNAV` only consumes the
15702
+ * accountant pool configuration, so share-price reconstruction deliberately
15703
+ * does not require historical Merkle leaves.
15704
+ */
15705
+ const MAINNET_VAULT_HISTORIES = [{
15706
+ vaultAddress: MAINNET_DEPLOYMENT$3.hypovault.vaults.wethPlpVault,
15707
+ poolConfigurations: [poolConfiguration(25296753n, "0xdb7ed1d63d3f3b158fca070bdbf8d0268ed8e5c398cae772a1facb40987a838e", wethInitialPoolInfos), poolConfiguration(25704951n, "0xb6d62abb10728655c4c9b612abcd82af9e93c5906357eb6be41cabb224b32118", MainnetWETHPLPVaultPoolInfos.poolInfos)],
15708
+ managerRootTransitions: [
15709
+ {
15710
+ activationBlockNumber: 25296743n,
15711
+ transactionHash: "0xe809d2b0d67da62888967ba15b75168154b1dfe3036f9d7801ce4c2589091226",
15712
+ manageRoot: "0xcd0defea21f2f5625ba2d231bce9500ad31a12181821c3e44a9eab8091726ef9"
15713
+ },
15714
+ {
15715
+ activationBlockNumber: 25303785n,
15716
+ transactionHash: "0xa4deca842f0ce6ed3f95eecc07820869466349df2af78f5d4d9a3b5fac2867b1",
15717
+ manageRoot: "0x14c4c96cc3730452ce71a447bdde6132f81acec862098a9ddd5e086805046a07"
15718
+ },
15719
+ {
15720
+ activationBlockNumber: 25704951n,
15721
+ transactionHash: "0xb6d62abb10728655c4c9b612abcd82af9e93c5906357eb6be41cabb224b32118",
15722
+ manageRoot: "0x4d2fb008ac93d2a363881e31e65f31bacbefef39efb44cf2f95b65cf49c65c7d"
15716
15723
  }
15717
- layersFromLeaves.push(parentLayer);
15718
- }
15719
- return Object.fromEntries([...layersFromLeaves].reverse().map((layer, index) => [String(index), layer]));
15724
+ ]
15725
+ }, {
15726
+ vaultAddress: MAINNET_DEPLOYMENT$3.hypovault.vaults.usdcPlpVault,
15727
+ poolConfigurations: [
15728
+ poolConfiguration(25296798n, "0x37f7ea4ec78c071b6301576745b22f411ac729363fab4202213c7191d89f48c6", usdcInitialPoolInfos),
15729
+ poolConfiguration(25332015n, "0xbe29b782e3aab5cb28476248ff4f5ea67cb6adc16bb5488ec7a1a27f07e59752", usdcTwoPoolInitialDeviation),
15730
+ poolConfiguration(25332931n, "0xb0cc8525abcf3c507eb46e8654250cc67e500886f031adec8cfb5b0baf7c2028", MainnetUSDCPLPPreviousVaultPoolInfos.poolInfos),
15731
+ poolConfiguration(25704951n, "0xb6d62abb10728655c4c9b612abcd82af9e93c5906357eb6be41cabb224b32118", MainnetUSDCPLPVaultPoolInfos.poolInfos)
15732
+ ],
15733
+ managerRootTransitions: [
15734
+ {
15735
+ activationBlockNumber: 25296786n,
15736
+ transactionHash: "0x76ffd4204aa7ce84195d22254d0450f1438656d1da034d54ac267c2636b0a06d",
15737
+ manageRoot: "0xe00ec1dbc941e12239b487765793e966350d795b11092d1cfbcb894be46c40d4"
15738
+ },
15739
+ {
15740
+ activationBlockNumber: 25303784n,
15741
+ transactionHash: "0xea67b8b3ab2cdee17ec79f7d59268468dd7b91774d318f219e5b405246617293",
15742
+ manageRoot: "0x215542d18c9cf442c62bc3a06dbe8d8d9bc893e5d97e70b675e5c8b1721c6e29"
15743
+ },
15744
+ {
15745
+ activationBlockNumber: 25332022n,
15746
+ transactionHash: "0xec02bfbfaa10325189ca751d2cf2412b6004910e65f43d40418bd0e12e7c40d1",
15747
+ manageRoot: "0xed7d4ae055fd62c6edc93bd676456748f52fe4f4b78f60ab3ef6394bacc31b5d"
15748
+ },
15749
+ {
15750
+ activationBlockNumber: 25704951n,
15751
+ transactionHash: "0xb6d62abb10728655c4c9b612abcd82af9e93c5906357eb6be41cabb224b32118",
15752
+ manageRoot: "0x3223880461fe3e61dc96d9d81579ae943507ec95f17cba100b462cec53967e14"
15753
+ }
15754
+ ]
15755
+ }];
15756
+ function copyPoolConfiguration(configuration) {
15757
+ return {
15758
+ ...configuration,
15759
+ poolInfos: configuration.poolInfos.map((poolInfo) => ({ ...poolInfo }))
15760
+ };
15720
15761
  }
15721
- function createStrategistLeavesArtifact(metadata, definitions) {
15722
- if (definitions.length === 0) throw new Error("Strategist artifact requires at least one permission leaf");
15723
- const treeCapacity = nextPowerOfTwo(definitions.length);
15724
- const leafs = definitions.map((definition) => buildLeaf(definition, metadata.decoderAndSanitizerAddress));
15725
- const emptyLeaf = buildLeaf(EMPTY_DEFINITION, zeroAddress);
15726
- while (leafs.length < treeCapacity) leafs.push(emptyLeaf);
15727
- const merkleTree = buildMerkleTree(leafs.map((leaf) => leaf.LeafDigest));
15728
- const root = merkleTree["0"]?.[0];
15729
- if (root === void 0) throw new Error("Strategist Merkle tree root was not generated");
15762
+ function copyManagerRootTransition(transition) {
15763
+ return { ...transition };
15764
+ }
15765
+ function copyHistory(history) {
15730
15766
  return {
15731
- metadata: {
15732
- AccountantAddress: getAddress(metadata.accountantAddress),
15733
- BoringVaultAddress: getAddress(metadata.boringVaultAddress),
15734
- DecoderAndSanitizerAddress: getAddress(metadata.decoderAndSanitizerAddress),
15735
- DigestComposition: DIGEST_COMPOSITION,
15736
- LeafCount: definitions.length,
15737
- ManageRoot: root,
15738
- ManagerAddress: getAddress(metadata.managerAddress),
15739
- TreeCapacity: treeCapacity
15740
- },
15741
- leafs,
15742
- MerkleTree: merkleTree
15767
+ ...history,
15768
+ poolConfigurations: history.poolConfigurations.map(copyPoolConfiguration),
15769
+ managerRootTransitions: history.managerRootTransitions.map(copyManagerRootTransition)
15743
15770
  };
15744
15771
  }
15772
+ function findHistory(chainId, vaultAddress) {
15773
+ if (chainId !== MAINNET_CHAIN_ID) return null;
15774
+ const normalizedVault = vaultAddress.toLowerCase();
15775
+ const history = MAINNET_VAULT_HISTORIES.find((candidate) => candidate.vaultAddress.toLowerCase() === normalizedVault);
15776
+ return history === void 0 ? null : copyHistory(history);
15777
+ }
15778
+ function latestAtBlock(values, blockNumber) {
15779
+ for (let index = values.length - 1; index >= 0; index -= 1) {
15780
+ const value = values[index];
15781
+ if (value !== void 0 && blockNumber >= value.activationBlockNumber) return { ...value };
15782
+ }
15783
+ return null;
15784
+ }
15785
+ function getMainnetVaultPoolConfigurationAtBlock({ chainId, vaultAddress, blockNumber }) {
15786
+ const history = findHistory(chainId, vaultAddress);
15787
+ return history === null ? null : latestAtBlock(history.poolConfigurations, blockNumber);
15788
+ }
15789
+ function getMainnetVaultManagerRootAtBlock({ chainId, vaultAddress, blockNumber }) {
15790
+ const history = findHistory(chainId, vaultAddress);
15791
+ return history === null ? null : latestAtBlock(history.managerRootTransitions, blockNumber);
15792
+ }
15793
+ function getMainnetVaultPoolConfigurationHistory({ chainId, vaultAddress }) {
15794
+ return findHistory(chainId, vaultAddress)?.poolConfigurations ?? null;
15795
+ }
15796
+ function getMainnetVaultManagerRootHistory({ chainId, vaultAddress }) {
15797
+ return findHistory(chainId, vaultAddress)?.managerRootTransitions ?? null;
15798
+ }
15745
15799
 
15746
15800
  //#endregion
15747
- //#region src/hypoVault/hypoVaultManagerArtifacts/MainnetUSDCPLPStrategistLeaves.ts
15748
- const VAULT$1 = "0x236d0558f06cd60780b232d4Ec4c92d2cb7e4D18";
15749
- const DECODER$1 = "0xC87c45d2dbE5acb56013e2591427ECC84Fa251E6";
15750
- const USDC$1 = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
15751
- const CURRENT_POOL$1 = "0x00000000563b70d704f4c6675a5f6ac989fbae13";
15752
- const CURRENT_PO_ETH$1 = "0x1e46b0289B7E0F710E2Db8Ab87800dd782D624f7";
15753
- const CURRENT_PO_USDC$1 = "0x12bF31955522BAC337D93e1bC0a39F68D8BDa216";
15754
- const WSPCXX_PO_USDC = "0x141cc517a6276542B59732Fd85C1A2C536eF7aCA";
15755
- const NEW_POOL$1 = "0x00000000009C7B687e833559e34503f64d7ed7c4";
15756
- const NEW_PO_USDC$1 = "0x3CCdA7d5E841d6543D90BcEc20b36a724C184DE9";
15757
- const NEW_PO_WETH$1 = "0x69E9f9e44E5F52237493b980dd7306198C64A4E4";
15758
- const WETH$1 = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
15759
- const DISPATCH_SIGNATURE$1 = "dispatch(uint256[],uint256[],uint128[],int24[3][],bool,uint256)";
15760
- const MAINNET_USDC_PLP_STRATEGIST_LEAF_DEFINITIONS = [
15761
- {
15762
- description: "Approve poUSDC to spend USDC",
15763
- target: USDC$1,
15764
- functionSignature: "approve(address,uint256)",
15765
- addressArguments: [CURRENT_PO_USDC$1],
15766
- canSendValue: false
15767
- },
15768
- {
15769
- description: "Deposit USDC for poUSDC",
15770
- target: CURRENT_PO_USDC$1,
15771
- functionSignature: "deposit(uint256,address)",
15772
- addressArguments: [VAULT$1],
15773
- canSendValue: false
15774
- },
15775
- {
15776
- description: "Withdraw USDC from poUSDC",
15777
- target: CURRENT_PO_USDC$1,
15778
- functionSignature: "withdraw(uint256,address,address)",
15779
- addressArguments: [VAULT$1, VAULT$1],
15780
- canSendValue: false
15781
- },
15782
- {
15783
- description: "Withdraw USDC from poUSDC (with open positions)",
15784
- target: CURRENT_PO_USDC$1,
15785
- functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
15786
- addressArguments: [VAULT$1, VAULT$1],
15787
- canSendValue: false
15788
- },
15789
- {
15790
- description: "Mint poUSDC using USDC",
15791
- target: CURRENT_PO_USDC$1,
15792
- functionSignature: "mint(uint256,address)",
15793
- addressArguments: [VAULT$1],
15794
- canSendValue: false
15795
- },
15796
- {
15797
- description: "Redeem poUSDC for USDC",
15798
- target: CURRENT_PO_USDC$1,
15799
- functionSignature: "redeem(uint256,address,address)",
15800
- addressArguments: [VAULT$1, VAULT$1],
15801
- canSendValue: false
15802
- },
15803
- {
15804
- description: "Dispatch mint/burn options on PanopticPool",
15805
- target: CURRENT_POOL$1,
15806
- functionSignature: DISPATCH_SIGNATURE$1,
15807
- addressArguments: [],
15808
- canSendValue: false
15809
- },
15810
- {
15811
- description: "Withdraw ETH from poETH",
15812
- target: CURRENT_PO_ETH$1,
15813
- functionSignature: "withdraw(uint256,address,address)",
15814
- addressArguments: [VAULT$1, VAULT$1],
15815
- canSendValue: false
15816
- },
15817
- {
15818
- description: "Withdraw ETH from poETH (with open positions)",
15819
- target: CURRENT_PO_ETH$1,
15820
- functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
15821
- addressArguments: [VAULT$1, VAULT$1],
15822
- canSendValue: false
15823
- },
15824
- {
15825
- description: "Approve wSPCXx poUSDC to spend USDC",
15826
- target: USDC$1,
15827
- functionSignature: "approve(address,uint256)",
15828
- addressArguments: [WSPCXX_PO_USDC],
15829
- canSendValue: false
15830
- },
15831
- {
15832
- description: "Deposit USDC for wSPCXx poUSDC",
15833
- target: WSPCXX_PO_USDC,
15834
- functionSignature: "deposit(uint256,address)",
15835
- addressArguments: [VAULT$1],
15836
- canSendValue: false
15837
- },
15838
- {
15839
- description: "Withdraw USDC from wSPCXx poUSDC",
15840
- target: WSPCXX_PO_USDC,
15841
- functionSignature: "withdraw(uint256,address,address)",
15842
- addressArguments: [VAULT$1, VAULT$1],
15843
- canSendValue: false
15844
- },
15845
- {
15846
- description: "Deposit ETH for poETH (payable)",
15847
- target: CURRENT_PO_ETH$1,
15848
- functionSignature: "deposit(uint256,address)",
15849
- addressArguments: [VAULT$1],
15850
- canSendValue: true
15851
- },
15852
- {
15853
- description: "Mint poETH using ETH (payable)",
15854
- target: CURRENT_PO_ETH$1,
15855
- functionSignature: "mint(uint256,address)",
15856
- addressArguments: [VAULT$1],
15857
- canSendValue: true
15858
- },
15859
- {
15860
- description: "Redeem poETH for ETH",
15861
- target: CURRENT_PO_ETH$1,
15862
- functionSignature: "redeem(uint256,address,address)",
15863
- addressArguments: [VAULT$1, VAULT$1],
15864
- canSendValue: false
15865
- },
15866
- {
15867
- description: "Approve poUSDC v3 to spend USDC",
15868
- target: USDC$1,
15869
- functionSignature: "approve(address,uint256)",
15870
- addressArguments: [NEW_PO_USDC$1],
15871
- canSendValue: false
15872
- },
15873
- {
15874
- description: "Deposit USDC for poUSDC v3",
15875
- target: NEW_PO_USDC$1,
15876
- functionSignature: "deposit(uint256,address)",
15877
- addressArguments: [VAULT$1],
15878
- canSendValue: false
15879
- },
15880
- {
15881
- description: "Withdraw USDC from poUSDC v3",
15882
- target: NEW_PO_USDC$1,
15883
- functionSignature: "withdraw(uint256,address,address)",
15884
- addressArguments: [VAULT$1, VAULT$1],
15885
- canSendValue: false
15886
- },
15887
- {
15888
- description: "Withdraw USDC from poUSDC v3 (with open positions)",
15889
- target: NEW_PO_USDC$1,
15890
- functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
15891
- addressArguments: [VAULT$1, VAULT$1],
15892
- canSendValue: false
15893
- },
15894
- {
15895
- description: "Mint poUSDC v3 using USDC",
15896
- target: NEW_PO_USDC$1,
15897
- functionSignature: "mint(uint256,address)",
15898
- addressArguments: [VAULT$1],
15899
- canSendValue: false
15900
- },
15901
- {
15902
- description: "Redeem poUSDC v3 for USDC",
15903
- target: NEW_PO_USDC$1,
15904
- functionSignature: "redeem(uint256,address,address)",
15905
- addressArguments: [VAULT$1, VAULT$1],
15906
- canSendValue: false
15907
- },
15908
- {
15909
- description: "Dispatch mint/burn options on PanopticPool",
15910
- target: NEW_POOL$1,
15911
- functionSignature: DISPATCH_SIGNATURE$1,
15912
- addressArguments: [],
15913
- canSendValue: false
15914
- },
15915
- {
15916
- description: "Approve poWETH v3 to spend WETH",
15917
- target: WETH$1,
15918
- functionSignature: "approve(address,uint256)",
15919
- addressArguments: [NEW_PO_WETH$1],
15920
- canSendValue: false
15921
- },
15922
- {
15923
- description: "Deposit WETH for poWETH v3",
15924
- target: NEW_PO_WETH$1,
15925
- functionSignature: "deposit(uint256,address)",
15926
- addressArguments: [VAULT$1],
15927
- canSendValue: false
15928
- },
15929
- {
15930
- description: "Withdraw WETH from poWETH v3",
15931
- target: NEW_PO_WETH$1,
15932
- functionSignature: "withdraw(uint256,address,address)",
15933
- addressArguments: [VAULT$1, VAULT$1],
15934
- canSendValue: false
15935
- },
15936
- {
15937
- description: "Withdraw WETH from poWETH v3 (with open positions)",
15938
- target: NEW_PO_WETH$1,
15939
- functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
15940
- addressArguments: [VAULT$1, VAULT$1],
15941
- canSendValue: false
15942
- },
15943
- {
15944
- description: "Mint poWETH v3 using WETH",
15945
- target: NEW_PO_WETH$1,
15946
- functionSignature: "mint(uint256,address)",
15947
- addressArguments: [VAULT$1],
15948
- canSendValue: false
15949
- },
15950
- {
15951
- description: "Redeem poWETH v3 for WETH",
15952
- target: NEW_PO_WETH$1,
15953
- functionSignature: "redeem(uint256,address,address)",
15954
- addressArguments: [VAULT$1, VAULT$1],
15955
- canSendValue: false
15956
- }
15957
- ];
15958
- const MAINNET_USDC_PLP_STRATEGIST_ARTIFACT_METADATA = {
15959
- accountantAddress: "0x65aA902AE3135658587FFC36ED51B61c927114e1",
15960
- boringVaultAddress: VAULT$1,
15961
- decoderAndSanitizerAddress: DECODER$1,
15962
- managerAddress: "0x2ce65016366ef7320078e0758D58Cf1038bc7C4e"
15963
- };
15964
- /** Number of leaf definitions authorized before the V3 pool release. */
15965
- const PRE_V3_AUTHORIZATION_LEAF_COUNT$1 = 12;
15966
- /** Production permissions before the ETH/USDC 5bps v3 pool authorization executes. */
15967
- const MainnetUSDCPLPPreviousStrategistLeaves = createStrategistLeavesArtifact(MAINNET_USDC_PLP_STRATEGIST_ARTIFACT_METADATA, MAINNET_USDC_PLP_STRATEGIST_LEAF_DEFINITIONS.slice(0, PRE_V3_AUTHORIZATION_LEAF_COUNT$1));
15968
- /** Production permissions after the ETH/USDC 5bps v3 pool authorization executes. */
15969
- const MainnetUSDCPLPStrategistLeaves = createStrategistLeavesArtifact(MAINNET_USDC_PLP_STRATEGIST_ARTIFACT_METADATA, MAINNET_USDC_PLP_STRATEGIST_LEAF_DEFINITIONS);
15801
+ //#region src/hypoVault/utils/buildManagerInput.ts
15802
+ const NATIVE_ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
15803
+ const NATIVE_ETH_ALIAS_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
15804
+ function isUnderlyingEquivalentToken({ token, underlyingToken, wethAddress }) {
15805
+ const tokenLower = token.toLowerCase();
15806
+ const underlyingLower = underlyingToken.toLowerCase();
15807
+ if (tokenLower === underlyingLower) return true;
15808
+ if (wethAddress === void 0) return false;
15809
+ const wethLower = wethAddress.toLowerCase();
15810
+ const tokenIsNativeAlias = tokenLower === NATIVE_ZERO_ADDRESS || tokenLower === NATIVE_ETH_ALIAS_ADDRESS;
15811
+ return tokenIsNativeAlias && underlyingLower === wethLower;
15812
+ }
15813
+ /**
15814
+ * Builds the encoded managerInput for HypoVault operations like fulfillDeposits and fulfillWithdrawals.
15815
+ *
15816
+ * Supports the full input space of computeNAV by:
15817
+ * - Fetching TWAP ticks from each pool in poolInfos
15818
+ * - Setting token prices based on whether each token matches the underlyingToken address
15819
+ *
15820
+ * @param params.viemClient - Viem client with account for RPC calls
15821
+ * @param params.poolInfos - Array of pool info objects containing pool and token configuration
15822
+ * @param params.tokenIds - 2D array of tokenIds for each pool
15823
+ * @param params.underlyingToken - Address of the vault's underlying token
15824
+ * @param params.erc4626Vaults - Optional list of ERC4626 vaults considered by accountant NAV
15825
+ * @returns Encoded managerInput as Hex
15826
+ */
15827
+ async function buildManagerInput({ viemClient, poolInfos, tokenIds, underlyingToken, wethAddress, erc4626Vaults = [] }) {
15828
+ if (tokenIds.length !== poolInfos.length) throw new Error(`Invalid managerInput tokenIds length: expected ${poolInfos.length}, received ${tokenIds.length}`);
15829
+ const twapTicks = await Promise.all(poolInfos.map((poolInfo) => readContract(viemClient, {
15830
+ address: poolInfo.pool,
15831
+ abi: parseAbi(["function getTWAP() view returns (int24)"]),
15832
+ functionName: "getTWAP"
15833
+ })));
15834
+ const managerPrices = poolInfos.map((poolInfo, i) => {
15835
+ const twapTick = Number(twapTicks[i]);
15836
+ const token0IsUnderlying = isUnderlyingEquivalentToken({
15837
+ token: poolInfo.token0,
15838
+ underlyingToken,
15839
+ wethAddress
15840
+ });
15841
+ const token1IsUnderlying = isUnderlyingEquivalentToken({
15842
+ token: poolInfo.token1,
15843
+ underlyingToken,
15844
+ wethAddress
15845
+ });
15846
+ return {
15847
+ poolPrice: twapTick,
15848
+ token0Price: token0IsUnderlying ? 0 : twapTick,
15849
+ token1Price: token1IsUnderlying ? 0 : twapTick
15850
+ };
15851
+ });
15852
+ if (managerPrices.length !== poolInfos.length) throw new Error(`Invalid managerInput managerPrices length: expected ${poolInfos.length}, received ${managerPrices.length}`);
15853
+ return encodeAbiParameters(PanopticVaultAccountantManagerInputAbi, [
15854
+ managerPrices,
15855
+ poolInfos.map((poolInfo) => ({
15856
+ pool: poolInfo.pool,
15857
+ token0: poolInfo.token0,
15858
+ token1: poolInfo.token1,
15859
+ maxPriceDeviation: poolInfo.maxPriceDeviation
15860
+ })),
15861
+ tokenIds,
15862
+ erc4626Vaults
15863
+ ]);
15864
+ }
15970
15865
 
15971
15866
  //#endregion
15972
- //#region src/hypoVault/hypoVaultManagerArtifacts/MainnetWETHPLPStrategistLeaves.ts
15973
- const MAINNET_DEPLOYMENT$2 = requireChainDeployment(MAINNET_CHAIN_ID);
15974
- const NEW_POOL_DEPLOYMENT = MAINNET_DEPLOYMENT$2.panoptic.additionalPools?.ethUsdc5bpsV3;
15975
- if (NEW_POOL_DEPLOYMENT === void 0) throw new Error("Missing mainnet ETH/USDC 5bps v3 Panoptic pool deployment");
15976
- const VAULT = MAINNET_DEPLOYMENT$2.hypovault.vaults.wethPlpVault;
15977
- const DECODER = MAINNET_DEPLOYMENT$2.hypovault.core.collateralTrackerDecoderAndSanitizer;
15978
- const CURRENT_POOL = MAINNET_DEPLOYMENT$2.panoptic.pool.panopticPool;
15979
- const CURRENT_PO_ETH = MAINNET_DEPLOYMENT$2.panoptic.pool.collateralTracker0;
15980
- const CURRENT_PO_USDC = MAINNET_DEPLOYMENT$2.panoptic.pool.collateralTracker1;
15981
- const NEW_POOL = NEW_POOL_DEPLOYMENT.panopticPool;
15982
- const NEW_PO_USDC = NEW_POOL_DEPLOYMENT.collateralTracker0;
15983
- const NEW_PO_WETH = NEW_POOL_DEPLOYMENT.collateralTracker1;
15984
- const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
15985
- const WETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
15986
- const DISPATCH_SIGNATURE = "dispatch(uint256[],uint256[],uint128[],int24[3][],bool,uint256)";
15987
- const MAINNET_WETH_PLP_STRATEGIST_LEAF_DEFINITIONS = [
15988
- {
15989
- description: "Deposit ETH for poETH (payable)",
15990
- target: CURRENT_PO_ETH,
15991
- functionSignature: "deposit(uint256,address)",
15992
- addressArguments: [VAULT],
15993
- canSendValue: true
15994
- },
15995
- {
15996
- description: "Withdraw ETH from poETH",
15997
- target: CURRENT_PO_ETH,
15998
- functionSignature: "withdraw(uint256,address,address)",
15999
- addressArguments: [VAULT, VAULT],
16000
- canSendValue: false
16001
- },
16002
- {
16003
- description: "Withdraw ETH from poETH (with open positions)",
16004
- target: CURRENT_PO_ETH,
16005
- functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
16006
- addressArguments: [VAULT, VAULT],
16007
- canSendValue: false
16008
- },
16009
- {
16010
- description: "Mint poETH using ETH (payable)",
16011
- target: CURRENT_PO_ETH,
16012
- functionSignature: "mint(uint256,address)",
16013
- addressArguments: [VAULT],
16014
- canSendValue: true
16015
- },
16016
- {
16017
- description: "Redeem poETH for ETH",
16018
- target: CURRENT_PO_ETH,
16019
- functionSignature: "redeem(uint256,address,address)",
16020
- addressArguments: [VAULT, VAULT],
16021
- canSendValue: false
16022
- },
16023
- {
16024
- description: "Dispatch mint/burn options on PanopticPool",
16025
- target: CURRENT_POOL,
16026
- functionSignature: DISPATCH_SIGNATURE,
16027
- addressArguments: [],
16028
- canSendValue: false
16029
- },
16030
- {
16031
- description: "Wrap ETH to WETH",
16032
- target: WETH,
16033
- functionSignature: "deposit()",
16034
- addressArguments: [],
16035
- canSendValue: true
16036
- },
16037
- {
16038
- description: "Unwrap WETH to ETH",
16039
- target: WETH,
16040
- functionSignature: "withdraw(uint256)",
16041
- addressArguments: [],
16042
- canSendValue: false
16043
- },
16044
- {
16045
- description: "Withdraw USDC from poUSDC",
16046
- target: CURRENT_PO_USDC,
16047
- functionSignature: "withdraw(uint256,address,address)",
16048
- addressArguments: [VAULT, VAULT],
16049
- canSendValue: false
16050
- },
16051
- {
16052
- description: "Withdraw USDC from poUSDC (with open positions)",
16053
- target: CURRENT_PO_USDC,
16054
- functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
16055
- addressArguments: [VAULT, VAULT],
16056
- canSendValue: false
16057
- },
16058
- {
16059
- description: "Approve poUSDC to spend USDC",
16060
- target: USDC,
16061
- functionSignature: "approve(address,uint256)",
16062
- addressArguments: [CURRENT_PO_USDC],
16063
- canSendValue: false
16064
- },
16065
- {
16066
- description: "Deposit USDC for poUSDC",
16067
- target: CURRENT_PO_USDC,
16068
- functionSignature: "deposit(uint256,address)",
16069
- addressArguments: [VAULT],
16070
- canSendValue: false
16071
- },
16072
- {
16073
- description: "Mint poUSDC using USDC",
16074
- target: CURRENT_PO_USDC,
16075
- functionSignature: "mint(uint256,address)",
16076
- addressArguments: [VAULT],
16077
- canSendValue: false
16078
- },
16079
- {
16080
- description: "Redeem poUSDC for USDC",
16081
- target: CURRENT_PO_USDC,
16082
- functionSignature: "redeem(uint256,address,address)",
16083
- addressArguments: [VAULT, VAULT],
16084
- canSendValue: false
16085
- },
16086
- {
16087
- description: "Approve poWETH v3 to spend WETH",
16088
- target: WETH,
16089
- functionSignature: "approve(address,uint256)",
16090
- addressArguments: [NEW_PO_WETH],
16091
- canSendValue: false
16092
- },
16093
- {
16094
- description: "Deposit WETH for poWETH v3",
16095
- target: NEW_PO_WETH,
16096
- functionSignature: "deposit(uint256,address)",
16097
- addressArguments: [VAULT],
16098
- canSendValue: false
16099
- },
16100
- {
16101
- description: "Withdraw WETH from poWETH v3",
16102
- target: NEW_PO_WETH,
16103
- functionSignature: "withdraw(uint256,address,address)",
16104
- addressArguments: [VAULT, VAULT],
16105
- canSendValue: false
16106
- },
16107
- {
16108
- description: "Withdraw WETH from poWETH v3 (with open positions)",
16109
- target: NEW_PO_WETH,
16110
- functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
16111
- addressArguments: [VAULT, VAULT],
16112
- canSendValue: false
16113
- },
16114
- {
16115
- description: "Mint poWETH v3 using WETH",
16116
- target: NEW_PO_WETH,
16117
- functionSignature: "mint(uint256,address)",
16118
- addressArguments: [VAULT],
16119
- canSendValue: false
16120
- },
16121
- {
16122
- description: "Redeem poWETH v3 for WETH",
16123
- target: NEW_PO_WETH,
16124
- functionSignature: "redeem(uint256,address,address)",
16125
- addressArguments: [VAULT, VAULT],
16126
- canSendValue: false
16127
- },
16128
- {
16129
- description: "Dispatch mint/burn options on PanopticPool",
16130
- target: NEW_POOL,
16131
- functionSignature: DISPATCH_SIGNATURE,
16132
- addressArguments: [],
16133
- canSendValue: false
16134
- },
16135
- {
16136
- description: "Approve poUSDC v3 to spend USDC",
16137
- target: USDC,
16138
- functionSignature: "approve(address,uint256)",
16139
- addressArguments: [NEW_PO_USDC],
16140
- canSendValue: false
16141
- },
16142
- {
16143
- description: "Deposit USDC for poUSDC v3",
16144
- target: NEW_PO_USDC,
16145
- functionSignature: "deposit(uint256,address)",
16146
- addressArguments: [VAULT],
16147
- canSendValue: false
16148
- },
16149
- {
16150
- description: "Withdraw USDC from poUSDC v3",
16151
- target: NEW_PO_USDC,
16152
- functionSignature: "withdraw(uint256,address,address)",
16153
- addressArguments: [VAULT, VAULT],
16154
- canSendValue: false
16155
- },
16156
- {
16157
- description: "Withdraw USDC from poUSDC v3 (with open positions)",
16158
- target: NEW_PO_USDC,
16159
- functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
16160
- addressArguments: [VAULT, VAULT],
16161
- canSendValue: false
16162
- },
16163
- {
16164
- description: "Mint poUSDC v3 using USDC",
16165
- target: NEW_PO_USDC,
16166
- functionSignature: "mint(uint256,address)",
16167
- addressArguments: [VAULT],
16168
- canSendValue: false
16169
- },
16170
- {
16171
- description: "Redeem poUSDC v3 for USDC",
16172
- target: NEW_PO_USDC,
16173
- functionSignature: "redeem(uint256,address,address)",
16174
- addressArguments: [VAULT, VAULT],
16175
- canSendValue: false
16176
- }
16177
- ];
16178
- const MAINNET_WETH_PLP_STRATEGIST_ARTIFACT_METADATA = {
16179
- accountantAddress: MAINNET_DEPLOYMENT$2.hypovault.core.accountant,
16180
- boringVaultAddress: VAULT,
16181
- decoderAndSanitizerAddress: DECODER,
16182
- managerAddress: MAINNET_DEPLOYMENT$2.hypovault.managers.wethPlpVaultManager
16183
- };
16184
- /** Number of leaf definitions authorized before the V3 pool release. */
16185
- const PRE_V3_AUTHORIZATION_LEAF_COUNT = 10;
16186
- /** Production permissions before the ETH/USDC 5bps v3 pool authorization executes. */
16187
- const MainnetWETHPLPPreviousStrategistLeaves = createStrategistLeavesArtifact(MAINNET_WETH_PLP_STRATEGIST_ARTIFACT_METADATA, MAINNET_WETH_PLP_STRATEGIST_LEAF_DEFINITIONS.slice(0, PRE_V3_AUTHORIZATION_LEAF_COUNT));
16188
- /** Production permissions after the ETH/USDC 5bps v3 pool authorization executes. */
16189
- const MainnetWETHPLPStrategistLeaves = createStrategistLeavesArtifact(MAINNET_WETH_PLP_STRATEGIST_ARTIFACT_METADATA, MAINNET_WETH_PLP_STRATEGIST_LEAF_DEFINITIONS);
15867
+ //#region src/hypoVault/utils/buildManagerInputAtBlock.ts
15868
+ /**
15869
+ * Builds encoded managerInput for HypoVault accountant reads at a specific block.
15870
+ */
15871
+ async function buildManagerInputAtBlock({ viemClient, poolInfos, tokenIds, underlyingToken, wethAddress, blockNumber, erc4626Vaults = [] }) {
15872
+ if (tokenIds.length !== poolInfos.length) throw new Error(`Invalid managerInput tokenIds length: expected ${poolInfos.length}, received ${tokenIds.length}`);
15873
+ const twapTicks = await Promise.all(poolInfos.map((poolInfo) => readContract(viemClient, {
15874
+ address: poolInfo.pool,
15875
+ abi: parseAbi(["function getTWAP() view returns (int24)"]),
15876
+ functionName: "getTWAP",
15877
+ blockNumber
15878
+ })));
15879
+ const managerPrices = poolInfos.map((poolInfo, i) => {
15880
+ const twapTick = Number(twapTicks[i]);
15881
+ const token0IsUnderlying = isUnderlyingEquivalentToken({
15882
+ token: poolInfo.token0,
15883
+ underlyingToken,
15884
+ wethAddress
15885
+ });
15886
+ const token1IsUnderlying = isUnderlyingEquivalentToken({
15887
+ token: poolInfo.token1,
15888
+ underlyingToken,
15889
+ wethAddress
15890
+ });
15891
+ return {
15892
+ poolPrice: twapTick,
15893
+ token0Price: token0IsUnderlying ? 0 : twapTick,
15894
+ token1Price: token1IsUnderlying ? 0 : twapTick
15895
+ };
15896
+ });
15897
+ if (managerPrices.length !== poolInfos.length) throw new Error(`Invalid managerInput managerPrices length: expected ${poolInfos.length}, received ${managerPrices.length}`);
15898
+ return encodeAbiParameters(PanopticVaultAccountantManagerInputAbi, [
15899
+ managerPrices,
15900
+ poolInfos.map((poolInfo) => ({
15901
+ pool: poolInfo.pool,
15902
+ token0: poolInfo.token0,
15903
+ token1: poolInfo.token1,
15904
+ maxPriceDeviation: poolInfo.maxPriceDeviation
15905
+ })),
15906
+ tokenIds,
15907
+ erc4626Vaults
15908
+ ]);
15909
+ }
16190
15910
 
16191
15911
  //#endregion
16192
- //#region src/hypoVault/mainnetV3Authorization.ts
16193
- const MAINNET_DEPLOYMENT$1 = requireChainDeployment(MAINNET_CHAIN_ID);
16194
- /** Block containing the successful V3 accountant-hash and manager-root update. */
16195
- const MAINNET_V3_AUTHORIZATION_BLOCK = 25704951n;
16196
- const POOL_INFO_ARRAY_ABI = {
16197
- type: "tuple[]",
16198
- components: [
16199
- {
16200
- name: "pool",
16201
- type: "address"
16202
- },
16203
- {
16204
- name: "token0",
16205
- type: "address"
16206
- },
16207
- {
16208
- name: "token1",
16209
- type: "address"
16210
- },
16211
- {
16212
- name: "maxPriceDeviation",
16213
- type: "int24"
16214
- }
16215
- ]
16216
- };
16217
- function createVaultTransition(transition) {
16218
- return {
16219
- ...transition,
16220
- generations: [{
16221
- version: "previous",
16222
- ...transition.previous
16223
- }, {
16224
- version: "next",
16225
- ...transition.next
16226
- }]
16227
- };
16228
- }
16229
- function hashPoolInfos(poolInfos) {
16230
- return keccak256(encodeAbiParameters([POOL_INFO_ARRAY_ABI], [poolInfos.map((poolInfo) => ({
16231
- pool: getAddress(poolInfo.pool),
16232
- token0: getAddress(poolInfo.token0),
16233
- token1: getAddress(poolInfo.token1),
16234
- maxPriceDeviation: poolInfo.maxPriceDeviation
16235
- }))]));
16236
- }
16237
- function generation(poolInfos, strategistLeaves) {
16238
- return {
16239
- poolInfos,
16240
- strategistLeaves,
16241
- poolHash: hashPoolInfos(poolInfos),
16242
- manageRoot: strategistLeaves.metadata.ManageRoot
16243
- };
16244
- }
16245
- const MAINNET_V3_AUTHORIZATION_TRANSITIONS = [createVaultTransition({
16246
- vaultAddress: MAINNET_DEPLOYMENT$1.hypovault.vaults.wethPlpVault,
16247
- managerAddress: MAINNET_DEPLOYMENT$1.hypovault.managers.wethPlpVaultManager,
16248
- strategistAddress: MAINNET_DEPLOYMENT$1.hypovault.turnkeySigners.wethPlpVaultManager,
16249
- activationBlockNumber: MAINNET_V3_AUTHORIZATION_BLOCK,
16250
- previous: generation(MainnetWETHPLPPreviousVaultPoolInfos.poolInfos, MainnetWETHPLPPreviousStrategistLeaves),
16251
- next: generation(MainnetWETHPLPVaultPoolInfos.poolInfos, MainnetWETHPLPStrategistLeaves)
16252
- }), createVaultTransition({
16253
- vaultAddress: MAINNET_DEPLOYMENT$1.hypovault.vaults.usdcPlpVault,
16254
- managerAddress: MAINNET_DEPLOYMENT$1.hypovault.managers.usdcPlpVaultManager,
16255
- strategistAddress: MAINNET_DEPLOYMENT$1.hypovault.turnkeySigners.usdcPlpVaultManager,
16256
- activationBlockNumber: MAINNET_V3_AUTHORIZATION_BLOCK,
16257
- previous: generation(MainnetUSDCPLPPreviousVaultPoolInfos.poolInfos, MainnetUSDCPLPPreviousStrategistLeaves),
16258
- next: generation(MainnetUSDCPLPVaultPoolInfos.poolInfos, MainnetUSDCPLPStrategistLeaves)
16259
- })];
16260
- const authorizationCacheByClient = new WeakMap();
16261
- function findTransition(chainId, vaultAddress) {
16262
- if (chainId !== MAINNET_CHAIN_ID) return null;
16263
- const normalizedVault = vaultAddress.toLowerCase();
16264
- return MAINNET_V3_AUTHORIZATION_TRANSITIONS.find((transition) => transition.vaultAddress.toLowerCase() === normalizedVault) ?? null;
16265
- }
16266
- /** Returns both known generations without reading chain state. */
16267
- function getMainnetV3AuthorizationGenerations({ chainId, vaultAddress }) {
16268
- const transition = findTransition(chainId, vaultAddress);
16269
- return transition === null ? null : {
16270
- previous: transition.previous,
16271
- next: transition.next
16272
- };
16273
- }
16274
- /**
16275
- * Selects the mainnet authorization artifacts active at a historical block without RPC reads.
16276
- * Live callers should use the compiled current artifacts directly; this selector exists for
16277
- * block-pinned NAV and manager-input reconstruction across the V3 authorization boundary.
16278
- */
16279
- function getMainnetV3AuthorizationArtifactsAtBlock({ chainId, vaultAddress, blockNumber }) {
16280
- const transition = findTransition(chainId, vaultAddress);
16281
- if (transition === null) return null;
16282
- const version = blockNumber < transition.activationBlockNumber ? "previous" : "next";
16283
- return {
16284
- blockNumber,
16285
- version,
16286
- ...transition[version]
16287
- };
16288
- }
16289
- /**
16290
- * Selects the exact artifact generation authorized by both the accountant and manager.
16291
- * A mixed or unknown state is rejected: using only one side of the transition would
16292
- * make either NAV calculation or strategist proof verification fail.
16293
- * Every authorization release must add its generation to this transition table before
16294
- * the on-chain hashes change, so startup and release verification keeps recognizing it.
16295
- */
16296
- async function resolveMainnetV3AuthorizationArtifacts({ viemClient, chainId, vaultAddress, blockNumber }) {
16297
- const transition = findTransition(chainId, vaultAddress);
16298
- if (transition === null) return null;
16299
- const resolvedBlockNumber = blockNumber ?? await getBlockNumber(viemClient);
16300
- const cacheKey = `${chainId}:${vaultAddress.toLowerCase()}:${resolvedBlockNumber.toString()}`;
16301
- const clientCache = authorizationCacheByClient.get(viemClient);
16302
- const cached = clientCache?.get(cacheKey);
16303
- if (cached !== void 0) return cached;
16304
- const [poolHash, manageRoot] = await Promise.all([readContract(viemClient, {
16305
- address: MAINNET_DEPLOYMENT$1.hypovault.core.accountant,
16306
- abi: PanopticVaultAccountantAbi,
16307
- functionName: "vaultHashes",
16308
- args: [transition.vaultAddress, 0n],
16309
- blockNumber: resolvedBlockNumber
16310
- }), readContract(viemClient, {
16311
- address: transition.managerAddress,
16312
- abi: HypoVaultManagerWithMerkleVerificationAbi,
16313
- functionName: "manageRoot",
16314
- args: [transition.strategistAddress],
16315
- blockNumber: resolvedBlockNumber
16316
- })]);
16317
- for (const candidate of [...transition.generations].reverse()) if (poolHash === candidate.poolHash && manageRoot === candidate.manageRoot) {
16318
- const resolved = {
16319
- blockNumber: resolvedBlockNumber,
16320
- ...candidate
16321
- };
16322
- const resolvedClientCache = clientCache ?? new Map();
16323
- resolvedClientCache.set(cacheKey, resolved);
16324
- if (clientCache === void 0) authorizationCacheByClient.set(viemClient, resolvedClientCache);
16325
- return resolved;
16326
- }
16327
- throw new Error(`Unsupported or inconsistent mainnet v3 authorization state for vault ${transition.vaultAddress}: accountant pool hash ${poolHash}, manager root ${manageRoot}`);
16328
- }
16329
-
16330
- //#endregion
16331
- //#region src/hypoVault/utils/buildManagerInput.ts
16332
- const NATIVE_ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
16333
- const NATIVE_ETH_ALIAS_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
16334
- function isUnderlyingEquivalentToken({ token, underlyingToken, wethAddress }) {
16335
- const tokenLower = token.toLowerCase();
16336
- const underlyingLower = underlyingToken.toLowerCase();
16337
- if (tokenLower === underlyingLower) return true;
16338
- if (wethAddress === void 0) return false;
16339
- const wethLower = wethAddress.toLowerCase();
16340
- const tokenIsNativeAlias = tokenLower === NATIVE_ZERO_ADDRESS || tokenLower === NATIVE_ETH_ALIAS_ADDRESS;
16341
- return tokenIsNativeAlias && underlyingLower === wethLower;
16342
- }
16343
- /**
16344
- * Builds the encoded managerInput for HypoVault operations like fulfillDeposits and fulfillWithdrawals.
16345
- *
16346
- * Supports the full input space of computeNAV by:
16347
- * - Fetching TWAP ticks from each pool in poolInfos
16348
- * - Setting token prices based on whether each token matches the underlyingToken address
16349
- *
16350
- * @param params.viemClient - Viem client with account for RPC calls
16351
- * @param params.poolInfos - Array of pool info objects containing pool and token configuration
16352
- * @param params.tokenIds - 2D array of tokenIds for each pool
16353
- * @param params.underlyingToken - Address of the vault's underlying token
16354
- * @param params.erc4626Vaults - Optional list of ERC4626 vaults considered by accountant NAV
16355
- * @returns Encoded managerInput as Hex
16356
- */
16357
- async function buildManagerInput({ viemClient, poolInfos, tokenIds, underlyingToken, wethAddress, erc4626Vaults = [] }) {
16358
- if (tokenIds.length !== poolInfos.length) throw new Error(`Invalid managerInput tokenIds length: expected ${poolInfos.length}, received ${tokenIds.length}`);
16359
- const twapTicks = await Promise.all(poolInfos.map((poolInfo) => readContract(viemClient, {
16360
- address: poolInfo.pool,
16361
- abi: parseAbi(["function getTWAP() view returns (int24)"]),
16362
- functionName: "getTWAP"
16363
- })));
16364
- const managerPrices = poolInfos.map((poolInfo, i) => {
16365
- const twapTick = Number(twapTicks[i]);
16366
- const token0IsUnderlying = isUnderlyingEquivalentToken({
16367
- token: poolInfo.token0,
16368
- underlyingToken,
16369
- wethAddress
16370
- });
16371
- const token1IsUnderlying = isUnderlyingEquivalentToken({
16372
- token: poolInfo.token1,
16373
- underlyingToken,
16374
- wethAddress
16375
- });
16376
- return {
16377
- poolPrice: twapTick,
16378
- token0Price: token0IsUnderlying ? 0 : twapTick,
16379
- token1Price: token1IsUnderlying ? 0 : twapTick
16380
- };
16381
- });
16382
- if (managerPrices.length !== poolInfos.length) throw new Error(`Invalid managerInput managerPrices length: expected ${poolInfos.length}, received ${managerPrices.length}`);
16383
- return encodeAbiParameters(PanopticVaultAccountantManagerInputAbi, [
16384
- managerPrices,
16385
- poolInfos.map((poolInfo) => ({
16386
- pool: poolInfo.pool,
16387
- token0: poolInfo.token0,
16388
- token1: poolInfo.token1,
16389
- maxPriceDeviation: poolInfo.maxPriceDeviation
16390
- })),
16391
- tokenIds,
16392
- erc4626Vaults
16393
- ]);
16394
- }
16395
-
16396
- //#endregion
16397
- //#region src/hypoVault/utils/buildManagerInputAtBlock.ts
16398
- /**
16399
- * Builds encoded managerInput for HypoVault accountant reads at a specific block.
16400
- */
16401
- async function buildManagerInputAtBlock({ viemClient, poolInfos, tokenIds, underlyingToken, wethAddress, blockNumber, erc4626Vaults = [] }) {
16402
- if (tokenIds.length !== poolInfos.length) throw new Error(`Invalid managerInput tokenIds length: expected ${poolInfos.length}, received ${tokenIds.length}`);
16403
- const twapTicks = await Promise.all(poolInfos.map((poolInfo) => readContract(viemClient, {
16404
- address: poolInfo.pool,
16405
- abi: parseAbi(["function getTWAP() view returns (int24)"]),
16406
- functionName: "getTWAP",
16407
- blockNumber
16408
- })));
16409
- const managerPrices = poolInfos.map((poolInfo, i) => {
16410
- const twapTick = Number(twapTicks[i]);
16411
- const token0IsUnderlying = isUnderlyingEquivalentToken({
16412
- token: poolInfo.token0,
16413
- underlyingToken,
16414
- wethAddress
16415
- });
16416
- const token1IsUnderlying = isUnderlyingEquivalentToken({
16417
- token: poolInfo.token1,
16418
- underlyingToken,
16419
- wethAddress
16420
- });
16421
- return {
16422
- poolPrice: twapTick,
16423
- token0Price: token0IsUnderlying ? 0 : twapTick,
16424
- token1Price: token1IsUnderlying ? 0 : twapTick
16425
- };
16426
- });
16427
- if (managerPrices.length !== poolInfos.length) throw new Error(`Invalid managerInput managerPrices length: expected ${poolInfos.length}, received ${managerPrices.length}`);
16428
- return encodeAbiParameters(PanopticVaultAccountantManagerInputAbi, [
16429
- managerPrices,
16430
- poolInfos.map((poolInfo) => ({
16431
- pool: poolInfo.pool,
16432
- token0: poolInfo.token0,
16433
- token1: poolInfo.token1,
16434
- maxPriceDeviation: poolInfo.maxPriceDeviation
16435
- })),
16436
- tokenIds,
16437
- erc4626Vaults
16438
- ]);
16439
- }
16440
-
16441
- //#endregion
16442
- //#region src/hypoVault/utils/vaultManagerInput.ts
16443
- const DEFAULT_MANAGER_INPUT$1 = "0x";
16444
- const PAGE_SIZE = 1e3;
16445
- const VAULT_POOL_INFOS_BY_CHAIN = {
16446
- [MAINNET_CHAIN_ID]: [
16447
- MainnetUSDCPLPVaultPoolInfos,
16448
- MainnetWETHPLPVaultPoolInfos,
16449
- MainnetUSDCPLPLegacyVaultPoolInfos,
16450
- MainnetWETHPLPLegacyVaultPoolInfos
16451
- ],
16452
- [SEPOLIA_CHAIN_ID]: [SepoliaUSDCPLPVaultPoolInfos, SepoliaWETHPLPVaultPoolInfos],
16453
- [BASE_CHAIN_ID]: [BaseUSDCPLPVaultPoolInfos, BaseWETHPLPVaultPoolInfos]
15912
+ //#region src/hypoVault/utils/vaultManagerInput.ts
15913
+ const DEFAULT_MANAGER_INPUT$1 = "0x";
15914
+ const PAGE_SIZE = 1e3;
15915
+ const VAULT_POOL_INFOS_BY_CHAIN = {
15916
+ [MAINNET_CHAIN_ID]: [
15917
+ MainnetUSDCPLPVaultPoolInfos,
15918
+ MainnetWETHPLPVaultPoolInfos,
15919
+ MainnetUSDCPLPLegacyVaultPoolInfos,
15920
+ MainnetWETHPLPLegacyVaultPoolInfos
15921
+ ],
15922
+ [SEPOLIA_CHAIN_ID]: [SepoliaUSDCPLPVaultPoolInfos, SepoliaWETHPLPVaultPoolInfos],
15923
+ [BASE_CHAIN_ID]: [BaseUSDCPLPVaultPoolInfos, BaseWETHPLPVaultPoolInfos]
16454
15924
  };
16455
15925
  const GET_POOL_ACCOUNT_BALANCE_CANDIDATES = `
16456
15926
  query PoolAccountBalanceCandidates(
@@ -16824,12 +16294,12 @@ async function buildVaultManagerInput({ viemClient, chainId, vaultAddress, under
16824
16294
  });
16825
16295
  }
16826
16296
  async function buildVaultManagerInputAtBlock({ viemClient, chainId, vaultAddress, underlyingToken, blockNumber, managerAddress, panopticSubgraphUrl, fetchFn }) {
16827
- const authorization = getMainnetV3AuthorizationArtifactsAtBlock({
16297
+ const historicalPoolConfiguration = getMainnetVaultPoolConfigurationAtBlock({
16828
16298
  chainId,
16829
16299
  vaultAddress,
16830
16300
  blockNumber
16831
16301
  });
16832
- const poolInfos = authorization?.poolInfos ?? getVaultPoolInfos(vaultAddress, chainId);
16302
+ const poolInfos = historicalPoolConfiguration?.poolInfos ?? getVaultPoolInfos(vaultAddress, chainId);
16833
16303
  if (poolInfos.length === 0) return DEFAULT_MANAGER_INPUT$1;
16834
16304
  const tokenIds = await resolveVaultTokenIdsByPool({
16835
16305
  viemClient,
@@ -18784,6 +18254,547 @@ const MainnetLegacyWETHPLPStrategistLeaves = {
18784
18254
  }
18785
18255
  };
18786
18256
 
18257
+ //#endregion
18258
+ //#region src/hypoVault/hypoVaultManagerArtifacts/createStrategistLeavesArtifact.ts
18259
+ const DIGEST_COMPOSITION = [
18260
+ "Bytes20(DECODER_AND_SANITIZER_ADDRESS)",
18261
+ "Bytes20(TARGET_ADDRESS)",
18262
+ "Bytes1(CAN_SEND_VALUE)",
18263
+ "Bytes4(TARGET_FUNCTION_SELECTOR)",
18264
+ "Bytes{N*20}(ADDRESS_ARGUMENT_0,...,ADDRESS_ARGUMENT_N)"
18265
+ ];
18266
+ const EMPTY_DEFINITION = {
18267
+ description: "",
18268
+ target: zeroAddress,
18269
+ functionSignature: "",
18270
+ addressArguments: [],
18271
+ canSendValue: false
18272
+ };
18273
+ function efficientHash$1(a, b) {
18274
+ return keccak256(encodePacked(["bytes32", "bytes32"], a < b ? [a, b] : [b, a]));
18275
+ }
18276
+ function nextPowerOfTwo(value) {
18277
+ let capacity = 1;
18278
+ while (capacity < value) capacity *= 2;
18279
+ return capacity;
18280
+ }
18281
+ function functionSelector(signature) {
18282
+ return keccak256(toBytes(signature)).slice(0, 10);
18283
+ }
18284
+ function buildLeaf(definition, decoderAndSanitizerAddress) {
18285
+ const selector = functionSelector(definition.functionSignature);
18286
+ const packedArgumentAddresses = definition.addressArguments.length === 0 ? "0x" : concat(definition.addressArguments.map((address) => getAddress(address)));
18287
+ const rawDigest = concat([encodePacked([
18288
+ "address",
18289
+ "address",
18290
+ "bool",
18291
+ "bytes4"
18292
+ ], [
18293
+ getAddress(decoderAndSanitizerAddress),
18294
+ getAddress(definition.target),
18295
+ definition.canSendValue,
18296
+ selector
18297
+ ]), packedArgumentAddresses]);
18298
+ return {
18299
+ AddressArguments: definition.addressArguments,
18300
+ CanSendValue: definition.canSendValue,
18301
+ DecoderAndSanitizerAddress: getAddress(decoderAndSanitizerAddress),
18302
+ Description: definition.description,
18303
+ FunctionSelector: selector,
18304
+ FunctionSignature: definition.functionSignature,
18305
+ LeafDigest: keccak256(rawDigest),
18306
+ PackedArgumentAddresses: packedArgumentAddresses,
18307
+ TargetAddress: getAddress(definition.target)
18308
+ };
18309
+ }
18310
+ function buildMerkleTree(leafDigests) {
18311
+ if (leafDigests.length === 0) throw new Error("Strategist Merkle tree requires at least one leaf digest");
18312
+ const layersFromLeaves = [[...leafDigests]];
18313
+ while (layersFromLeaves[layersFromLeaves.length - 1]?.length !== 1) {
18314
+ const currentLayer = layersFromLeaves[layersFromLeaves.length - 1];
18315
+ if (currentLayer === void 0 || currentLayer.length === 0) throw new Error("Strategist Merkle tree produced an empty layer");
18316
+ if (currentLayer.length % 2 !== 0) throw new Error("Strategist Merkle tree layers must contain an even number of nodes");
18317
+ const parentLayer = [];
18318
+ for (let index = 0; index < currentLayer.length; index += 2) {
18319
+ const left = currentLayer[index];
18320
+ const right = currentLayer[index + 1];
18321
+ if (left === void 0 || right === void 0) throw new Error("Strategist Merkle tree contains an incomplete pair");
18322
+ parentLayer.push(efficientHash$1(left, right));
18323
+ }
18324
+ layersFromLeaves.push(parentLayer);
18325
+ }
18326
+ return Object.fromEntries([...layersFromLeaves].reverse().map((layer, index) => [String(index), layer]));
18327
+ }
18328
+ function createStrategistLeavesArtifact(metadata, definitions) {
18329
+ if (definitions.length === 0) throw new Error("Strategist artifact requires at least one permission leaf");
18330
+ const treeCapacity = nextPowerOfTwo(definitions.length);
18331
+ const leafs = definitions.map((definition) => buildLeaf(definition, metadata.decoderAndSanitizerAddress));
18332
+ const emptyLeaf = buildLeaf(EMPTY_DEFINITION, zeroAddress);
18333
+ while (leafs.length < treeCapacity) leafs.push(emptyLeaf);
18334
+ const merkleTree = buildMerkleTree(leafs.map((leaf) => leaf.LeafDigest));
18335
+ const root = merkleTree["0"]?.[0];
18336
+ if (root === void 0) throw new Error("Strategist Merkle tree root was not generated");
18337
+ return {
18338
+ metadata: {
18339
+ AccountantAddress: getAddress(metadata.accountantAddress),
18340
+ BoringVaultAddress: getAddress(metadata.boringVaultAddress),
18341
+ DecoderAndSanitizerAddress: getAddress(metadata.decoderAndSanitizerAddress),
18342
+ DigestComposition: DIGEST_COMPOSITION,
18343
+ LeafCount: definitions.length,
18344
+ ManageRoot: root,
18345
+ ManagerAddress: getAddress(metadata.managerAddress),
18346
+ TreeCapacity: treeCapacity
18347
+ },
18348
+ leafs,
18349
+ MerkleTree: merkleTree
18350
+ };
18351
+ }
18352
+
18353
+ //#endregion
18354
+ //#region src/hypoVault/hypoVaultManagerArtifacts/MainnetUSDCPLPStrategistLeaves.ts
18355
+ const VAULT$1 = "0x236d0558f06cd60780b232d4Ec4c92d2cb7e4D18";
18356
+ const DECODER$1 = "0xC87c45d2dbE5acb56013e2591427ECC84Fa251E6";
18357
+ const USDC$1 = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
18358
+ const CURRENT_POOL$1 = "0x00000000563b70d704f4c6675a5f6ac989fbae13";
18359
+ const CURRENT_PO_ETH$1 = "0x1e46b0289B7E0F710E2Db8Ab87800dd782D624f7";
18360
+ const CURRENT_PO_USDC$1 = "0x12bF31955522BAC337D93e1bC0a39F68D8BDa216";
18361
+ const WSPCXX_PO_USDC = "0x141cc517a6276542B59732Fd85C1A2C536eF7aCA";
18362
+ const NEW_POOL$1 = "0x00000000009C7B687e833559e34503f64d7ed7c4";
18363
+ const NEW_PO_USDC$1 = "0x3CCdA7d5E841d6543D90BcEc20b36a724C184DE9";
18364
+ const NEW_PO_WETH$1 = "0x69E9f9e44E5F52237493b980dd7306198C64A4E4";
18365
+ const WETH$1 = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
18366
+ const DISPATCH_SIGNATURE$1 = "dispatch(uint256[],uint256[],uint128[],int24[3][],bool,uint256)";
18367
+ const MAINNET_USDC_PLP_STRATEGIST_LEAF_DEFINITIONS = [
18368
+ {
18369
+ description: "Approve poUSDC to spend USDC",
18370
+ target: USDC$1,
18371
+ functionSignature: "approve(address,uint256)",
18372
+ addressArguments: [CURRENT_PO_USDC$1],
18373
+ canSendValue: false
18374
+ },
18375
+ {
18376
+ description: "Deposit USDC for poUSDC",
18377
+ target: CURRENT_PO_USDC$1,
18378
+ functionSignature: "deposit(uint256,address)",
18379
+ addressArguments: [VAULT$1],
18380
+ canSendValue: false
18381
+ },
18382
+ {
18383
+ description: "Withdraw USDC from poUSDC",
18384
+ target: CURRENT_PO_USDC$1,
18385
+ functionSignature: "withdraw(uint256,address,address)",
18386
+ addressArguments: [VAULT$1, VAULT$1],
18387
+ canSendValue: false
18388
+ },
18389
+ {
18390
+ description: "Withdraw USDC from poUSDC (with open positions)",
18391
+ target: CURRENT_PO_USDC$1,
18392
+ functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
18393
+ addressArguments: [VAULT$1, VAULT$1],
18394
+ canSendValue: false
18395
+ },
18396
+ {
18397
+ description: "Mint poUSDC using USDC",
18398
+ target: CURRENT_PO_USDC$1,
18399
+ functionSignature: "mint(uint256,address)",
18400
+ addressArguments: [VAULT$1],
18401
+ canSendValue: false
18402
+ },
18403
+ {
18404
+ description: "Redeem poUSDC for USDC",
18405
+ target: CURRENT_PO_USDC$1,
18406
+ functionSignature: "redeem(uint256,address,address)",
18407
+ addressArguments: [VAULT$1, VAULT$1],
18408
+ canSendValue: false
18409
+ },
18410
+ {
18411
+ description: "Dispatch mint/burn options on PanopticPool",
18412
+ target: CURRENT_POOL$1,
18413
+ functionSignature: DISPATCH_SIGNATURE$1,
18414
+ addressArguments: [],
18415
+ canSendValue: false
18416
+ },
18417
+ {
18418
+ description: "Withdraw ETH from poETH",
18419
+ target: CURRENT_PO_ETH$1,
18420
+ functionSignature: "withdraw(uint256,address,address)",
18421
+ addressArguments: [VAULT$1, VAULT$1],
18422
+ canSendValue: false
18423
+ },
18424
+ {
18425
+ description: "Withdraw ETH from poETH (with open positions)",
18426
+ target: CURRENT_PO_ETH$1,
18427
+ functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
18428
+ addressArguments: [VAULT$1, VAULT$1],
18429
+ canSendValue: false
18430
+ },
18431
+ {
18432
+ description: "Approve wSPCXx poUSDC to spend USDC",
18433
+ target: USDC$1,
18434
+ functionSignature: "approve(address,uint256)",
18435
+ addressArguments: [WSPCXX_PO_USDC],
18436
+ canSendValue: false
18437
+ },
18438
+ {
18439
+ description: "Deposit USDC for wSPCXx poUSDC",
18440
+ target: WSPCXX_PO_USDC,
18441
+ functionSignature: "deposit(uint256,address)",
18442
+ addressArguments: [VAULT$1],
18443
+ canSendValue: false
18444
+ },
18445
+ {
18446
+ description: "Withdraw USDC from wSPCXx poUSDC",
18447
+ target: WSPCXX_PO_USDC,
18448
+ functionSignature: "withdraw(uint256,address,address)",
18449
+ addressArguments: [VAULT$1, VAULT$1],
18450
+ canSendValue: false
18451
+ },
18452
+ {
18453
+ description: "Deposit ETH for poETH (payable)",
18454
+ target: CURRENT_PO_ETH$1,
18455
+ functionSignature: "deposit(uint256,address)",
18456
+ addressArguments: [VAULT$1],
18457
+ canSendValue: true
18458
+ },
18459
+ {
18460
+ description: "Mint poETH using ETH (payable)",
18461
+ target: CURRENT_PO_ETH$1,
18462
+ functionSignature: "mint(uint256,address)",
18463
+ addressArguments: [VAULT$1],
18464
+ canSendValue: true
18465
+ },
18466
+ {
18467
+ description: "Redeem poETH for ETH",
18468
+ target: CURRENT_PO_ETH$1,
18469
+ functionSignature: "redeem(uint256,address,address)",
18470
+ addressArguments: [VAULT$1, VAULT$1],
18471
+ canSendValue: false
18472
+ },
18473
+ {
18474
+ description: "Approve poUSDC v3 to spend USDC",
18475
+ target: USDC$1,
18476
+ functionSignature: "approve(address,uint256)",
18477
+ addressArguments: [NEW_PO_USDC$1],
18478
+ canSendValue: false
18479
+ },
18480
+ {
18481
+ description: "Deposit USDC for poUSDC v3",
18482
+ target: NEW_PO_USDC$1,
18483
+ functionSignature: "deposit(uint256,address)",
18484
+ addressArguments: [VAULT$1],
18485
+ canSendValue: false
18486
+ },
18487
+ {
18488
+ description: "Withdraw USDC from poUSDC v3",
18489
+ target: NEW_PO_USDC$1,
18490
+ functionSignature: "withdraw(uint256,address,address)",
18491
+ addressArguments: [VAULT$1, VAULT$1],
18492
+ canSendValue: false
18493
+ },
18494
+ {
18495
+ description: "Withdraw USDC from poUSDC v3 (with open positions)",
18496
+ target: NEW_PO_USDC$1,
18497
+ functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
18498
+ addressArguments: [VAULT$1, VAULT$1],
18499
+ canSendValue: false
18500
+ },
18501
+ {
18502
+ description: "Mint poUSDC v3 using USDC",
18503
+ target: NEW_PO_USDC$1,
18504
+ functionSignature: "mint(uint256,address)",
18505
+ addressArguments: [VAULT$1],
18506
+ canSendValue: false
18507
+ },
18508
+ {
18509
+ description: "Redeem poUSDC v3 for USDC",
18510
+ target: NEW_PO_USDC$1,
18511
+ functionSignature: "redeem(uint256,address,address)",
18512
+ addressArguments: [VAULT$1, VAULT$1],
18513
+ canSendValue: false
18514
+ },
18515
+ {
18516
+ description: "Dispatch mint/burn options on PanopticPool",
18517
+ target: NEW_POOL$1,
18518
+ functionSignature: DISPATCH_SIGNATURE$1,
18519
+ addressArguments: [],
18520
+ canSendValue: false
18521
+ },
18522
+ {
18523
+ description: "Approve poWETH v3 to spend WETH",
18524
+ target: WETH$1,
18525
+ functionSignature: "approve(address,uint256)",
18526
+ addressArguments: [NEW_PO_WETH$1],
18527
+ canSendValue: false
18528
+ },
18529
+ {
18530
+ description: "Deposit WETH for poWETH v3",
18531
+ target: NEW_PO_WETH$1,
18532
+ functionSignature: "deposit(uint256,address)",
18533
+ addressArguments: [VAULT$1],
18534
+ canSendValue: false
18535
+ },
18536
+ {
18537
+ description: "Withdraw WETH from poWETH v3",
18538
+ target: NEW_PO_WETH$1,
18539
+ functionSignature: "withdraw(uint256,address,address)",
18540
+ addressArguments: [VAULT$1, VAULT$1],
18541
+ canSendValue: false
18542
+ },
18543
+ {
18544
+ description: "Withdraw WETH from poWETH v3 (with open positions)",
18545
+ target: NEW_PO_WETH$1,
18546
+ functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
18547
+ addressArguments: [VAULT$1, VAULT$1],
18548
+ canSendValue: false
18549
+ },
18550
+ {
18551
+ description: "Mint poWETH v3 using WETH",
18552
+ target: NEW_PO_WETH$1,
18553
+ functionSignature: "mint(uint256,address)",
18554
+ addressArguments: [VAULT$1],
18555
+ canSendValue: false
18556
+ },
18557
+ {
18558
+ description: "Redeem poWETH v3 for WETH",
18559
+ target: NEW_PO_WETH$1,
18560
+ functionSignature: "redeem(uint256,address,address)",
18561
+ addressArguments: [VAULT$1, VAULT$1],
18562
+ canSendValue: false
18563
+ }
18564
+ ];
18565
+ const MAINNET_USDC_PLP_STRATEGIST_ARTIFACT_METADATA = {
18566
+ accountantAddress: "0x65aA902AE3135658587FFC36ED51B61c927114e1",
18567
+ boringVaultAddress: VAULT$1,
18568
+ decoderAndSanitizerAddress: DECODER$1,
18569
+ managerAddress: "0x2ce65016366ef7320078e0758D58Cf1038bc7C4e"
18570
+ };
18571
+ /** Number of leaf definitions authorized before the V3 pool release. */
18572
+ const PRE_V3_AUTHORIZATION_LEAF_COUNT$1 = 12;
18573
+ /** Production permissions before the ETH/USDC 5bps v3 pool authorization executes. */
18574
+ const MainnetUSDCPLPPreviousStrategistLeaves = createStrategistLeavesArtifact(MAINNET_USDC_PLP_STRATEGIST_ARTIFACT_METADATA, MAINNET_USDC_PLP_STRATEGIST_LEAF_DEFINITIONS.slice(0, PRE_V3_AUTHORIZATION_LEAF_COUNT$1));
18575
+ /** Production permissions after the ETH/USDC 5bps v3 pool authorization executes. */
18576
+ const MainnetUSDCPLPStrategistLeaves = createStrategistLeavesArtifact(MAINNET_USDC_PLP_STRATEGIST_ARTIFACT_METADATA, MAINNET_USDC_PLP_STRATEGIST_LEAF_DEFINITIONS);
18577
+
18578
+ //#endregion
18579
+ //#region src/hypoVault/hypoVaultManagerArtifacts/MainnetWETHPLPStrategistLeaves.ts
18580
+ const MAINNET_DEPLOYMENT$2 = requireChainDeployment(MAINNET_CHAIN_ID);
18581
+ const NEW_POOL_DEPLOYMENT = MAINNET_DEPLOYMENT$2.panoptic.additionalPools?.ethUsdc5bpsV3;
18582
+ if (NEW_POOL_DEPLOYMENT === void 0) throw new Error("Missing mainnet ETH/USDC 5bps v3 Panoptic pool deployment");
18583
+ const VAULT = MAINNET_DEPLOYMENT$2.hypovault.vaults.wethPlpVault;
18584
+ const DECODER = MAINNET_DEPLOYMENT$2.hypovault.core.collateralTrackerDecoderAndSanitizer;
18585
+ const CURRENT_POOL = MAINNET_DEPLOYMENT$2.panoptic.pool.panopticPool;
18586
+ const CURRENT_PO_ETH = MAINNET_DEPLOYMENT$2.panoptic.pool.collateralTracker0;
18587
+ const CURRENT_PO_USDC = MAINNET_DEPLOYMENT$2.panoptic.pool.collateralTracker1;
18588
+ const NEW_POOL = NEW_POOL_DEPLOYMENT.panopticPool;
18589
+ const NEW_PO_USDC = NEW_POOL_DEPLOYMENT.collateralTracker0;
18590
+ const NEW_PO_WETH = NEW_POOL_DEPLOYMENT.collateralTracker1;
18591
+ const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
18592
+ const WETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
18593
+ const DISPATCH_SIGNATURE = "dispatch(uint256[],uint256[],uint128[],int24[3][],bool,uint256)";
18594
+ const MAINNET_WETH_PLP_STRATEGIST_LEAF_DEFINITIONS = [
18595
+ {
18596
+ description: "Deposit ETH for poETH (payable)",
18597
+ target: CURRENT_PO_ETH,
18598
+ functionSignature: "deposit(uint256,address)",
18599
+ addressArguments: [VAULT],
18600
+ canSendValue: true
18601
+ },
18602
+ {
18603
+ description: "Withdraw ETH from poETH",
18604
+ target: CURRENT_PO_ETH,
18605
+ functionSignature: "withdraw(uint256,address,address)",
18606
+ addressArguments: [VAULT, VAULT],
18607
+ canSendValue: false
18608
+ },
18609
+ {
18610
+ description: "Withdraw ETH from poETH (with open positions)",
18611
+ target: CURRENT_PO_ETH,
18612
+ functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
18613
+ addressArguments: [VAULT, VAULT],
18614
+ canSendValue: false
18615
+ },
18616
+ {
18617
+ description: "Mint poETH using ETH (payable)",
18618
+ target: CURRENT_PO_ETH,
18619
+ functionSignature: "mint(uint256,address)",
18620
+ addressArguments: [VAULT],
18621
+ canSendValue: true
18622
+ },
18623
+ {
18624
+ description: "Redeem poETH for ETH",
18625
+ target: CURRENT_PO_ETH,
18626
+ functionSignature: "redeem(uint256,address,address)",
18627
+ addressArguments: [VAULT, VAULT],
18628
+ canSendValue: false
18629
+ },
18630
+ {
18631
+ description: "Dispatch mint/burn options on PanopticPool",
18632
+ target: CURRENT_POOL,
18633
+ functionSignature: DISPATCH_SIGNATURE,
18634
+ addressArguments: [],
18635
+ canSendValue: false
18636
+ },
18637
+ {
18638
+ description: "Wrap ETH to WETH",
18639
+ target: WETH,
18640
+ functionSignature: "deposit()",
18641
+ addressArguments: [],
18642
+ canSendValue: true
18643
+ },
18644
+ {
18645
+ description: "Unwrap WETH to ETH",
18646
+ target: WETH,
18647
+ functionSignature: "withdraw(uint256)",
18648
+ addressArguments: [],
18649
+ canSendValue: false
18650
+ },
18651
+ {
18652
+ description: "Withdraw USDC from poUSDC",
18653
+ target: CURRENT_PO_USDC,
18654
+ functionSignature: "withdraw(uint256,address,address)",
18655
+ addressArguments: [VAULT, VAULT],
18656
+ canSendValue: false
18657
+ },
18658
+ {
18659
+ description: "Withdraw USDC from poUSDC (with open positions)",
18660
+ target: CURRENT_PO_USDC,
18661
+ functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
18662
+ addressArguments: [VAULT, VAULT],
18663
+ canSendValue: false
18664
+ },
18665
+ {
18666
+ description: "Approve poUSDC to spend USDC",
18667
+ target: USDC,
18668
+ functionSignature: "approve(address,uint256)",
18669
+ addressArguments: [CURRENT_PO_USDC],
18670
+ canSendValue: false
18671
+ },
18672
+ {
18673
+ description: "Deposit USDC for poUSDC",
18674
+ target: CURRENT_PO_USDC,
18675
+ functionSignature: "deposit(uint256,address)",
18676
+ addressArguments: [VAULT],
18677
+ canSendValue: false
18678
+ },
18679
+ {
18680
+ description: "Mint poUSDC using USDC",
18681
+ target: CURRENT_PO_USDC,
18682
+ functionSignature: "mint(uint256,address)",
18683
+ addressArguments: [VAULT],
18684
+ canSendValue: false
18685
+ },
18686
+ {
18687
+ description: "Redeem poUSDC for USDC",
18688
+ target: CURRENT_PO_USDC,
18689
+ functionSignature: "redeem(uint256,address,address)",
18690
+ addressArguments: [VAULT, VAULT],
18691
+ canSendValue: false
18692
+ },
18693
+ {
18694
+ description: "Approve poWETH v3 to spend WETH",
18695
+ target: WETH,
18696
+ functionSignature: "approve(address,uint256)",
18697
+ addressArguments: [NEW_PO_WETH],
18698
+ canSendValue: false
18699
+ },
18700
+ {
18701
+ description: "Deposit WETH for poWETH v3",
18702
+ target: NEW_PO_WETH,
18703
+ functionSignature: "deposit(uint256,address)",
18704
+ addressArguments: [VAULT],
18705
+ canSendValue: false
18706
+ },
18707
+ {
18708
+ description: "Withdraw WETH from poWETH v3",
18709
+ target: NEW_PO_WETH,
18710
+ functionSignature: "withdraw(uint256,address,address)",
18711
+ addressArguments: [VAULT, VAULT],
18712
+ canSendValue: false
18713
+ },
18714
+ {
18715
+ description: "Withdraw WETH from poWETH v3 (with open positions)",
18716
+ target: NEW_PO_WETH,
18717
+ functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
18718
+ addressArguments: [VAULT, VAULT],
18719
+ canSendValue: false
18720
+ },
18721
+ {
18722
+ description: "Mint poWETH v3 using WETH",
18723
+ target: NEW_PO_WETH,
18724
+ functionSignature: "mint(uint256,address)",
18725
+ addressArguments: [VAULT],
18726
+ canSendValue: false
18727
+ },
18728
+ {
18729
+ description: "Redeem poWETH v3 for WETH",
18730
+ target: NEW_PO_WETH,
18731
+ functionSignature: "redeem(uint256,address,address)",
18732
+ addressArguments: [VAULT, VAULT],
18733
+ canSendValue: false
18734
+ },
18735
+ {
18736
+ description: "Dispatch mint/burn options on PanopticPool",
18737
+ target: NEW_POOL,
18738
+ functionSignature: DISPATCH_SIGNATURE,
18739
+ addressArguments: [],
18740
+ canSendValue: false
18741
+ },
18742
+ {
18743
+ description: "Approve poUSDC v3 to spend USDC",
18744
+ target: USDC,
18745
+ functionSignature: "approve(address,uint256)",
18746
+ addressArguments: [NEW_PO_USDC],
18747
+ canSendValue: false
18748
+ },
18749
+ {
18750
+ description: "Deposit USDC for poUSDC v3",
18751
+ target: NEW_PO_USDC,
18752
+ functionSignature: "deposit(uint256,address)",
18753
+ addressArguments: [VAULT],
18754
+ canSendValue: false
18755
+ },
18756
+ {
18757
+ description: "Withdraw USDC from poUSDC v3",
18758
+ target: NEW_PO_USDC,
18759
+ functionSignature: "withdraw(uint256,address,address)",
18760
+ addressArguments: [VAULT, VAULT],
18761
+ canSendValue: false
18762
+ },
18763
+ {
18764
+ description: "Withdraw USDC from poUSDC v3 (with open positions)",
18765
+ target: NEW_PO_USDC,
18766
+ functionSignature: "withdraw(uint256,address,address,uint256[],bool)",
18767
+ addressArguments: [VAULT, VAULT],
18768
+ canSendValue: false
18769
+ },
18770
+ {
18771
+ description: "Mint poUSDC v3 using USDC",
18772
+ target: NEW_PO_USDC,
18773
+ functionSignature: "mint(uint256,address)",
18774
+ addressArguments: [VAULT],
18775
+ canSendValue: false
18776
+ },
18777
+ {
18778
+ description: "Redeem poUSDC v3 for USDC",
18779
+ target: NEW_PO_USDC,
18780
+ functionSignature: "redeem(uint256,address,address)",
18781
+ addressArguments: [VAULT, VAULT],
18782
+ canSendValue: false
18783
+ }
18784
+ ];
18785
+ const MAINNET_WETH_PLP_STRATEGIST_ARTIFACT_METADATA = {
18786
+ accountantAddress: MAINNET_DEPLOYMENT$2.hypovault.core.accountant,
18787
+ boringVaultAddress: VAULT,
18788
+ decoderAndSanitizerAddress: DECODER,
18789
+ managerAddress: MAINNET_DEPLOYMENT$2.hypovault.managers.wethPlpVaultManager
18790
+ };
18791
+ /** Number of leaf definitions authorized before the V3 pool release. */
18792
+ const PRE_V3_AUTHORIZATION_LEAF_COUNT = 10;
18793
+ /** Production permissions before the ETH/USDC 5bps v3 pool authorization executes. */
18794
+ const MainnetWETHPLPPreviousStrategistLeaves = createStrategistLeavesArtifact(MAINNET_WETH_PLP_STRATEGIST_ARTIFACT_METADATA, MAINNET_WETH_PLP_STRATEGIST_LEAF_DEFINITIONS.slice(0, PRE_V3_AUTHORIZATION_LEAF_COUNT));
18795
+ /** Production permissions after the ETH/USDC 5bps v3 pool authorization executes. */
18796
+ const MainnetWETHPLPStrategistLeaves = createStrategistLeavesArtifact(MAINNET_WETH_PLP_STRATEGIST_ARTIFACT_METADATA, MAINNET_WETH_PLP_STRATEGIST_LEAF_DEFINITIONS);
18797
+
18787
18798
  //#endregion
18788
18799
  //#region src/hypoVault/hypoVaultManagerArtifacts/SepoliaUSDCPLPStrategistLeaves.ts
18789
18800
  const SepoliaUSDCPLPStrategistLeaves = {
@@ -19120,6 +19131,145 @@ function encodeFulfillWithdrawalsFunctionData({ sharesToFulfill, maxAssetsReceiv
19120
19131
  });
19121
19132
  }
19122
19133
 
19134
+ //#endregion
19135
+ //#region src/hypoVault/mainnetV3Authorization.ts
19136
+ const MAINNET_DEPLOYMENT$1 = requireChainDeployment(MAINNET_CHAIN_ID);
19137
+ /** Block containing the successful V3 accountant-hash and manager-root update. */
19138
+ const MAINNET_V3_AUTHORIZATION_BLOCK = 25704951n;
19139
+ const POOL_INFO_ARRAY_ABI = {
19140
+ type: "tuple[]",
19141
+ components: [
19142
+ {
19143
+ name: "pool",
19144
+ type: "address"
19145
+ },
19146
+ {
19147
+ name: "token0",
19148
+ type: "address"
19149
+ },
19150
+ {
19151
+ name: "token1",
19152
+ type: "address"
19153
+ },
19154
+ {
19155
+ name: "maxPriceDeviation",
19156
+ type: "int24"
19157
+ }
19158
+ ]
19159
+ };
19160
+ function createVaultTransition(transition) {
19161
+ return {
19162
+ ...transition,
19163
+ generations: [{
19164
+ version: "previous",
19165
+ ...transition.previous
19166
+ }, {
19167
+ version: "next",
19168
+ ...transition.next
19169
+ }]
19170
+ };
19171
+ }
19172
+ function hashPoolInfos(poolInfos) {
19173
+ return keccak256(encodeAbiParameters([POOL_INFO_ARRAY_ABI], [poolInfos.map((poolInfo) => ({
19174
+ pool: getAddress(poolInfo.pool),
19175
+ token0: getAddress(poolInfo.token0),
19176
+ token1: getAddress(poolInfo.token1),
19177
+ maxPriceDeviation: poolInfo.maxPriceDeviation
19178
+ }))]));
19179
+ }
19180
+ function generation(poolInfos, strategistLeaves) {
19181
+ return {
19182
+ poolInfos,
19183
+ strategistLeaves,
19184
+ poolHash: hashPoolInfos(poolInfos),
19185
+ manageRoot: strategistLeaves.metadata.ManageRoot
19186
+ };
19187
+ }
19188
+ const MAINNET_V3_AUTHORIZATION_TRANSITIONS = [createVaultTransition({
19189
+ vaultAddress: MAINNET_DEPLOYMENT$1.hypovault.vaults.wethPlpVault,
19190
+ managerAddress: MAINNET_DEPLOYMENT$1.hypovault.managers.wethPlpVaultManager,
19191
+ strategistAddress: MAINNET_DEPLOYMENT$1.hypovault.turnkeySigners.wethPlpVaultManager,
19192
+ activationBlockNumber: MAINNET_V3_AUTHORIZATION_BLOCK,
19193
+ previous: generation(MainnetWETHPLPPreviousVaultPoolInfos.poolInfos, MainnetWETHPLPPreviousStrategistLeaves),
19194
+ next: generation(MainnetWETHPLPVaultPoolInfos.poolInfos, MainnetWETHPLPStrategistLeaves)
19195
+ }), createVaultTransition({
19196
+ vaultAddress: MAINNET_DEPLOYMENT$1.hypovault.vaults.usdcPlpVault,
19197
+ managerAddress: MAINNET_DEPLOYMENT$1.hypovault.managers.usdcPlpVaultManager,
19198
+ strategistAddress: MAINNET_DEPLOYMENT$1.hypovault.turnkeySigners.usdcPlpVaultManager,
19199
+ activationBlockNumber: MAINNET_V3_AUTHORIZATION_BLOCK,
19200
+ previous: generation(MainnetUSDCPLPPreviousVaultPoolInfos.poolInfos, MainnetUSDCPLPPreviousStrategistLeaves),
19201
+ next: generation(MainnetUSDCPLPVaultPoolInfos.poolInfos, MainnetUSDCPLPStrategistLeaves)
19202
+ })];
19203
+ const authorizationCacheByClient = new WeakMap();
19204
+ function findTransition(chainId, vaultAddress) {
19205
+ if (chainId !== MAINNET_CHAIN_ID) return null;
19206
+ const normalizedVault = vaultAddress.toLowerCase();
19207
+ return MAINNET_V3_AUTHORIZATION_TRANSITIONS.find((transition) => transition.vaultAddress.toLowerCase() === normalizedVault) ?? null;
19208
+ }
19209
+ /** Returns both known generations without reading chain state. */
19210
+ function getMainnetV3AuthorizationGenerations({ chainId, vaultAddress }) {
19211
+ const transition = findTransition(chainId, vaultAddress);
19212
+ return transition === null ? null : {
19213
+ previous: transition.previous,
19214
+ next: transition.next
19215
+ };
19216
+ }
19217
+ /**
19218
+ * Selects the mainnet authorization artifacts active at a historical block without RPC reads.
19219
+ * Live callers should use the compiled current artifacts directly; this selector exists for
19220
+ * block-pinned NAV and manager-input reconstruction across the V3 authorization boundary.
19221
+ */
19222
+ function getMainnetV3AuthorizationArtifactsAtBlock({ chainId, vaultAddress, blockNumber }) {
19223
+ const transition = findTransition(chainId, vaultAddress);
19224
+ if (transition === null) return null;
19225
+ const version = blockNumber < transition.activationBlockNumber ? "previous" : "next";
19226
+ return {
19227
+ blockNumber,
19228
+ version,
19229
+ ...transition[version]
19230
+ };
19231
+ }
19232
+ /**
19233
+ * Selects the exact artifact generation authorized by both the accountant and manager.
19234
+ * A mixed or unknown state is rejected: using only one side of the transition would
19235
+ * make either NAV calculation or strategist proof verification fail.
19236
+ * Every authorization release must add its generation to this transition table before
19237
+ * the on-chain hashes change, so startup and release verification keeps recognizing it.
19238
+ */
19239
+ async function resolveMainnetV3AuthorizationArtifacts({ viemClient, chainId, vaultAddress, blockNumber }) {
19240
+ const transition = findTransition(chainId, vaultAddress);
19241
+ if (transition === null) return null;
19242
+ const resolvedBlockNumber = blockNumber ?? await getBlockNumber(viemClient);
19243
+ const cacheKey = `${chainId}:${vaultAddress.toLowerCase()}:${resolvedBlockNumber.toString()}`;
19244
+ const clientCache = authorizationCacheByClient.get(viemClient);
19245
+ const cached = clientCache?.get(cacheKey);
19246
+ if (cached !== void 0) return cached;
19247
+ const [poolHash, manageRoot] = await Promise.all([readContract(viemClient, {
19248
+ address: MAINNET_DEPLOYMENT$1.hypovault.core.accountant,
19249
+ abi: PanopticVaultAccountantAbi,
19250
+ functionName: "vaultHashes",
19251
+ args: [transition.vaultAddress, 0n],
19252
+ blockNumber: resolvedBlockNumber
19253
+ }), readContract(viemClient, {
19254
+ address: transition.managerAddress,
19255
+ abi: HypoVaultManagerWithMerkleVerificationAbi,
19256
+ functionName: "manageRoot",
19257
+ args: [transition.strategistAddress],
19258
+ blockNumber: resolvedBlockNumber
19259
+ })]);
19260
+ for (const candidate of [...transition.generations].reverse()) if (poolHash === candidate.poolHash && manageRoot === candidate.manageRoot) {
19261
+ const resolved = {
19262
+ blockNumber: resolvedBlockNumber,
19263
+ ...candidate
19264
+ };
19265
+ const resolvedClientCache = clientCache ?? new Map();
19266
+ resolvedClientCache.set(cacheKey, resolved);
19267
+ if (clientCache === void 0) authorizationCacheByClient.set(viemClient, resolvedClientCache);
19268
+ return resolved;
19269
+ }
19270
+ throw new Error(`Unsupported or inconsistent mainnet v3 authorization state for vault ${transition.vaultAddress}: accountant pool hash ${poolHash}, manager root ${manageRoot}`);
19271
+ }
19272
+
19123
19273
  //#endregion
19124
19274
  //#region src/hypoVault/requestDeposit/requestDeposit.ts
19125
19275
  const getRequestDepositContractConfig = ({ vaultAddress, assets }) => ({
@@ -20380,12 +20530,12 @@ function createPlpManagerInputStrategy(minBlock) {
20380
20530
  minBlockNumber: minBlock,
20381
20531
  context: `PLP manager input for vault ${vault.id}`
20382
20532
  });
20383
- const authorization = getMainnetV3AuthorizationArtifactsAtBlock({
20533
+ const historicalPoolConfiguration = getMainnetVaultPoolConfigurationAtBlock({
20384
20534
  chainId,
20385
20535
  vaultAddress,
20386
20536
  blockNumber
20387
20537
  });
20388
- const poolInfos = authorization?.poolInfos ?? getVaultPoolInfos(vaultAddress, chainId);
20538
+ const poolInfos = historicalPoolConfiguration?.poolInfos ?? getVaultPoolInfos(vaultAddress, chainId);
20389
20539
  if (poolInfos.length === 0) return DEFAULT_MANAGER_INPUT;
20390
20540
  const tokenIds = candidates === void 0 ? await resolveVaultTokenIdsByPool({
20391
20541
  viemClient: client,
@@ -20884,5 +21034,5 @@ function getAlchemyWsRpcUrl(chainId, alchemyApiKey) {
20884
21034
  }
20885
21035
 
20886
21036
  //#endregion
20887
- export { BASE_CHAIN_ID, BASE_DEPLOYMENT, BASE_ETH_USDC_5BPS_MARKET, BASE_HYPOVAULT_ADDRESSES, BASE_HYPOVAULT_CORE_ADDRESSES, BASE_HYPOVAULT_MANAGER_ADDRESSES, BASE_HYPOVAULT_MANAGER_TURNKEY_SIGNERS, BASE_PANOPTIC_POOL_ADDRESSES, BASE_PANOPTIC_V2_ADDRESSES, BORROW_INDEX_BITS, BPS_SCALE, BaseUSDCPLPStrategistLeaves, BaseUSDCPLPVaultPoolInfos, BaseWETHPLPStrategistLeaves, BaseWETHPLPVaultPoolInfos, CHAIN_DEPLOYMENTS, CollateralTrackerAbi, CollateralTrackerV1_1Abi, Erc1155Abi, Erc20Abi, HypoVaultAbi, HypoVaultManagerConfigSchema, HypoVaultManagerWithMerkleVerificationAbi, MAINNET_CHAIN_ID, MAINNET_DEPLOYMENT, MAINNET_ETH_USDC_5BPS_V3_PANOPTIC_POOL_ADDRESSES, MAINNET_PANOPTIC_V2_ADDRESSES, MAINNET_RISK_ENGINES, MAINNET_V3_AUTHORIZATION_BLOCK, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, MainnetLegacyUSDCPLPStrategistLeaves, MainnetLegacyWETHPLPStrategistLeaves, MainnetUSDCPLPLegacyVaultPoolInfos, MainnetUSDCPLPPreviousStrategistLeaves, MainnetUSDCPLPPreviousVaultPoolInfos, MainnetUSDCPLPStrategistLeaves, MainnetUSDCPLPVaultPoolInfos, MainnetWETHPLPLegacyVaultPoolInfos, MainnetWETHPLPPreviousStrategistLeaves, MainnetWETHPLPPreviousVaultPoolInfos, MainnetWETHPLPStrategistLeaves, MainnetWETHPLPVaultPoolInfos, Multicall3Abi, NonFungiblePositionManagerAbi, PanopticFactoryV3Abi, PanopticFactoryV4Abi, PanopticHelperAbi, PanopticPoolAbi, PanopticPoolV1_1Abi, PanopticQueryV1_1Abi, PanopticVaultAccountantAbi, PanopticVaultAccountantManagerInputAbi, PoolManagerAbi, RATE_AT_TARGET_BITS, RescueDistributorAbi, SECONDS_PER_YEAR, SEPOLIA_CHAIN_ID, SEPOLIA_DEPLOYMENT, SEPOLIA_ETH_USDC_5BPS_MARKET, SEPOLIA_HYPOVAULT_ADDRESSES, SEPOLIA_HYPOVAULT_CORE_ADDRESSES, SEPOLIA_HYPOVAULT_MANAGER_ADDRESSES, SEPOLIA_HYPOVAULT_MANAGER_TURNKEY_SIGNERS, SEPOLIA_PANOPTIC_POOL_ADDRESSES, SEPOLIA_PANOPTIC_V2_ADDRESSES, SemiFungiblePositionManagerAbi, SemiFungiblePositionManagerV1_1Abi, SepoliaUSDCPLPStrategistLeaves, SepoliaUSDCPLPVaultPoolInfos, SepoliaWETHPLPStrategistLeaves, SepoliaWETHPLPVaultPoolInfos, Simple7702AccountAbi, StateViewAbi, UNREALIZED_INTEREST_BITS, UniswapHelperAbi, UniswapHelperV1_1Abi, UniswapMigratorAbi, UniswapV3FactoryAbi, UniswapV3PoolAbi, UsdcPlpVaultBaseProdConfig, UsdcPlpVaultMainnetLegacyConfig, UsdcPlpVaultMainnetProdConfig, UsdcPlpVaultSepoliaDevConfig, UsdcPlpVaultSepoliaProdConfig, VAULT_DISPLAY_NAMES_PER_CHAIN, VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN, VaultApyPreInceptionBlockError, WAD, WETHAbi, WethPlpVaultBaseProdConfig, WethPlpVaultMainnetLegacyConfig, WethPlpVaultMainnetProdConfig, WethPlpVaultSepoliaDevConfig, WethPlpVaultSepoliaProdConfig, adjustUnderlyingIdleBalance, annualizePerSecondRateWad, buildClaimVaultShareCalldatas, buildExecuteDepositCalldatas, buildExecuteWithdrawalCalldatas, buildManageArgs, buildManagerInput, buildManagerInputAtBlock, buildRequestWithdrawalCalldatas, buildVaultManagerInput, buildVaultManagerInputAtBlock, builderFactoryAbi, builderWalletAbi, calculateAnnualizedApyPct, calculateAssetsFromShares, calculateAvailableShares, calculateClaimableAssetsFromQueuedWithdrawals, calculateClaimableSharesFromQueuedDeposits, calculateSharesFromAssets, calculateVaultNetLendingApyPctFromTrackerInputs, calculateVaultNetLendingYieldUnderlyingFromTrackerInputs, cancelDeposit, chainToHypoVaultGraphQlAPI, collateralTrackerV2Abi as collateralTrackerAbi, collateralTrackerV2Abi, computeSharePriceFromNavSnapshot, convertJsonTreeToArray, deriveSupplyRatePerSecWad, deriveVaultApyTimeseriesFromSharePrices, encodeApproveFunctionData, encodeCancelDepositFunctionData, encodeDepositFunctionData, encodeExecuteDepositFunctionData, encodeExecuteWithdrawalFunctionData, encodeExecuteWithdrawalMulticallFunctionData, encodeFulfillDepositsFunctionData, encodeFulfillWithdrawalsFunctionData, encodeRequestDepositFunctionData, encodeRequestWithdrawalFunctionData, encodeRequestWithdrawalMulticallFunctionData, encodeWithdrawFunctionData, executeWithdrawal, executeWithdrawalMulticall, fetchFirstDepositTimestampByVaultId, fetchVaultLendingAllocation, fetchVaultNetLendingApyPct, fetchVaultNetLendingYieldUnderlying, fetchVaultSharePriceSnapshot, findLeaf, findLeafForTarget, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, generateProof, getAlchemyRpcUrl, getAlchemyWsRpcUrl, getCancelDepositContractConfig, getChainDeployment, getEthUsdcMarket, getExecuteWithdrawalContractConfig, getExecuteWithdrawalMulticallContractConfig, getHypoVaultConfigForVault, getHypoVaultGraphQLClient, getIrmCurrent, getIrmCurve, getLendingAllocationRows, getMainnetV3AuthorizationArtifactsAtBlock, getMainnetV3AuthorizationGenerations, getMinQueuedDepositEpoch, getProofsFromDigests, getProofsUsingTree, getRequestDepositContractConfig, getRequestWithdrawalContractConfig, getRequestWithdrawalMulticallContractConfig, getStaleOracleOverrideBytecodeForAccountant, getStaleOracleStateOverrideForAccountant, getVaultApyErrorMessage, getVaultApyStrategy, getVaultPoolInfos, isExpectedHistoricalReadMiss, isStaleOraclePriceError, isStaleOraclePriceReadError, isSupportedChain, packMarketState, panopticFactoryV4Abi as panopticFactoryAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi as panopticPoolAbi, panopticPoolV2Abi, panopticQueryAbi, parseCustomError, ratePerSecWadToAprPct, requestDeposit, requestWithdrawal, requestWithdrawalMulticall, requireChainDeployment, resolveMainnetV3AuthorizationArtifacts, resolveVaultDisplayName, resolveVaultHistoricalCandidatesByPool, resolveVaultTokenIdsByPool, riskEngineAbi, semiFungiblePositionManagerV4Abi as semiFungiblePositionManagerAbi, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, setVaultApyStrategyOverride, simulateCancelDeposit, simulateExecuteWithdrawal, simulateExecuteWithdrawalMulticall, simulateRequestDeposit, simulateRequestWithdrawal, simulateRequestWithdrawalMulticall, useCancelDeposit, useClaimVaultShares, useExecuteWithdrawal, useRequestDeposit, useRequestWithdrawal, utilizationBpsToWad, utilizationPctToWad, verifyVaultOpenTokenIdsAtBlock };
21037
+ export { BASE_CHAIN_ID, BASE_DEPLOYMENT, BASE_ETH_USDC_5BPS_MARKET, BASE_HYPOVAULT_ADDRESSES, BASE_HYPOVAULT_CORE_ADDRESSES, BASE_HYPOVAULT_MANAGER_ADDRESSES, BASE_HYPOVAULT_MANAGER_TURNKEY_SIGNERS, BASE_PANOPTIC_POOL_ADDRESSES, BASE_PANOPTIC_V2_ADDRESSES, BORROW_INDEX_BITS, BPS_SCALE, BaseUSDCPLPStrategistLeaves, BaseUSDCPLPVaultPoolInfos, BaseWETHPLPStrategistLeaves, BaseWETHPLPVaultPoolInfos, CHAIN_DEPLOYMENTS, CollateralTrackerAbi, CollateralTrackerV1_1Abi, Erc1155Abi, Erc20Abi, HypoVaultAbi, HypoVaultManagerConfigSchema, HypoVaultManagerWithMerkleVerificationAbi, MAINNET_CHAIN_ID, MAINNET_DEPLOYMENT, MAINNET_ETH_USDC_5BPS_V3_PANOPTIC_POOL_ADDRESSES, MAINNET_PANOPTIC_V2_ADDRESSES, MAINNET_RISK_ENGINES, MAINNET_V3_AUTHORIZATION_BLOCK, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, MainnetLegacyUSDCPLPStrategistLeaves, MainnetLegacyWETHPLPStrategistLeaves, MainnetUSDCPLPLegacyVaultPoolInfos, MainnetUSDCPLPPreviousStrategistLeaves, MainnetUSDCPLPPreviousVaultPoolInfos, MainnetUSDCPLPStrategistLeaves, MainnetUSDCPLPVaultPoolInfos, MainnetWETHPLPLegacyVaultPoolInfos, MainnetWETHPLPPreviousStrategistLeaves, MainnetWETHPLPPreviousVaultPoolInfos, MainnetWETHPLPStrategistLeaves, MainnetWETHPLPVaultPoolInfos, Multicall3Abi, NonFungiblePositionManagerAbi, PanopticFactoryV3Abi, PanopticFactoryV4Abi, PanopticHelperAbi, PanopticPoolAbi, PanopticPoolV1_1Abi, PanopticQueryV1_1Abi, PanopticVaultAccountantAbi, PanopticVaultAccountantManagerInputAbi, PoolManagerAbi, RATE_AT_TARGET_BITS, RescueDistributorAbi, SECONDS_PER_YEAR, SEPOLIA_CHAIN_ID, SEPOLIA_DEPLOYMENT, SEPOLIA_ETH_USDC_5BPS_MARKET, SEPOLIA_HYPOVAULT_ADDRESSES, SEPOLIA_HYPOVAULT_CORE_ADDRESSES, SEPOLIA_HYPOVAULT_MANAGER_ADDRESSES, SEPOLIA_HYPOVAULT_MANAGER_TURNKEY_SIGNERS, SEPOLIA_PANOPTIC_POOL_ADDRESSES, SEPOLIA_PANOPTIC_V2_ADDRESSES, SemiFungiblePositionManagerAbi, SemiFungiblePositionManagerV1_1Abi, SepoliaUSDCPLPStrategistLeaves, SepoliaUSDCPLPVaultPoolInfos, SepoliaWETHPLPStrategistLeaves, SepoliaWETHPLPVaultPoolInfos, Simple7702AccountAbi, StateViewAbi, UNREALIZED_INTEREST_BITS, UniswapHelperAbi, UniswapHelperV1_1Abi, UniswapMigratorAbi, UniswapV3FactoryAbi, UniswapV3PoolAbi, UsdcPlpVaultBaseProdConfig, UsdcPlpVaultMainnetLegacyConfig, UsdcPlpVaultMainnetProdConfig, UsdcPlpVaultSepoliaDevConfig, UsdcPlpVaultSepoliaProdConfig, VAULT_DISPLAY_NAMES_PER_CHAIN, VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN, VaultApyPreInceptionBlockError, WAD, WETHAbi, WethPlpVaultBaseProdConfig, WethPlpVaultMainnetLegacyConfig, WethPlpVaultMainnetProdConfig, WethPlpVaultSepoliaDevConfig, WethPlpVaultSepoliaProdConfig, adjustUnderlyingIdleBalance, annualizePerSecondRateWad, buildClaimVaultShareCalldatas, buildExecuteDepositCalldatas, buildExecuteWithdrawalCalldatas, buildManageArgs, buildManagerInput, buildManagerInputAtBlock, buildRequestWithdrawalCalldatas, buildVaultManagerInput, buildVaultManagerInputAtBlock, builderFactoryAbi, builderWalletAbi, calculateAnnualizedApyPct, calculateAssetsFromShares, calculateAvailableShares, calculateClaimableAssetsFromQueuedWithdrawals, calculateClaimableSharesFromQueuedDeposits, calculateSharesFromAssets, calculateVaultNetLendingApyPctFromTrackerInputs, calculateVaultNetLendingYieldUnderlyingFromTrackerInputs, cancelDeposit, chainToHypoVaultGraphQlAPI, collateralTrackerV2Abi as collateralTrackerAbi, collateralTrackerV2Abi, computeSharePriceFromNavSnapshot, convertJsonTreeToArray, deriveSupplyRatePerSecWad, deriveVaultApyTimeseriesFromSharePrices, encodeApproveFunctionData, encodeCancelDepositFunctionData, encodeDepositFunctionData, encodeExecuteDepositFunctionData, encodeExecuteWithdrawalFunctionData, encodeExecuteWithdrawalMulticallFunctionData, encodeFulfillDepositsFunctionData, encodeFulfillWithdrawalsFunctionData, encodeRequestDepositFunctionData, encodeRequestWithdrawalFunctionData, encodeRequestWithdrawalMulticallFunctionData, encodeWithdrawFunctionData, executeWithdrawal, executeWithdrawalMulticall, fetchFirstDepositTimestampByVaultId, fetchVaultLendingAllocation, fetchVaultNetLendingApyPct, fetchVaultNetLendingYieldUnderlying, fetchVaultSharePriceSnapshot, findLeaf, findLeafForTarget, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, generateProof, getAlchemyRpcUrl, getAlchemyWsRpcUrl, getCancelDepositContractConfig, getChainDeployment, getEthUsdcMarket, getExecuteWithdrawalContractConfig, getExecuteWithdrawalMulticallContractConfig, getHypoVaultConfigForVault, getHypoVaultGraphQLClient, getIrmCurrent, getIrmCurve, getLendingAllocationRows, getMainnetV3AuthorizationArtifactsAtBlock, getMainnetV3AuthorizationGenerations, getMainnetVaultManagerRootAtBlock, getMainnetVaultManagerRootHistory, getMainnetVaultPoolConfigurationAtBlock, getMainnetVaultPoolConfigurationHistory, getMinQueuedDepositEpoch, getProofsFromDigests, getProofsUsingTree, getRequestDepositContractConfig, getRequestWithdrawalContractConfig, getRequestWithdrawalMulticallContractConfig, getStaleOracleOverrideBytecodeForAccountant, getStaleOracleStateOverrideForAccountant, getVaultApyErrorMessage, getVaultApyStrategy, getVaultPoolInfos, isExpectedHistoricalReadMiss, isStaleOraclePriceError, isStaleOraclePriceReadError, isSupportedChain, packMarketState, panopticFactoryV4Abi as panopticFactoryAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi as panopticPoolAbi, panopticPoolV2Abi, panopticQueryAbi, parseCustomError, ratePerSecWadToAprPct, requestDeposit, requestWithdrawal, requestWithdrawalMulticall, requireChainDeployment, resolveMainnetV3AuthorizationArtifacts, resolveVaultDisplayName, resolveVaultHistoricalCandidatesByPool, resolveVaultTokenIdsByPool, riskEngineAbi, semiFungiblePositionManagerV4Abi as semiFungiblePositionManagerAbi, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, setVaultApyStrategyOverride, simulateCancelDeposit, simulateExecuteWithdrawal, simulateExecuteWithdrawalMulticall, simulateRequestDeposit, simulateRequestWithdrawal, simulateRequestWithdrawalMulticall, useCancelDeposit, useClaimVaultShares, useExecuteWithdrawal, useRequestDeposit, useRequestWithdrawal, utilizationBpsToWad, utilizationPctToWad, verifyVaultOpenTokenIdsAtBlock };
20888
21038
  //# sourceMappingURL=index.js.map