@panoptic-eng/sdk 1.0.36 → 1.0.38
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/cow/index.d.ts +4 -5
- package/dist/cow/index.js +3 -3
- package/dist/cow/types.d.ts +3 -2
- package/dist/{cow-aX6of9TS.js → cow-DB8siv6M.js} +2 -2
- package/dist/{cow-aX6of9TS.js.map → cow-DB8siv6M.js.map} +1 -1
- package/dist/deployments.d.ts +3 -2
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +4 -0
- package/dist/deployments.js.map +1 -1
- package/dist/{position-C8rkkKhi.js → getTrackedPositionIds-zYPIs5dt.js} +1086 -34
- package/dist/getTrackedPositionIds-zYPIs5dt.js.map +1 -0
- package/dist/hypoVault/vaultDisplayNames.d.ts +2 -0
- package/dist/hypoVault/vaultDisplayNames.js +4 -0
- package/dist/{index-CURXeKNy.d.ts → index-BhEBx83X.d.ts} +405 -351
- package/dist/index-BhEBx83X.d.ts.map +1 -0
- package/dist/index-Bo9tHtD7.d.ts +1901 -0
- package/dist/index-Bo9tHtD7.d.ts.map +1 -0
- package/dist/{index-Cp-nCeV2.d.ts → index-CttjEZ-S.d.ts} +3 -4
- package/dist/index-CttjEZ-S.d.ts.map +1 -0
- package/dist/{index-Zvu-rJpV.d.ts → index-DktZq9Kb.d.ts} +2 -2
- package/dist/{index-Zvu-rJpV.d.ts.map → index-DktZq9Kb.d.ts.map} +1 -1
- package/dist/index.d.ts +159 -39
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +323 -70
- package/dist/index.js.map +1 -1
- package/dist/{irm-DnM96-X4.js → irm-ChkvYphK.js} +3 -318
- package/dist/irm-ChkvYphK.js.map +1 -0
- package/dist/{irm-CmgC1Mqi.d.ts → irm-D2WTHtuo.d.ts} +3 -30
- package/dist/{irm-CmgC1Mqi.d.ts.map → irm-D2WTHtuo.d.ts.map} +1 -1
- package/dist/irm-D5plRhpB.d.ts +32 -0
- package/dist/irm-D5plRhpB.d.ts.map +1 -0
- package/dist/panoptic/v2/greeks/index.d.ts +3 -2
- package/dist/panoptic/v2/index.d.ts +7 -8
- package/dist/panoptic/v2/index.js +7 -6
- package/dist/panoptic/v2/react-public.d.ts +29 -13
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +48 -8
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/panoptic/v2/types/index.d.ts +3 -0
- package/dist/panoptic/v2/types/index.js +0 -0
- package/dist/quote-DeHNUR0Z.d.ts +52 -0
- package/dist/quote-DeHNUR0Z.d.ts.map +1 -0
- package/dist/{router-CS86ptMu.js → router-BCUJkY8j.js} +3 -3
- package/dist/{router-CS86ptMu.js.map → router-BCUJkY8j.js.map} +1 -1
- package/dist/{router-DcoU2KmV.js → router-tCRa0ekE.js} +2 -2
- package/dist/{router-DcoU2KmV.js.map → router-tCRa0ekE.js.map} +1 -1
- package/dist/src-CRAtPwWk.js +321 -0
- package/dist/src-CRAtPwWk.js.map +1 -0
- package/dist/test/index.d.ts +2 -2
- package/dist/test/index.d.ts.map +1 -1
- package/dist/transactionFees-CVi2TrJh.js +175 -0
- package/dist/transactionFees-CVi2TrJh.js.map +1 -0
- package/dist/transactionFees-DzDyt50k.d.ts +63 -0
- package/dist/transactionFees-DzDyt50k.d.ts.map +1 -0
- package/dist/{types-D_jcYss-.d.ts → types-Cad5m4Td.d.ts} +3 -5
- package/dist/types-Cad5m4Td.d.ts.map +1 -0
- package/dist/{types-BHdnurYr.d.ts → types-DM0nxlZr.d.ts} +2 -2
- package/dist/{types-BHdnurYr.d.ts.map → types-DM0nxlZr.d.ts.map} +1 -1
- package/dist/uniswap/index.d.ts +4 -5
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +4 -4
- package/dist/{v2-D0dEatKb.js → v2-BxtzpUnV.js} +3267 -2675
- package/dist/v2-BxtzpUnV.js.map +1 -0
- package/dist/vault-transaction-fees.d.ts +2 -0
- package/dist/vault-transaction-fees.js +3 -0
- package/dist/vaultDisplayNames-CKpz51Hu.js +0 -0
- package/dist/vaultDisplayNames-Q6htUcch.d.ts +2 -0
- package/dist/{writes-AupZCK4M.js → writes-D3bj1wth.js} +326 -1292
- package/dist/writes-D3bj1wth.js.map +1 -0
- package/package.json +5 -1
- package/dist/index-CURXeKNy.d.ts.map +0 -1
- package/dist/index-Cp-nCeV2.d.ts.map +0 -1
- package/dist/irm-DnM96-X4.js.map +0 -1
- package/dist/position-BqIgubs5.d.ts +0 -199
- package/dist/position-BqIgubs5.d.ts.map +0 -1
- package/dist/position-C8rkkKhi.js.map +0 -1
- package/dist/quote-BxQkPBRg.d.ts +0 -718
- package/dist/quote-BxQkPBRg.d.ts.map +0 -1
- package/dist/simulation-zM6-YUaw.d.ts +0 -258
- package/dist/simulation-zM6-YUaw.d.ts.map +0 -1
- package/dist/tx-CbDQ58Io.d.ts +0 -367
- package/dist/tx-CbDQ58Io.d.ts.map +0 -1
- package/dist/types-D_jcYss-.d.ts.map +0 -1
- package/dist/v2-D0dEatKb.js.map +0 -1
- package/dist/writes-AupZCK4M.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTrackedPositionIds-zYPIs5dt.js","names":["params: GetBlockMetaParams","decodePositionBalance","balanceData: bigint","value: bigint","logs: Log[]","events: PanopticEvent[]","client: PublicClient","hash: Hash","confirmations?: bigint","params: SubmitWriteParams","hash","gasOverrides: Record<string, unknown>","message: string","cause?: Error","solvent: bigint","numberOfTicks: bigint","cause?: Error","tokenAddress: Address","assetsRequested: bigint","assetBalance: bigint","parameterType: bigint","currentTick: bigint","token: Address","from: Address","amount: bigint","balance: bigint","walletChainId: bigint","expectedChainId: bigint","cause?: Error","requestedPool: Address","configuredPool: Address","elapsedMs: bigint","blocksProcessed: bigint","blocksRemaining: bigint","providerBlock: bigint","expectedBlock: bigint","label: string","index: number","functionName: string","currentCount: bigint","attemptedAdd: bigint","level: SafeMode","reason: string","blockTimestamp: bigint","currentTimestamp: bigint","stalenessSeconds: bigint","healthStatus: PoolHealthStatus","lastUpdate: bigint","currentTime: bigint","method: string","retriesAttempted: bigint","code: bigint","rpcMessage: string","dataType: 'poolMeta' | 'positions' | 'positionMeta'","key: string","tickLimitLow: bigint","tickLimitHigh: bigint","token: Address","operation: string","diagnostics: BatchDiagnostic[]","tokenAddress: Address","token0: Address","token1: Address","errorConstructors: Record<\n string,\n (args: readonly unknown[], cause?: Error) => PanopticError\n>","error: unknown","found: { errorName: string; args: readonly unknown[] } | null","current: Record<string, unknown> | null","errorName: string","args: readonly unknown[]","originalError: unknown","selector: `0x${string}`","i: { type: string }","foundData: `0x${string}` | null","error: PanopticError","errorClass: new (...args: unknown[]) => T","value: bigint","oraclePack: bigint","blockTimestamp: bigint","timestamp: bigint","left: bigint","right: bigint","period: bigint","emaPeriods: bigint","maxTicksDelta: bigint","maxClampDelta: bigint","state: DiagnosticOracleState","parameters: OracleRiskParameters","onchainLevel: bigint","causes: OracleSafeModeCause[]","candidateEpochs: bigint[]","DEFAULT_MINT_BUFFER: MintBufferRatio","required: bigint","buffer: MintBufferRatio","required0: bigint","required1: bigint","balance: bigint","erc20Abi","params: GetPoolMetadataParams","underlyingPoolId: string","fee: bigint","tickSpacing: bigint","params: GetPoolParams","vegoid","collateralTracker0: CollateralTracker","collateralTracker1: CollateralTracker","riskEngine: RiskEngine","params: GetUtilizationParams","collateralToken0: Address","collateralToken1: Address","poolData: readonly [bigint, bigint, bigint, bigint]","totalSupply: bigint","params: GetOracleStateParams","params: GetOracleRiskParametersParams","params: GetRiskParametersParams","params: {\n client: PublicClient\n poolAddress: Address\n builderCode: bigint\n}","poolId: bigint","poolKeyBytes: `0x${string}`","params: FetchPoolIdParams","encodedStrike: bigint","index: bigint","leg: bigint","tokenId: bigint","encodedPosition: bigint","legs: LegParams[]","hex: string","length: number","balance: bigint","params: GetPositionParams","legs: TokenIdLeg[]","params: GetPositionsParams","_meta","ids: bigint[]","positionBalances: readonly bigint[]","meta: BlockMeta","positions: Position[]","candidates: bigint[][]","candidate: bigint[]","validTokenIds: bigint[]","validBalances: bigint[]","params: GetPositionGreeksParams","directory: string","fsPromises: typeof FsPromises | null","pathModule: typeof Path | null","key: string","value: string","prefix: string","result: string[]","chainId: bigint","poolAddress: Address","account: Address","tokenId: bigint","key: string","value: string","prefix: string","result: string[]","keysToDelete: string[]","value: unknown","_key: string","space?: string | number","text: string","params: RecoverSnapshotParams","error: unknown","parts: string[]","current: unknown","params: {\n client: PublicClient\n poolAddress: Address\n account: Address\n fromBlock: bigint\n toBlock: bigint\n}","params: {\n client: PublicClient\n account: Address\n events: SnapshotEventLog[]\n}","event: SnapshotEventLog","params: {\n input: Hex\n from: Address\n to: Address | null\n account?: Address\n pool?: Address\n rolesContext?: RolesSnapshotContext\n}","params: RecoverSnapshotFromTxParams","input: `0x${string}`","candidates: DispatchCalldata[]","account: Address","txFrom: Address","match: DispatchCalldata | null","results: DispatchCalldata[]","params: {\n client: PublicClient\n poolAddress: Address\n account: Address\n positionIds: bigint[]\n blockNumber?: bigint\n}","params: GetTrackedPositionIdsParams","tokenId: bigint","params: GetOpenPositionIdsParams","snapshot: SnapshotRecoveryResult | null"],"sources":["../src/generated.ts","../src/panoptic/v2/clients/blockMeta.ts","../src/panoptic/v2/writes/utils.ts","../src/panoptic/v2/errors/base.ts","../src/panoptic/v2/errors/contract.ts","../src/panoptic/v2/errors/sdk.ts","../src/panoptic/v2/errors/errorsAbi.ts","../src/panoptic/v2/errors/parser.ts","../src/panoptic/v2/abis/stateView.ts","../src/panoptic/v2/abis/uniswapV3Pool.ts","../src/panoptic/v2/utils/oraclePack.ts","../src/panoptic/v2/utils/oracleSafeMode.ts","../src/panoptic/v2/reads/mintBuffer.ts","../src/panoptic/v2/reads/pool.ts","../src/panoptic/v2/tokenId/constants.ts","../src/panoptic/v2/utils/option-encoding-v2.ts","../src/panoptic/v2/reads/position.ts","../src/panoptic/v2/storage/fileStorage.ts","../src/panoptic/v2/storage/keys.ts","../src/panoptic/v2/storage/memoryStorage.ts","../src/panoptic/v2/storage/serializer.ts","../src/panoptic/v2/sync/snapshotRecovery.ts","../src/panoptic/v2/sync/getTrackedPositionIds.ts"],"sourcesContent":["//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// CollateralTrackerV2\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport const collateralTrackerV2Abi = [\n { type: 'constructor', inputs: [], stateMutability: 'nonpayable' },\n {\n type: 'function',\n inputs: [],\n name: 'accrueInterest',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'owner', internalType: 'address', type: 'address' },\n { name: 'spender', internalType: 'address', type: 'address' },\n ],\n name: 'allowance',\n outputs: [{ name: 'allowance', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'spender', internalType: 'address', type: 'address' },\n { name: 'amount', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'approve',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'asset',\n outputs: [{ name: 'assetTokenAddress', internalType: 'address', type: 'address' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [{ name: 'owner', internalType: 'address', type: 'address' }],\n name: 'assetsAndInterest',\n outputs: [\n { name: '', internalType: 'uint256', type: 'uint256' },\n { name: '', internalType: 'uint256', type: 'uint256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'owner', internalType: 'address', type: 'address' }],\n name: 'assetsOf',\n outputs: [{ name: 'assets', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'account', internalType: 'address', type: 'address' }],\n name: 'balanceOf',\n outputs: [{ name: 'balance', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'borrowIndex',\n outputs: [{ name: '', internalType: 'uint80', type: 'uint80' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'shares', internalType: 'uint256', type: 'uint256' }],\n name: 'convertToAssets',\n outputs: [{ name: 'assets', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'assets', internalType: 'uint256', type: 'uint256' }],\n name: 'convertToShares',\n outputs: [{ name: 'shares', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'decimals',\n outputs: [{ name: '', internalType: 'uint8', type: 'uint8' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'delegatee', internalType: 'address', type: 'address' }],\n name: 'delegate',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'assets', internalType: 'uint256', type: 'uint256' },\n { name: 'receiver', internalType: 'address', type: 'address' },\n ],\n name: 'deposit',\n outputs: [{ name: 'shares', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'getPoolData',\n outputs: [\n { name: 'depositedAssets', internalType: 'uint256', type: 'uint256' },\n { name: 'insideAMM', internalType: 'uint256', type: 'uint256' },\n { name: 'creditedShares', internalType: 'uint256', type: 'uint256' },\n {\n name: 'currentPoolUtilization',\n internalType: 'uint256',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'initialize',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'interestRate',\n outputs: [{ name: '', internalType: 'uint128', type: 'uint128' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'user', internalType: 'address', type: 'address' }],\n name: 'interestState',\n outputs: [\n { name: 'userBorrowIndex', internalType: 'int128', type: 'int128' },\n { name: 'netBorrows', internalType: 'int128', type: 'int128' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'lastInteractionTimestamp',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: '', internalType: 'address', type: 'address' }],\n name: 'maxDeposit',\n outputs: [{ name: 'maxAssets', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [{ name: '', internalType: 'address', type: 'address' }],\n name: 'maxMint',\n outputs: [{ name: 'maxShares', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'owner', internalType: 'address', type: 'address' }],\n name: 'maxRedeem',\n outputs: [{ name: 'maxShares', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'owner', internalType: 'address', type: 'address' }],\n name: 'maxWithdraw',\n outputs: [{ name: 'maxAssets', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'shares', internalType: 'uint256', type: 'uint256' },\n { name: 'receiver', internalType: 'address', type: 'address' },\n ],\n name: 'mint',\n outputs: [{ name: 'assets', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n inputs: [{ name: 'data', internalType: 'bytes[]', type: 'bytes[]' }],\n name: 'multicall',\n outputs: [{ name: 'results', internalType: 'bytes[]', type: 'bytes[]' }],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'name',\n outputs: [{ name: '', internalType: 'string', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'owner', internalType: 'address', type: 'address' }],\n name: 'owedInterest',\n outputs: [{ name: '', internalType: 'uint128', type: 'uint128' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'panopticPool',\n outputs: [{ name: '', internalType: 'contract PanopticPoolV2', type: 'address' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'poolFee',\n outputs: [{ name: '_poolFee', internalType: 'uint24', type: 'uint24' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'poolManager',\n outputs: [{ name: '', internalType: 'contract IPoolManager', type: 'address' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [{ name: 'assets', internalType: 'uint256', type: 'uint256' }],\n name: 'previewDeposit',\n outputs: [{ name: 'shares', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'shares', internalType: 'uint256', type: 'uint256' }],\n name: 'previewMint',\n outputs: [{ name: 'assets', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'owner', internalType: 'address', type: 'address' }],\n name: 'previewOwedInterest',\n outputs: [{ name: '', internalType: 'uint128', type: 'uint128' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'shares', internalType: 'uint256', type: 'uint256' }],\n name: 'previewRedeem',\n outputs: [{ name: 'assets', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'assets', internalType: 'uint256', type: 'uint256' }],\n name: 'previewWithdraw',\n outputs: [{ name: 'shares', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'rateAtTarget',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'shares', internalType: 'uint256', type: 'uint256' },\n { name: 'receiver', internalType: 'address', type: 'address' },\n { name: 'owner', internalType: 'address', type: 'address' },\n ],\n name: 'redeem',\n outputs: [{ name: 'assets', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'reentrancyGuardEntered',\n outputs: [{ name: 'entered', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'refunder', internalType: 'address', type: 'address' },\n { name: 'refundee', internalType: 'address', type: 'address' },\n { name: 'assets', internalType: 'int256', type: 'int256' },\n ],\n name: 'refund',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'delegatee', internalType: 'address', type: 'address' }],\n name: 'revoke',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'riskEngine',\n outputs: [{ name: '', internalType: 'contract IRiskEngine', type: 'address' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n { name: 'optionOwner', internalType: 'address', type: 'address' },\n { name: 'longAmount', internalType: 'int128', type: 'int128' },\n { name: 'shortAmount', internalType: 'int128', type: 'int128' },\n { name: 'ammDeltaAmount', internalType: 'int128', type: 'int128' },\n { name: 'realizedPremium', internalType: 'int128', type: 'int128' },\n {\n name: 'riskParameters',\n internalType: 'RiskParameters',\n type: 'uint256',\n },\n ],\n name: 'settleBurn',\n outputs: [{ name: '', internalType: 'int128', type: 'int128' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'liquidator', internalType: 'address', type: 'address' },\n { name: 'liquidatee', internalType: 'address', type: 'address' },\n { name: 'bonus', internalType: 'int256', type: 'int256' },\n ],\n name: 'settleLiquidation',\n outputs: [],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'optionOwner', internalType: 'address', type: 'address' },\n { name: 'longAmount', internalType: 'int128', type: 'int128' },\n { name: 'shortAmount', internalType: 'int128', type: 'int128' },\n { name: 'ammDeltaAmount', internalType: 'int128', type: 'int128' },\n {\n name: 'riskParameters',\n internalType: 'RiskParameters',\n type: 'uint256',\n },\n ],\n name: 'settleMint',\n outputs: [\n { name: '', internalType: 'uint32', type: 'uint32' },\n { name: '', internalType: 'int128', type: 'int128' },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'symbol',\n outputs: [{ name: '', internalType: 'string', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'token0',\n outputs: [{ name: '', internalType: 'address', type: 'address' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'token1',\n outputs: [{ name: '', internalType: 'address', type: 'address' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'totalAssets',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'totalSupply',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'recipient', internalType: 'address', type: 'address' },\n { name: 'amount', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'transfer',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'from', internalType: 'address', type: 'address' },\n { name: 'to', internalType: 'address', type: 'address' },\n { name: 'amount', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'transferFrom',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'underlyingIsToken0',\n outputs: [{ name: '_underlyingIsToken0', internalType: 'bool', type: 'bool' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'underlyingToken',\n outputs: [{ name: '', internalType: 'address', type: 'address' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [{ name: 'data', internalType: 'bytes', type: 'bytes' }],\n name: 'unlockCallback',\n outputs: [{ name: '', internalType: 'bytes', type: 'bytes' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'unrealizedGlobalInterest',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'assets', internalType: 'uint256', type: 'uint256' },\n { name: 'receiver', internalType: 'address', type: 'address' },\n { name: 'owner', internalType: 'address', type: 'address' },\n ],\n name: 'withdraw',\n outputs: [{ name: 'shares', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'assets', internalType: 'uint256', type: 'uint256' },\n { name: 'receiver', internalType: 'address', type: 'address' },\n { name: 'owner', internalType: 'address', type: 'address' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n { name: 'usePremiaAsCollateral', internalType: 'bool', type: 'bool' },\n ],\n name: 'withdraw',\n outputs: [{ name: 'shares', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'spender',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'amount',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'Approval',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'builder',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'commissionPaidProtocol',\n internalType: 'uint128',\n type: 'uint128',\n indexed: false,\n },\n {\n name: 'commissionPaidBuilder',\n internalType: 'uint128',\n type: 'uint128',\n indexed: false,\n },\n ],\n name: 'CommissionPaid',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'sender',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'assets',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n {\n name: 'shares',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'Deposit',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'interestOwed',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n {\n name: 'interestPaid',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n {\n name: 'sharesBurned',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'InsolvencyPenaltyApplied',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'liquidatee',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'liquidator',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'protocolLossAssets',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n {\n name: 'protocolLossShares',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'ProtocolLossRealized',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n { name: 'from', internalType: 'address', type: 'address', indexed: true },\n { name: 'to', internalType: 'address', type: 'address', indexed: true },\n {\n name: 'amount',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'Transfer',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'sender',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'receiver',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'assets',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n {\n name: 'shares',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'Withdraw',\n },\n { type: 'error', inputs: [], name: 'AlreadyInitialized' },\n { type: 'error', inputs: [], name: 'BelowMinimumRedemption' },\n { type: 'error', inputs: [], name: 'CastingError' },\n { type: 'error', inputs: [], name: 'DepositTooLarge' },\n { type: 'error', inputs: [], name: 'ExceedsMaximumRedemption' },\n {\n type: 'error',\n inputs: [\n { name: 'tokenAddress', internalType: 'address', type: 'address' },\n { name: 'assetsRequested', internalType: 'uint256', type: 'uint256' },\n { name: 'assetBalance', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'NotEnoughTokens',\n },\n { type: 'error', inputs: [], name: 'NotPanopticPool' },\n { type: 'error', inputs: [], name: 'PositionCountNotZero' },\n { type: 'error', inputs: [], name: 'Reentrancy' },\n {\n type: 'error',\n inputs: [\n { name: 'token', internalType: 'address', type: 'address' },\n { name: 'from', internalType: 'address', type: 'address' },\n { name: 'amount', internalType: 'uint256', type: 'uint256' },\n { name: 'balance', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'TransferFailed',\n },\n { type: 'error', inputs: [], name: 'UnauthorizedUniswapCallback' },\n] as const\n\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// PanopticFactoryV3\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport const panopticFactoryV3Abi = [\n {\n type: 'constructor',\n inputs: [\n {\n name: '_SFPM',\n internalType: 'contract SemiFungiblePositionManagerV3',\n type: 'address',\n },\n {\n name: '_univ3Factory',\n internalType: 'contract IUniswapV3Factory',\n type: 'address',\n },\n { name: '_poolReference', internalType: 'address', type: 'address' },\n {\n name: '_collateralReference',\n internalType: 'address',\n type: 'address',\n },\n { name: 'properties', internalType: 'bytes32[]', type: 'bytes32[]' },\n { name: 'indices', internalType: 'uint256[][]', type: 'uint256[][]' },\n { name: 'pointers', internalType: 'Pointer[][]', type: 'uint256[][]' },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'spender', internalType: 'address', type: 'address' },\n { name: 'id', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'approve',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'owner', internalType: 'address', type: 'address' }],\n name: 'balanceOf',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'panopticPool', internalType: 'address', type: 'address' },\n { name: 'symbol0', internalType: 'string', type: 'string' },\n { name: 'symbol1', internalType: 'string', type: 'string' },\n { name: 'fee', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'constructMetadata',\n outputs: [{ name: '', internalType: 'string', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'token0', internalType: 'address', type: 'address' },\n { name: 'token1', internalType: 'address', type: 'address' },\n { name: 'fee', internalType: 'uint24', type: 'uint24' },\n {\n name: 'riskEngine',\n internalType: 'contract IRiskEngine',\n type: 'address',\n },\n { name: 'salt', internalType: 'uint96', type: 'uint96' },\n ],\n name: 'deployNewPool',\n outputs: [\n {\n name: 'newPoolContract',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n name: 'getApproved',\n outputs: [{ name: '', internalType: 'address', type: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'univ3pool',\n internalType: 'contract IUniswapV3Pool',\n type: 'address',\n },\n {\n name: 'riskEngine',\n internalType: 'contract IRiskEngine',\n type: 'address',\n },\n ],\n name: 'getPanopticPool',\n outputs: [{ name: '', internalType: 'contract PanopticPoolV2', type: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'address', type: 'address' },\n ],\n name: 'isApprovedForAll',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'deployerAddress', internalType: 'address', type: 'address' },\n { name: 'v3Pool', internalType: 'address', type: 'address' },\n { name: 'riskEngine', internalType: 'address', type: 'address' },\n { name: 'salt', internalType: 'uint96', type: 'uint96' },\n { name: 'loops', internalType: 'uint256', type: 'uint256' },\n { name: 'minTargetRarity', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'minePoolAddress',\n outputs: [\n { name: 'bestSalt', internalType: 'uint96', type: 'uint96' },\n { name: 'highestRarity', internalType: 'uint256', type: 'uint256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'data', internalType: 'bytes[]', type: 'bytes[]' }],\n name: 'multicall',\n outputs: [{ name: 'results', internalType: 'bytes[]', type: 'bytes[]' }],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'name',\n outputs: [{ name: '', internalType: 'string', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'id', internalType: 'uint256', type: 'uint256' }],\n name: 'ownerOf',\n outputs: [{ name: 'owner', internalType: 'address', type: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'from', internalType: 'address', type: 'address' },\n { name: 'to', internalType: 'address', type: 'address' },\n { name: 'id', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'safeTransferFrom',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'from', internalType: 'address', type: 'address' },\n { name: 'to', internalType: 'address', type: 'address' },\n { name: 'id', internalType: 'uint256', type: 'uint256' },\n { name: 'data', internalType: 'bytes', type: 'bytes' },\n ],\n name: 'safeTransferFrom',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'operator', internalType: 'address', type: 'address' },\n { name: 'approved', internalType: 'bool', type: 'bool' },\n ],\n name: 'setApprovalForAll',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'interfaceId', internalType: 'bytes4', type: 'bytes4' }],\n name: 'supportsInterface',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'symbol',\n outputs: [{ name: '', internalType: 'string', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'tokenId', internalType: 'uint256', type: 'uint256' }],\n name: 'tokenURI',\n outputs: [{ name: '', internalType: 'string', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'from', internalType: 'address', type: 'address' },\n { name: 'to', internalType: 'address', type: 'address' },\n { name: 'id', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'transferFrom',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'spender',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n { name: 'id', internalType: 'uint256', type: 'uint256', indexed: true },\n ],\n name: 'Approval',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'operator',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n { name: 'approved', internalType: 'bool', type: 'bool', indexed: false },\n ],\n name: 'ApprovalForAll',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'poolAddress',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n indexed: true,\n },\n {\n name: 'uniswapPool',\n internalType: 'contract IUniswapV3Pool',\n type: 'address',\n indexed: true,\n },\n {\n name: 'collateralTracker0',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n indexed: false,\n },\n {\n name: 'collateralTracker1',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n indexed: false,\n },\n {\n name: 'riskEngine',\n internalType: 'contract IRiskEngine',\n type: 'address',\n indexed: false,\n },\n ],\n name: 'PoolDeployed',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n { name: 'from', internalType: 'address', type: 'address', indexed: true },\n { name: 'to', internalType: 'address', type: 'address', indexed: true },\n { name: 'id', internalType: 'uint256', type: 'uint256', indexed: true },\n ],\n name: 'Transfer',\n },\n { type: 'error', inputs: [], name: 'AlreadyInitialized' },\n { type: 'error', inputs: [], name: 'CreateFail' },\n { type: 'error', inputs: [], name: 'PoolNotInitialized' },\n { type: 'error', inputs: [], name: 'ZeroAddress' },\n] as const\n\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// PanopticFactoryV4\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport const panopticFactoryV4Abi = [\n {\n type: 'constructor',\n inputs: [\n {\n name: '_SFPM',\n internalType: 'contract SemiFungiblePositionManagerV4',\n type: 'address',\n },\n {\n name: '_manager',\n internalType: 'contract IPoolManager',\n type: 'address',\n },\n { name: '_poolReference', internalType: 'address', type: 'address' },\n {\n name: '_collateralReference',\n internalType: 'address',\n type: 'address',\n },\n { name: 'properties', internalType: 'bytes32[]', type: 'bytes32[]' },\n { name: 'indices', internalType: 'uint256[][]', type: 'uint256[][]' },\n { name: 'pointers', internalType: 'Pointer[][]', type: 'uint256[][]' },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'spender', internalType: 'address', type: 'address' },\n { name: 'id', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'approve',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'owner', internalType: 'address', type: 'address' }],\n name: 'balanceOf',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'panopticPool', internalType: 'address', type: 'address' },\n { name: 'symbol0', internalType: 'string', type: 'string' },\n { name: 'symbol1', internalType: 'string', type: 'string' },\n { name: 'fee', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'constructMetadata',\n outputs: [{ name: '', internalType: 'string', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'key',\n internalType: 'struct PoolKey',\n type: 'tuple',\n components: [\n { name: 'currency0', internalType: 'Currency', type: 'address' },\n { name: 'currency1', internalType: 'Currency', type: 'address' },\n { name: 'fee', internalType: 'uint24', type: 'uint24' },\n { name: 'tickSpacing', internalType: 'int24', type: 'int24' },\n { name: 'hooks', internalType: 'contract IHooks', type: 'address' },\n ],\n },\n {\n name: 'riskEngine',\n internalType: 'contract IRiskEngine',\n type: 'address',\n },\n { name: 'salt', internalType: 'uint96', type: 'uint96' },\n ],\n name: 'deployNewPool',\n outputs: [\n {\n name: 'newPoolContract',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n name: 'getApproved',\n outputs: [{ name: '', internalType: 'address', type: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'keyV4',\n internalType: 'struct PoolKey',\n type: 'tuple',\n components: [\n { name: 'currency0', internalType: 'Currency', type: 'address' },\n { name: 'currency1', internalType: 'Currency', type: 'address' },\n { name: 'fee', internalType: 'uint24', type: 'uint24' },\n { name: 'tickSpacing', internalType: 'int24', type: 'int24' },\n { name: 'hooks', internalType: 'contract IHooks', type: 'address' },\n ],\n },\n {\n name: 'riskEngine',\n internalType: 'contract IRiskEngine',\n type: 'address',\n },\n ],\n name: 'getPanopticPool',\n outputs: [{ name: '', internalType: 'contract PanopticPoolV2', type: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'address', type: 'address' },\n ],\n name: 'isApprovedForAll',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'deployerAddress', internalType: 'address', type: 'address' },\n {\n name: 'key',\n internalType: 'struct PoolKey',\n type: 'tuple',\n components: [\n { name: 'currency0', internalType: 'Currency', type: 'address' },\n { name: 'currency1', internalType: 'Currency', type: 'address' },\n { name: 'fee', internalType: 'uint24', type: 'uint24' },\n { name: 'tickSpacing', internalType: 'int24', type: 'int24' },\n { name: 'hooks', internalType: 'contract IHooks', type: 'address' },\n ],\n },\n { name: 'riskEngine', internalType: 'address', type: 'address' },\n { name: 'salt', internalType: 'uint96', type: 'uint96' },\n { name: 'loops', internalType: 'uint256', type: 'uint256' },\n { name: 'minTargetRarity', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'minePoolAddress',\n outputs: [\n { name: 'bestSalt', internalType: 'uint96', type: 'uint96' },\n { name: 'highestRarity', internalType: 'uint256', type: 'uint256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'data', internalType: 'bytes[]', type: 'bytes[]' }],\n name: 'multicall',\n outputs: [{ name: 'results', internalType: 'bytes[]', type: 'bytes[]' }],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'name',\n outputs: [{ name: '', internalType: 'string', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'id', internalType: 'uint256', type: 'uint256' }],\n name: 'ownerOf',\n outputs: [{ name: 'owner', internalType: 'address', type: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'from', internalType: 'address', type: 'address' },\n { name: 'to', internalType: 'address', type: 'address' },\n { name: 'id', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'safeTransferFrom',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'from', internalType: 'address', type: 'address' },\n { name: 'to', internalType: 'address', type: 'address' },\n { name: 'id', internalType: 'uint256', type: 'uint256' },\n { name: 'data', internalType: 'bytes', type: 'bytes' },\n ],\n name: 'safeTransferFrom',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'operator', internalType: 'address', type: 'address' },\n { name: 'approved', internalType: 'bool', type: 'bool' },\n ],\n name: 'setApprovalForAll',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'interfaceId', internalType: 'bytes4', type: 'bytes4' }],\n name: 'supportsInterface',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'symbol',\n outputs: [{ name: '', internalType: 'string', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'tokenId', internalType: 'uint256', type: 'uint256' }],\n name: 'tokenURI',\n outputs: [{ name: '', internalType: 'string', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'from', internalType: 'address', type: 'address' },\n { name: 'to', internalType: 'address', type: 'address' },\n { name: 'id', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'transferFrom',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'spender',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n { name: 'id', internalType: 'uint256', type: 'uint256', indexed: true },\n ],\n name: 'Approval',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'operator',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n { name: 'approved', internalType: 'bool', type: 'bool', indexed: false },\n ],\n name: 'ApprovalForAll',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'poolAddress',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n indexed: true,\n },\n { name: 'idV4', internalType: 'PoolId', type: 'bytes32', indexed: true },\n {\n name: 'collateralTracker0',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n indexed: false,\n },\n {\n name: 'collateralTracker1',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n indexed: false,\n },\n {\n name: 'riskEngine',\n internalType: 'contract IRiskEngine',\n type: 'address',\n indexed: false,\n },\n ],\n name: 'PoolDeployed',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n { name: 'from', internalType: 'address', type: 'address', indexed: true },\n { name: 'to', internalType: 'address', type: 'address', indexed: true },\n { name: 'id', internalType: 'uint256', type: 'uint256', indexed: true },\n ],\n name: 'Transfer',\n },\n { type: 'error', inputs: [], name: 'AlreadyInitialized' },\n { type: 'error', inputs: [], name: 'CreateFail' },\n { type: 'error', inputs: [], name: 'PoolNotInitialized' },\n { type: 'error', inputs: [], name: 'ZeroAddress' },\n] as const\n\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// PanopticGuardian\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport const panopticGuardianAbi = [\n {\n type: 'constructor',\n inputs: [\n { name: 'guardianAdmin', internalType: 'address', type: 'address' },\n { name: 'treasurer', internalType: 'address', type: 'address' },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'GUARDIAN_ADMIN',\n outputs: [{ name: '', internalType: 'address', type: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'TREASURER',\n outputs: [{ name: '', internalType: 'address', type: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'UNLOCK_DELAY',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: '', internalType: 'address', type: 'address' }],\n name: 'builderAdminRevoked',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n ],\n name: 'cancelUnlock',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'riskEngine',\n internalType: 'contract IRiskEngine',\n type: 'address',\n },\n { name: 'token', internalType: 'address', type: 'address' },\n { name: 'recipient', internalType: 'address', type: 'address' },\n { name: 'amount', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'collect',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'builderCode', internalType: 'uint256', type: 'uint256' },\n { name: 'builderAdmin', internalType: 'address', type: 'address' },\n {\n name: 'builderFactory',\n internalType: 'contract BuilderFactory',\n type: 'address',\n },\n ],\n name: 'deployBuilder',\n outputs: [{ name: 'wallet', internalType: 'address', type: 'address' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n ],\n name: 'executeUnlock',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'account', internalType: 'address', type: 'address' },\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n { name: 'builderCode', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'isBuilderAdmin',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n ],\n name: 'isPoolUnlockReady',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n ],\n name: 'lockPool',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n { name: 'builderCode', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'lockPoolAsBuilder',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n ],\n name: 'requestUnlock',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'admin', internalType: 'address', type: 'address' },\n { name: 'revoked', internalType: 'bool', type: 'bool' },\n ],\n name: 'setBuilderAdminRevoked',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: '', internalType: 'contract PanopticPoolV2', type: 'address' }],\n name: 'unlockEta',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'admin',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n ],\n name: 'BuilderAdminRestored',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'admin',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n ],\n name: 'BuilderAdminRevoked',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'builderCode',\n internalType: 'uint256',\n type: 'uint256',\n indexed: true,\n },\n {\n name: 'wallet',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n ],\n name: 'BuilderDeployed',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n indexed: true,\n },\n {\n name: 'locker',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n ],\n name: 'PoolLocked',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n indexed: true,\n },\n ],\n name: 'PoolUnlocked',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'token',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'recipient',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'amount',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'TokensCollected',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n indexed: true,\n },\n ],\n name: 'UnlockCancelled',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n indexed: true,\n },\n { name: 'eta', internalType: 'uint256', type: 'uint256', indexed: false },\n ],\n name: 'UnlockRequested',\n },\n { type: 'error', inputs: [], name: 'InvalidBuilderCode' },\n { type: 'error', inputs: [], name: 'NoPendingUnlock' },\n { type: 'error', inputs: [], name: 'NotAuthorizedBuilder' },\n { type: 'error', inputs: [], name: 'NotFactoryAdmin' },\n { type: 'error', inputs: [], name: 'NotGuardianAdmin' },\n { type: 'error', inputs: [], name: 'NotTreasurer' },\n { type: 'error', inputs: [], name: 'UnlockAlreadyPending' },\n {\n type: 'error',\n inputs: [{ name: 'eta', internalType: 'uint256', type: 'uint256' }],\n name: 'UnlockNotReady',\n },\n { type: 'error', inputs: [], name: 'ZeroAddress' },\n] as const\n\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// PanopticPoolV2\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport const panopticPoolV2Abi = [\n {\n type: 'constructor',\n inputs: [\n {\n name: '_sfpm',\n internalType: 'contract ISemiFungiblePositionManager',\n type: 'address',\n },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'SFPM',\n outputs: [\n {\n name: '',\n internalType: 'contract ISemiFungiblePositionManager',\n type: 'address',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'minValue0', internalType: 'uint256', type: 'uint256' },\n { name: 'minValue1', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'assertMinCollateralValues',\n outputs: [],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'collateralToken0',\n outputs: [\n {\n name: '',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n },\n ],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'collateralToken1',\n outputs: [\n {\n name: '',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n },\n ],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n {\n name: 'finalPositionIdList',\n internalType: 'TokenId[]',\n type: 'uint256[]',\n },\n { name: 'positionSizes', internalType: 'uint128[]', type: 'uint128[]' },\n {\n name: 'tickAndSpreadLimits',\n internalType: 'int24[3][]',\n type: 'int24[3][]',\n },\n { name: 'usePremiaAsCollateral', internalType: 'bool', type: 'bool' },\n { name: 'builderCode', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'dispatch',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'positionIdListFrom',\n internalType: 'TokenId[]',\n type: 'uint256[]',\n },\n { name: 'account', internalType: 'address', type: 'address' },\n {\n name: 'positionIdListTo',\n internalType: 'TokenId[]',\n type: 'uint256[]',\n },\n {\n name: 'positionIdListToFinal',\n internalType: 'TokenId[]',\n type: 'uint256[]',\n },\n {\n name: 'usePremiaAsCollateral',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n ],\n name: 'dispatchFrom',\n outputs: [],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n inputs: [{ name: 'account', internalType: 'address', type: 'address' }],\n name: 'getAssetsOf',\n outputs: [\n { name: 'assets0', internalType: 'uint256', type: 'uint256' },\n { name: 'assets1', internalType: 'uint256', type: 'uint256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'tickLower', internalType: 'int24', type: 'int24' },\n { name: 'tickUpper', internalType: 'int24', type: 'int24' },\n ],\n name: 'getChunkData',\n outputs: [\n {\n name: 'liquidities0',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'liquidities1',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n { name: 'settled0', internalType: 'LeftRightUnsigned', type: 'uint256' },\n { name: 'settled1', internalType: 'LeftRightUnsigned', type: 'uint256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'getCurrentTick',\n outputs: [{ name: 'currentTick', internalType: 'int24', type: 'int24' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'user', internalType: 'address', type: 'address' },\n { name: 'includePendingPremium', internalType: 'bool', type: 'bool' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n ],\n name: 'getFullPositionsData',\n outputs: [\n {\n name: 'shortPremium',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'longPremium',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'positionBalances',\n internalType: 'PositionBalance[]',\n type: 'uint256[]',\n },\n {\n name: 'collateralRequirements',\n internalType: 'LeftRightUnsigned[]',\n type: 'uint256[]',\n },\n {\n name: 'netPremiaPerPosition',\n internalType: 'LeftRightSigned[]',\n type: 'int256[]',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'getOracleTicks',\n outputs: [\n { name: 'currentTick', internalType: 'int24', type: 'int24' },\n { name: 'spotTick', internalType: 'int24', type: 'int24' },\n { name: 'medianTick', internalType: 'int24', type: 'int24' },\n { name: 'latestTick', internalType: 'int24', type: 'int24' },\n { name: 'oraclePack', internalType: 'OraclePack', type: 'uint256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'builderCode', internalType: 'uint256', type: 'uint256' }],\n name: 'getRiskParameters',\n outputs: [\n {\n name: 'riskParameters',\n internalType: 'RiskParameters',\n type: 'uint256',\n },\n { name: 'currentTick', internalType: 'int24', type: 'int24' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'getTWAP',\n outputs: [{ name: 'twapTick', internalType: 'int24', type: 'int24' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'initialize',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'isSafeMode',\n outputs: [{ name: '', internalType: 'uint8', type: 'uint8' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'lockSafeMode',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'data', internalType: 'bytes[]', type: 'bytes[]' }],\n name: 'multicall',\n outputs: [{ name: 'results', internalType: 'bytes[]', type: 'bytes[]' }],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n inputs: [{ name: 'user', internalType: 'address', type: 'address' }],\n name: 'numberOfLegs',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'uint256', type: 'uint256' },\n { name: '', internalType: 'uint256', type: 'uint256' },\n { name: '', internalType: 'bytes', type: 'bytes' },\n ],\n name: 'onERC1155Received',\n outputs: [{ name: '', internalType: 'bytes4', type: 'bytes4' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'pokeOracle',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'poolId',\n outputs: [{ name: '', internalType: 'uint64', type: 'uint64' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'poolKey',\n outputs: [{ name: 'key', internalType: 'bytes', type: 'bytes' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'poolManager',\n outputs: [{ name: '', internalType: 'address', type: 'address' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'reentrancyGuardEntered',\n outputs: [{ name: 'entered', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'riskEngine',\n outputs: [{ name: '', internalType: 'contract IRiskEngine', type: 'address' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'tickSpacing',\n outputs: [{ name: '', internalType: 'int24', type: 'int24' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [],\n name: 'unlockSafeMode',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'user', internalType: 'address', type: 'address' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n { name: 'usePremiaAsCollateral', internalType: 'bool', type: 'bool' },\n ],\n name: 'validateCollateralWithdrawable',\n outputs: [],\n stateMutability: 'view',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'liquidator',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'liquidatee',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'bonusAmounts',\n internalType: 'LeftRightSigned',\n type: 'int256',\n indexed: false,\n },\n ],\n name: 'AccountLiquidated',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'exercisor',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n { name: 'user', internalType: 'address', type: 'address', indexed: true },\n {\n name: 'tokenId',\n internalType: 'TokenId',\n type: 'uint256',\n indexed: true,\n },\n {\n name: 'exerciseFee',\n internalType: 'LeftRightSigned',\n type: 'int256',\n indexed: false,\n },\n ],\n name: 'ForcedExercised',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'recipient',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'positionSize',\n internalType: 'uint128',\n type: 'uint128',\n indexed: false,\n },\n {\n name: 'tokenId',\n internalType: 'TokenId',\n type: 'uint256',\n indexed: true,\n },\n {\n name: 'premiaByLeg',\n internalType: 'LeftRightSigned[4]',\n type: 'int256[4]',\n indexed: false,\n },\n ],\n name: 'OptionBurnt',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'recipient',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'tokenId',\n internalType: 'TokenId',\n type: 'uint256',\n indexed: true,\n },\n {\n name: 'balanceData',\n internalType: 'PositionBalance',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'OptionMinted',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n { name: 'user', internalType: 'address', type: 'address', indexed: true },\n {\n name: 'tokenId',\n internalType: 'TokenId',\n type: 'uint256',\n indexed: true,\n },\n {\n name: 'legIndex',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n {\n name: 'settledAmounts',\n internalType: 'LeftRightSigned',\n type: 'int256',\n indexed: false,\n },\n ],\n name: 'PremiumSettled',\n },\n {\n type: 'error',\n inputs: [\n { name: 'solvent', internalType: 'uint256', type: 'uint256' },\n { name: 'numberOfTicks', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'AccountInsolvent',\n },\n { type: 'error', inputs: [], name: 'AlreadyInitialized' },\n { type: 'error', inputs: [], name: 'CastingError' },\n { type: 'error', inputs: [], name: 'DuplicateTokenId' },\n { type: 'error', inputs: [], name: 'EffectiveLiquidityAboveThreshold' },\n { type: 'error', inputs: [], name: 'InputListFail' },\n { type: 'error', inputs: [], name: 'InvalidTick' },\n { type: 'error', inputs: [], name: 'InvalidTickBound' },\n { type: 'error', inputs: [], name: 'LiquidityTooHigh' },\n { type: 'error', inputs: [], name: 'NetLiquidityZero' },\n { type: 'error', inputs: [], name: 'NoLegsExercisable' },\n { type: 'error', inputs: [], name: 'NotGuardian' },\n { type: 'error', inputs: [], name: 'NotMarginCalled' },\n { type: 'error', inputs: [], name: 'PositionNotOwned' },\n { type: 'error', inputs: [], name: 'PriceImpactTooLarge' },\n { type: 'error', inputs: [], name: 'Reentrancy' },\n { type: 'error', inputs: [], name: 'StaleOracle' },\n { type: 'error', inputs: [], name: 'TokenIdHasZeroLegs' },\n { type: 'error', inputs: [], name: 'TooManyLegsOpen' },\n { type: 'error', inputs: [], name: 'UnderOverFlow' },\n { type: 'error', inputs: [], name: 'WrongPoolId' },\n] as const\n\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// PanopticQuery\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport const panopticQueryAbi = [\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'account', internalType: 'address', type: 'address' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n ],\n name: 'checkCollateral',\n outputs: [\n {\n name: 'collateralBalances0',\n internalType: 'uint256[4]',\n type: 'uint256[4]',\n },\n {\n name: 'requiredCollaterals0',\n internalType: 'uint256[4]',\n type: 'uint256[4]',\n },\n {\n name: 'collateralBalances1',\n internalType: 'uint256[4]',\n type: 'uint256[4]',\n },\n {\n name: 'requiredCollaterals1',\n internalType: 'uint256[4]',\n type: 'uint256[4]',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'account', internalType: 'address', type: 'address' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n ],\n name: 'checkCollateral',\n outputs: [\n {\n name: 'balancesAndRequired',\n internalType: 'uint256[4]',\n type: 'uint256[4]',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'account', internalType: 'address', type: 'address' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n ],\n name: 'checkCollateralListOutput',\n outputs: [\n { name: '', internalType: 'uint256[4][]', type: 'uint256[4][]' },\n { name: '', internalType: 'int256[]', type: 'int256[]' },\n { name: '', internalType: 'int24[]', type: 'int24[]' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n ],\n name: 'getChunkData',\n outputs: [{ name: '', internalType: 'uint256[2][4][]', type: 'uint256[2][4][]' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'account', internalType: 'address', type: 'address' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n ],\n name: 'getLiquidationPrices',\n outputs: [\n { name: 'liquidationPriceDown', internalType: 'int24', type: 'int24' },\n { name: 'liquidationPriceUp', internalType: 'int24', type: 'int24' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n { name: 'tokenId', internalType: 'TokenId', type: 'uint256' },\n { name: 'positionSize', internalType: 'uint128', type: 'uint128' },\n ],\n name: 'getItmAmounts',\n outputs: [\n { name: 'itm0', internalType: 'int256', type: 'int256' },\n { name: 'itm1', internalType: 'int256', type: 'int256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n {\n name: 'existingPositionIds',\n internalType: 'TokenId[]',\n type: 'uint256[]',\n },\n { name: 'account', internalType: 'address', type: 'address' },\n { name: 'tokenId', internalType: 'TokenId', type: 'uint256' },\n ],\n name: 'getMaxPositionSizeBounds',\n outputs: [\n { name: 'maxSizeAtMinUtil', internalType: 'uint128', type: 'uint128' },\n { name: 'maxSizeAtMaxUtil', internalType: 'uint128', type: 'uint128' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'account', internalType: 'address', type: 'address' },\n { name: 'includePendingPremium', internalType: 'bool', type: 'bool' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n ],\n name: 'getNetLiquidationValue',\n outputs: [\n { name: 'value0', internalType: 'int256', type: 'int256' },\n { name: 'value1', internalType: 'int256', type: 'int256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'account', internalType: 'address', type: 'address' },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n ],\n name: 'getPortfolioValue',\n outputs: [\n { name: 'value0', internalType: 'int256', type: 'int256' },\n { name: 'value1', internalType: 'int256', type: 'int256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'account', internalType: 'address', type: 'address' },\n { name: 'atTicks', internalType: 'int24[]', type: 'int24[]' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n ],\n name: 'getPortfolioValueAtTicks',\n outputs: [\n { name: 'value0', internalType: 'int256[]', type: 'int256[]' },\n { name: 'value1', internalType: 'int256[]', type: 'int256[]' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'tokenId', internalType: 'TokenId', type: 'uint256' },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n ],\n name: 'getRequiredBase',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'startTick', internalType: 'int24', type: 'int24' },\n { name: 'nTicks', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'getTickNets',\n outputs: [\n { name: 'tickData', internalType: 'int256[]', type: 'int256[]' },\n { name: 'liquidityNets', internalType: 'int256[]', type: 'int256[]' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'account', internalType: 'address', type: 'address' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n ],\n name: 'isAccountSolvent',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n { name: 'tokenId', internalType: 'TokenId', type: 'uint256' },\n ],\n name: 'optimizeRiskPartners',\n outputs: [{ name: '', internalType: 'TokenId', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'pool', internalType: 'contract PanopticPool', type: 'address' },\n { name: 'tickLower', internalType: 'int24', type: 'int24' },\n { name: 'tickUpper', internalType: 'int24', type: 'int24' },\n { name: 'width', internalType: 'int24', type: 'int24' },\n ],\n name: 'scanChunks',\n outputs: [\n { name: '', internalType: 'int24[]', type: 'int24[]' },\n { name: '', internalType: 'uint128[2][]', type: 'uint128[2][]' },\n { name: '', internalType: 'uint128[2][]', type: 'uint128[2][]' },\n {\n name: '',\n internalType: 'LeftRightUnsigned[2][]',\n type: 'uint256[2][]',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'self', internalType: 'TokenId', type: 'uint256' }],\n name: 'validateTokenId',\n outputs: [],\n stateMutability: 'pure',\n },\n { type: 'error', inputs: [], name: 'CastingError' },\n { type: 'error', inputs: [], name: 'InvalidTick' },\n {\n type: 'error',\n inputs: [{ name: 'parameterType', internalType: 'uint256', type: 'uint256' }],\n name: 'InvalidTokenIdParameter',\n },\n { type: 'error', inputs: [], name: 'LiquidityTooHigh' },\n { type: 'error', inputs: [], name: 'UnderOverFlow' },\n] as const\n\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// RiskEngine\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport const riskEngineAbi = [\n {\n type: 'constructor',\n inputs: [\n { name: '_crossBuffer0', internalType: 'uint256', type: 'uint256' },\n { name: '_crossBuffer1', internalType: 'uint256', type: 'uint256' },\n { name: '_guardian', internalType: 'address', type: 'address' },\n { name: '_builderFactory', internalType: 'address', type: 'address' },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'ADJUSTMENT_SPEED',\n outputs: [{ name: '', internalType: 'int256', type: 'int256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'BP_DECREASE_BUFFER',\n outputs: [{ name: '', internalType: 'uint32', type: 'uint32' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'BUILDER_FACTORY',\n outputs: [{ name: '', internalType: 'address', type: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'BUILDER_SPLIT',\n outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'BUYER_COLLATERAL_RATIO',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'CROSS_BUFFER_0',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'CROSS_BUFFER_1',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'CURVE_STEEPNESS',\n outputs: [{ name: '', internalType: 'int256', type: 'int256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'DECIMALS',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'EMA_PERIODS',\n outputs: [{ name: '', internalType: 'uint96', type: 'uint96' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'FORCE_EXERCISE_COST',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'GUARDIAN',\n outputs: [{ name: '', internalType: 'address', type: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'INITIAL_RATE_AT_TARGET',\n outputs: [{ name: '', internalType: 'int256', type: 'int256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'IRM_MAX_ELAPSED_TIME',\n outputs: [{ name: '', internalType: 'int256', type: 'int256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'MAINT_MARGIN_RATE',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'MAX_BONUS',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'MAX_CLAMP_DELTA',\n outputs: [{ name: '', internalType: 'int24', type: 'int24' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'MAX_OPEN_LEGS',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'MAX_RATE_AT_TARGET',\n outputs: [{ name: '', internalType: 'int256', type: 'int256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'MAX_SPREAD',\n outputs: [{ name: '', internalType: 'uint24', type: 'uint24' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'MAX_TICKS_DELTA',\n outputs: [{ name: '', internalType: 'int256', type: 'int256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'MAX_TWAP_DELTA_DISPATCH',\n outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'MIN_RATE_AT_TARGET',\n outputs: [{ name: '', internalType: 'int256', type: 'int256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'NOTIONAL_FEE',\n outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'PREMIUM_FEE',\n outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'PROTOCOL_SPLIT',\n outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'SATURATED_POOL_UTIL',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'SELLER_COLLATERAL_RATIO',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'TARGET_POOL_UTIL',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'TARGET_UTILIZATION',\n outputs: [{ name: '', internalType: 'int256', type: 'int256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'VEGOID',\n outputs: [{ name: '', internalType: 'uint8', type: 'uint8' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'token', internalType: 'address', type: 'address' },\n { name: 'recipient', internalType: 'address', type: 'address' },\n ],\n name: 'collect',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'token', internalType: 'address', type: 'address' },\n { name: 'recipient', internalType: 'address', type: 'address' },\n { name: 'amount', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'collect',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'oraclePack', internalType: 'OraclePack', type: 'uint256' },\n { name: 'currentTick', internalType: 'int24', type: 'int24' },\n ],\n name: 'computeInternalMedian',\n outputs: [\n { name: 'medianTick', internalType: 'int24', type: 'int24' },\n {\n name: 'updatedOraclePack',\n internalType: 'OraclePack',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'utilization', internalType: 'int256', type: 'int256' },\n { name: 'crossBuffer', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'crossBufferRatio',\n outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n { name: 'currentTick', internalType: 'int24', type: 'int24' },\n { name: 'oracleTick', internalType: 'int24', type: 'int24' },\n { name: 'tokenId', internalType: 'TokenId', type: 'uint256' },\n {\n name: 'positionBalance',\n internalType: 'PositionBalance',\n type: 'uint256',\n },\n ],\n name: 'exerciseCost',\n outputs: [{ name: 'exerciseFees', internalType: 'LeftRightSigned', type: 'int256' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [{ name: 'builderCode', internalType: 'uint256', type: 'uint256' }],\n name: 'getFeeRecipient',\n outputs: [{ name: 'feeRecipient', internalType: 'address', type: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'tokenData0',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'tokenData1',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n { name: 'atSqrtPriceX96', internalType: 'uint160', type: 'uint160' },\n { name: 'netPaid', internalType: 'LeftRightSigned', type: 'int256' },\n {\n name: 'shortPremium',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'loanAmounts',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n ],\n name: 'getLiquidationBonus',\n outputs: [\n { name: '', internalType: 'LeftRightSigned', type: 'int256' },\n { name: '', internalType: 'LeftRightSigned', type: 'int256' },\n ],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'positionBalanceArray',\n internalType: 'PositionBalance[]',\n type: 'uint256[]',\n },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n { name: 'user', internalType: 'address', type: 'address' },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n {\n name: 'shortPremia',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'longPremia',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'ct0',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n },\n {\n name: 'ct1',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n },\n ],\n name: 'getMargin',\n outputs: [\n {\n name: 'tokenData0',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'tokenData1',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'globalUtilizations',\n internalType: 'PositionBalance',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'currentTick', internalType: 'int24', type: 'int24' },\n { name: '_oraclePack', internalType: 'OraclePack', type: 'uint256' },\n ],\n name: 'getOracleTicks',\n outputs: [\n { name: 'spotTick', internalType: 'int24', type: 'int24' },\n { name: 'medianTick', internalType: 'int24', type: 'int24' },\n { name: 'latestTick', internalType: 'int24', type: 'int24' },\n { name: 'oraclePack', internalType: 'OraclePack', type: 'uint256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'positionBalanceArray',\n internalType: 'PositionBalance[]',\n type: 'uint256[]',\n },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n ],\n name: 'getPerPositionCollateralRequirements',\n outputs: [\n {\n name: 'collateralRequirements',\n internalType: 'LeftRightUnsigned[]',\n type: 'uint256[]',\n },\n ],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n { name: 'payor', internalType: 'address', type: 'address' },\n { name: 'fees', internalType: 'LeftRightSigned', type: 'int256' },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n {\n name: 'ct0',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n },\n {\n name: 'ct1',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n },\n ],\n name: 'getRefundAmounts',\n outputs: [{ name: '', internalType: 'LeftRightSigned', type: 'int256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'currentTick', internalType: 'int24', type: 'int24' },\n { name: 'oraclePack', internalType: 'OraclePack', type: 'uint256' },\n { name: 'builderCode', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'getRiskParameters',\n outputs: [{ name: '', internalType: 'RiskParameters', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'currentTick', internalType: 'int24', type: 'int24' },\n { name: '_oraclePack', internalType: 'OraclePack', type: 'uint256' },\n { name: 'safeMode', internalType: 'uint8', type: 'uint8' },\n ],\n name: 'getSolvencyTicks',\n outputs: [\n { name: '', internalType: 'int24[]', type: 'int24[]' },\n { name: '', internalType: 'OraclePack', type: 'uint256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n {\n name: 'premiasByLeg',\n internalType: 'LeftRightSigned[4][]',\n type: 'int256[4][]',\n },\n {\n name: 'collateralRemaining',\n internalType: 'LeftRightSigned',\n type: 'int256',\n },\n { name: 'atSqrtPriceX96', internalType: 'uint160', type: 'uint160' },\n ],\n name: 'haircutPremia',\n outputs: [\n { name: 'bonusDeltas', internalType: 'LeftRightSigned', type: 'int256' },\n {\n name: 'haircutTotal',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'haircutPerLeg',\n internalType: 'LeftRightSigned[4][]',\n type: 'int256[4][]',\n },\n ],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n { name: 'utilization', internalType: 'uint256', type: 'uint256' },\n {\n name: 'interestRateAccumulator',\n internalType: 'MarketState',\n type: 'uint256',\n },\n ],\n name: 'interestRate',\n outputs: [{ name: '', internalType: 'uint128', type: 'uint128' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'positionBalanceArray',\n internalType: 'PositionBalance[]',\n type: 'uint256[]',\n },\n { name: 'positionIdList', internalType: 'TokenId[]', type: 'uint256[]' },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n { name: 'user', internalType: 'address', type: 'address' },\n {\n name: 'shortPremia',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'longPremia',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n {\n name: 'ct0',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n },\n {\n name: 'ct1',\n internalType: 'contract CollateralTrackerV2',\n type: 'address',\n },\n { name: 'buffer', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'isAccountSolvent',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'currentTick', internalType: 'int24', type: 'int24' },\n { name: 'oraclePack', internalType: 'OraclePack', type: 'uint256' },\n ],\n name: 'isSafeMode',\n outputs: [{ name: 'safeMode', internalType: 'uint8', type: 'uint8' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n ],\n name: 'lockPool',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'oraclePack', internalType: 'OraclePack', type: 'uint256' }],\n name: 'twapEMA',\n outputs: [{ name: '', internalType: 'int24', type: 'int24' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'pool',\n internalType: 'contract PanopticPoolV2',\n type: 'address',\n },\n ],\n name: 'unlockPool',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'utilization', internalType: 'uint256', type: 'uint256' },\n {\n name: 'interestRateAccumulator',\n internalType: 'MarketState',\n type: 'uint256',\n },\n ],\n name: 'updateInterestRate',\n outputs: [\n { name: '', internalType: 'uint128', type: 'uint128' },\n { name: '', internalType: 'uint256', type: 'uint256' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [],\n name: 'vegoid',\n outputs: [{ name: '', internalType: 'uint8', type: 'uint8' }],\n stateMutability: 'pure',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'collateralToken',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'avgBorrowRate',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n {\n name: 'rateAtTarget',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'BorrowRateUpdated',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [{ name: 'lockMode', internalType: 'bool', type: 'bool', indexed: false }],\n name: 'GuardianSafeModeUpdated',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'token',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'recipient',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'amount',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'TokensCollected',\n },\n { type: 'error', inputs: [], name: 'BelowMinimumRedemption' },\n { type: 'error', inputs: [], name: 'CastingError' },\n { type: 'error', inputs: [], name: 'InvalidBuilderCode' },\n { type: 'error', inputs: [], name: 'InvalidTick' },\n { type: 'error', inputs: [], name: 'LengthMismatch' },\n { type: 'error', inputs: [], name: 'LiquidityTooHigh' },\n { type: 'error', inputs: [], name: 'NotGuardian' },\n {\n type: 'error',\n inputs: [\n { name: 'token', internalType: 'address', type: 'address' },\n { name: 'from', internalType: 'address', type: 'address' },\n { name: 'amount', internalType: 'uint256', type: 'uint256' },\n { name: 'balance', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'TransferFailed',\n },\n { type: 'error', inputs: [], name: 'UnderOverFlow' },\n] as const\n\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// SemiFungiblePositionManagerV3\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport const semiFungiblePositionManagerV3Abi = [\n {\n type: 'constructor',\n inputs: [\n {\n name: '_factory',\n internalType: 'contract IUniswapV3Factory',\n type: 'address',\n },\n {\n name: '_minEnforcedTickFillCost',\n internalType: 'uint256',\n type: 'uint256',\n },\n {\n name: '_supplyMultiplierTickFill',\n internalType: 'uint256',\n type: 'uint256',\n },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'account', internalType: 'address', type: 'address' },\n { name: 'tokenId', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'balanceOf',\n outputs: [{ name: 'balance', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'owners', internalType: 'address[]', type: 'address[]' },\n { name: 'ids', internalType: 'uint256[]', type: 'uint256[]' },\n ],\n name: 'balanceOfBatch',\n outputs: [{ name: 'balances', internalType: 'uint256[]', type: 'uint256[]' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'poolKey', internalType: 'bytes', type: 'bytes' },\n { name: 'tokenId', internalType: 'TokenId', type: 'uint256' },\n { name: 'positionSize', internalType: 'uint128', type: 'uint128' },\n { name: 'tickLimitLow', internalType: 'int24', type: 'int24' },\n { name: 'tickLimitHigh', internalType: 'int24', type: 'int24' },\n ],\n name: 'burnTokenizedPosition',\n outputs: [\n { name: '', internalType: 'LeftRightUnsigned[4]', type: 'uint256[4]' },\n { name: '', internalType: 'LeftRightSigned', type: 'int256' },\n { name: '', internalType: 'int24', type: 'int24' },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'poolId', internalType: 'uint64', type: 'uint64' }],\n name: 'expandEnforcedTickRange',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'poolKey', internalType: 'bytes', type: 'bytes' },\n { name: 'owner', internalType: 'address', type: 'address' },\n { name: 'tokenType', internalType: 'uint256', type: 'uint256' },\n { name: 'tickLower', internalType: 'int24', type: 'int24' },\n { name: 'tickUpper', internalType: 'int24', type: 'int24' },\n ],\n name: 'getAccountFeesBase',\n outputs: [\n { name: 'feesBase0', internalType: 'int128', type: 'int128' },\n { name: 'feesBase1', internalType: 'int128', type: 'int128' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'poolKey', internalType: 'bytes', type: 'bytes' },\n { name: 'owner', internalType: 'address', type: 'address' },\n { name: 'tokenType', internalType: 'uint256', type: 'uint256' },\n { name: 'tickLower', internalType: 'int24', type: 'int24' },\n { name: 'tickUpper', internalType: 'int24', type: 'int24' },\n ],\n name: 'getAccountLiquidity',\n outputs: [\n {\n name: 'accountLiquidities',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'poolKey', internalType: 'bytes', type: 'bytes' },\n { name: 'owner', internalType: 'address', type: 'address' },\n { name: 'tokenType', internalType: 'uint256', type: 'uint256' },\n { name: 'tickLower', internalType: 'int24', type: 'int24' },\n { name: 'tickUpper', internalType: 'int24', type: 'int24' },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n { name: 'isLong', internalType: 'uint256', type: 'uint256' },\n { name: 'vegoid', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'getAccountPremium',\n outputs: [\n { name: '', internalType: 'uint128', type: 'uint128' },\n { name: '', internalType: 'uint128', type: 'uint128' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'poolKey', internalType: 'bytes', type: 'bytes' }],\n name: 'getCurrentTick',\n outputs: [{ name: 'currentTick', internalType: 'int24', type: 'int24' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'poolId', internalType: 'uint64', type: 'uint64' }],\n name: 'getEnforcedTickLimits',\n outputs: [\n { name: '', internalType: 'int24', type: 'int24' },\n { name: '', internalType: 'int24', type: 'int24' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'id', internalType: 'bytes', type: 'bytes' },\n { name: 'vegoid', internalType: 'uint8', type: 'uint8' },\n ],\n name: 'getPoolId',\n outputs: [{ name: 'poolId', internalType: 'uint64', type: 'uint64' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'poolId', internalType: 'uint64', type: 'uint64' }],\n name: 'getUniswapV3PoolFromId',\n outputs: [\n {\n name: 'uniswapV3Pool',\n internalType: 'contract IUniswapV3Pool',\n type: 'address',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'token0', internalType: 'address', type: 'address' },\n { name: 'token1', internalType: 'address', type: 'address' },\n { name: 'fee', internalType: 'uint24', type: 'uint24' },\n { name: 'vegoid', internalType: 'uint8', type: 'uint8' },\n ],\n name: 'initializeAMMPool',\n outputs: [{ name: 'poolId', internalType: 'uint64', type: 'uint64' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'owner', internalType: 'address', type: 'address' },\n { name: 'operator', internalType: 'address', type: 'address' },\n ],\n name: 'isApprovedForAll',\n outputs: [{ name: 'approvedForAll', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'poolKey', internalType: 'bytes', type: 'bytes' },\n { name: 'tokenId', internalType: 'TokenId', type: 'uint256' },\n { name: 'positionSize', internalType: 'uint128', type: 'uint128' },\n { name: 'tickLimitLow', internalType: 'int24', type: 'int24' },\n { name: 'tickLimitHigh', internalType: 'int24', type: 'int24' },\n ],\n name: 'mintTokenizedPosition',\n outputs: [\n { name: '', internalType: 'LeftRightUnsigned[4]', type: 'uint256[4]' },\n { name: '', internalType: 'LeftRightSigned', type: 'int256' },\n { name: '', internalType: 'int24', type: 'int24' },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'data', internalType: 'bytes[]', type: 'bytes[]' }],\n name: 'multicall',\n outputs: [{ name: 'results', internalType: 'bytes[]', type: 'bytes[]' }],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'reentrancyGuardEntered',\n outputs: [{ name: 'entered', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'uint256[]', type: 'uint256[]' },\n { name: '', internalType: 'uint256[]', type: 'uint256[]' },\n { name: '', internalType: 'bytes', type: 'bytes' },\n ],\n name: 'safeBatchTransferFrom',\n outputs: [],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'uint256', type: 'uint256' },\n { name: '', internalType: 'uint256', type: 'uint256' },\n { name: '', internalType: 'bytes', type: 'bytes' },\n ],\n name: 'safeTransferFrom',\n outputs: [],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n { name: 'operator', internalType: 'address', type: 'address' },\n { name: 'approved', internalType: 'bool', type: 'bool' },\n ],\n name: 'setApprovalForAll',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'interfaceId', internalType: 'bytes4', type: 'bytes4' }],\n name: 'supportsInterface',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n { name: 'amount0Owed', internalType: 'uint256', type: 'uint256' },\n { name: 'amount1Owed', internalType: 'uint256', type: 'uint256' },\n { name: 'data', internalType: 'bytes', type: 'bytes' },\n ],\n name: 'uniswapV3MintCallback',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'amount0Delta', internalType: 'int256', type: 'int256' },\n { name: 'amount1Delta', internalType: 'int256', type: 'int256' },\n { name: 'data', internalType: 'bytes', type: 'bytes' },\n ],\n name: 'uniswapV3SwapCallback',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'operator',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n { name: 'approved', internalType: 'bool', type: 'bool', indexed: false },\n ],\n name: 'ApprovalForAll',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'uniswapPool',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'minEnforcedTick',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n {\n name: 'maxEnforcedTick',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n ],\n name: 'EnforcedTicksUpdated',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'univ3pool',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'tokenType',\n internalType: 'uint256',\n type: 'uint256',\n indexed: true,\n },\n {\n name: 'tickLower',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n {\n name: 'tickUpper',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n {\n name: 'liquidityDelta',\n internalType: 'int128',\n type: 'int128',\n indexed: false,\n },\n ],\n name: 'LiquidityChunkUpdated',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'uniswapPool',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'poolId',\n internalType: 'uint64',\n type: 'uint64',\n indexed: false,\n },\n {\n name: 'minEnforcedTick',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n {\n name: 'maxEnforcedTick',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n ],\n name: 'PoolInitialized',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'recipient',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'tokenId',\n internalType: 'TokenId',\n type: 'uint256',\n indexed: true,\n },\n {\n name: 'positionSize',\n internalType: 'uint128',\n type: 'uint128',\n indexed: false,\n },\n ],\n name: 'TokenizedPositionBurnt',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'caller',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'tokenId',\n internalType: 'TokenId',\n type: 'uint256',\n indexed: true,\n },\n {\n name: 'positionSize',\n internalType: 'uint128',\n type: 'uint128',\n indexed: false,\n },\n ],\n name: 'TokenizedPositionMinted',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'operator',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n { name: 'from', internalType: 'address', type: 'address', indexed: true },\n { name: 'to', internalType: 'address', type: 'address', indexed: true },\n {\n name: 'ids',\n internalType: 'uint256[]',\n type: 'uint256[]',\n indexed: false,\n },\n {\n name: 'amounts',\n internalType: 'uint256[]',\n type: 'uint256[]',\n indexed: false,\n },\n ],\n name: 'TransferBatch',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'operator',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n { name: 'from', internalType: 'address', type: 'address', indexed: true },\n { name: 'to', internalType: 'address', type: 'address', indexed: true },\n { name: 'id', internalType: 'uint256', type: 'uint256', indexed: false },\n {\n name: 'amount',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'TransferSingle',\n },\n { type: 'error', inputs: [], name: 'CastingError' },\n { type: 'error', inputs: [], name: 'ChunkHasZeroLiquidity' },\n { type: 'error', inputs: [], name: 'InvalidTick' },\n { type: 'error', inputs: [], name: 'InvalidTickBound' },\n {\n type: 'error',\n inputs: [{ name: 'parameterType', internalType: 'uint256', type: 'uint256' }],\n name: 'InvalidTokenIdParameter',\n },\n { type: 'error', inputs: [], name: 'InvalidUniswapCallback' },\n { type: 'error', inputs: [], name: 'LiquidityTooHigh' },\n { type: 'error', inputs: [], name: 'NotAuthorized' },\n { type: 'error', inputs: [], name: 'NotEnoughLiquidityInChunk' },\n { type: 'error', inputs: [], name: 'PoolNotInitialized' },\n { type: 'error', inputs: [], name: 'PositionTooLarge' },\n {\n type: 'error',\n inputs: [{ name: 'currentTick', internalType: 'int24', type: 'int24' }],\n name: 'PriceBoundFail',\n },\n { type: 'error', inputs: [], name: 'Reentrancy' },\n {\n type: 'error',\n inputs: [\n { name: 'token', internalType: 'address', type: 'address' },\n { name: 'from', internalType: 'address', type: 'address' },\n { name: 'amount', internalType: 'uint256', type: 'uint256' },\n { name: 'balance', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'TransferFailed',\n },\n { type: 'error', inputs: [], name: 'UnderOverFlow' },\n { type: 'error', inputs: [], name: 'UnsafeRecipient' },\n { type: 'error', inputs: [], name: 'WrongUniswapPool' },\n] as const\n\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// SemiFungiblePositionManagerV4\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport const semiFungiblePositionManagerV4Abi = [\n {\n type: 'constructor',\n inputs: [\n {\n name: 'poolManager',\n internalType: 'contract IPoolManager',\n type: 'address',\n },\n {\n name: '_minEnforcedTickFillCost',\n internalType: 'uint256',\n type: 'uint256',\n },\n {\n name: '_nativeEnforcedTickFillCost',\n internalType: 'uint256',\n type: 'uint256',\n },\n {\n name: '_supplyMultiplierTickFill',\n internalType: 'uint256',\n type: 'uint256',\n },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'account', internalType: 'address', type: 'address' },\n { name: 'tokenId', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'balanceOf',\n outputs: [{ name: 'balance', internalType: 'uint256', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'owners', internalType: 'address[]', type: 'address[]' },\n { name: 'ids', internalType: 'uint256[]', type: 'uint256[]' },\n ],\n name: 'balanceOfBatch',\n outputs: [{ name: 'balances', internalType: 'uint256[]', type: 'uint256[]' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'poolKey', internalType: 'bytes', type: 'bytes' },\n { name: 'tokenId', internalType: 'TokenId', type: 'uint256' },\n { name: 'positionSize', internalType: 'uint128', type: 'uint128' },\n { name: 'tickLimitLow', internalType: 'int24', type: 'int24' },\n { name: 'tickLimitHigh', internalType: 'int24', type: 'int24' },\n ],\n name: 'burnTokenizedPosition',\n outputs: [\n { name: '', internalType: 'LeftRightUnsigned[4]', type: 'uint256[4]' },\n { name: '', internalType: 'LeftRightSigned', type: 'int256' },\n { name: '', internalType: 'int24', type: 'int24' },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'poolId', internalType: 'uint64', type: 'uint64' }],\n name: 'expandEnforcedTickRange',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'poolKey', internalType: 'bytes', type: 'bytes' },\n { name: 'owner', internalType: 'address', type: 'address' },\n { name: 'tokenType', internalType: 'uint256', type: 'uint256' },\n { name: 'tickLower', internalType: 'int24', type: 'int24' },\n { name: 'tickUpper', internalType: 'int24', type: 'int24' },\n ],\n name: 'getAccountLiquidity',\n outputs: [\n {\n name: 'accountLiquidities',\n internalType: 'LeftRightUnsigned',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'poolKey', internalType: 'bytes', type: 'bytes' },\n { name: 'owner', internalType: 'address', type: 'address' },\n { name: 'tokenType', internalType: 'uint256', type: 'uint256' },\n { name: 'tickLower', internalType: 'int24', type: 'int24' },\n { name: 'tickUpper', internalType: 'int24', type: 'int24' },\n { name: 'atTick', internalType: 'int24', type: 'int24' },\n { name: 'isLong', internalType: 'uint256', type: 'uint256' },\n { name: 'vegoid', internalType: 'uint256', type: 'uint256' },\n ],\n name: 'getAccountPremium',\n outputs: [\n { name: '', internalType: 'uint128', type: 'uint128' },\n { name: '', internalType: 'uint128', type: 'uint128' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'poolKey', internalType: 'bytes', type: 'bytes' }],\n name: 'getCurrentTick',\n outputs: [{ name: 'currentTick', internalType: 'int24', type: 'int24' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'poolId', internalType: 'uint64', type: 'uint64' }],\n name: 'getEnforcedTickLimits',\n outputs: [\n { name: '', internalType: 'int24', type: 'int24' },\n { name: '', internalType: 'int24', type: 'int24' },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'id', internalType: 'bytes', type: 'bytes' },\n { name: 'vegoid', internalType: 'uint8', type: 'uint8' },\n ],\n name: 'getPoolId',\n outputs: [{ name: '', internalType: 'uint64', type: 'uint64' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [{ name: 'poolId', internalType: 'uint64', type: 'uint64' }],\n name: 'getUniswapV4PoolKeyFromId',\n outputs: [\n {\n name: '',\n internalType: 'struct PoolKey',\n type: 'tuple',\n components: [\n { name: 'currency0', internalType: 'Currency', type: 'address' },\n { name: 'currency1', internalType: 'Currency', type: 'address' },\n { name: 'fee', internalType: 'uint24', type: 'uint24' },\n { name: 'tickSpacing', internalType: 'int24', type: 'int24' },\n { name: 'hooks', internalType: 'contract IHooks', type: 'address' },\n ],\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n {\n name: 'key',\n internalType: 'struct PoolKey',\n type: 'tuple',\n components: [\n { name: 'currency0', internalType: 'Currency', type: 'address' },\n { name: 'currency1', internalType: 'Currency', type: 'address' },\n { name: 'fee', internalType: 'uint24', type: 'uint24' },\n { name: 'tickSpacing', internalType: 'int24', type: 'int24' },\n { name: 'hooks', internalType: 'contract IHooks', type: 'address' },\n ],\n },\n { name: 'vegoid', internalType: 'uint8', type: 'uint8' },\n ],\n name: 'initializeAMMPool',\n outputs: [{ name: 'poolId', internalType: 'uint64', type: 'uint64' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [\n { name: 'owner', internalType: 'address', type: 'address' },\n { name: 'operator', internalType: 'address', type: 'address' },\n ],\n name: 'isApprovedForAll',\n outputs: [{ name: 'approvedForAll', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: 'poolKey', internalType: 'bytes', type: 'bytes' },\n { name: 'tokenId', internalType: 'TokenId', type: 'uint256' },\n { name: 'positionSize', internalType: 'uint128', type: 'uint128' },\n { name: 'tickLimitLow', internalType: 'int24', type: 'int24' },\n { name: 'tickLimitHigh', internalType: 'int24', type: 'int24' },\n ],\n name: 'mintTokenizedPosition',\n outputs: [\n { name: '', internalType: 'LeftRightUnsigned[4]', type: 'uint256[4]' },\n { name: '', internalType: 'LeftRightSigned', type: 'int256' },\n { name: '', internalType: 'int24', type: 'int24' },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'data', internalType: 'bytes[]', type: 'bytes[]' }],\n name: 'multicall',\n outputs: [{ name: 'results', internalType: 'bytes[]', type: 'bytes[]' }],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n inputs: [],\n name: 'reentrancyGuardEntered',\n outputs: [{ name: 'entered', internalType: 'bool', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n inputs: [\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'uint256[]', type: 'uint256[]' },\n { name: '', internalType: 'uint256[]', type: 'uint256[]' },\n { name: '', internalType: 'bytes', type: 'bytes' },\n ],\n name: 'safeBatchTransferFrom',\n outputs: [],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'address', type: 'address' },\n { name: '', internalType: 'uint256', type: 'uint256' },\n { name: '', internalType: 'uint256', type: 'uint256' },\n { name: '', internalType: 'bytes', type: 'bytes' },\n ],\n name: 'safeTransferFrom',\n outputs: [],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [\n { name: 'operator', internalType: 'address', type: 'address' },\n { name: 'approved', internalType: 'bool', type: 'bool' },\n ],\n name: 'setApprovalForAll',\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n inputs: [{ name: 'interfaceId', internalType: 'bytes4', type: 'bytes4' }],\n name: 'supportsInterface',\n outputs: [{ name: '', internalType: 'bool', type: 'bool' }],\n stateMutability: 'pure',\n },\n {\n type: 'function',\n inputs: [{ name: 'data', internalType: 'bytes', type: 'bytes' }],\n name: 'unlockCallback',\n outputs: [{ name: '', internalType: 'bytes', type: 'bytes' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'operator',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n { name: 'approved', internalType: 'bool', type: 'bool', indexed: false },\n ],\n name: 'ApprovalForAll',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n { name: 'idV4', internalType: 'PoolId', type: 'bytes32', indexed: true },\n {\n name: 'minEnforcedTick',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n {\n name: 'maxEnforcedTick',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n ],\n name: 'EnforcedTicksUpdated',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'poolId',\n internalType: 'PoolId',\n type: 'bytes32',\n indexed: true,\n },\n {\n name: 'owner',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'tokenType',\n internalType: 'uint256',\n type: 'uint256',\n indexed: true,\n },\n {\n name: 'tickLower',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n {\n name: 'tickUpper',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n {\n name: 'liquidityDelta',\n internalType: 'int128',\n type: 'int128',\n indexed: false,\n },\n ],\n name: 'LiquidityChunkUpdated',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n { name: 'idV4', internalType: 'PoolId', type: 'bytes32', indexed: true },\n {\n name: 'poolId',\n internalType: 'uint64',\n type: 'uint64',\n indexed: false,\n },\n {\n name: 'minEnforcedTick',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n {\n name: 'maxEnforcedTick',\n internalType: 'int24',\n type: 'int24',\n indexed: false,\n },\n ],\n name: 'PoolInitialized',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'recipient',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'tokenId',\n internalType: 'TokenId',\n type: 'uint256',\n indexed: true,\n },\n {\n name: 'positionSize',\n internalType: 'uint128',\n type: 'uint128',\n indexed: false,\n },\n ],\n name: 'TokenizedPositionBurnt',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'caller',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n {\n name: 'tokenId',\n internalType: 'TokenId',\n type: 'uint256',\n indexed: true,\n },\n {\n name: 'positionSize',\n internalType: 'uint128',\n type: 'uint128',\n indexed: false,\n },\n ],\n name: 'TokenizedPositionMinted',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'operator',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n { name: 'from', internalType: 'address', type: 'address', indexed: true },\n { name: 'to', internalType: 'address', type: 'address', indexed: true },\n {\n name: 'ids',\n internalType: 'uint256[]',\n type: 'uint256[]',\n indexed: false,\n },\n {\n name: 'amounts',\n internalType: 'uint256[]',\n type: 'uint256[]',\n indexed: false,\n },\n ],\n name: 'TransferBatch',\n },\n {\n type: 'event',\n anonymous: false,\n inputs: [\n {\n name: 'operator',\n internalType: 'address',\n type: 'address',\n indexed: true,\n },\n { name: 'from', internalType: 'address', type: 'address', indexed: true },\n { name: 'to', internalType: 'address', type: 'address', indexed: true },\n { name: 'id', internalType: 'uint256', type: 'uint256', indexed: false },\n {\n name: 'amount',\n internalType: 'uint256',\n type: 'uint256',\n indexed: false,\n },\n ],\n name: 'TransferSingle',\n },\n { type: 'error', inputs: [], name: 'ChunkHasZeroLiquidity' },\n { type: 'error', inputs: [], name: 'InvalidTick' },\n { type: 'error', inputs: [], name: 'InvalidTickBound' },\n {\n type: 'error',\n inputs: [{ name: 'parameterType', internalType: 'uint256', type: 'uint256' }],\n name: 'InvalidTokenIdParameter',\n },\n { type: 'error', inputs: [], name: 'LiquidityTooHigh' },\n { type: 'error', inputs: [], name: 'NotAuthorized' },\n { type: 'error', inputs: [], name: 'NotEnoughLiquidityInChunk' },\n { type: 'error', inputs: [], name: 'PoolNotInitialized' },\n { type: 'error', inputs: [], name: 'PositionTooLarge' },\n {\n type: 'error',\n inputs: [{ name: 'currentTick', internalType: 'int24', type: 'int24' }],\n name: 'PriceBoundFail',\n },\n { type: 'error', inputs: [], name: 'Reentrancy' },\n { type: 'error', inputs: [], name: 'UnauthorizedUniswapCallback' },\n { type: 'error', inputs: [], name: 'UnderOverFlow' },\n { type: 'error', inputs: [], name: 'UnsafeRecipient' },\n { type: 'error', inputs: [], name: 'WrongUniswapPool' },\n] as const\n","/**\n * Block metadata utilities for the Panoptic v2 SDK.\n * @module v2/clients/blockMeta\n */\n\nimport type { PublicClient } from 'viem'\n\nimport type { BlockMeta } from '../types'\n\n/**\n * Parameters for getBlockMeta.\n */\nexport interface GetBlockMetaParams {\n /** viem PublicClient */\n client: Pick<PublicClient, 'getBlock'>\n /** Optional block number (defaults to latest) */\n blockNumber?: bigint\n}\n\n/**\n * Get block metadata for a given block.\n * Used to tag all read results with same-block consistency proof.\n *\n * @param params - The parameters\n * @returns Block metadata\n */\nexport async function getBlockMeta(params: GetBlockMetaParams): Promise<BlockMeta> {\n const { client, blockNumber } = params\n\n const block = await client.getBlock({\n blockNumber,\n includeTransactions: false,\n })\n\n return {\n blockNumber: block.number,\n blockHash: block.hash,\n blockTimestamp: block.timestamp,\n }\n}\n","/**\n * Write utilities for the Panoptic v2 SDK.\n * @module v2/writes/utils\n */\n\nimport type { Abi, Address, Hash, Log, PublicClient, WalletClient } from 'viem'\nimport { decodeEventLog, encodeFunctionData } from 'viem'\n\nimport { collateralTrackerV2Abi, panopticPoolV2Abi } from '../../../generated'\nimport type { PanopticEvent, TxOverrides, TxReceipt, TxResult } from '../types'\n\n/**\n * Decode PositionBalance packed data.\n *\n * Layout (from LSB to MSB):\n * - positionSize: bits 0-127 (uint128)\n * - poolUtilization0: bits 128-143 (uint16)\n * - poolUtilization1: bits 144-159 (uint16)\n * - tickAtMint: bits 160-183 (int24)\n * - timestampAtMint: bits 184-215 (uint32)\n * - blockAtMint: bits 216-254 (uint39)\n * - swapAtMint: bit 255 (bool)\n */\nexport function decodePositionBalance(balanceData: bigint): {\n positionSize: bigint\n poolUtilization0: bigint\n poolUtilization1: bigint\n tickAtMint: bigint\n timestampAtMint: bigint\n blockAtMint: bigint\n swapAtMint: boolean\n} {\n const positionSize = balanceData & ((1n << 128n) - 1n)\n const poolUtilization0 = (balanceData >> 128n) & 0xffffn\n const poolUtilization1 = (balanceData >> 144n) & 0xffffn\n\n // tickAtMint is int24 at bits 160-183\n let tickAtMint = (balanceData >> 160n) & 0xffffffn\n // Sign extend if negative (int24)\n if (tickAtMint > 0x7fffffn) {\n tickAtMint = tickAtMint - 0x1000000n\n }\n\n // timestampAtMint is uint32 at bits 184-215\n const timestampAtMint = (balanceData >> 184n) & 0xffffffffn\n\n // blockAtMint is uint39 at bits 216-254\n const blockAtMint = (balanceData >> 216n) & ((1n << 39n) - 1n)\n\n // swapAtMint is bool at bit 255\n const swapAtMint = balanceData >> 255n === 1n\n\n return {\n positionSize,\n poolUtilization0,\n poolUtilization1,\n tickAtMint,\n timestampAtMint,\n blockAtMint,\n swapAtMint,\n }\n}\n\n/**\n * Decode LeftRightSigned packed value.\n */\nexport function decodeLeftRightSigned(value: bigint): { right: bigint; left: bigint } {\n // Right is bits 0-127 (token0), Left is bits 128-255 (token1)\n // Both are signed int128\n let right = value & ((1n << 128n) - 1n)\n let left = value >> 128n\n\n // Sign extend right if needed\n if (right >= 1n << 127n) {\n right = right - (1n << 128n)\n }\n // Sign extend left if needed\n if (left >= 1n << 127n) {\n left = left - (1n << 128n)\n }\n\n return { right, left }\n}\n\n/**\n * Decode LeftRightUnsigned packed value.\n */\nexport function decodeLeftRightUnsigned(value: bigint): { right: bigint; left: bigint } {\n // Right is bits 0-127 (token0), Left is bits 128-255 (token1)\n // Both are unsigned uint128\n const right = value & ((1n << 128n) - 1n)\n const left = value >> 128n\n\n return { right, left }\n}\n\n/**\n * Parse Panoptic events from transaction logs.\n *\n * @param logs - The transaction logs\n * @returns Parsed Panoptic events\n */\nexport function parsePanopticEvents(logs: Log[]): PanopticEvent[] {\n const events: PanopticEvent[] = []\n\n // Try to decode each log with known ABIs\n for (const log of logs) {\n const baseEvent = {\n blockNumber: log.blockNumber ?? 0n,\n blockHash: (log.blockHash ??\n '0x0000000000000000000000000000000000000000000000000000000000000000') as Hash,\n transactionHash: log.transactionHash ?? ('0x' as Hash),\n logIndex: BigInt(log.logIndex ?? 0),\n }\n\n try {\n // Try PanopticPool events\n const poolEvent = decodeEventLog({\n abi: panopticPoolV2Abi,\n data: log.data,\n topics: log.topics,\n })\n\n if (poolEvent.eventName === 'OptionMinted') {\n const args = poolEvent.args as {\n recipient: `0x${string}`\n tokenId: bigint\n balanceData: bigint\n }\n const balance = decodePositionBalance(args.balanceData)\n events.push({\n type: 'OptionMinted',\n ...baseEvent,\n recipient: args.recipient,\n tokenId: args.tokenId,\n positionSize: balance.positionSize,\n poolUtilization0: balance.poolUtilization0,\n poolUtilization1: balance.poolUtilization1,\n tickAtMint: balance.tickAtMint,\n timestampAtMint: balance.timestampAtMint,\n blockAtMint: balance.blockAtMint,\n swapAtMint: balance.swapAtMint,\n })\n } else if (poolEvent.eventName === 'OptionBurnt') {\n const args = poolEvent.args as {\n recipient: `0x${string}`\n tokenId: bigint\n positionSize: bigint\n premiaByLeg: readonly bigint[]\n }\n events.push({\n type: 'OptionBurnt',\n ...baseEvent,\n recipient: args.recipient,\n tokenId: args.tokenId,\n positionSize: args.positionSize,\n premiaByLeg: [\n args.premiaByLeg[0] ?? 0n,\n args.premiaByLeg[1] ?? 0n,\n args.premiaByLeg[2] ?? 0n,\n args.premiaByLeg[3] ?? 0n,\n ] as const,\n })\n } else if (poolEvent.eventName === 'AccountLiquidated') {\n const args = poolEvent.args as {\n liquidator: `0x${string}`\n liquidatee: `0x${string}`\n bonusAmounts: bigint\n }\n const { right, left } = decodeLeftRightSigned(args.bonusAmounts)\n events.push({\n type: 'AccountLiquidated',\n ...baseEvent,\n liquidator: args.liquidator,\n liquidatee: args.liquidatee,\n bonusAmount0: right,\n bonusAmount1: left,\n })\n } else if (poolEvent.eventName === 'ForcedExercised') {\n const args = poolEvent.args as {\n exercisor: `0x${string}`\n user: `0x${string}`\n tokenId: bigint\n exerciseFee: bigint\n }\n const { right, left } = decodeLeftRightSigned(args.exerciseFee)\n events.push({\n type: 'ForcedExercised',\n ...baseEvent,\n exercisor: args.exercisor,\n user: args.user,\n tokenId: args.tokenId,\n exerciseFee0: right,\n exerciseFee1: left,\n })\n } else if (poolEvent.eventName === 'PremiumSettled') {\n const args = poolEvent.args as {\n user: `0x${string}`\n tokenId: bigint\n legIndex: bigint\n settledAmounts: bigint\n }\n const { right, left } = decodeLeftRightSigned(args.settledAmounts)\n events.push({\n type: 'PremiumSettled',\n ...baseEvent,\n user: args.user,\n tokenId: args.tokenId,\n legIndex: args.legIndex,\n settledAmount0: right,\n settledAmount1: left,\n })\n }\n } catch {\n // Not a PanopticPool event, try CollateralTracker\n try {\n const collateralEvent = decodeEventLog({\n abi: collateralTrackerV2Abi,\n data: log.data,\n topics: log.topics,\n })\n\n if (collateralEvent.eventName === 'Deposit') {\n const args = collateralEvent.args as {\n sender: `0x${string}`\n owner: `0x${string}`\n assets: bigint\n shares: bigint\n }\n events.push({\n type: 'Deposit',\n ...baseEvent,\n sender: args.sender,\n owner: args.owner,\n assets: args.assets,\n shares: args.shares,\n })\n } else if (collateralEvent.eventName === 'Withdraw') {\n const args = collateralEvent.args as {\n sender: `0x${string}`\n receiver: `0x${string}`\n owner: `0x${string}`\n assets: bigint\n shares: bigint\n }\n events.push({\n type: 'Withdraw',\n ...baseEvent,\n sender: args.sender,\n receiver: args.receiver,\n owner: args.owner,\n assets: args.assets,\n shares: args.shares,\n })\n }\n } catch {\n // Unknown event, skip\n }\n }\n }\n\n return events\n}\n\n/**\n * Create a TxResult from a transaction hash.\n *\n * @param client - The public client\n * @param hash - The transaction hash\n * @returns TxResult with wait function\n */\nexport function createTxResult(client: PublicClient, hash: Hash): TxResult {\n return {\n hash,\n wait: async (confirmations?: bigint): Promise<TxReceipt> => {\n const receipt = await client.waitForTransactionReceipt({\n hash,\n confirmations: confirmations !== undefined ? Number(confirmations) : undefined,\n })\n\n const events = parsePanopticEvents(receipt.logs)\n\n return {\n hash: receipt.transactionHash,\n blockNumber: receipt.blockNumber,\n blockHash: receipt.blockHash,\n gasUsed: receipt.gasUsed,\n status: receipt.status === 'success' ? 'success' : 'reverted',\n events,\n }\n },\n }\n}\n\n/**\n * Execute a write operation and return TxResult.\n *\n * @param client - The public client\n * @param hashPromise - Promise that resolves to transaction hash\n * @returns TxResult\n */\nexport async function executeWrite(\n client: PublicClient,\n hashPromise: Promise<Hash>,\n): Promise<TxResult> {\n const hash = await hashPromise\n return createTxResult(client, hash)\n}\n\n/**\n * Execute a write operation and wait for receipt.\n *\n * @param client - The public client\n * @param hashPromise - Promise that resolves to transaction hash\n * @param confirmations - Number of confirmations to wait for\n * @returns TxReceipt\n */\nexport async function executeWriteAndWait(\n client: PublicClient,\n hashPromise: Promise<Hash>,\n confirmations?: bigint,\n): Promise<TxReceipt> {\n const result = await executeWrite(client, hashPromise)\n return result.wait(confirmations)\n}\n\n/**\n * Parameters for the submitWrite helper.\n */\nexport interface SubmitWriteParams {\n /** Public client */\n client: PublicClient\n /** Wallet client */\n walletClient: WalletClient\n /** Account address */\n account: Address\n /** Contract address */\n address: Address\n /** Contract ABI */\n abi: Abi\n /** Function name to call */\n functionName: string\n /** Function arguments */\n args: readonly unknown[]\n /** ETH value to send with the transaction (for native ETH deposits) */\n value?: bigint\n /** Optional gas and transaction overrides */\n txOverrides?: TxOverrides\n}\n\n/**\n * Submit a write operation, supporting both direct wallet submission\n * and custom broadcaster paths with gas overrides.\n *\n * Normal path (no broadcaster): calls walletClient.writeContract() with gas overrides.\n * Broadcaster path: prepareTransactionRequest → apply overrides → signTransaction → broadcast.\n *\n * @param params - Submit write parameters\n * @returns TxResult\n */\nexport async function submitWrite(params: SubmitWriteParams): Promise<TxResult> {\n const { client, walletClient, account, address, abi, functionName, args, value, txOverrides } =\n params\n\n const broadcaster = txOverrides?.broadcaster\n\n if (broadcaster) {\n // Encode contract calldata before request preparation so gas/tx params\n // are derived from the exact call being signed and broadcast.\n const data = encodeFunctionData({ abi, functionName, args })\n\n // Broadcaster path: prepare → sign → broadcast\n const broadcastAccount = walletClient.account ?? account\n const request = await walletClient.prepareTransactionRequest({\n account: broadcastAccount,\n to: address,\n chain: walletClient.chain,\n data,\n ...(value !== undefined && { value }),\n ...(txOverrides?.maxFeePerGas !== undefined && { maxFeePerGas: txOverrides.maxFeePerGas }),\n ...(txOverrides?.maxPriorityFeePerGas !== undefined && {\n maxPriorityFeePerGas: txOverrides.maxPriorityFeePerGas,\n }),\n ...(txOverrides?.gas !== undefined && { gas: txOverrides.gas }),\n ...(txOverrides?.nonce !== undefined && { nonce: Number(txOverrides.nonce) }),\n })\n\n const signedTx = await walletClient.signTransaction({\n ...request,\n account: broadcastAccount,\n } as unknown as Parameters<WalletClient['signTransaction']>[0])\n\n const hash = await broadcaster.broadcast(signedTx)\n return createTxResult(client, hash)\n }\n\n // Normal path: direct writeContract with gas overrides\n const gasOverrides: Record<string, unknown> = {}\n if (txOverrides?.maxFeePerGas !== undefined) {\n gasOverrides.maxFeePerGas = txOverrides.maxFeePerGas\n }\n if (txOverrides?.maxPriorityFeePerGas !== undefined) {\n gasOverrides.maxPriorityFeePerGas = txOverrides.maxPriorityFeePerGas\n }\n if (txOverrides?.nonce !== undefined) {\n gasOverrides.nonce = Number(txOverrides.nonce)\n }\n\n // Use the walletClient's local account (if available) for local signing.\n // Passing a string address triggers eth_sendTransaction (remote signing),\n // which fails with hosted RPC providers like Alchemy/Infura.\n const resolvedAccount = walletClient.account ?? account\n\n // If no explicit gas override, estimate with a 20% buffer.\n // Panoptic dispatch calls are gas-heavy and viem's default estimate can be tight.\n if (txOverrides?.gas !== undefined) {\n gasOverrides.gas = txOverrides.gas\n } else {\n const estimated = await client.estimateContractGas({\n address,\n abi,\n functionName,\n args,\n account: resolvedAccount,\n ...(value !== undefined && { value }),\n } as Parameters<typeof client.estimateContractGas>[0])\n gasOverrides.gas = (estimated * 120n) / 100n\n }\n\n const hash = await walletClient.writeContract({\n address,\n abi,\n functionName,\n args,\n account: resolvedAccount,\n chain: walletClient.chain,\n ...(value !== undefined && { value }),\n ...gasOverrides,\n })\n\n return createTxResult(client, hash)\n}\n\n/**\n * Parameters required for all write operations.\n */\nexport interface BaseWriteParams {\n /** Public client for reading state */\n client: PublicClient\n}\n","/**\n * Base error class for the Panoptic v2 SDK.\n * @module v2/errors/base\n */\n\n/**\n * Base error class for all Panoptic SDK errors.\n * All errors thrown by the SDK extend this class.\n *\n * @example\n * ```typescript\n * try {\n * await openPosition(config, params)\n * } catch (error) {\n * if (error instanceof PanopticError) {\n * console.log('Panoptic error:', error.name, error.message)\n * console.log('Original cause:', error.cause)\n * }\n * }\n * ```\n */\nexport class PanopticError extends Error {\n override readonly name: string = 'PanopticError'\n\n /** The Solidity error name (e.g. 'PriceBoundFail', 'InputListFail'). Set by the parser. */\n errorName?: string\n\n /**\n * Creates a new PanopticError.\n *\n * @param message - Human-readable error message\n * @param cause - Optional underlying error that caused this error\n */\n constructor(\n message: string,\n public readonly cause?: Error,\n ) {\n super(message)\n\n // Maintains proper stack trace for where error was thrown (V8 only)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor)\n }\n\n // Ensure prototype chain is correctly set up\n Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n","/**\n * Contract errors from Errors.sol mapped to TypeScript classes.\n * @module v2/errors/contract\n */\n\nimport type { Address } from 'viem'\n\nimport { PanopticError } from './base'\n\n// ─────────────────────────────────────────────────────────────\n// Solvency & Margin Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * The account is not solvent enough to perform the desired action.\n * @see Errors.sol:9\n */\nexport class AccountInsolventError extends PanopticError {\n override readonly name = 'AccountInsolventError'\n\n constructor(\n public readonly solvent: bigint,\n public readonly numberOfTicks: bigint,\n cause?: Error,\n ) {\n super(`Account insolvent: solvent=${solvent}, numberOfTicks=${numberOfTicks}`, cause)\n }\n}\n\n/**\n * Position is still solvent and cannot be liquidated.\n * @see Errors.sol:84\n */\nexport class NotMarginCalledError extends PanopticError {\n override readonly name = 'NotMarginCalledError'\n\n constructor(cause?: Error) {\n super('Position is still solvent and cannot be liquidated', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Token & Collateral Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * The user does not own enough assets to open/close a position.\n * @see Errors.sol:78\n */\nexport class NotEnoughTokensError extends PanopticError {\n override readonly name = 'NotEnoughTokensError'\n\n constructor(\n public readonly tokenAddress: Address,\n public readonly assetsRequested: bigint,\n public readonly assetBalance: bigint,\n cause?: Error,\n ) {\n super(\n `Not enough tokens: requested=${assetsRequested}, balance=${assetBalance}, token=${tokenAddress}`,\n cause,\n )\n }\n}\n\n/**\n * There is not enough available liquidity in the chunk for a long leg.\n * @see Errors.sol:75\n */\nexport class NotEnoughLiquidityInChunkError extends PanopticError {\n override readonly name = 'NotEnoughLiquidityInChunkError'\n\n constructor(cause?: Error) {\n super('Not enough liquidity in chunk for long leg creation or short leg closure', cause)\n }\n}\n\n/**\n * There is not enough available liquidity to fulfill a credit.\n * @see Errors.sol:47\n */\nexport class InsufficientCreditLiquidityError extends PanopticError {\n override readonly name = 'InsufficientCreditLiquidityError'\n\n constructor(cause?: Error) {\n super('Insufficient credit liquidity available in the PanopticPool', cause)\n }\n}\n\n/**\n * The amount deposited is larger than the maximum permitted.\n * @see Errors.sol:25\n */\nexport class DepositTooLargeError extends PanopticError {\n override readonly name = 'DepositTooLargeError'\n\n constructor(cause?: Error) {\n super('Deposit amount exceeds maximum permitted', cause)\n }\n}\n\n/**\n * Attempted to withdraw/redeem less than a single asset.\n * @see Errors.sol:16\n */\nexport class BelowMinimumRedemptionError extends PanopticError {\n override readonly name = 'BelowMinimumRedemptionError'\n\n constructor(cause?: Error) {\n super('Redemption amount below minimum threshold', cause)\n }\n}\n\n/**\n * Attempted to withdraw/redeem more than available.\n * @see Errors.sol:35\n */\nexport class ExceedsMaximumRedemptionError extends PanopticError {\n override readonly name = 'ExceedsMaximumRedemptionError'\n\n constructor(cause?: Error) {\n super('Redemption exceeds maximum available (liquidity, shares, or open positions)', cause)\n }\n}\n\n/**\n * Mints/burns of a position returns no collateral requirement.\n * @see Errors.sol:141\n */\nexport class ZeroCollateralRequirementError extends PanopticError {\n override readonly name = 'ZeroCollateralRequirementError'\n\n constructor(cause?: Error) {\n super('Position mint/burn returned zero collateral requirement', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Position & TokenId Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * The TokenId provided is malformed or invalid.\n * @see Errors.sol:54\n */\nexport class InvalidTokenIdParameterError extends PanopticError {\n override readonly name = 'InvalidTokenIdParameterError'\n\n /**\n * Parameter type meanings:\n * 0=poolId, 1=ratio, 2=tokenType, 3=riskPartner, 4=strike, 5=width, 6=duplicateChunk\n */\n constructor(\n public readonly parameterType: bigint,\n cause?: Error,\n ) {\n const paramNames = [\n 'poolId',\n 'ratio',\n 'tokenType',\n 'riskPartner',\n 'strike',\n 'width',\n 'duplicateChunk',\n ]\n const paramName = paramNames[Number(parameterType)] ?? `unknown(${parameterType})`\n super(`Invalid TokenId parameter: ${paramName}`, cause)\n }\n}\n\n/**\n * Position is not owned by the user and has positionSize=0.\n * @see Errors.sol:96\n */\nexport class PositionNotOwnedError extends PanopticError {\n override readonly name = 'PositionNotOwnedError'\n\n constructor(cause?: Error) {\n super('Position is not owned by the user', cause)\n }\n}\n\n/**\n * The maximum token deltas for a position exceed limits.\n * @see Errors.sol:99\n */\nexport class PositionTooLargeError extends PanopticError {\n override readonly name = 'PositionTooLargeError'\n\n constructor(cause?: Error) {\n super('Position size exceeds maximum allowed token deltas', cause)\n }\n}\n\n/**\n * User has open positions, so they cannot transfer collateral shares.\n * @see Errors.sol:93\n */\nexport class PositionCountNotZeroError extends PanopticError {\n override readonly name = 'PositionCountNotZeroError'\n\n constructor(cause?: Error) {\n super('Cannot transfer collateral shares while positions are open', cause)\n }\n}\n\n/**\n * The list of provided TokenIds has a duplicate entry.\n * @see Errors.sol:28\n */\nexport class DuplicateTokenIdError extends PanopticError {\n override readonly name = 'DuplicateTokenIdError'\n\n constructor(cause?: Error) {\n super('Duplicate TokenId in provided list', cause)\n }\n}\n\n/**\n * The supplied tokenId has no valid legs.\n * @see Errors.sol:144\n */\nexport class TokenIdHasZeroLegsError extends PanopticError {\n override readonly name = 'TokenIdHasZeroLegsError'\n\n constructor(cause?: Error) {\n super('TokenId has no valid legs', cause)\n }\n}\n\n/**\n * Position would exceed maximum legs open for account.\n * @see Errors.sol:112\n */\nexport class TooManyLegsOpenError extends PanopticError {\n override readonly name = 'TooManyLegsOpenError'\n\n constructor(cause?: Error) {\n super('Position would exceed maximum allowed legs open', cause)\n }\n}\n\n/**\n * The provided list of option positions is incorrect or invalid.\n * @see Errors.sol:38\n */\nexport class InputListFailError extends PanopticError {\n override readonly name = 'InputListFailError'\n\n constructor(cause?: Error) {\n super('Invalid position list provided', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Tick & Price Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * Tick is not between MIN_TICK and MAX_TICK.\n * @see Errors.sol:41\n */\nexport class InvalidTickError extends PanopticError {\n override readonly name = 'InvalidTickError'\n\n constructor(cause?: Error) {\n super('Tick is outside valid range (MIN_TICK to MAX_TICK)', cause)\n }\n}\n\n/**\n * The tick range is invalid (not initializable or exceeds bounds).\n * @see Errors.sol:120\n */\nexport class InvalidTickBoundError extends PanopticError {\n override readonly name = 'InvalidTickBoundError'\n\n constructor(cause?: Error) {\n super(\n 'Tick range is invalid (not initializable multiples of tickSpacing or exceeds bounds)',\n cause,\n )\n }\n}\n\n/**\n * The current tick has fallen outside the slippage range.\n * @see Errors.sol:102\n */\nexport class PriceBoundFailError extends PanopticError {\n override readonly name = 'PriceBoundFailError'\n\n constructor(\n public readonly currentTick: bigint,\n cause?: Error,\n ) {\n super(`Price moved outside slippage bounds (currentTick=${currentTick})`, cause)\n }\n}\n\n/**\n * The price impact of the trade is too large.\n * @see Errors.sol:105\n */\nexport class PriceImpactTooLargeError extends PanopticError {\n override readonly name = 'PriceImpactTooLargeError'\n\n constructor(cause?: Error) {\n super('Price impact of trade exceeds maximum allowed', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Liquidity Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * Mints/burns of zero-liquidity chunks are not supported.\n * @see Errors.sol:19\n */\nexport class ChunkHasZeroLiquidityError extends PanopticError {\n override readonly name = 'ChunkHasZeroLiquidityError'\n\n constructor(cause?: Error) {\n super('Cannot mint/burn chunk with zero liquidity', cause)\n }\n}\n\n/**\n * Liquidity in a chunk is above 2^128.\n * @see Errors.sol:44\n */\nexport class LiquidityTooHighError extends PanopticError {\n override readonly name = 'LiquidityTooHighError'\n\n constructor(cause?: Error) {\n super('Liquidity exceeds maximum (2^128)', cause)\n }\n}\n\n/**\n * Net liquidity is zero due to small positions.\n * @see Errors.sol:63\n */\nexport class NetLiquidityZeroError extends PanopticError {\n override readonly name = 'NetLiquidityZeroError'\n\n constructor(cause?: Error) {\n super('Net liquidity is zero, cannot compute liquidity spread', cause)\n }\n}\n\n/**\n * Effective liquidity above threshold during long mint or short burn.\n * @see Errors.sol:32\n */\nexport class EffectiveLiquidityAboveThresholdError extends PanopticError {\n override readonly name = 'EffectiveLiquidityAboveThresholdError'\n\n constructor(cause?: Error) {\n super('Effective liquidity above spread threshold', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Oracle & Safe Mode Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * An oracle price is too far from another or the current tick.\n * @see Errors.sol:109\n */\nexport class StaleOracleError extends PanopticError {\n override readonly name = 'StaleOracleError'\n\n constructor(cause?: Error) {\n super('Oracle price deviation too high (potential manipulation safeguard)', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Exercise Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * None of the legs in a position are force-exercisable.\n * @see Errors.sol:66\n */\nexport class NoLegsExercisableError extends PanopticError {\n override readonly name = 'NoLegsExercisableError'\n\n constructor(cause?: Error) {\n super('No legs are force-exercisable (all are short or ATM long)', cause)\n }\n}\n\n/**\n * The leg is not long, so premium cannot be settled.\n * @see Errors.sol:69\n */\nexport class NotALongLegError extends PanopticError {\n override readonly name = 'NotALongLegError'\n\n constructor(cause?: Error) {\n super('Cannot settle premium for non-long leg', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Pool & Initialization Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * The Uniswap Pool has not been created.\n * @see Errors.sol:90\n */\nexport class PoolNotInitializedError extends PanopticError {\n override readonly name = 'PoolNotInitializedError'\n\n constructor(cause?: Error) {\n super('Uniswap pool not initialized', cause)\n }\n}\n\n/**\n * Smart contract has already been initialized.\n * @see Errors.sol:22\n */\nexport class AlreadyInitializedError extends PanopticError {\n override readonly name = 'AlreadyInitializedError'\n\n constructor(cause?: Error) {\n super('Contract already initialized', cause)\n }\n}\n\n/**\n * The supplied poolId does not match the poolId for that Uniswap Pool.\n * @see Errors.sol:132\n */\nexport class WrongPoolIdError extends PanopticError {\n override readonly name = 'WrongPoolIdError'\n\n constructor(cause?: Error) {\n super('Pool ID mismatch', cause)\n }\n}\n\n/**\n * The poolId's don't match (SFPM).\n * @see Errors.sol:135\n */\nexport class WrongUniswapPoolError extends PanopticError {\n override readonly name = 'WrongUniswapPoolError'\n\n constructor(cause?: Error) {\n super('Uniswap pool mismatch', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Authorization Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * The caller is not the Panoptic Pool.\n * @see Errors.sol:87\n */\nexport class NotPanopticPoolError extends PanopticError {\n override readonly name = 'NotPanopticPoolError'\n\n constructor(cause?: Error) {\n super('Caller is not the Panoptic Pool', cause)\n }\n}\n\n/**\n * Can only be called by the guardian.\n * @see Errors.sol:81\n */\nexport class NotGuardianError extends PanopticError {\n override readonly name = 'NotGuardianError'\n\n constructor(cause?: Error) {\n super('Caller is not the guardian', cause)\n }\n}\n\n/**\n * Can only be called by the Builder.\n * @see Errors.sol:72\n */\nexport class NotBuilderError extends PanopticError {\n override readonly name = 'NotBuilderError'\n\n constructor(cause?: Error) {\n super('Caller is not the builder', cause)\n }\n}\n\n/**\n * Invalid builder code.\n * @see Errors.sol:50\n */\nexport class InvalidBuilderCodeError extends PanopticError {\n override readonly name = 'InvalidBuilderCodeError'\n\n constructor(cause?: Error) {\n super('Invalid builder code', cause)\n }\n}\n\n/**\n * Mint or swap callback from invalid address.\n * @see Errors.sol:57\n */\nexport class InvalidUniswapCallbackError extends PanopticError {\n override readonly name = 'InvalidUniswapCallbackError'\n\n constructor(cause?: Error) {\n super('Invalid Uniswap callback (address mismatch)', cause)\n }\n}\n\n/**\n * Unlock callback from non-canonical pool manager.\n * @see Errors.sol:123\n */\nexport class UnauthorizedUniswapCallbackError extends PanopticError {\n override readonly name = 'UnauthorizedUniswapCallbackError'\n\n constructor(cause?: Error) {\n super('Unauthorized Uniswap V4 callback', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Transfer & Casting Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * ERC20 or SFPM (ERC1155) token transfer did not complete successfully.\n * @see Errors.sol:115\n */\nexport class TransferFailedError extends PanopticError {\n override readonly name = 'TransferFailedError'\n\n constructor(\n public readonly token: Address,\n public readonly from: Address,\n public readonly amount: bigint,\n public readonly balance: bigint,\n cause?: Error,\n ) {\n super(\n `Transfer failed: token=${token}, from=${from}, amount=${amount}, balance=${balance}`,\n cause,\n )\n }\n}\n\n/**\n * Casting error (e.g., uint128(uint256(a)) fails).\n * @see Errors.sol:13\n */\nexport class CastingError extends PanopticError {\n override readonly name = 'CastingError'\n\n constructor(cause?: Error) {\n super('Numeric casting overflow', cause)\n }\n}\n\n/**\n * Underflow or overflow in library operation.\n * @see Errors.sol:126\n */\nexport class UnderOverFlowError extends PanopticError {\n override readonly name = 'UnderOverFlowError'\n\n constructor(cause?: Error) {\n super('Arithmetic underflow or overflow', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Reentrancy Error\n// ─────────────────────────────────────────────────────────────\n\n/**\n * Reentrancy check triggered.\n * @see Errors.sol:129\n */\nexport class ReentrancyError extends PanopticError {\n override readonly name = 'ReentrancyError'\n\n constructor(cause?: Error) {\n super('Reentrancy detected', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Factory Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * Pool deployment via CREATE2 failed.\n */\nexport class CreateFailError extends PanopticError {\n override readonly name = 'CreateFailError'\n\n constructor(cause?: Error) {\n super('Pool deployment failed (CREATE2)', cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Other Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * Zero address was supplied as a parameter.\n * @see Errors.sol:138\n */\nexport class ZeroAddressError extends PanopticError {\n override readonly name = 'ZeroAddressError'\n\n constructor(cause?: Error) {\n super('Zero address supplied', cause)\n }\n}\n\n/**\n * Length mismatch between positionIdList and positionBalanceArray.\n * @see Errors.sol:60\n */\nexport class LengthMismatchError extends PanopticError {\n override readonly name = 'LengthMismatchError'\n\n constructor(cause?: Error) {\n super('Array length mismatch', cause)\n }\n}\n","/**\n * SDK-specific errors not derived from contract Errors.sol.\n * @module v2/errors/sdk\n */\n\nimport type { Address } from 'viem'\n\nimport type { BatchDiagnostic } from '../batch/types'\nimport type { SafeMode } from '../types/oracle'\nimport type { PoolHealthStatus } from '../types/pool'\nimport { PanopticError } from './base'\n\n// ─────────────────────────────────────────────────────────────\n// Configuration & Network Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * Wallet is connected to a different network than the config expects.\n * Thrown on write operations when wallet chain !== config chain.\n */\nexport class NetworkMismatchError extends PanopticError {\n override readonly name = 'NetworkMismatchError'\n\n constructor(\n public readonly walletChainId: bigint,\n public readonly expectedChainId: bigint,\n cause?: Error,\n ) {\n super(\n `Network mismatch: wallet on chain ${walletChainId}, expected chain ${expectedChainId}`,\n cause,\n )\n }\n}\n\n/**\n * Cross-pool operation attempted (query for different pool than configured).\n */\nexport class CrossPoolError extends PanopticError {\n override readonly name = 'CrossPoolError'\n\n constructor(\n public readonly requestedPool: Address,\n public readonly configuredPool: Address,\n cause?: Error,\n ) {\n super(`Cross-pool error: requested ${requestedPool}, configured ${configuredPool}`, cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Sync & Position Tracking Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * Position sync timed out.\n */\nexport class SyncTimeoutError extends PanopticError {\n override readonly name = 'SyncTimeoutError'\n\n constructor(\n public readonly elapsedMs: bigint,\n public readonly blocksProcessed: bigint,\n public readonly blocksRemaining: bigint,\n cause?: Error,\n ) {\n super(\n `Sync timeout after ${elapsedMs}ms: processed ${blocksProcessed} blocks, ${blocksRemaining} remaining`,\n cause,\n )\n }\n}\n\n/**\n * Snapshot recovery from dispatch() calldata failed.\n */\nexport class PositionSnapshotNotFoundError extends PanopticError {\n override readonly name = 'PositionSnapshotNotFoundError'\n\n constructor(cause?: Error) {\n super('Position snapshot not found in dispatch() calldata history', cause)\n }\n}\n\n/**\n * Provider is behind the expected block number.\n * Thrown when minBlockNumber option is specified and provider is lagging.\n */\nexport class ProviderLagError extends PanopticError {\n override readonly name = 'ProviderLagError'\n\n constructor(\n public readonly providerBlock: bigint,\n public readonly expectedBlock: bigint,\n cause?: Error,\n ) {\n super(`Provider behind: at block ${providerBlock}, expected at least ${expectedBlock}`, cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Multicall Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * Multicall3 returned fewer results than the number of calls submitted.\n */\nexport class MulticallResultMissingError extends PanopticError {\n override readonly name = 'MulticallResultMissingError'\n\n constructor(\n public readonly label: string,\n public readonly index: number,\n cause?: Error,\n ) {\n super(`Missing Multicall3 result for ${label} (index ${index})`, cause)\n }\n}\n\n/**\n * Multicall3 sub-call reverted (success=false in the result tuple).\n */\nexport class MulticallResultFailedError extends PanopticError {\n override readonly name = 'MulticallResultFailedError'\n\n constructor(\n public readonly label: string,\n public readonly index: number,\n cause?: Error,\n ) {\n super(`Multicall3 result failed for ${label} (index ${index})`, cause)\n }\n}\n\n/**\n * eth_call to Multicall3 returned no data (provider-level failure).\n */\nexport class MulticallNoDataError extends PanopticError {\n override readonly name = 'MulticallNoDataError'\n\n constructor(\n public readonly functionName: string,\n cause?: Error,\n ) {\n super(`Multicall3.${functionName} returned no data`, cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Chunk Tracking Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * Exceeded the maximum number of tracked chunks (1000 per pool).\n */\nexport class ChunkLimitError extends PanopticError {\n override readonly name = 'ChunkLimitError'\n\n constructor(\n public readonly currentCount: bigint,\n public readonly attemptedAdd: bigint,\n cause?: Error,\n ) {\n super(\n `Chunk limit exceeded: ${currentCount} tracked, attempted to add ${attemptedAdd} (max 1000)`,\n cause,\n )\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Pool Health Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * Pool is in safe mode and trading is restricted.\n */\nexport class SafeModeError extends PanopticError {\n override readonly name = 'SafeModeError'\n\n constructor(\n public readonly level: SafeMode,\n public readonly reason: string,\n cause?: Error,\n ) {\n super(`Pool in safe mode (${level}): ${reason}`, cause)\n }\n}\n\n/**\n * Data is stale (too old based on block timestamp).\n */\nexport class StaleDataError extends PanopticError {\n override readonly name = 'StaleDataError'\n\n constructor(\n public readonly blockTimestamp: bigint,\n public readonly currentTimestamp: bigint,\n public readonly stalenessSeconds: bigint,\n cause?: Error,\n ) {\n super(\n `Data stale: block timestamp ${blockTimestamp}, current ${currentTimestamp}, stale by ${stalenessSeconds}s`,\n cause,\n )\n }\n}\n\n/**\n * Pool is in an unhealthy state (low liquidity or paused).\n */\nexport class UnhealthyPoolError extends PanopticError {\n override readonly name = 'UnhealthyPoolError'\n\n constructor(\n public readonly healthStatus: PoolHealthStatus,\n cause?: Error,\n ) {\n super(`Pool unhealthy: ${healthStatus}`, cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Oracle Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * Cannot poke oracle because less than 64 seconds since last update.\n */\nexport class OracleRateLimitedError extends PanopticError {\n override readonly name = 'OracleRateLimitedError'\n\n constructor(\n public readonly lastUpdate: bigint,\n public readonly currentTime: bigint,\n cause?: Error,\n ) {\n const elapsed = currentTime - lastUpdate\n super(`Oracle rate limited: last update ${elapsed}s ago, must wait 64s between updates`, cause)\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// Helper Contract Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * PanopticHelper contract is not deployed.\n * Functions requiring the helper will throw this error.\n */\nexport class PanopticHelperNotDeployedError extends PanopticError {\n override readonly name = 'PanopticHelperNotDeployedError'\n\n constructor(cause?: Error) {\n super(\n 'PanopticHelper contract not deployed. This function requires the helper contract.',\n cause,\n )\n }\n}\n\n// ─────────────────────────────────────────────────────────────\n// RPC Errors\n// ─────────────────────────────────────────────────────────────\n\n/**\n * RPC request failed after all retries.\n */\nexport class RpcError extends PanopticError {\n override readonly name = 'RpcError'\n\n constructor(\n public readonly method: string,\n public readonly retriesAttempted: bigint,\n cause?: Error,\n ) {\n super(`RPC ${method} failed after ${retriesAttempted} retries`, cause)\n }\n}\n\n/**\n * RPC returned an error response.\n */\nexport class RpcResponseError extends PanopticError {\n override readonly name = 'RpcResponseError'\n\n constructor(\n public readonly code: bigint,\n public readonly rpcMessage: string,\n cause?: Error,\n ) {\n super(`RPC error ${code}: ${rpcMessage}`, cause)\n }\n}\n\n/**\n * Thrown when required data is not found in storage.\n * This usually means syncPositions() needs to be called first.\n */\nexport class StorageDataNotFoundError extends PanopticError {\n override readonly name = 'StorageDataNotFoundError'\n\n constructor(\n public readonly dataType: 'poolMeta' | 'positions' | 'positionMeta',\n public readonly key: string,\n ) {\n super(\n `${dataType} not found in storage (key: ${key}). ` +\n 'Call syncPositions() first to populate storage.',\n )\n }\n}\n\n/**\n * Position ID list was not provided and could not be resolved from storage.\n *\n * Either pass `existingPositionIds` / `positionIdList` explicitly, or provide\n * `storage` + `chainId` so the SDK can read tracked positions automatically.\n */\nexport class MissingPositionIdsError extends PanopticError {\n override readonly name = 'MissingPositionIdsError'\n\n constructor() {\n super(\n 'Either existingPositionIds/positionIdList must be provided, or storage + chainId for auto-resolution.',\n )\n }\n}\n\n/**\n * History range parameters are invalid (e.g. startBlock > endBlock, points < 0).\n */\nexport class InvalidHistoryRangeError extends PanopticError {\n override readonly name = 'InvalidHistoryRangeError'\n}\n\n/**\n * Tick limits are invalid for the given operation.\n *\n * tickLimitLow must be <= tickLimitHigh regardless of swapAtMint.\n * The SDK handles reordering internally based on the swapAtMint flag.\n */\n/**\n * Generic validation error for public SDK functions.\n * Thrown when input parameters fail validation checks.\n */\nexport class PanopticValidationError extends PanopticError {\n override readonly name = 'PanopticValidationError'\n}\n\nexport class InvalidTickLimitsError extends PanopticError {\n override readonly name = 'InvalidTickLimitsError'\n\n constructor(\n public readonly tickLimitLow: bigint,\n public readonly tickLimitHigh: bigint,\n ) {\n super(\n `Invalid tick limits: tickLimitLow (${tickLimitLow}) must be <= tickLimitHigh (${tickLimitHigh}). ` +\n 'The SDK reorders limits based on swapAtMint — always pass them in ascending order.',\n )\n }\n}\n\n/**\n * No loan positions found for the given token.\n */\nexport class NoLoanPositionsError extends PanopticError {\n override readonly name = 'NoLoanPositionsError'\n\n constructor(public readonly token: Address) {\n super(`No loan positions found for token ${token}`)\n }\n}\n\n/**\n * All loan tokenId slots are in use — no unique tokenId could be generated.\n */\nexport class LoanSlotExhaustedError extends PanopticError {\n override readonly name = 'LoanSlotExhaustedError'\n\n constructor() {\n super('Could not build unique loan tokenId — all slots in use')\n }\n}\n\n/**\n * Maximum retry attempts exceeded for the given operation.\n */\nexport class MaxRetriesExceededError extends PanopticError {\n override readonly name = 'MaxRetriesExceededError'\n\n constructor(public readonly operation: string) {\n super(`${operation}: max retries exceeded`)\n }\n}\n\n/**\n * Batch dispatch validation failed.\n *\n * Thrown by `executeBatchDispatch` when the batch contains invalid items\n * (mint of an existing tokenId, burn of a position not held, duplicate tokenIds,\n * cross-pool ops, etc.). The `diagnostics` array carries one entry per failure.\n */\nexport class BatchValidationError extends PanopticError {\n override readonly name = 'BatchValidationError'\n\n constructor(public readonly diagnostics: BatchDiagnostic[]) {\n super(\n `Batch dispatch validation failed (${diagnostics.length} issue${diagnostics.length === 1 ? '' : 's'}): ` +\n diagnostics.map((d) => `[${d.code}] ${d.message}`).join('; '),\n )\n }\n}\n\n/**\n * Thrown when a swap token address doesn't match either token in the pool.\n */\nexport class SwapTokenMismatchError extends PanopticError {\n override readonly name = 'SwapTokenMismatchError'\n\n constructor(\n public readonly tokenAddress: Address,\n public readonly token0: Address,\n public readonly token1: Address,\n ) {\n super(\n `Token ${tokenAddress} does not match either pool token: token0=${token0}, token1=${token1}`,\n )\n }\n}\n","/**\n * Custom error ABI definitions for Panoptic v2 contracts.\n *\n * Contains all custom errors from Errors.sol with their signatures.\n * Used for decoding contract revert data.\n *\n * Selectors sourced from `forge selectors list` output.\n *\n * @module v2/errors/errorsAbi\n */\n\n/**\n * All custom errors from Panoptic Errors.sol\n *\n * Selector computation: keccak256(errorSignature)[:4]\n */\nexport const panopticErrorsAbi = [\n // AccountInsolvent(uint256 solvent, uint256 numberOfTicks) - 0xcdef092d\n {\n type: 'error',\n name: 'AccountInsolvent',\n inputs: [\n { name: 'solvent', type: 'uint256' },\n { name: 'numberOfTicks', type: 'uint256' },\n ],\n },\n\n // AlreadyInitialized() - 0x0dc149f0\n {\n type: 'error',\n name: 'AlreadyInitialized',\n inputs: [],\n },\n\n // BelowMinimumRedemption() - 0x13185bd7\n {\n type: 'error',\n name: 'BelowMinimumRedemption',\n inputs: [],\n },\n\n // CastingError() - 0xb6680045\n {\n type: 'error',\n name: 'CastingError',\n inputs: [],\n },\n\n // ChunkHasZeroLiquidity() - 0x126ae3af\n {\n type: 'error',\n name: 'ChunkHasZeroLiquidity',\n inputs: [],\n },\n\n // CreateFail() - 0xebfef188\n {\n type: 'error',\n name: 'CreateFail',\n inputs: [],\n },\n\n // DepositTooLarge() - 0xc56d46d3\n {\n type: 'error',\n name: 'DepositTooLarge',\n inputs: [],\n },\n\n // DuplicateTokenId() - 0x2bd1a05a\n {\n type: 'error',\n name: 'DuplicateTokenId',\n inputs: [],\n },\n\n // EffectiveLiquidityAboveThreshold() - 0x3a8795c2\n {\n type: 'error',\n name: 'EffectiveLiquidityAboveThreshold',\n inputs: [],\n },\n\n // ExceedsMaximumRedemption() - 0x20adf2ea\n {\n type: 'error',\n name: 'ExceedsMaximumRedemption',\n inputs: [],\n },\n\n // InputListFail() - 0x99e877ce\n {\n type: 'error',\n name: 'InputListFail',\n inputs: [],\n },\n\n // InsufficientCreditLiquidity() - 0x7a70c281\n {\n type: 'error',\n name: 'InsufficientCreditLiquidity',\n inputs: [],\n },\n\n // InvalidBuilderCode() - 0x15b3fb46\n {\n type: 'error',\n name: 'InvalidBuilderCode',\n inputs: [],\n },\n\n // InvalidTick() - 0xce8ef7fc\n {\n type: 'error',\n name: 'InvalidTick',\n inputs: [],\n },\n\n // InvalidTickBound() - 0x1577d966\n {\n type: 'error',\n name: 'InvalidTickBound',\n inputs: [],\n },\n\n // InvalidTokenIdParameter(uint256 parameterType) - 0x93db0263\n {\n type: 'error',\n name: 'InvalidTokenIdParameter',\n inputs: [{ name: 'parameterType', type: 'uint256' }],\n },\n\n // InvalidUniswapCallback() - 0x3a94c705\n {\n type: 'error',\n name: 'InvalidUniswapCallback',\n inputs: [],\n },\n\n // LengthMismatch() - 0xff633a38\n {\n type: 'error',\n name: 'LengthMismatch',\n inputs: [],\n },\n\n // LiquidityTooHigh() - 0xa500e7ea\n {\n type: 'error',\n name: 'LiquidityTooHigh',\n inputs: [],\n },\n\n // NetLiquidityZero() - 0x73582ea0\n {\n type: 'error',\n name: 'NetLiquidityZero',\n inputs: [],\n },\n\n // NoLegsExercisable() - 0x7721f7da\n {\n type: 'error',\n name: 'NoLegsExercisable',\n inputs: [],\n },\n\n // NotALongLeg() - 0xb7d44f76\n {\n type: 'error',\n name: 'NotALongLeg',\n inputs: [],\n },\n\n // NotBuilder() - 0x0404714e\n {\n type: 'error',\n name: 'NotBuilder',\n inputs: [],\n },\n\n // NotEnoughLiquidityInChunk() - 0xc56d518e\n {\n type: 'error',\n name: 'NotEnoughLiquidityInChunk',\n inputs: [],\n },\n\n // NotEnoughTokens(address tokenAddress, uint256 assetsRequested, uint256 assetBalance) - 0x71c3730b\n {\n type: 'error',\n name: 'NotEnoughTokens',\n inputs: [\n { name: 'tokenAddress', type: 'address' },\n { name: 'assetsRequested', type: 'uint256' },\n { name: 'assetBalance', type: 'uint256' },\n ],\n },\n\n // NotGuardian() - 0xef6d0f02\n {\n type: 'error',\n name: 'NotGuardian',\n inputs: [],\n },\n\n // NotMarginCalled() - 0x2a23f1ad\n {\n type: 'error',\n name: 'NotMarginCalled',\n inputs: [],\n },\n\n // NotPanopticPool() - 0x2dd1912a\n {\n type: 'error',\n name: 'NotPanopticPool',\n inputs: [],\n },\n\n // PoolNotInitialized() - 0x486aa307\n {\n type: 'error',\n name: 'PoolNotInitialized',\n inputs: [],\n },\n\n // PositionCountNotZero() - 0x2501f81e\n {\n type: 'error',\n name: 'PositionCountNotZero',\n inputs: [],\n },\n\n // PositionNotOwned() - 0x00bd51c8\n {\n type: 'error',\n name: 'PositionNotOwned',\n inputs: [],\n },\n\n // PositionTooLarge() - 0x543a6e10\n {\n type: 'error',\n name: 'PositionTooLarge',\n inputs: [],\n },\n\n // PriceBoundFail(int24 currentTick) - 0x618ea40c\n {\n type: 'error',\n name: 'PriceBoundFail',\n inputs: [{ name: 'currentTick', type: 'int24' }],\n },\n\n // PriceImpactTooLarge() - 0xcbe5b9a6\n {\n type: 'error',\n name: 'PriceImpactTooLarge',\n inputs: [],\n },\n\n // Reentrancy() - 0xab143c06\n {\n type: 'error',\n name: 'Reentrancy',\n inputs: [],\n },\n\n // StaleOracle() - 0x88cce429\n {\n type: 'error',\n name: 'StaleOracle',\n inputs: [],\n },\n\n // TokenIdHasZeroLegs() - 0x9cd92fb2\n {\n type: 'error',\n name: 'TokenIdHasZeroLegs',\n inputs: [],\n },\n\n // TooManyLegsOpen() - 0x0ed7e777\n {\n type: 'error',\n name: 'TooManyLegsOpen',\n inputs: [],\n },\n\n // TransferFailed(address token, address from, uint256 amount, uint256 balance) - 0x81f20f86\n {\n type: 'error',\n name: 'TransferFailed',\n inputs: [\n { name: 'token', type: 'address' },\n { name: 'from', type: 'address' },\n { name: 'amount', type: 'uint256' },\n { name: 'balance', type: 'uint256' },\n ],\n },\n\n // UnauthorizedUniswapCallback() - 0x3e30718a\n {\n type: 'error',\n name: 'UnauthorizedUniswapCallback',\n inputs: [],\n },\n\n // UnderOverFlow() - 0xd2190174\n {\n type: 'error',\n name: 'UnderOverFlow',\n inputs: [],\n },\n\n // WrongPoolId() - 0xcfa4bfa2\n {\n type: 'error',\n name: 'WrongPoolId',\n inputs: [],\n },\n\n // WrongUniswapPool() - 0x768778de\n {\n type: 'error',\n name: 'WrongUniswapPool',\n inputs: [],\n },\n\n // ZeroAddress() - 0xd92e233d\n {\n type: 'error',\n name: 'ZeroAddress',\n inputs: [],\n },\n\n // ZeroCollateralRequirement() - 0x5b8edb4a\n {\n type: 'error',\n name: 'ZeroCollateralRequirement',\n inputs: [],\n },\n] as const\n","/**\n * Error parsing utilities for the Panoptic v2 SDK.\n *\n * Converts raw contract errors into typed SDK error classes.\n *\n * @module v2/errors/parser\n */\n\nimport { type Abi, BaseError, decodeErrorResult, toFunctionSelector } from 'viem'\n\nimport { collateralTrackerV2Abi, panopticPoolV2Abi, riskEngineAbi } from '../../../generated'\nimport { PanopticError } from './base'\nimport {\n // Solvency & Margin\n AccountInsolventError,\n AlreadyInitializedError,\n BelowMinimumRedemptionError,\n CastingError,\n // Liquidity\n ChunkHasZeroLiquidityError,\n CreateFailError,\n DepositTooLargeError,\n DuplicateTokenIdError,\n EffectiveLiquidityAboveThresholdError,\n ExceedsMaximumRedemptionError,\n InputListFailError,\n InsufficientCreditLiquidityError,\n InvalidBuilderCodeError,\n InvalidTickBoundError,\n // Tick & Price\n InvalidTickError,\n // Position & TokenId\n InvalidTokenIdParameterError,\n InvalidUniswapCallbackError,\n LengthMismatchError,\n LiquidityTooHighError,\n NetLiquidityZeroError,\n // Exercise\n NoLegsExercisableError,\n NotALongLegError,\n NotBuilderError,\n NotEnoughLiquidityInChunkError,\n // Token & Collateral\n NotEnoughTokensError,\n NotGuardianError,\n NotMarginCalledError,\n // Authorization\n NotPanopticPoolError,\n // Pool & Initialization\n PoolNotInitializedError,\n PositionCountNotZeroError,\n PositionNotOwnedError,\n PositionTooLargeError,\n PriceBoundFailError,\n PriceImpactTooLargeError,\n // Reentrancy\n ReentrancyError,\n // Oracle & Safe Mode\n StaleOracleError,\n TokenIdHasZeroLegsError,\n TooManyLegsOpenError,\n // Transfer & Casting\n TransferFailedError,\n UnauthorizedUniswapCallbackError,\n UnderOverFlowError,\n WrongPoolIdError,\n WrongUniswapPoolError,\n // Other\n ZeroAddressError,\n ZeroCollateralRequirementError,\n} from './contract'\nimport { panopticErrorsAbi } from './errorsAbi'\n\n/**\n * Result of parsing a Panoptic error.\n */\nexport interface ParsedError {\n /** The parsed error instance */\n error: PanopticError\n /** The original error name from the contract */\n errorName: string\n /** The decoded error arguments */\n args: readonly unknown[]\n}\n\n/**\n * Combined ABI for error decoding.\n * Includes the dedicated errors ABI for complete coverage.\n */\nconst combinedAbi = [\n ...panopticPoolV2Abi,\n ...collateralTrackerV2Abi,\n ...riskEngineAbi,\n ...panopticErrorsAbi,\n] as Abi\n\n/**\n * Map of error names to error constructors.\n */\nconst errorConstructors: Record<\n string,\n (args: readonly unknown[], cause?: Error) => PanopticError\n> = {\n // Solvency & Margin\n AccountInsolvent: (args, cause) =>\n new AccountInsolventError(args[0] as bigint, args[1] as bigint, cause),\n NotMarginCalled: (_args, cause) => new NotMarginCalledError(cause),\n\n // Factory\n CreateFail: (_args, cause) => new CreateFailError(cause),\n\n // Token & Collateral\n NotEnoughTokens: (args, cause) =>\n new NotEnoughTokensError(args[0] as `0x${string}`, args[1] as bigint, args[2] as bigint, cause),\n NotEnoughLiquidityInChunk: (_args, cause) => new NotEnoughLiquidityInChunkError(cause),\n InsufficientCreditLiquidity: (_args, cause) => new InsufficientCreditLiquidityError(cause),\n DepositTooLarge: (_args, cause) => new DepositTooLargeError(cause),\n BelowMinimumRedemption: (_args, cause) => new BelowMinimumRedemptionError(cause),\n ExceedsMaximumRedemption: (_args, cause) => new ExceedsMaximumRedemptionError(cause),\n ZeroCollateralRequirement: (_args, cause) => new ZeroCollateralRequirementError(cause),\n\n // Position & TokenId\n InvalidTokenIdParameter: (args, cause) =>\n new InvalidTokenIdParameterError(args[0] as bigint, cause),\n PositionNotOwned: (_args, cause) => new PositionNotOwnedError(cause),\n PositionTooLarge: (_args, cause) => new PositionTooLargeError(cause),\n PositionCountNotZero: (_args, cause) => new PositionCountNotZeroError(cause),\n DuplicateTokenId: (_args, cause) => new DuplicateTokenIdError(cause),\n TokenIdHasZeroLegs: (_args, cause) => new TokenIdHasZeroLegsError(cause),\n TooManyLegsOpen: (_args, cause) => new TooManyLegsOpenError(cause),\n InputListFail: (_args, cause) => new InputListFailError(cause),\n\n // Tick & Price\n InvalidTick: (_args, cause) => new InvalidTickError(cause),\n InvalidTickBound: (_args, cause) => new InvalidTickBoundError(cause),\n PriceBoundFail: (args, cause) => new PriceBoundFailError(args[0] as bigint, cause),\n PriceImpactTooLarge: (_args, cause) => new PriceImpactTooLargeError(cause),\n\n // Liquidity\n ChunkHasZeroLiquidity: (_args, cause) => new ChunkHasZeroLiquidityError(cause),\n LiquidityTooHigh: (_args, cause) => new LiquidityTooHighError(cause),\n NetLiquidityZero: (_args, cause) => new NetLiquidityZeroError(cause),\n EffectiveLiquidityAboveThreshold: (_args, cause) =>\n new EffectiveLiquidityAboveThresholdError(cause),\n\n // Oracle & Safe Mode\n StaleOracle: (_args, cause) => new StaleOracleError(cause),\n\n // Exercise\n NoLegsExercisable: (_args, cause) => new NoLegsExercisableError(cause),\n NotALongLeg: (_args, cause) => new NotALongLegError(cause),\n\n // Pool & Initialization\n PoolNotInitialized: (_args, cause) => new PoolNotInitializedError(cause),\n AlreadyInitialized: (_args, cause) => new AlreadyInitializedError(cause),\n WrongPoolId: (_args, cause) => new WrongPoolIdError(cause),\n WrongUniswapPool: (_args, cause) => new WrongUniswapPoolError(cause),\n\n // Authorization\n NotPanopticPool: (_args, cause) => new NotPanopticPoolError(cause),\n NotGuardian: (_args, cause) => new NotGuardianError(cause),\n NotBuilder: (_args, cause) => new NotBuilderError(cause),\n InvalidBuilderCode: (_args, cause) => new InvalidBuilderCodeError(cause),\n InvalidUniswapCallback: (_args, cause) => new InvalidUniswapCallbackError(cause),\n UnauthorizedUniswapCallback: (_args, cause) => new UnauthorizedUniswapCallbackError(cause),\n\n // Transfer & Casting\n TransferFailed: (args, cause) =>\n new TransferFailedError(\n args[0] as `0x${string}`,\n args[1] as `0x${string}`,\n args[2] as bigint,\n args[3] as bigint,\n cause,\n ),\n CastingError: (_args, cause) => new CastingError(cause),\n UnderOverFlow: (_args, cause) => new UnderOverFlowError(cause),\n\n // Reentrancy\n Reentrancy: (_args, cause) => new ReentrancyError(cause),\n\n // Other\n ZeroAddress: (_args, cause) => new ZeroAddressError(cause),\n LengthMismatch: (_args, cause) => new LengthMismatchError(cause),\n}\n\n/**\n * Parse a raw contract error into a typed SDK error.\n *\n * This function attempts to decode the error data from a failed contract call\n * and return a typed error instance with extracted parameters.\n *\n * @param error - The raw error from a failed contract call\n * @returns Parsed error with typed error instance, or null if parsing fails\n *\n * @example\n * ```typescript\n * try {\n * await contract.openPosition(...)\n * } catch (rawError) {\n * const parsed = parsePanopticError(rawError)\n * if (parsed) {\n * console.log('Error:', parsed.errorName)\n * if (parsed.error instanceof AccountInsolventError) {\n * console.log('Solvent value:', parsed.error.solvent)\n * }\n * }\n * }\n * ```\n */\nexport function parsePanopticError(error: unknown): ParsedError | null {\n // Strategy 1: Check if viem already decoded the error (ContractFunctionRevertedError.data)\n const viemDecoded = extractViemDecodedError(error)\n if (viemDecoded) {\n return buildParsedError(viemDecoded.errorName, viemDecoded.args, error)\n }\n\n // Strategy 2: Extract raw hex data and decode ourselves\n const errorData = extractErrorData(error)\n if (!errorData) return null\n\n try {\n const decoded = decodeErrorResult({\n abi: combinedAbi,\n data: errorData,\n })\n\n return buildParsedError(decoded.errorName, decoded.args ?? [], error)\n } catch {\n // decodeErrorResult failed — possibly we only have the 4-byte selector\n // (e.g. from a multicall error message). Try matching the selector manually.\n if (errorData.length >= 10) {\n const selector = errorData.slice(0, 10) as `0x${string}`\n const match = matchSelectorToErrorName(selector)\n if (match) {\n return buildParsedError(match, [], error)\n }\n }\n return null\n }\n}\n\n/**\n * Walk the cause chain looking for a viem ContractFunctionRevertedError\n * that already has decoded `.data` (an object with `errorName` and `args`).\n * This happens when the ABI passed to simulateContract includes the error definitions.\n */\nfunction extractViemDecodedError(\n error: unknown,\n): { errorName: string; args: readonly unknown[] } | null {\n if (!error || typeof error !== 'object') return null\n\n // Use BaseError.walk if available\n if (error instanceof BaseError) {\n let found: { errorName: string; args: readonly unknown[] } | null = null\n error.walk((e) => {\n if (found) return false\n const node = e as Record<string, unknown>\n if (\n node.data &&\n typeof node.data === 'object' &&\n 'errorName' in (node.data as object) &&\n typeof (node.data as Record<string, unknown>).errorName === 'string'\n ) {\n const data = node.data as { errorName: string; args?: readonly unknown[] }\n found = { errorName: data.errorName, args: data.args ?? [] }\n return true\n }\n return false\n })\n return found\n }\n\n // Manual walk for non-viem errors\n let current: Record<string, unknown> | null = error as Record<string, unknown>\n for (let i = 0; i < 10 && current; i++) {\n if (\n current.data &&\n typeof current.data === 'object' &&\n 'errorName' in (current.data as object) &&\n typeof (current.data as Record<string, unknown>).errorName === 'string'\n ) {\n const data = current.data as { errorName: string; args?: readonly unknown[] }\n return { errorName: data.errorName, args: data.args ?? [] }\n }\n current =\n current.cause && typeof current.cause === 'object'\n ? (current.cause as Record<string, unknown>)\n : null\n }\n\n return null\n}\n\n/**\n * Build a ParsedError from a decoded error name and args.\n */\nfunction buildParsedError(\n errorName: string,\n args: readonly unknown[],\n originalError: unknown,\n): ParsedError {\n const constructor = errorConstructors[errorName]\n const cause = originalError instanceof Error ? originalError : undefined\n\n if (!constructor) {\n const unknownError = new PanopticError(`Unknown contract error: ${errorName}`)\n unknownError.errorName = errorName\n return { error: unknownError, errorName, args }\n }\n\n const typedError = constructor(args, cause)\n typedError.errorName = errorName\n return { error: typedError, errorName, args }\n}\n\n/**\n * Match a 4-byte selector against the panoptic errors ABI.\n * Used as fallback when we only have the selector (no encoded args).\n */\nfunction matchSelectorToErrorName(selector: `0x${string}`): string | null {\n for (const item of panopticErrorsAbi) {\n if (item.type !== 'error') continue\n const computed = toFunctionSelector(\n `${item.name}(${item.inputs.map((i: { type: string }) => i.type).join(',')})`,\n )\n if (computed === selector) {\n return item.name\n }\n }\n return null\n}\n\n/**\n * Extract error data from various error formats.\n *\n * Strategy:\n * 1. Use viem's BaseError.walk() to traverse the full cause chain and find\n * hex data on any node (handles arbitrary nesting depth for multicall etc.)\n * 2. Fall back to manual cause-chain walk for non-viem errors\n * 3. Last resort: extract selector from error message (loses args)\n */\nfunction extractErrorData(error: unknown): `0x${string}` | null {\n if (!error) return null\n\n // Direct hex data\n if (typeof error === 'string' && error.startsWith('0x')) {\n return error as `0x${string}`\n }\n\n if (typeof error !== 'object') return null\n\n // Strategy 1: Use viem's BaseError.walk() — traverses the full cause chain\n if (error instanceof BaseError) {\n let foundData: `0x${string}` | null = null\n\n error.walk((e) => {\n if (foundData) return false\n const node = e as Record<string, unknown>\n\n // Check .data as hex string (full revert bytes on RPC errors)\n if (node.data && typeof node.data === 'string' && node.data.startsWith('0x')) {\n foundData = node.data as `0x${string}`\n return true\n }\n\n // Check .data.data (some RPC providers nest: { data: { data: '0x...' } })\n if (node.data && typeof node.data === 'object') {\n const nested = node.data as Record<string, unknown>\n if (nested.data && typeof nested.data === 'string' && nested.data.startsWith('0x')) {\n foundData = nested.data as `0x${string}`\n return true\n }\n }\n\n return false\n })\n\n if (foundData) return foundData\n\n // Also check .signature on walked nodes (viem stores raw selector here\n // when it can't decode against the provided ABI)\n error.walk((e) => {\n if (foundData) return false\n const node = e as Record<string, unknown>\n if (node.signature && typeof node.signature === 'string' && node.signature.startsWith('0x')) {\n foundData = node.signature as `0x${string}`\n return true\n }\n return false\n })\n\n if (foundData) return foundData\n }\n\n // Strategy 2: Manual cause-chain walk for non-viem errors\n let current: Record<string, unknown> | null = error as Record<string, unknown>\n const maxDepth = 10\n for (let i = 0; i < maxDepth && current; i++) {\n if (current.data && typeof current.data === 'string' && current.data.startsWith('0x')) {\n return current.data as `0x${string}`\n }\n\n if (current.data && typeof current.data === 'object') {\n const nested = current.data as Record<string, unknown>\n if (nested.data && typeof nested.data === 'string' && nested.data.startsWith('0x')) {\n return nested.data as `0x${string}`\n }\n }\n\n if (current.error && typeof current.error === 'object') {\n const rpcError = current.error as Record<string, unknown>\n if (rpcError.data && typeof rpcError.data === 'string' && rpcError.data.startsWith('0x')) {\n return rpcError.data as `0x${string}`\n }\n }\n\n current =\n current.cause && typeof current.cause === 'object'\n ? (current.cause as Record<string, unknown>)\n : null\n }\n\n // Strategy 3: Extract from error message (last resort — may only have 4-byte selector)\n const obj = error as Record<string, unknown>\n if (obj.message && typeof obj.message === 'string') {\n const signatureMatch = obj.message.match(/signature:\\s*(0x[a-fA-F0-9]{8,})/i)\n if (signatureMatch) {\n return signatureMatch[1] as `0x${string}`\n }\n }\n\n return null\n}\n\n/**\n * Check if an error is a specific Panoptic error type.\n *\n * @param error - The error to check\n * @param errorClass - The error class to check against\n * @returns True if the error is an instance of the specified class\n *\n * @example\n * ```typescript\n * const parsed = parsePanopticError(error)\n * if (parsed && isPanopticErrorType(parsed.error, AccountInsolventError)) {\n * console.log('Account is insolvent!')\n * }\n * ```\n */\nexport function isPanopticErrorType<T extends PanopticError>(\n error: PanopticError,\n errorClass: new (...args: unknown[]) => T,\n): error is T {\n return error instanceof errorClass\n}\n","/**\n * Minimal Uniswap V4 StateView ABI for fee growth reads.\n * Only includes functions needed by streamia history.\n */\nexport const stateViewAbi = [\n {\n inputs: [{ internalType: 'PoolId', name: 'poolId', type: 'bytes32' }],\n name: 'getSlot0',\n outputs: [\n { internalType: 'uint160', name: 'sqrtPriceX96', type: 'uint160' },\n { internalType: 'int24', name: 'tick', type: 'int24' },\n { internalType: 'uint24', name: 'protocolFee', type: 'uint24' },\n { internalType: 'uint24', name: 'lpFee', type: 'uint24' },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [{ internalType: 'PoolId', name: 'poolId', type: 'bytes32' }],\n name: 'getFeeGrowthGlobals',\n outputs: [\n { internalType: 'uint256', name: 'feeGrowthGlobal0', type: 'uint256' },\n { internalType: 'uint256', name: 'feeGrowthGlobal1', type: 'uint256' },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n { internalType: 'PoolId', name: 'poolId', type: 'bytes32' },\n { internalType: 'int24', name: 'tick', type: 'int24' },\n ],\n name: 'getTickInfo',\n outputs: [\n { internalType: 'uint128', name: 'liquidityGross', type: 'uint128' },\n { internalType: 'int128', name: 'liquidityNet', type: 'int128' },\n { internalType: 'uint256', name: 'feeGrowthOutside0X128', type: 'uint256' },\n { internalType: 'uint256', name: 'feeGrowthOutside1X128', type: 'uint256' },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [{ internalType: 'PoolId', name: 'poolId', type: 'bytes32' }],\n name: 'getLiquidity',\n outputs: [{ internalType: 'uint128', name: 'liquidity', type: 'uint128' }],\n stateMutability: 'view',\n type: 'function',\n },\n] as const\n","/**\n * Minimal Uniswap V3 Pool ABI for fee growth reads.\n * Only includes functions needed by streamia history.\n */\nexport const uniswapV3PoolAbi = [\n {\n inputs: [],\n name: 'slot0',\n outputs: [\n { internalType: 'uint160', name: 'sqrtPriceX96', type: 'uint160' },\n { internalType: 'int24', name: 'tick', type: 'int24' },\n { internalType: 'uint16', name: 'observationIndex', type: 'uint16' },\n { internalType: 'uint16', name: 'observationCardinality', type: 'uint16' },\n { internalType: 'uint16', name: 'observationCardinalityNext', type: 'uint16' },\n { internalType: 'uint8', name: 'feeProtocol', type: 'uint8' },\n { internalType: 'bool', name: 'unlocked', type: 'bool' },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'feeGrowthGlobal0X128',\n outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'feeGrowthGlobal1X128',\n outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [{ internalType: 'int24', name: '', type: 'int24' }],\n name: 'ticks',\n outputs: [\n { internalType: 'uint128', name: 'liquidityGross', type: 'uint128' },\n { internalType: 'int128', name: 'liquidityNet', type: 'int128' },\n { internalType: 'uint256', name: 'feeGrowthOutside0X128', type: 'uint256' },\n { internalType: 'uint256', name: 'feeGrowthOutside1X128', type: 'uint256' },\n { internalType: 'int56', name: 'tickCumulativeOutside', type: 'int56' },\n { internalType: 'uint160', name: 'secondsPerLiquidityOutsideX128', type: 'uint160' },\n { internalType: 'uint32', name: 'secondsOutside', type: 'uint32' },\n { internalType: 'bool', name: 'initialized', type: 'bool' },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'liquidity',\n outputs: [{ internalType: 'uint128', name: '', type: 'uint128' }],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'fee',\n outputs: [{ internalType: 'uint24', name: '', type: 'uint24' }],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'token0',\n outputs: [{ internalType: 'address', name: '', type: 'address' }],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'token1',\n outputs: [{ internalType: 'address', name: '', type: 'address' }],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'tickSpacing',\n outputs: [{ internalType: 'int24', name: '', type: 'int24' }],\n stateMutability: 'view',\n type: 'function',\n },\n] as const\n","import { ORACLE_EPOCH_SECONDS } from './constants'\n\nconst ORACLE_EPOCH_SHIFT = 232n\nconst ORACLE_EPOCH_MASK = (1n << 24n) - 1n\nconst ORACLE_TICK_MASK = (1n << 22n) - 1n\n\nfunction decodeSigned22(value: bigint): bigint {\n const signBit = 1n << 21n\n const truncated = value & ORACLE_TICK_MASK\n return (truncated & signBit) === 0n ? truncated : truncated - (1n << 22n)\n}\n\n/** Timing decoded from an OraclePack and resolved against a specific block. */\nexport interface OracleTiming {\n /** Modulo-2^24 oracle epoch stored on-chain. */\n epoch: bigint\n /** Absolute epoch-boundary timestamp reconstructed at or before the supplied block. */\n timestamp: bigint\n}\n\n/** Fixed-width oracle state decoded from an OraclePack. */\nexport interface DecodedOraclePack {\n referenceTick: bigint\n lockMode: bigint\n spotEMA: bigint\n fastEMA: bigint\n slowEMA: bigint\n eonsEMA: bigint\n epoch: bigint\n timestamp: bigint\n}\n\n/**\n * Decode the 24-bit epoch stored at bits 232..255 of OraclePack.\n *\n * The packed timestamp is modulo 2^30 seconds and only identifies an absolute\n * Unix timestamp within the wrap window containing `blockTimestamp`. Supplying\n * the relevant block timestamp resolves it to the latest matching epoch at or\n * before that block, including across the epoch counter wraparound.\n */\nexport function decodeOracleTiming(oraclePack: bigint, blockTimestamp: bigint): OracleTiming {\n const epoch = (oraclePack >> ORACLE_EPOCH_SHIFT) & ORACLE_EPOCH_MASK\n const currentEpoch = oracleEpochAt(blockTimestamp)\n const elapsedEpochs = (currentEpoch - epoch) & ORACLE_EPOCH_MASK\n const currentEpochTimestamp = blockTimestamp - (blockTimestamp % ORACLE_EPOCH_SECONDS)\n return { epoch, timestamp: currentEpochTimestamp - elapsedEpochs * ORACLE_EPOCH_SECONDS }\n}\n\n/** Decode the fixed-width ticks and guardian state stored in OraclePack. */\nexport function decodeOraclePack(oraclePack: bigint, blockTimestamp: bigint): DecodedOraclePack {\n const timing = decodeOracleTiming(oraclePack, blockTimestamp)\n return {\n referenceTick: decodeSigned22(oraclePack >> 96n),\n lockMode: (oraclePack >> 118n) & 3n,\n spotEMA: decodeSigned22(oraclePack >> 120n),\n fastEMA: decodeSigned22(oraclePack >> 142n),\n slowEMA: decodeSigned22(oraclePack >> 164n),\n eonsEMA: decodeSigned22(oraclePack >> 186n),\n ...timing,\n }\n}\n\n/** Return the contract's modulo-2^24 64-second epoch for a block timestamp. */\nexport function oracleEpochAt(timestamp: bigint): bigint {\n return (timestamp / ORACLE_EPOCH_SECONDS) & ORACLE_EPOCH_MASK\n}\n","import { PanopticValidationError } from '../errors'\nimport type { OracleState } from '../types'\nimport { ORACLE_EPOCH_SECONDS } from './constants'\n\nconst UINT24_MASK = (1n << 24n) - 1n\n\nexport interface OracleEmaPeriods {\n spot: bigint\n fast: bigint\n slow: bigint\n eons: bigint\n}\n\nexport interface OracleRiskParameters {\n emaPeriods: OracleEmaPeriods\n maxTicksDelta: bigint\n /** Informational observation clamp; not used by SafeMode diagnosis. May be zero. */\n maxClampDelta: bigint\n}\n\nexport type OracleSafeModeCause =\n | 'externalShock'\n | 'internalDisagreement'\n | 'highDivergence'\n | 'guardianLock'\n | 'unknown'\n\nexport interface OracleSafeModeDiagnosis {\n /** Authoritative value returned by PanopticPool.isSafeMode(). */\n level: bigint\n /** Value reproduced using the known RiskEngine formula and live constants. */\n reproducedLevel: bigint\n matchesOnchain: boolean\n causes: readonly OracleSafeModeCause[]\n externalShockDelta: bigint\n internalDisagreementDelta: bigint\n highDivergenceDelta: bigint\n guardianLocked: boolean\n /** Minimum whole 64-second oracle epochs to wait after the last observation. */\n minimumPokeEpochs: bigint\n shouldPoke: boolean\n}\n\ntype DiagnosticOracleState = Pick<\n OracleState,\n 'currentTick' | 'spotEMA' | 'fastEMA' | 'slowEMA' | 'medianTick' | 'lockMode'\n>\n\nfunction absoluteDelta(left: bigint, right: bigint): bigint {\n return left >= right ? left - right : right - left\n}\n\nfunction epochsForPeriod(period: bigint): bigint {\n return (period + ORACLE_EPOCH_SECONDS - 1n) / ORACLE_EPOCH_SECONDS\n}\n\n/** Decode the four uint24 periods packed by RiskEngine.EMA_PERIODS(). */\nexport function decodeOracleRiskParameters(\n emaPeriods: bigint,\n maxTicksDelta: bigint,\n maxClampDelta: bigint,\n): OracleRiskParameters {\n const decodedPeriods = {\n spot: emaPeriods & UINT24_MASK,\n fast: (emaPeriods >> 24n) & UINT24_MASK,\n slow: (emaPeriods >> 48n) & UINT24_MASK,\n eons: (emaPeriods >> 72n) & UINT24_MASK,\n }\n if (\n decodedPeriods.spot === 0n ||\n decodedPeriods.fast === 0n ||\n decodedPeriods.slow === 0n ||\n decodedPeriods.eons === 0n ||\n maxTicksDelta <= 0n ||\n maxClampDelta < 0n\n ) {\n throw new PanopticValidationError(\n `RiskEngine returned invalid oracle parameters: EMA_PERIODS=${emaPeriods}, ` +\n `MAX_TICKS_DELTA=${maxTicksDelta}, MAX_CLAMP_DELTA=${maxClampDelta}`,\n )\n }\n return { emaPeriods: decodedPeriods, maxTicksDelta, maxClampDelta }\n}\n\n/** Explain the on-chain SafeMode level using this deployment's RiskEngine constants. */\nexport function diagnoseOracleSafeMode(\n state: DiagnosticOracleState,\n parameters: OracleRiskParameters,\n onchainLevel: bigint,\n): OracleSafeModeDiagnosis {\n const externalShockDelta = absoluteDelta(state.currentTick, state.spotEMA)\n const internalDisagreementDelta = absoluteDelta(state.spotEMA, state.fastEMA)\n const highDivergenceDelta = absoluteDelta(state.medianTick, state.slowEMA)\n const internalThreshold = parameters.maxTicksDelta / 2n\n const externalShock = externalShockDelta > parameters.maxTicksDelta\n const internalDisagreement = internalDisagreementDelta > internalThreshold\n const highDivergence = highDivergenceDelta > internalThreshold\n const guardianLocked = state.lockMode !== 0n\n\n const algorithmicLevel =\n (externalShock ? 1n : 0n) + (internalDisagreement ? 1n : 0n) + (highDivergence ? 1n : 0n)\n const reproducedLevel = algorithmicLevel + state.lockMode\n const matchesOnchain = reproducedLevel === onchainLevel\n const causes: OracleSafeModeCause[] = []\n if (matchesOnchain) {\n if (externalShock) causes.push('externalShock')\n if (internalDisagreement) causes.push('internalDisagreement')\n if (highDivergence) causes.push('highDivergence')\n } else {\n causes.push('unknown')\n }\n if (guardianLocked) causes.push('guardianLock')\n\n const candidateEpochs: bigint[] = []\n if (!matchesOnchain) candidateEpochs.push(1n)\n if (highDivergence) candidateEpochs.push(1n)\n if (externalShock) candidateEpochs.push(epochsForPeriod(parameters.emaPeriods.spot))\n if (internalDisagreement) candidateEpochs.push(epochsForPeriod(parameters.emaPeriods.fast))\n const minimumPokeEpochs = candidateEpochs.reduce(\n (minimum, epochs) => (minimum === 0n || epochs < minimum ? epochs : minimum),\n 0n,\n )\n\n return {\n level: onchainLevel,\n reproducedLevel,\n matchesOnchain,\n causes,\n externalShockDelta,\n internalDisagreementDelta,\n highDivergenceDelta,\n guardianLocked,\n minimumPokeEpochs,\n shouldPoke: onchainLevel > 0n && !guardianLocked,\n }\n}\n","/**\n * The mint-time margin buffer — the single place the SDK and every UI surface\n * turn a maintenance requirement into the figure the contract actually enforces\n * at mint.\n *\n * `RiskEngine._checkSolvencyAtTick` applies `BP_DECREASE_BUFFER / DECIMALS` to\n * the NATIVE token0 and token1 requirements, with `Math.mulDivRoundingUp`, and\n * only then compares each side against that side's balance. Three properties of\n * that sentence are load-bearing and were each wrong somewhere in the UI:\n *\n * 1. **Scale.** The ratio is `10_666_667 / 10_000_000`, not `10_666 / 10_000`.\n * The truncated form understates the requirement by ~6.3 ppm of notional.\n * 2. **Rounding.** The contract rounds UP. Flooring lets a position read as\n * affordable at exactly the boundary and then revert at mint.\n * 3. **Order.** The buffer is applied per token BEFORE any price conversion.\n * Buffering an already-quote-converted total re-rounds the conversion dust\n * through the buffer, so the two disagree by more than the ratio implies.\n *\n * @module v2/reads/mintBuffer\n */\n\nimport { PanopticValidationError } from '../errors'\nimport type { MintBufferRatio } from '../types/mintBuffer'\n\nexport type { MintBufferRatio } from '../types/mintBuffer'\n\n/**\n * `RiskEngine.BP_DECREASE_BUFFER` — the numerator of the mint-time buffer.\n *\n * Exported so callers can display the constant; prefer {@link applyMintBuffer}\n * over multiplying by it directly, which is how the rounding bug reappears.\n */\nexport const MINT_BUFFER = 10_666_667n\n\n/** `RiskEngine.DECIMALS` — the denominator {@link MINT_BUFFER} is taken over. */\nexport const MINT_BUFFER_DENOMINATOR = 10_000_000n\n\n/** The compiled-in default, matching the deployed RiskEngine. */\nexport const DEFAULT_MINT_BUFFER: MintBufferRatio = {\n numerator: MINT_BUFFER,\n denominator: MINT_BUFFER_DENOMINATOR,\n}\n\n/**\n * Apply the mint buffer to ONE token's NATIVE requirement, rounding up exactly\n * as `Math.mulDivRoundingUp` does on-chain.\n *\n * Call this on the native token0/token1 requirement, never on a quote-converted\n * total — see the module docstring for why the order matters.\n *\n * @param required - Maintenance requirement in that token's own units\n * @param buffer - Optional live on-chain ratio; defaults to {@link DEFAULT_MINT_BUFFER}\n * @returns The mint-time requirement the solvency check enforces\n */\nexport function applyMintBuffer(\n required: bigint,\n buffer: MintBufferRatio = DEFAULT_MINT_BUFFER,\n): bigint {\n const { numerator, denominator } = buffer\n if (denominator <= 0n) {\n throw new PanopticValidationError('applyMintBuffer: buffer denominator must be positive')\n }\n if (required <= 0n) return 0n\n return (required * numerator + denominator - 1n) / denominator\n}\n\n/**\n * Apply the mint buffer to both tokens' NATIVE requirements, independently.\n *\n * This is the shape the solvency check itself uses: two separate per-side\n * comparisons, never a pooled total.\n *\n * @param required0 - Maintenance requirement in token0 units\n * @param required1 - Maintenance requirement in token1 units\n * @param buffer - Optional live on-chain ratio\n * @returns `[buffered0, buffered1]`\n */\nexport function applyMintBufferPerToken(\n required0: bigint,\n required1: bigint,\n buffer: MintBufferRatio = DEFAULT_MINT_BUFFER,\n): [bigint, bigint] {\n return [applyMintBuffer(required0, buffer), applyMintBuffer(required1, buffer)]\n}\n\n/**\n * Collateral still deployable on one side before the mint solvency check fails:\n * `balance - bufferedRequired`, floored at zero.\n *\n * Both arguments must be in the SAME token's units.\n *\n * @param balance - That side's collateral balance\n * @param required - That side's maintenance requirement (unbuffered)\n * @param buffer - Optional live on-chain ratio\n * @returns Mintable headroom, never negative\n */\nexport function mintableAfterBuffer(\n balance: bigint,\n required: bigint,\n buffer: MintBufferRatio = DEFAULT_MINT_BUFFER,\n): bigint {\n const requiredAtMint = applyMintBuffer(required, buffer)\n return balance > requiredAtMint ? balance - requiredAtMint : 0n\n}\n","/**\n * Pool read functions for the Panoptic v2 SDK.\n *\n * ## Same-Block Guarantee\n *\n * All dynamic data is fetched in a SINGLE multicall to ensure block consistency.\n * Per PLAN.md §6, immutable \"static prefetch\" data (addresses, decimals, symbols)\n * can be fetched separately and cached - it's not subject to same-block consistency.\n *\n * Functions accept an optional `poolMetadata` parameter containing pre-fetched\n * immutable addresses. If not provided, it will be fetched first (static prefetch).\n * Then ONE multicall fetches all dynamic data at the target block.\n *\n * @module v2/reads/pool\n */\n\nimport type { Address, PublicClient } from 'viem'\nimport { decodeAbiParameters, keccak256, zeroAddress } from 'viem'\n\nimport { collateralTrackerV2Abi, panopticPoolV2Abi, riskEngineAbi } from '../../../generated'\nimport { stateViewAbi } from '../abis/stateView'\nimport { uniswapV3PoolAbi } from '../abis/uniswapV3Pool'\nimport { getBlockMeta } from '../clients/blockMeta'\nimport { tickToSqrtPriceX96 } from '../formatters/tick'\nimport type {\n BlockMeta,\n CollateralTracker,\n OracleState,\n Pool,\n PoolKey,\n RiskEngine,\n RiskParameters,\n Utilization,\n} from '../types'\nimport { decodeOraclePack } from '../utils/oraclePack'\nimport { type OracleRiskParameters, decodeOracleRiskParameters } from '../utils/oracleSafeMode'\nimport { DEFAULT_MINT_BUFFER } from './mintBuffer'\n\n// ERC20 minimal ABI for token metadata\nconst erc20Abi = [\n {\n type: 'function',\n name: 'symbol',\n inputs: [],\n outputs: [{ type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'decimals',\n inputs: [],\n outputs: [{ type: 'uint8' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'name',\n inputs: [],\n outputs: [{ type: 'string' }],\n stateMutability: 'view',\n },\n] as const\n\n/**\n * Immutable pool metadata that can be cached.\n * These values never change for a given pool, so they're exempt from\n * same-block consistency requirements (per PLAN.md \"Static Prefetches\" exception).\n */\nexport interface PoolMetadata {\n /** Pool key bytes */\n poolKeyBytes: `0x${string}`\n /** Pool ID */\n poolId: bigint\n /** Collateral tracker 0 address */\n collateralToken0Address: Address\n /** Collateral tracker 1 address */\n collateralToken1Address: Address\n /** Risk engine address */\n riskEngineAddress: Address\n /** Token 0 underlying asset address */\n token0Asset: Address\n /** Token 1 underlying asset address */\n token1Asset: Address\n /** Token 0 symbol */\n token0Symbol: string\n /** Token 1 symbol */\n token1Symbol: string\n /** Token 0 decimals */\n token0Decimals: bigint\n /** Token 1 decimals */\n token1Decimals: bigint\n /** Token 0 name */\n token0Name: string\n /** Token 1 name */\n token1Name: string\n /** Underlying pool ID (V3: pool address, V4: keccak256(poolKeyBytes)) */\n underlyingPoolId: string\n /** Whether this is a V4 pool (poolManager is non-zero) */\n isV4: boolean\n /** Tick spacing */\n tickSpacing: bigint\n /** Fee tier (V4: from poolKey, V3: from Uniswap pool fee()) */\n fee: bigint\n /** SemiFungiblePositionManager address */\n sfpmAddress: Address\n}\n\n/**\n * Parameters for getPoolMetadata.\n */\nexport interface GetPoolMetadataParams {\n /** viem PublicClient */\n client: PublicClient\n /** PanopticPool address */\n poolAddress: Address\n}\n\n/**\n * Fetch immutable pool metadata (addresses, symbols, decimals).\n * This data never changes for a given pool and can be cached indefinitely.\n *\n * This is the \"static prefetch\" per PLAN.md §6 - exempt from same-block consistency.\n *\n * @param params - The parameters\n * @returns Immutable pool metadata\n */\nexport async function getPoolMetadata(params: GetPoolMetadataParams): Promise<PoolMetadata> {\n const { client, poolAddress } = params\n\n // First call: get basic immutable pool data\n const basicResults = await client.multicall({\n contracts: [\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'poolKey',\n },\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'poolId',\n },\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'collateralToken0',\n },\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'collateralToken1',\n },\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'riskEngine',\n },\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'poolManager',\n },\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'SFPM',\n },\n ],\n allowFailure: false,\n })\n\n const [\n poolKeyBytes,\n poolId,\n collateralToken0Address,\n collateralToken1Address,\n riskEngineAddress,\n poolManager,\n sfpmAddress,\n ] = basicResults\n\n // Second call: get underlying asset addresses from collateral trackers\n const assetResults = await client.multicall({\n contracts: [\n {\n address: collateralToken0Address,\n abi: collateralTrackerV2Abi,\n functionName: 'asset',\n },\n {\n address: collateralToken1Address,\n abi: collateralTrackerV2Abi,\n functionName: 'asset',\n },\n ],\n allowFailure: false,\n })\n\n const [token0Asset, token1Asset] = assetResults\n\n // Native ETH (address zero) has no ERC20 contract — use hardcoded metadata\n const NATIVE_ETH_ADDRESS = '0x0000000000000000000000000000000000000000'\n const isToken0Native = token0Asset.toLowerCase() === NATIVE_ETH_ADDRESS\n const isToken1Native = token1Asset.toLowerCase() === NATIVE_ETH_ADDRESS\n\n // Third call: get token metadata (symbols, decimals, names) — skip native ETH tokens\n const erc20Contracts = [\n ...(isToken0Native\n ? []\n : [\n { address: token0Asset, abi: erc20Abi, functionName: 'symbol' as const },\n { address: token0Asset, abi: erc20Abi, functionName: 'decimals' as const },\n { address: token0Asset, abi: erc20Abi, functionName: 'name' as const },\n ]),\n ...(isToken1Native\n ? []\n : [\n { address: token1Asset, abi: erc20Abi, functionName: 'symbol' as const },\n { address: token1Asset, abi: erc20Abi, functionName: 'decimals' as const },\n { address: token1Asset, abi: erc20Abi, functionName: 'name' as const },\n ]),\n ]\n\n const erc20Results =\n erc20Contracts.length > 0\n ? await client.multicall({ contracts: erc20Contracts, allowFailure: false })\n : []\n\n // Reconstruct metadata, inserting native ETH defaults where needed\n let resultIdx = 0\n const token0Symbol = isToken0Native ? 'ETH' : (erc20Results[resultIdx++] as string)\n const token0Decimals = isToken0Native ? 18 : (erc20Results[resultIdx++] as number)\n const token0Name = isToken0Native ? 'Ether' : (erc20Results[resultIdx++] as string)\n const token1Symbol = isToken1Native ? 'ETH' : (erc20Results[resultIdx++] as string)\n const token1Decimals = isToken1Native ? 18 : (erc20Results[resultIdx++] as number)\n const token1Name = isToken1Native ? 'Ether' : (erc20Results[resultIdx++] as string)\n\n // Derive underlyingPoolId, tickSpacing, and fee\n const isV4 = poolManager !== zeroAddress\n const parsedPoolKey = parsePoolKey(poolKeyBytes)\n let underlyingPoolId: string\n let fee: bigint\n let tickSpacing: bigint\n\n if (isV4) {\n underlyingPoolId = keccak256(poolKeyBytes)\n fee = parsedPoolKey.fee\n tickSpacing = tickSpacingFromPoolId(poolId)\n } else {\n const v3PoolAddress = decodeAbiParameters([{ type: 'address' }], poolKeyBytes)[0]\n underlyingPoolId = v3PoolAddress\n const [v3Fee, v3TickSpacing] = await client.multicall({\n contracts: [\n { address: v3PoolAddress, abi: uniswapV3PoolAbi, functionName: 'fee' },\n { address: v3PoolAddress, abi: uniswapV3PoolAbi, functionName: 'tickSpacing' },\n ],\n allowFailure: false,\n })\n fee = BigInt(v3Fee)\n tickSpacing = BigInt(v3TickSpacing)\n }\n\n return {\n poolKeyBytes,\n poolId,\n collateralToken0Address,\n collateralToken1Address,\n isV4,\n riskEngineAddress,\n token0Asset,\n token1Asset,\n token0Symbol,\n token1Symbol,\n token0Decimals: BigInt(token0Decimals),\n token1Decimals: BigInt(token1Decimals),\n token0Name,\n token1Name,\n underlyingPoolId,\n tickSpacing,\n fee,\n sfpmAddress,\n }\n}\n\n/**\n * Parameters for getPool.\n */\nexport interface GetPoolParams {\n /** viem PublicClient */\n client: PublicClient\n /** PanopticPool address */\n poolAddress: Address\n /** Chain ID */\n chainId: bigint\n /** Optional block number for historical queries */\n blockNumber?: bigint\n /** Optional pre-fetched pool metadata (for caching/optimization) */\n poolMetadata?: PoolMetadata\n /** Optional StateView address for V4 pools (needed to read Uniswap pool liquidity) */\n stateViewAddress?: Address\n /** Optional pre-fetched block metadata (skips getBlockMeta RPC call) */\n _meta?: BlockMeta\n}\n\n/**\n * Get full pool data including both collateral trackers and oracle state.\n *\n * ## Same-Block Guarantee\n * All dynamic data is fetched in ONE multicall at the target block.\n * Static metadata (addresses, symbols, decimals) is either provided via\n * poolMetadata or fetched separately (static prefetch exception).\n *\n * @param params - The parameters\n * @returns Pool data with block metadata\n */\nexport async function getPool(params: GetPoolParams): Promise<Pool> {\n const { client, poolAddress, chainId, blockNumber, poolMetadata } = params\n\n const targetBlockNumber =\n blockNumber ?? params._meta?.blockNumber ?? (await client.getBlockNumber())\n\n // Get static metadata (either from cache or fetch it)\n const metadata = poolMetadata ?? (await getPoolMetadata({ client, poolAddress }))\n\n // Build Uniswap pool liquidity read (V3 vs V4)\n const liquidityContract =\n metadata.isV4 && params.stateViewAddress\n ? {\n address: params.stateViewAddress,\n abi: stateViewAbi,\n functionName: 'getLiquidity' as const,\n args: [metadata.underlyingPoolId as `0x${string}`] as const,\n }\n : !metadata.isV4\n ? {\n address: metadata.underlyingPoolId as Address,\n abi: uniswapV3PoolAbi,\n functionName: 'liquidity' as const,\n }\n : null // V4 without stateViewAddress — skip\n\n // SINGLE multicall for ALL dynamic data - ensures same-block consistency\n const [dynamicResults, _meta] = await Promise.all([\n client.multicall({\n contracts: [\n // Pool dynamic state\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'getCurrentTick',\n },\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'isSafeMode',\n },\n // Token 0 collateral tracker dynamic data\n {\n address: metadata.collateralToken0Address,\n abi: collateralTrackerV2Abi,\n functionName: 'getPoolData',\n },\n {\n address: metadata.collateralToken0Address,\n abi: collateralTrackerV2Abi,\n functionName: 'totalSupply',\n },\n {\n address: metadata.collateralToken0Address,\n abi: collateralTrackerV2Abi,\n functionName: 'interestRate',\n },\n // Token 1 collateral tracker dynamic data\n {\n address: metadata.collateralToken1Address,\n abi: collateralTrackerV2Abi,\n functionName: 'getPoolData',\n },\n {\n address: metadata.collateralToken1Address,\n abi: collateralTrackerV2Abi,\n functionName: 'totalSupply',\n },\n {\n address: metadata.collateralToken1Address,\n abi: collateralTrackerV2Abi,\n functionName: 'interestRate',\n },\n // Risk engine parameters (technically immutable but included for completeness)\n {\n address: metadata.riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'SELLER_COLLATERAL_RATIO',\n },\n {\n address: metadata.riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'MAINT_MARGIN_RATE',\n },\n {\n address: metadata.riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'NOTIONAL_FEE',\n },\n {\n address: metadata.riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'PREMIUM_FEE',\n },\n {\n address: metadata.riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'VEGOID',\n },\n {\n address: metadata.riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'MAX_SPREAD',\n },\n // Uniswap pool in-range liquidity (V3 or V4 via StateView)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...(liquidityContract ? [liquidityContract as any] : []),\n ],\n blockNumber: targetBlockNumber,\n allowFailure: true,\n }),\n params._meta ?? getBlockMeta({ client, blockNumber: targetBlockNumber }),\n ])\n\n // Extract results — first 14 are core (must succeed), last is liquidity (may fail)\n const coreResults = dynamicResults.slice(0, 14)\n if (coreResults.some((r) => r.status !== 'success')) {\n const failed = coreResults.find((r) => r.status !== 'success')\n throw new Error(`Core pool read failed: ${JSON.stringify(failed)}`)\n }\n const [\n currentTick,\n safeModeRaw,\n token0PoolData,\n token0TotalSupply,\n token0InterestRate,\n token1PoolData,\n token1TotalSupply,\n token1InterestRate,\n sellerCollateralRatio,\n maintMarginRate,\n notionalFee,\n premiumFee,\n vegoid,\n maxSpread,\n ] = coreResults.map((r) => r.result) as [\n bigint, // currentTick\n number, // safeModeRaw\n readonly [bigint, bigint, bigint, bigint], // token0PoolData (getPoolData)\n bigint, // token0TotalSupply\n bigint, // token0InterestRate\n readonly [bigint, bigint, bigint, bigint], // token1PoolData (getPoolData)\n bigint, // token1TotalSupply\n bigint, // token1InterestRate\n bigint, // sellerCollateralRatio\n bigint, // maintMarginRate\n bigint, // notionalFee\n bigint, // premiumFee\n bigint, // vegoid\n bigint, // maxSpread\n ]\n const liquidityResult = dynamicResults[14]\n const uniswapPoolLiquidity =\n liquidityResult?.status === 'success' ? BigInt(liquidityResult.result as bigint) : 0n\n\n // V3 poolKey() only contains the Uniswap pool address, so enrich the parsed\n // key with the immutable fee and tick spacing resolved by getPoolMetadata.\n const tickSpacing = metadata.tickSpacing\n const poolKey = {\n ...parsePoolKey(metadata.poolKeyBytes),\n fee: metadata.fee,\n tickSpacing,\n }\n\n // Annualize rates: interestRate() returns WAD/s, multiply by seconds/year\n const SECONDS_PER_YEAR = 31_536_000n\n const borrowRate0 = BigInt(token0InterestRate) * SECONDS_PER_YEAR\n const borrowRate1 = BigInt(token1InterestRate) * SECONDS_PER_YEAR\n const utilization0 = token0PoolData[3]\n const utilization1 = token1PoolData[3]\n // Supply rate = borrow rate * utilization (utilization is in bps, so /10000)\n const supplyRate0 = (borrowRate0 * utilization0) / 10000n\n const supplyRate1 = (borrowRate1 * utilization1) / 10000n\n const totalAssets0 = token0PoolData[0] + token0PoolData[1]\n const totalAssets1 = token1PoolData[0] + token1PoolData[1]\n\n // Build collateral trackers\n const collateralTracker0: CollateralTracker = {\n address: metadata.collateralToken0Address,\n token: metadata.token0Asset,\n symbol: metadata.token0Symbol,\n decimals: metadata.token0Decimals,\n totalAssets: totalAssets0,\n insideAMM: token0PoolData[1],\n creditedShares: token0PoolData[2],\n totalShares: token0TotalSupply,\n utilization: utilization0,\n borrowRate: borrowRate0,\n supplyRate: supplyRate0,\n }\n\n const collateralTracker1: CollateralTracker = {\n address: metadata.collateralToken1Address,\n token: metadata.token1Asset,\n symbol: metadata.token1Symbol,\n decimals: metadata.token1Decimals,\n totalAssets: totalAssets1,\n insideAMM: token1PoolData[1],\n creditedShares: token1PoolData[2],\n totalShares: token1TotalSupply,\n utilization: utilization1,\n borrowRate: borrowRate1,\n supplyRate: supplyRate1,\n }\n\n // Build risk engine\n const riskEngine: RiskEngine = {\n address: metadata.riskEngineAddress,\n collateralRequirement: sellerCollateralRatio,\n maintenanceMargin: maintMarginRate,\n commissionRate: BigInt(notionalFee),\n premiumFeeRate: BigInt(premiumFee),\n vegoid: BigInt(vegoid),\n maxSpread: BigInt(maxSpread),\n }\n\n // Determine health status based on safe mode\n const healthStatus = safeModeRaw === 0 ? 'active' : safeModeRaw === 1 ? 'low_liquidity' : 'paused'\n\n // sqrtPriceX96 from tick\n const sqrtPriceX96 = tickToSqrtPriceX96(BigInt(currentTick))\n\n return {\n address: poolAddress,\n chainId,\n poolId: metadata.poolId,\n poolKey,\n tickSpacing,\n collateralTracker0,\n collateralTracker1,\n riskEngine,\n currentTick: BigInt(currentTick),\n sqrtPriceX96,\n uniswapPoolLiquidity,\n healthStatus,\n metadata,\n _meta,\n }\n}\n\n/**\n * Parameters for getUtilization.\n */\nexport interface GetUtilizationParams {\n /** viem PublicClient */\n client: PublicClient\n /** PanopticPool address */\n poolAddress: Address\n /** Optional block number for historical queries */\n blockNumber?: bigint\n /** Optional pre-fetched collateral tracker addresses (for caching/optimization) */\n collateralAddresses?: {\n collateralToken0: Address\n collateralToken1: Address\n }\n /** Optional pre-fetched block metadata (skips getBlockMeta RPC call) */\n _meta?: BlockMeta\n}\n\n/**\n * Get current pool utilization for both tokens.\n *\n * ## Same-Block Guarantee\n * All dynamic data is fetched in ONE multicall at the target block.\n * Collateral tracker addresses are either provided or fetched separately (static prefetch).\n *\n * @param params - The parameters\n * @returns Utilization data with block metadata\n */\nexport async function getUtilization(params: GetUtilizationParams): Promise<Utilization> {\n const { client, poolAddress, blockNumber, collateralAddresses } = params\n\n const targetBlockNumber =\n blockNumber ?? params._meta?.blockNumber ?? (await client.getBlockNumber())\n\n // Get collateral tracker addresses (static prefetch if not provided)\n let collateralToken0: Address\n let collateralToken1: Address\n\n if (collateralAddresses) {\n collateralToken0 = collateralAddresses.collateralToken0\n collateralToken1 = collateralAddresses.collateralToken1\n } else {\n // Static prefetch - addresses are immutable\n const addressResults = await client.multicall({\n contracts: [\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'collateralToken0',\n },\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'collateralToken1',\n },\n ],\n allowFailure: false,\n })\n collateralToken0 = addressResults[0]\n collateralToken1 = addressResults[1]\n }\n\n // SINGLE multicall for ALL dynamic data - ensures same-block consistency\n const [poolDataResults, _meta] = await Promise.all([\n client.multicall({\n contracts: [\n {\n address: collateralToken0,\n abi: collateralTrackerV2Abi,\n functionName: 'getPoolData',\n },\n {\n address: collateralToken1,\n abi: collateralTrackerV2Abi,\n functionName: 'getPoolData',\n },\n {\n address: collateralToken0,\n abi: collateralTrackerV2Abi,\n functionName: 'totalSupply',\n },\n {\n address: collateralToken1,\n abi: collateralTrackerV2Abi,\n functionName: 'totalSupply',\n },\n ],\n blockNumber: targetBlockNumber,\n allowFailure: false,\n }),\n params._meta ?? getBlockMeta({ client, blockNumber: targetBlockNumber }),\n ])\n\n const [poolData0, poolData1, totalSupply0, totalSupply1] = poolDataResults\n\n return {\n utilization0: poolData0[3], // currentPoolUtilization\n utilization1: poolData1[3],\n availableToBorrow0: availableToBorrow(poolData0, totalSupply0),\n availableToBorrow1: availableToBorrow(poolData1, totalSupply1),\n _meta,\n }\n}\n\n/**\n * Assets available to borrow from a collateral tracker.\n *\n * Mirrors `CollateralTracker._maxWithdrawWithPositions`: deposited assets less\n * one wei, less the assets backing credited shares.\n *\n * @param poolData - `getPoolData()` tuple: [depositedAssets, insideAMM, creditedShares, utilization]\n * @param totalSupply - Collateral tracker share supply, for the share→asset conversion\n */\nfunction availableToBorrow(\n poolData: readonly [bigint, bigint, bigint, bigint],\n totalSupply: bigint,\n): bigint {\n const [depositedAssets, insideAMM, creditedShares] = poolData\n const available = depositedAssets > 0n ? depositedAssets - 1n : 0n\n if (creditedShares === 0n || totalSupply === 0n) return available\n\n const totalAssets = depositedAssets + insideAMM\n const creditedAssets = (creditedShares * totalAssets) / totalSupply\n return available > creditedAssets ? available - creditedAssets : 0n\n}\n\n/**\n * Parameters for getOracleState.\n */\nexport interface GetOracleStateParams {\n /** viem PublicClient */\n client: PublicClient\n /** PanopticPool address */\n poolAddress: Address\n /** Optional block number for historical queries */\n blockNumber?: bigint\n /** Optional pre-fetched block metadata (skips getBlockMeta RPC call) */\n _meta?: BlockMeta\n}\n\n/**\n * Get current oracle state from the pool.\n *\n * ## Same-Block Guarantee\n * Single contract call + block meta fetch at the same block.\n *\n * @param params - The parameters\n * @returns Oracle state with block metadata\n */\nexport async function getOracleState(params: GetOracleStateParams): Promise<OracleState> {\n const { client, poolAddress, blockNumber } = params\n\n const targetBlockNumber =\n blockNumber ?? params._meta?.blockNumber ?? (await client.getBlockNumber())\n\n // Read the detailed oracle state and the canonical TWAP used by downstream\n // safety checks at the same block.\n const [[oracleTicks, twapTick], _meta] = await Promise.all([\n client.multicall({\n contracts: [\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'getOracleTicks',\n },\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'getTWAP',\n },\n ],\n allowFailure: false,\n blockNumber: targetBlockNumber,\n }),\n params._meta ?? getBlockMeta({ client, blockNumber: targetBlockNumber }),\n ])\n\n // oracleTicks returns: currentTick, spotTick, medianTick, latestTick, oraclePack\n const [currentTick, spotTick, medianTick, latestTick, oraclePack] = oracleTicks\n\n const decoded = decodeOraclePack(oraclePack, _meta.blockTimestamp)\n\n return {\n epoch: decoded.epoch,\n lastUpdateTimestamp: decoded.timestamp,\n // Deprecated OracleState alias; use currentTick or oracleReferenceTick.\n referenceTick: BigInt(currentTick),\n currentTick: BigInt(currentTick),\n oracleReferenceTick: decoded.referenceTick,\n latestTick: BigInt(latestTick),\n twapTick: BigInt(twapTick),\n spotEMA: BigInt(spotTick),\n fastEMA: decoded.fastEMA,\n slowEMA: decoded.slowEMA,\n eonsEMA: decoded.eonsEMA,\n lockMode: decoded.lockMode,\n medianTick: BigInt(medianTick),\n _meta,\n }\n}\n\nexport interface GetOracleRiskParametersParams {\n client: PublicClient\n riskEngineAddress: Address\n blockNumber?: bigint\n}\n\nexport interface OracleRiskParametersState extends OracleRiskParameters {\n _meta: BlockMeta\n}\n\n/** Read the oracle constants from a specific deployed RiskEngine. */\nexport async function getOracleRiskParameters(\n params: GetOracleRiskParametersParams,\n): Promise<OracleRiskParametersState> {\n const targetBlockNumber = params.blockNumber ?? (await params.client.getBlockNumber())\n const [[emaPeriods, maxTicksDelta, maxClampDelta], _meta] = await Promise.all([\n params.client.multicall({\n contracts: [\n {\n address: params.riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'EMA_PERIODS',\n },\n {\n address: params.riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'MAX_TICKS_DELTA',\n },\n {\n address: params.riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'MAX_CLAMP_DELTA',\n },\n ],\n allowFailure: false,\n blockNumber: targetBlockNumber,\n }),\n getBlockMeta({ client: params.client, blockNumber: targetBlockNumber }),\n ])\n return {\n ...decodeOracleRiskParameters(BigInt(emaPeriods), BigInt(maxTicksDelta), BigInt(maxClampDelta)),\n _meta,\n }\n}\n\n/**\n * Parameters for getRiskParameters.\n */\nexport interface GetRiskParametersParams {\n /** viem PublicClient */\n client: PublicClient\n /** PanopticPool address */\n poolAddress: Address\n /** Builder code (default: 0) */\n builderCode?: bigint\n /** Optional block number for historical queries */\n blockNumber?: bigint\n /** Optional pre-fetched risk engine address (for caching/optimization) */\n riskEngineAddress?: Address\n /** Optional pre-fetched block metadata (skips getBlockMeta RPC call) */\n _meta?: BlockMeta\n}\n\n/**\n * Get risk parameters from the pool.\n *\n * ## Same-Block Guarantee\n * All dynamic data is fetched in ONE multicall at the target block.\n * Risk engine address is either provided or fetched separately (static prefetch).\n *\n * @param params - The parameters\n * @returns Risk parameters with block metadata\n */\nexport async function getRiskParameters(params: GetRiskParametersParams): Promise<RiskParameters> {\n const {\n client,\n poolAddress,\n builderCode = 0n,\n blockNumber,\n riskEngineAddress: providedAddress,\n } = params\n\n const targetBlockNumber =\n blockNumber ?? params._meta?.blockNumber ?? (await client.getBlockNumber())\n\n // Get risk engine address (static prefetch if not provided)\n const riskEngineAddress =\n providedAddress ??\n (await client.readContract({\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'riskEngine',\n }))\n\n // SINGLE multicall for ALL risk parameters - ensures same-block consistency\n const [riskEngineResults, _meta] = await Promise.all([\n client.multicall({\n contracts: [\n {\n address: riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'SELLER_COLLATERAL_RATIO',\n },\n {\n address: riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'BUYER_COLLATERAL_RATIO',\n },\n {\n address: riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'MAINT_MARGIN_RATE',\n },\n {\n address: riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'NOTIONAL_FEE',\n },\n {\n address: riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'TARGET_POOL_UTIL',\n },\n {\n address: riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'SATURATED_POOL_UTIL',\n },\n // The mint-time margin buffer, read live rather than compiled in, so a\n // redeployed RiskEngine cannot silently desync the displayed \"required\n // at mint\" from what the solvency check actually enforces.\n {\n address: riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'BP_DECREASE_BUFFER',\n },\n {\n address: riskEngineAddress,\n abi: riskEngineAbi,\n functionName: 'DECIMALS',\n },\n {\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'getRiskParameters',\n args: [builderCode],\n },\n ],\n blockNumber: targetBlockNumber,\n allowFailure: false,\n }),\n params._meta ?? getBlockMeta({ client, blockNumber: targetBlockNumber }),\n ])\n\n const [\n sellerCollateralRatio,\n buyerCollateralRatio,\n maintMarginRate,\n notionalFee,\n targetPoolUtil,\n saturatedPoolUtil,\n bpDecreaseBuffer,\n riskEngineDecimals,\n ,\n ] = riskEngineResults\n\n return {\n collateralRequirement: sellerCollateralRatio,\n maintenanceMargin: maintMarginRate,\n commissionRate: BigInt(notionalFee),\n targetUtilization: targetPoolUtil,\n saturatedUtilization: saturatedPoolUtil,\n itmSpreadMultiplier: buyerCollateralRatio, // Using buyer ratio as ITM multiplier\n // A live numerator is meaningful only with its live scale. If the scale is\n // invalid, fall back to the complete compiled-in ratio.\n mintBuffer:\n BigInt(riskEngineDecimals) > 0n\n ? { numerator: BigInt(bpDecreaseBuffer), denominator: BigInt(riskEngineDecimals) }\n : DEFAULT_MINT_BUFFER,\n _meta,\n }\n}\n\n// ---------------------------------------------------------------------------\n// Builder code validation\n// ---------------------------------------------------------------------------\n\n/**\n * Validate whether a builder code maps to a deployed builder wallet.\n *\n * Calls `PanopticPool.getRiskParameters(builderCode)` — the contract reverts\n * with `InvalidBuilderCode` when the computed CREATE2 address has no bytecode.\n *\n * @returns `true` when valid, `false` when the contract reverts.\n */\nexport async function validateBuilderCode(params: {\n client: PublicClient\n poolAddress: Address\n builderCode: bigint\n}): Promise<boolean> {\n const { client, poolAddress, builderCode } = params\n if (builderCode === 0n) return true\n try {\n await client.readContract({\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'getRiskParameters',\n args: [builderCode],\n })\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Extract tickSpacing from the encoded 64-bit poolId.\n * Layout: poolAddress (5 bytes) + vegoid (1 byte) + tickSpacing (2 bytes).\n * tickSpacing occupies bits 48–63.\n */\nfunction tickSpacingFromPoolId(poolId: bigint): bigint {\n return (poolId >> 48n) & 0xffffn\n}\n\n/**\n * Parse pool key from ABI-encoded bytes.\n *\n * V4 pools: PoolKey struct is ABI-encoded as 5 consecutive 32-byte slots\n * (currency0, currency1, fee, tickSpacing, hooks).\n *\n * V3 pools: poolKey() returns abi.encode(uniswapV3PoolAddress) — a single\n * 32-byte slot. The struct fields are not available, so currency0/currency1\n * are zeroed and tickSpacing/fee are set to 0 (callers should use\n * getV3PoolTickSpacing and getV3PoolFee respectively).\n */\nfunction parsePoolKey(poolKeyBytes: `0x${string}`): PoolKey {\n const hex = poolKeyBytes.slice(2)\n\n // V3: single ABI-encoded address (64 hex chars = 32 bytes)\n if (hex.length <= 64) {\n return {\n currency0: zeroAddress,\n currency1: zeroAddress,\n fee: 0n,\n tickSpacing: 0n,\n hooks: zeroAddress,\n }\n }\n\n if (hex.length < 320) {\n throw new Error(`Malformed V4 pool key: expected 320 hex chars (160 bytes), got ${hex.length}`)\n }\n\n // Each slot is 64 hex chars (32 bytes)\n // Addresses are in the last 40 hex chars (20 bytes) of their slot\n // Numeric values can be parsed from the full 64 hex chars of their slot\n const currency0 = `0x${hex.slice(24, 64)}` as Address // Slot 0: chars 0-64, address at 24-64\n const currency1 = `0x${hex.slice(88, 128)}` as Address // Slot 1: chars 64-128, address at 88-128\n const fee = BigInt(`0x${hex.slice(128, 192)}`) // Slot 2: chars 128-192 (full slot)\n const tickSpacing = BigInt(`0x${hex.slice(192, 256)}`) // Slot 3: chars 192-256 (full slot)\n const hooks = `0x${hex.slice(280, 320)}` as Address // Slot 4: chars 256-320, address at 280-320\n\n return {\n currency0,\n currency1,\n fee,\n tickSpacing,\n hooks,\n }\n}\n\n/**\n * Parameters for fetchPoolId.\n */\nexport interface FetchPoolIdParams {\n /** viem PublicClient */\n client: PublicClient\n /** PanopticPool address */\n poolAddress: Address\n}\n\n/**\n * Result of fetchPoolId, including block metadata for same-block consistency.\n */\nexport interface FetchPoolIdResult {\n /** The encoded 64-bit pool ID */\n poolId: bigint\n /** Block metadata from the pinned read */\n _meta: BlockMeta\n}\n\n/**\n * Fetch the encoded 64-bit pool ID from a PanopticPool contract.\n *\n * Use this when you need the poolId without fetching the full pool state.\n * The returned poolId can be passed directly to `createTokenIdBuilder()`.\n * The read is pinned to the latest block at call time.\n *\n * @param params - The parameters\n * @returns The pool ID and block metadata\n */\nexport async function fetchPoolId(params: FetchPoolIdParams): Promise<FetchPoolIdResult> {\n const { client, poolAddress } = params\n\n const block = await client.getBlock({ blockTag: 'latest' })\n\n const poolId = await client.readContract({\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'poolId',\n blockNumber: block.number,\n })\n\n return {\n poolId,\n _meta: {\n blockNumber: block.number,\n blockTimestamp: block.timestamp,\n blockHash: block.hash,\n },\n }\n}\n\nexport { tickToSqrtPriceX96 }\n","/**\n * TokenId constants for the Panoptic v2 SDK.\n * @module v2/tokenId/constants\n */\n\n/**\n * Default vegoid value used in pool ID encoding.\n */\nexport const DEFAULT_VEGOID = 8n\n\n/**\n * Default MAX_SPREAD value (90_000 = 9 * 10_000).\n * On-chain: removed/net ratio cap, in units of 1/10_000.\n */\nexport const DEFAULT_MAX_SPREAD = 90_000n\n\n/**\n * Standard tick widths matching DTE gamma profiles.\n *\n * These represent the position width in ticks for each timescale.\n * Width = tickUpper - tickLower.\n */\nexport const STANDARD_TICK_WIDTHS = {\n /** 1-hour expiry profile (240 ticks) */\n '1H': 240n,\n /** 1-day expiry profile (720 ticks) */\n '1D': 720n,\n /** 1-week expiry profile (2400 ticks) */\n '1W': 2400n,\n /** 1-month expiry profile (4800 ticks) */\n '1M': 4800n,\n /** 1-year expiry profile (15000 ticks) */\n '1Y': 15000n,\n} as const\n\n/**\n * Timescale key type for STANDARD_TICK_WIDTHS.\n */\nexport type Timescale = keyof typeof STANDARD_TICK_WIDTHS\n\n/**\n * Bit positions and sizes for TokenId encoding.\n */\nexport const TOKEN_ID_BITS = {\n /** Pool ID occupies bits 0-63 */\n POOL_ID_SIZE: 64n,\n /** Vegoid starts at bit 40 within pool ID */\n VEGOID_STARTING_BIT: 40n,\n /** Vegoid is 8 bits */\n VEGOID_SIZE: 8n,\n /** Tick spacing starts at bit 48 within pool ID */\n TICK_SPACING_STARTING_BIT: 48n,\n /** Tick spacing is 16 bits */\n TICK_SPACING_SIZE: 16n,\n /** Each leg is 48 bits */\n LEG_SIZE: 48n,\n /** Maximum number of legs per TokenId */\n MAX_LEGS: 4n,\n} as const\n\n/**\n * Bit positions within a leg (relative to leg start).\n */\nexport const LEG_BITS = {\n /** Asset bit position */\n ASSET_BIT: 0n,\n /** Asset size in bits */\n ASSET_SIZE: 1n,\n /** Option ratio starting bit */\n RATIO_BIT: 1n,\n /** Option ratio size in bits */\n RATIO_SIZE: 7n,\n /** Is long starting bit */\n IS_LONG_BIT: 8n,\n /** Is long size in bits */\n IS_LONG_SIZE: 1n,\n /** Token type starting bit */\n TOKEN_TYPE_BIT: 9n,\n /** Token type size in bits */\n TOKEN_TYPE_SIZE: 1n,\n /** Risk partner starting bit */\n RISK_PARTNER_BIT: 10n,\n /** Risk partner size in bits */\n RISK_PARTNER_SIZE: 2n,\n /** Strike starting bit */\n STRIKE_BIT: 12n,\n /** Strike size in bits (24 bits, signed int24) */\n STRIKE_SIZE: 24n,\n /** Width starting bit */\n WIDTH_BIT: 36n,\n /** Width size in bits */\n WIDTH_SIZE: 12n,\n} as const\n\n/**\n * Masks for extracting/encoding leg fields.\n */\nexport const LEG_MASKS = {\n /** Mask for asset (1 bit) */\n ASSET: (1n << LEG_BITS.ASSET_SIZE) - 1n,\n /** Mask for option ratio (7 bits) */\n RATIO: (1n << LEG_BITS.RATIO_SIZE) - 1n,\n /** Mask for is long (1 bit) */\n IS_LONG: (1n << LEG_BITS.IS_LONG_SIZE) - 1n,\n /** Mask for token type (1 bit) */\n TOKEN_TYPE: (1n << LEG_BITS.TOKEN_TYPE_SIZE) - 1n,\n /** Mask for risk partner (2 bits) */\n RISK_PARTNER: (1n << LEG_BITS.RISK_PARTNER_SIZE) - 1n,\n /** Mask for strike (24 bits) */\n STRIKE: (1n << LEG_BITS.STRIKE_SIZE) - 1n,\n /** Mask for width (12 bits) */\n WIDTH: (1n << LEG_BITS.WIDTH_SIZE) - 1n,\n /** Mask for entire leg (48 bits) */\n LEG: (1n << TOKEN_ID_BITS.LEG_SIZE) - 1n,\n} as const\n\n/**\n * Maximum and minimum values for leg fields.\n */\nexport const LEG_LIMITS = {\n /** Maximum option ratio (127) */\n MAX_RATIO: 127n,\n /** Maximum width (4095) */\n MAX_WIDTH: 4095n,\n /** Maximum strike (8388607, max int24 positive) */\n MAX_STRIKE: 8388607n,\n /** Minimum strike (-8388608, min int24) */\n MIN_STRIKE: -8388608n,\n} as const\n\n/**\n * Value used to convert negative strike to unsigned representation.\n * Strike is stored as int24, so we use 2^24 for conversion.\n */\nexport const STRIKE_CONVERSION_FACTOR = 16777216n\n","import type { Address, Hex } from 'viem'\n\nimport { DEFAULT_VEGOID } from '../tokenId/constants'\n\nexport const vegoid = Number(DEFAULT_VEGOID)\n\nexport interface LegParams {\n index: number\n width: bigint\n optionRatio: bigint\n asset: bigint\n strike: bigint\n isLong: bigint // 0 if short, 1 if long\n tokenType: bigint // Which token (0|1 in underlying pool) is being moved\n riskPartner: bigint\n}\n\nexport const areLegsEqual = (leg1: LegParams, leg2: LegParams): boolean => {\n return (\n leg1.width === leg2.width &&\n leg1.optionRatio === leg2.optionRatio &&\n leg1.asset === leg2.asset &&\n leg1.strike === leg2.strike &&\n leg1.isLong === leg2.isLong &&\n leg1.tokenType === leg2.tokenType &&\n leg1.riskPartner === leg2.riskPartner\n )\n}\n\nexport const stringifyLeg = (leg: LegParams): string => {\n return `Index: ${leg.index} | Width: ${leg.width.toString()} | OptionRatio: ${leg.optionRatio.toString()} | Asset: ${leg.asset.toString()} | Strike: ${leg.strike.toString()} | IsLong?: ${leg.isLong.toString()} | Token Type: ${leg.tokenType.toString()} | Risk Partner: ${leg.riskPartner.toString()}`\n}\n\n// Synthetic TokenIds padding constant\nexport const SYNTH_TOKENID_PADDING = BigInt(\n '115792089237316195423570985007226406215939081747436879206741300988257197096960',\n)\n\nconst POOL_ID_SIZE = 64n\nconst VEGOID_STARTING_BIT = 40n\nconst VEGOID_SIZE = 8n\nconst TICK_SPACING_STARTING_BIT = 48n\nconst ASSET_STARTING_BIT = 0n\nconst ASSET_SIZE = 1n\nconst RATIO_STARTING_BIT = ASSET_STARTING_BIT + ASSET_SIZE // 0 + 1\nconst RATIO_SIZE = 7n\nconst IS_LONG_STARTING_BIT = RATIO_STARTING_BIT + RATIO_SIZE // 1 + 7\nconst IS_LONG_SIZE = 1n\nconst TOKEN_TYPE_STARTING_BIT = IS_LONG_STARTING_BIT + IS_LONG_SIZE // 8 + 1\nconst TOKEN_TYPE_SIZE = 1n\nconst RISK_PARTNER_STARTING_BIT = TOKEN_TYPE_STARTING_BIT + TOKEN_TYPE_SIZE // 9 + 1\nconst RISK_PARTNER_SIZE = 2n\nconst STRIKE_STARTING_BIT = RISK_PARTNER_STARTING_BIT + RISK_PARTNER_SIZE // 10 + 2\nconst STRIKE_SIZE = 24n\nconst WIDTH_STARTING_BIT = STRIKE_STARTING_BIT + STRIKE_SIZE // 12 + 24\nconst WIDTH_SIZE = 12n\nconst LEG_SIZE = WIDTH_STARTING_BIT + WIDTH_SIZE // 36 + 12 = 48\n\n// converts unsigned strike to signed for encoding\nexport const convertStrike = (n: bigint): bigint => {\n if (n < 0n) {\n // 3 bytes because strike is int24\n return 16777216n + n\n } else {\n return n\n }\n}\n\n// converts encoded (unsigned) strike back to signed\nexport const signStrike = (encodedStrike: bigint): bigint => {\n if (encodedStrike > 2n ** 23n) {\n return encodedStrike - 16777216n\n }\n return encodedStrike\n}\n\nconst getLegOffsetByIndex = (index: bigint): bigint => index * LEG_SIZE\n\nconst encodeAsset = (asset: bigint, legIndex: bigint): bigint =>\n asset << (getLegOffsetByIndex(legIndex) + ASSET_STARTING_BIT + POOL_ID_SIZE)\n\nconst encodeRatio = (optionRatio: bigint, legIndex: bigint): bigint =>\n optionRatio << (getLegOffsetByIndex(legIndex) + RATIO_STARTING_BIT + POOL_ID_SIZE)\n\nconst encodeIsLong = (isLong: bigint, legIndex: bigint): bigint =>\n isLong << (getLegOffsetByIndex(legIndex) + IS_LONG_STARTING_BIT + POOL_ID_SIZE)\n\nconst encodeTokenType = (tokenType: bigint, legIndex: bigint): bigint =>\n tokenType << (getLegOffsetByIndex(legIndex) + TOKEN_TYPE_STARTING_BIT + POOL_ID_SIZE)\n\nconst encodeRiskPartner = (riskPartner: bigint, legIndex: bigint): bigint =>\n riskPartner << (getLegOffsetByIndex(legIndex) + RISK_PARTNER_STARTING_BIT + POOL_ID_SIZE)\n\nconst encodeStrike = (strike: bigint, legIndex: bigint): bigint =>\n convertStrike(strike) << (getLegOffsetByIndex(legIndex) + STRIKE_STARTING_BIT + POOL_ID_SIZE)\n\nconst encodeWidth = (width: bigint, legIndex: bigint): bigint =>\n width << (getLegOffsetByIndex(legIndex) + WIDTH_STARTING_BIT + POOL_ID_SIZE)\n\nconst decodeAsset = (leg: bigint): bigint => leg % (1n << ASSET_SIZE)\n\nconst decodeRatio = (leg: bigint): bigint => (leg >> RATIO_STARTING_BIT) % (1n << RATIO_SIZE)\n\nconst decodeIsLong = (leg: bigint): bigint => (leg >> IS_LONG_STARTING_BIT) % (1n << IS_LONG_SIZE)\n\nconst decodeTokenType = (leg: bigint): bigint =>\n (leg >> TOKEN_TYPE_STARTING_BIT) % (1n << TOKEN_TYPE_SIZE)\n\nconst decodeRiskPartner = (leg: bigint): bigint =>\n (leg >> RISK_PARTNER_STARTING_BIT) % (1n << RISK_PARTNER_SIZE)\n\nconst decodeStrike = (leg: bigint): bigint =>\n signStrike((leg >> STRIKE_STARTING_BIT) % (1n << STRIKE_SIZE))\n\nconst decodeWidth = (leg: bigint): bigint => (leg >> WIDTH_STARTING_BIT) % (1n << WIDTH_SIZE)\n\n/**\n * Extract vegoid from a TokenId\n * Vegoid is stored in bits 40-47 (8 bits) of the poolId\n */\nexport const decodeVegoid = (tokenId: bigint): bigint => {\n return ((tokenId % (1n << POOL_ID_SIZE)) >> VEGOID_STARTING_BIT) % (1n << VEGOID_SIZE)\n}\n\n/**\n * Extract vegoid from a poolId\n * Vegoid is stored in bits 40-47 (8 bits) of the poolId\n */\nexport const decodeVegoidFromPoolId = (poolId: bigint): bigint => {\n return (poolId >> VEGOID_STARTING_BIT) % (1n << VEGOID_SIZE)\n}\n\n/**\n * Extract tickSpacing from a TokenId\n * TickSpacing is stored in bits 48-63 (16 bits) of the poolId\n */\nexport const decodeTickSpacing = (tokenId: bigint): bigint => {\n return (tokenId % (1n << POOL_ID_SIZE)) >> TICK_SPACING_STARTING_BIT\n}\n\n/**\n * Encode poolId with vegoid support\n * The encoded PoolId structure: [16-bit tickSpacing][8-bit vegoid][40-bit pool address]\n * @param address The Uniswap V3 pool address (hex string)\n * @param tickSpacing The tick spacing of the pool\n * @param vegoidValue The vegoid value (defaults to 4 if not provided)\n * @return The encoded poolId as bigint\n */\nexport const encodePoolId = (\n address: Address,\n tickSpacing: bigint,\n vegoidValue: bigint = BigInt(vegoid),\n): bigint => {\n // Remove 0x prefix and get first 10 hex chars (5 bytes = 40 bits)\n const addressHex = address.slice(2, 12).toLowerCase()\n\n // Convert to bytes array (big-endian), then reverse to little-endian\n const bytes: number[] = []\n for (let i = 0; i < 10; i += 2) {\n bytes.push(parseInt(addressHex.slice(i, i + 2), 16))\n }\n bytes.reverse()\n\n // Build poolId: pool address (5 bytes) + vegoid (1 byte) + tickSpacing (2 bytes) = 8 bytes\n // All in little-endian format\n let poolId = 0n\n for (let i = 0; i < bytes.length; i++) {\n poolId |= BigInt(bytes[i]) << BigInt(i * 8)\n }\n\n // Add vegoid at bit 40\n poolId |= (vegoidValue % 256n) << 40n\n\n // Add tickSpacing at bit 48\n poolId |= (tickSpacing % 65536n) << 48n\n\n return poolId\n}\n\n/**\n * Encode V4 poolId with vegoid support\n * The encoded PoolId structure: [16-bit tickSpacing][8-bit vegoid][40-bit pool pattern]\n * @param poolId The V4 pool ID (bytes32 hex string)\n * @param tickSpacing The tick spacing of the pool\n * @param vegoidValue The vegoid value (defaults to 4 if not provided)\n * @return The encoded poolId as bigint\n */\nexport const encodeV4PoolId = (\n poolId: Hex,\n tickSpacing: bigint,\n vegoidValue: bigint = BigInt(vegoid),\n): bigint => {\n // Remove 0x prefix and get last 10 hex chars (5 bytes = 40 bits)\n const poolIdHex = poolId.slice(2)\n const last5BytesHex = poolIdHex.slice(-10).toLowerCase()\n\n // Convert to bytes array (big-endian), then reverse to little-endian\n const bytes: number[] = []\n for (let i = 0; i < 10; i += 2) {\n bytes.push(parseInt(last5BytesHex.slice(i, i + 2), 16))\n }\n bytes.reverse()\n\n // Build encoded poolId: pool pattern (5 bytes) + vegoid (1 byte) + tickSpacing (2 bytes) = 8 bytes\n let encodedPoolId = 0n\n for (let i = 0; i < bytes.length; i++) {\n encodedPoolId |= BigInt(bytes[i]) << BigInt(i * 8)\n }\n\n // Add vegoid at bit 40\n encodedPoolId |= (vegoidValue % 256n) << 40n\n\n // Add tickSpacing at bit 48\n encodedPoolId |= (tickSpacing % 65536n) << 48n\n\n return encodedPoolId\n}\n\n// Can be (ab)used to create a leg id by passing in a tokenId of 0\nexport const addLeg = (tokenId: bigint, leg: LegParams): bigint => {\n const legIndex = BigInt(leg.index)\n const width = leg.width\n const strike = leg.strike\n const riskPartner = leg.riskPartner\n const tokenType = leg.tokenType\n const isLong = leg.isLong\n const optionRatio = leg.optionRatio\n const asset = leg.asset\n\n return (\n tokenId +\n encodeWidth(width, legIndex) +\n encodeStrike(strike, legIndex) +\n (encodeRiskPartner(riskPartner, legIndex) |\n encodeTokenType(tokenType, legIndex) |\n encodeIsLong(isLong, legIndex) |\n encodeRatio(optionRatio, legIndex) |\n encodeAsset(asset, legIndex))\n )\n}\n\nexport const encodePosition = (poolId: bigint, legs: LegParams[]): bigint => {\n return legs.reduce((acc, leg) => addLeg(acc, leg), poolId)\n}\n\nexport interface Position {\n poolId: string\n legs: LegParams[]\n}\n\nexport const decodePosition = (encodedPosition: bigint): Position => {\n const leg4 = (encodedPosition >> (POOL_ID_SIZE + getLegOffsetByIndex(3n))) % (1n << LEG_SIZE)\n\n const leg3 = (encodedPosition >> (POOL_ID_SIZE + getLegOffsetByIndex(2n))) % (1n << LEG_SIZE)\n\n const leg2 = (encodedPosition >> (POOL_ID_SIZE + getLegOffsetByIndex(1n))) % (1n << LEG_SIZE)\n\n const leg1 = (encodedPosition >> (POOL_ID_SIZE + getLegOffsetByIndex(0n))) % (1n << LEG_SIZE)\n\n let poolId = (encodedPosition % (1n << POOL_ID_SIZE)).toString(16)\n\n const poolIdLength = 16 // poolId is 64 bits => 16 hex characters\n if (poolId.length < poolIdLength) {\n poolId = padHexWithZeros('0x' + poolId, poolIdLength + 2) // +2 for 0x prefix\n } else {\n poolId = '0x' + poolId\n }\n\n const encodedLegs = [leg1, leg2, leg3, leg4].filter((leg) => decodeRatio(leg) > 0n)\n\n const legs: LegParams[] = encodedLegs.map((leg, index) => ({\n index: index,\n width: decodeWidth(leg),\n strike: decodeStrike(leg),\n riskPartner: decodeRiskPartner(leg),\n tokenType: decodeTokenType(leg),\n isLong: decodeIsLong(leg),\n optionRatio: decodeRatio(leg),\n asset: decodeAsset(leg),\n }))\n\n return {\n poolId,\n legs,\n }\n}\n\nexport function padHexWithZeros(hex: string, length: number): string {\n // Check if the hex starts with \"0x\"\n if (hex.startsWith('0x')) {\n // Remove the \"0x\" prefix\n hex = hex.substring(2)\n } else {\n throw new Error('do not use padHexWithZeros on non-hex strings')\n }\n\n // Subtract 2 from length to account for the substring(2) call to remove the leading 0x\n while (hex.length < length - 2) {\n hex = '0' + hex\n }\n\n // Add back the \"0x\" prefix\n return '0x' + hex\n}\n","/**\n * Position read functions for the Panoptic v2 SDK.\n * @module v2/reads/position\n */\n\nimport type { Address, PublicClient } from 'viem'\n\nimport { panopticPoolV2Abi } from '../../../generated'\nimport { getBlockMeta } from '../clients/blockMeta'\nimport { calculatePositionGreeks } from '../greeks'\nimport type { BlockMeta, Position, PositionGreeks, TokenIdLeg } from '../types'\nimport { decodePosition, decodeTickSpacing } from '../utils/option-encoding-v2'\n\n/**\n * Decode a packed PositionBalance (uint256) into its component fields.\n */\nfunction decodePositionBalance(balance: bigint) {\n const positionSize = balance & ((1n << 128n) - 1n)\n const poolUtilization0 = (balance >> 128n) & 0xffffn\n const poolUtilization1 = (balance >> 144n) & 0xffffn\n let tickAtMint = (balance >> 160n) & 0xffffffn\n if (tickAtMint > 0x7fffffn) {\n tickAtMint = tickAtMint - 0x1000000n\n }\n const timestampAtMint = (balance >> 184n) & 0xffffffffn\n const blockAtMint = (balance >> 216n) & ((1n << 39n) - 1n)\n const swapAtMint = balance >> 255n === 1n\n\n return {\n positionSize,\n poolUtilization0,\n poolUtilization1,\n tickAtMint,\n timestampAtMint,\n blockAtMint,\n swapAtMint,\n }\n}\n\n/**\n * Parameters for getPosition.\n */\nexport interface GetPositionParams {\n /** viem PublicClient */\n client: PublicClient\n /** PanopticPool address */\n poolAddress: Address\n /** Owner address */\n owner: Address\n /** TokenId to query */\n tokenId: bigint\n /** Optional block number for historical queries */\n blockNumber?: bigint\n /** Optional pre-fetched block metadata (skips getBlockMeta RPC call) */\n _meta?: BlockMeta\n}\n\n/**\n * Get a single position by tokenId.\n *\n * @param params - The parameters\n * @returns Position data with block metadata\n */\nexport async function getPosition(params: GetPositionParams): Promise<Position> {\n const { client, poolAddress, owner, tokenId, blockNumber } = params\n\n const targetBlockNumber =\n blockNumber ?? params._meta?.blockNumber ?? (await client.getBlockNumber())\n\n const [fullData, _meta] = await Promise.all([\n client.readContract({\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'getFullPositionsData',\n args: [owner, false, [tokenId]],\n blockNumber: targetBlockNumber,\n }),\n params._meta ?? getBlockMeta({ client, blockNumber: targetBlockNumber }),\n ])\n\n const balanceRaw = fullData[2][0] // positionBalances[0]\n const {\n positionSize,\n poolUtilization0: utilization0AtMint,\n poolUtilization1: utilization1AtMint,\n tickAtMint,\n timestampAtMint,\n blockAtMint,\n swapAtMint,\n } = decodePositionBalance(balanceRaw)\n\n // Decode the tokenId to get legs\n const decoded = decodePosition(tokenId)\n const tickSpacing = decodeTickSpacing(tokenId)\n\n // Convert decoded legs to TokenIdLeg format\n const legs: TokenIdLeg[] = decoded.legs.map((leg) => {\n const width = leg.width\n const strike = leg.strike\n // Calculate tick bounds based on strike and width\n const tickLower = strike - (width * tickSpacing) / 2n\n const tickUpper = strike + (width * tickSpacing) / 2n\n\n return {\n index: BigInt(leg.index),\n asset: leg.asset,\n optionRatio: leg.optionRatio,\n isLong: leg.isLong === 1n,\n tokenType: leg.tokenType,\n riskPartner: leg.riskPartner,\n strike,\n width,\n tickLower,\n tickUpper,\n }\n })\n\n return {\n tokenId,\n positionSize,\n owner,\n poolAddress,\n legs,\n poolUtilization0AtMint: utilization0AtMint,\n poolUtilization1AtMint: utilization1AtMint,\n tickAtMint: BigInt(tickAtMint),\n timestampAtMint,\n blockNumberAtMint: blockAtMint,\n swapAtMint,\n premiaOwed0: 0n, // Premia now tracked separately, not returned from positionData\n premiaOwed1: 0n,\n assetIndex: legs.length > 0 ? legs[0].asset : 0n,\n _meta,\n }\n}\n\n/**\n * Parameters for getPositions.\n */\nexport interface GetPositionsParams {\n /** viem PublicClient */\n client: PublicClient\n /** PanopticPool address */\n poolAddress: Address\n /** Owner address */\n owner: Address\n /** TokenIds to query */\n tokenIds: bigint[]\n /** Optional block number for historical queries */\n blockNumber?: bigint\n /** Optional pre-fetched block metadata (skips getBlockMeta RPC call) */\n _meta?: BlockMeta\n}\n\n/**\n * Get multiple positions for an account.\n *\n * @param params - The parameters\n * @returns Array of positions with block metadata\n */\nexport async function getPositions(\n params: GetPositionsParams,\n): Promise<{ positions: Position[]; _meta: BlockMeta }> {\n const { client, poolAddress, owner, tokenIds, blockNumber } = params\n\n if (tokenIds.length === 0) {\n const _meta =\n params._meta ??\n (await getBlockMeta({\n client,\n blockNumber: blockNumber ?? (await client.getBlockNumber()),\n }))\n return { positions: [], _meta }\n }\n\n const targetBlockNumber =\n blockNumber ?? params._meta?.blockNumber ?? (await client.getBlockNumber())\n\n const _meta = params._meta ?? (await getBlockMeta({ client, blockNumber: targetBlockNumber }))\n\n const decodePositions = (\n ids: bigint[],\n positionBalances: readonly bigint[],\n meta: BlockMeta,\n ): Position[] => {\n const positions: Position[] = []\n for (let i = 0; i < ids.length; i += 1) {\n const tokenId = ids[i]\n if (tokenId === undefined) continue\n const balanceRaw = positionBalances[i]\n if (balanceRaw === undefined) continue\n\n const {\n positionSize,\n poolUtilization0: utilization0AtMint,\n poolUtilization1: utilization1AtMint,\n tickAtMint,\n timestampAtMint,\n blockAtMint,\n swapAtMint,\n } = decodePositionBalance(balanceRaw)\n\n // Skip positions with zero size\n if (positionSize === 0n) {\n continue\n }\n\n // Decode the tokenId to get legs\n const decoded = decodePosition(tokenId)\n const tickSpacing = decodeTickSpacing(tokenId)\n\n // Convert decoded legs to TokenIdLeg format\n const legs: TokenIdLeg[] = decoded.legs.map((leg) => {\n const width = leg.width\n const strike = leg.strike\n const tickLower = strike - (width * tickSpacing) / 2n\n const tickUpper = strike + (width * tickSpacing) / 2n\n\n return {\n index: BigInt(leg.index),\n asset: leg.asset,\n optionRatio: leg.optionRatio,\n isLong: leg.isLong === 1n,\n tokenType: leg.tokenType,\n riskPartner: leg.riskPartner,\n strike,\n width,\n tickLower,\n tickUpper,\n }\n })\n\n positions.push({\n tokenId,\n positionSize,\n owner,\n poolAddress,\n legs,\n poolUtilization0AtMint: utilization0AtMint,\n poolUtilization1AtMint: utilization1AtMint,\n tickAtMint: BigInt(tickAtMint),\n timestampAtMint,\n blockNumberAtMint: blockAtMint,\n swapAtMint,\n premiaOwed0: 0n, // Premia now tracked separately\n premiaOwed1: 0n,\n assetIndex: legs.length > 0 ? legs[0].asset : 0n,\n _meta: meta,\n })\n }\n return positions\n }\n\n const getOrderingCandidates = (ids: bigint[]): bigint[][] => {\n if (ids.length <= 1) return [Array.from(ids)]\n const candidates: bigint[][] = []\n const seen = new Set<string>()\n const push = (candidate: bigint[]) => {\n const key = candidate.map((value) => value.toString()).join(',')\n if (seen.has(key)) return\n seen.add(key)\n candidates.push(candidate)\n }\n push(Array.from(ids))\n push(Array.from(ids).sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)))\n push(Array.from(ids).sort((a, b) => (a < b ? 1 : a > b ? -1 : 0)))\n return candidates\n }\n\n const fetchBalances = async (ids: bigint[]) => {\n const fullData = await client.readContract({\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'getFullPositionsData',\n args: [owner, false, ids],\n blockNumber: targetBlockNumber,\n })\n const balances = fullData[2]\n return Array.isArray(balances) ? balances : []\n }\n\n // Try full-batch read first.\n for (const candidate of getOrderingCandidates(tokenIds)) {\n try {\n const balances = await fetchBalances(candidate)\n return { positions: decodePositions(candidate, balances, _meta), _meta }\n } catch {\n // fall through to next ordering candidate\n }\n }\n\n // Last-resort fallback: probe each token independently and keep only successful reads.\n const perTokenResults = await Promise.all(\n tokenIds.map(async (tokenId) => {\n try {\n const balances = await fetchBalances([tokenId])\n return { tokenId, balance: balances[0] }\n } catch {\n return { tokenId, balance: undefined }\n }\n }),\n )\n const validTokenIds: bigint[] = []\n const validBalances: bigint[] = []\n for (const result of perTokenResults) {\n if (result.balance === undefined) continue\n validTokenIds.push(result.tokenId)\n validBalances.push(result.balance)\n }\n\n return { positions: decodePositions(validTokenIds, validBalances, _meta), _meta }\n}\n\n/**\n * Parameters for getPositionGreeks.\n */\nexport interface GetPositionGreeksParams {\n /** viem PublicClient */\n client: PublicClient\n /** PanopticPool address */\n poolAddress: Address\n /** Owner address */\n owner: Address\n /** TokenId to calculate greeks for */\n tokenId: bigint\n /** Optional: Current tick override (defaults to pool's current tick) */\n atTick?: bigint\n /** Optional block number for historical queries */\n blockNumber?: bigint\n /** Optional pre-fetched block metadata (skips getBlockMeta RPC call) */\n _meta?: BlockMeta\n}\n\n/**\n * Get Greeks for a position.\n *\n * Uses client-side calculation based on the position's legs, current tick,\n * and mint tick. Returns WAD-scaled (1e18) bigint values.\n *\n * @param params - The parameters\n * @returns Position greeks with block metadata\n */\nexport async function getPositionGreeks(\n params: GetPositionGreeksParams,\n): Promise<PositionGreeks & { _meta: BlockMeta }> {\n const { client, poolAddress, owner, tokenId, atTick, blockNumber } = params\n\n const targetBlockNumber =\n blockNumber ?? params._meta?.blockNumber ?? (await client.getBlockNumber())\n\n // Get position data and current tick in parallel\n const [fullData, currentTickResult, _meta] = await Promise.all([\n client.readContract({\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'getFullPositionsData',\n args: [owner, false, [tokenId]],\n blockNumber: targetBlockNumber,\n }),\n atTick === undefined\n ? client.readContract({\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'getCurrentTick',\n blockNumber: targetBlockNumber,\n })\n : Promise.resolve(atTick),\n params._meta ?? getBlockMeta({ client, blockNumber: targetBlockNumber }),\n ])\n\n const { tickAtMint, positionSize } = decodePositionBalance(fullData[2][0])\n\n // Decode the tokenId to get legs\n const decoded = decodePosition(tokenId)\n const tickSpacing = decodeTickSpacing(tokenId)\n\n // Convert decoded legs to TokenIdLeg format\n const legs: TokenIdLeg[] = decoded.legs.map((leg) => {\n const width = leg.width\n const strike = leg.strike\n const tickLower = strike - (width * tickSpacing) / 2n\n const tickUpper = strike + (width * tickSpacing) / 2n\n\n return {\n index: BigInt(leg.index),\n asset: leg.asset,\n optionRatio: leg.optionRatio,\n isLong: leg.isLong === 1n,\n tokenType: leg.tokenType,\n riskPartner: leg.riskPartner,\n strike,\n width,\n tickLower,\n tickUpper,\n }\n })\n\n const currentTick =\n typeof currentTickResult === 'bigint' ? currentTickResult : BigInt(currentTickResult)\n\n // Calculate greeks using client-side implementation\n const greeks = calculatePositionGreeks({\n legs,\n currentTick,\n mintTick: BigInt(tickAtMint),\n positionSize,\n poolTickSpacing: tickSpacing,\n })\n\n return {\n ...greeks,\n _meta,\n }\n}\n","/**\n * File-based storage adapter for Node.js.\n * @module v2/storage/fileStorage\n */\n\nimport type FsPromises from 'node:fs/promises'\nimport type Path from 'node:path'\n\nimport type { StorageAdapter } from './adapter'\n\n/**\n * Creates a file-based storage adapter for Node.js environments.\n * Stores data as JSON files in the specified directory.\n *\n * The directory will be created if it doesn't exist.\n *\n * @param directory - Path to the storage directory\n *\n * @example\n * ```typescript\n * import { createFileStorage, createConfig } from 'panoptic-v2-sdk'\n *\n * // Node.js only\n * const config = createConfig({\n * chainId: 1n,\n * transport: http('...'),\n * poolAddress: '0x...',\n * storage: createFileStorage('./panoptic-cache'),\n * })\n * ```\n */\nexport function createFileStorage(directory: string): StorageAdapter {\n // Lazy import fs/promises to avoid issues in browser environments\n // This function should only be called in Node.js\n let fsPromises: typeof FsPromises | null = null\n let pathModule: typeof Path | null = null\n let initialized = false\n\n const ensureInitialized = async () => {\n if (initialized) return\n\n // Dynamic import for Node.js modules\n fsPromises = await import('node:fs/promises')\n pathModule = await import('node:path')\n\n // Ensure directory exists\n await fsPromises.mkdir(directory, { recursive: true })\n initialized = true\n }\n\n const getFilePath = (key: string): string => {\n if (!pathModule) throw new Error('File storage not initialized')\n // Encode the key to be filesystem-safe\n const safeKey = Buffer.from(key).toString('base64url')\n return pathModule.join(directory, `${safeKey}.json`)\n }\n\n return {\n async get(key: string): Promise<string | null> {\n await ensureInitialized()\n if (!fsPromises) throw new Error('File storage not initialized')\n\n try {\n const filePath = getFilePath(key)\n const content = await fsPromises.readFile(filePath, 'utf-8')\n return content\n } catch (error) {\n // File doesn't exist\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n return null\n }\n throw error\n }\n },\n\n async set(key: string, value: string): Promise<void> {\n await ensureInitialized()\n if (!fsPromises) throw new Error('File storage not initialized')\n\n const filePath = getFilePath(key)\n await fsPromises.writeFile(filePath, value, 'utf-8')\n },\n\n async delete(key: string): Promise<void> {\n await ensureInitialized()\n if (!fsPromises) throw new Error('File storage not initialized')\n\n try {\n const filePath = getFilePath(key)\n await fsPromises.unlink(filePath)\n } catch (error) {\n // Ignore if file doesn't exist\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {\n throw error\n }\n }\n },\n\n async has(key: string): Promise<boolean> {\n await ensureInitialized()\n if (!fsPromises) throw new Error('File storage not initialized')\n\n try {\n const filePath = getFilePath(key)\n await fsPromises.access(filePath)\n return true\n } catch {\n return false\n }\n },\n\n async keys(prefix: string): Promise<string[]> {\n await ensureInitialized()\n if (!fsPromises || !pathModule) throw new Error('File storage not initialized')\n\n const result: string[] = []\n\n try {\n const files = await fsPromises.readdir(directory)\n for (const file of files) {\n if (file.endsWith('.json')) {\n const safeKey = file.slice(0, -5) // Remove .json\n try {\n const key = Buffer.from(safeKey, 'base64url').toString()\n if (key.startsWith(prefix)) {\n result.push(key)\n }\n } catch {\n // Invalid base64, skip\n }\n }\n }\n } catch (error) {\n // Directory doesn't exist yet\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {\n throw error\n }\n }\n\n return result\n },\n\n async clear(prefix: string): Promise<void> {\n await ensureInitialized()\n if (!fsPromises) throw new Error('File storage not initialized')\n\n const keysToDelete = await this.keys(prefix)\n for (const key of keysToDelete) {\n await this.delete(key)\n }\n },\n }\n}\n","/**\n * Storage key generation for the Panoptic v2 SDK.\n * @module v2/storage/keys\n */\n\nimport type { Address } from 'viem'\n\nimport { SCHEMA_VERSION, STORAGE_PREFIX } from '../utils/constants'\n\n/**\n * Get the schema version key.\n */\nexport function getSchemaVersionKey(): string {\n return `${STORAGE_PREFIX}:schemaVersion`\n}\n\n/**\n * Get the base prefix for a specific pool.\n */\nexport function getPoolPrefix(chainId: bigint, poolAddress: Address): string {\n return `${STORAGE_PREFIX}:v${SCHEMA_VERSION}:chain${chainId}:pool${poolAddress.toLowerCase()}`\n}\n\n/**\n * Get the key for tracked position IDs.\n */\nexport function getPositionsKey(chainId: bigint, poolAddress: Address, account: Address): string {\n return `${getPoolPrefix(chainId, poolAddress)}:positions:${account.toLowerCase()}`\n}\n\n/**\n * Get the key for position mint metadata.\n */\nexport function getPositionMetaKey(chainId: bigint, poolAddress: Address, tokenId: bigint): string {\n return `${getPoolPrefix(chainId, poolAddress)}:positionMeta:${tokenId.toString()}`\n}\n\n/**\n * Get the key for sync checkpoint.\n */\nexport function getSyncCheckpointKey(\n chainId: bigint,\n poolAddress: Address,\n account: Address,\n): string {\n return `${getPoolPrefix(chainId, poolAddress)}:sync:${account.toLowerCase()}`\n}\n\n/**\n * Get the key for closed positions.\n */\nexport function getClosedPositionsKey(\n chainId: bigint,\n poolAddress: Address,\n account: Address,\n): string {\n return `${getPoolPrefix(chainId, poolAddress)}:closed:${account.toLowerCase()}`\n}\n\n/**\n * Get the key for tracked chunks.\n */\nexport function getTrackedChunksKey(chainId: bigint, poolAddress: Address): string {\n return `${getPoolPrefix(chainId, poolAddress)}:chunks`\n}\n\n/**\n * Get the key for pending positions.\n */\nexport function getPendingPositionsKey(\n chainId: bigint,\n poolAddress: Address,\n account: Address,\n): string {\n return `${getPoolPrefix(chainId, poolAddress)}:pending:${account.toLowerCase()}`\n}\n\n/**\n * Get the key for pool metadata (tickSpacing, etc.).\n */\nexport function getPoolMetaKey(chainId: bigint, poolAddress: Address): string {\n return `${getPoolPrefix(chainId, poolAddress)}:poolMeta`\n}\n","/**\n * In-memory storage adapter for testing.\n * @module v2/storage/memoryStorage\n */\n\nimport type { StorageAdapter } from './adapter'\n\n/**\n * Creates an in-memory storage adapter.\n * Useful for testing and development.\n *\n * Data is lost when the process exits.\n *\n * @example\n * ```typescript\n * import { createMemoryStorage, createConfig } from 'panoptic-v2-sdk'\n *\n * const config = createConfig({\n * chainId: 1n,\n * transport: http('...'),\n * poolAddress: '0x...',\n * storage: createMemoryStorage(),\n * })\n * ```\n */\nexport function createMemoryStorage(): StorageAdapter {\n const store = new Map<string, string>()\n\n return {\n async get(key: string): Promise<string | null> {\n return store.get(key) ?? null\n },\n\n async set(key: string, value: string): Promise<void> {\n store.set(key, value)\n },\n\n async delete(key: string): Promise<void> {\n store.delete(key)\n },\n\n async has(key: string): Promise<boolean> {\n return store.has(key)\n },\n\n async keys(prefix: string): Promise<string[]> {\n const result: string[] = []\n for (const key of store.keys()) {\n if (key.startsWith(prefix)) {\n result.push(key)\n }\n }\n return result\n },\n\n async clear(prefix: string): Promise<void> {\n const keysToDelete: string[] = []\n for (const key of store.keys()) {\n if (key.startsWith(prefix)) {\n keysToDelete.push(key)\n }\n }\n for (const key of keysToDelete) {\n store.delete(key)\n }\n },\n }\n}\n","/**\n * BigInt-safe JSON serialization for the Panoptic v2 SDK.\n * Compatible with superjson patterns for SSR hydration.\n * @module v2/storage/serializer\n */\n\n/**\n * Tagged value for BigInt serialization.\n * Format compatible with superjson for Next.js/Remix SSR.\n */\ninterface BigIntTagged {\n __type: 'bigint'\n value: string\n}\n\n/**\n * Type guard to check if a value is a tagged BigInt.\n */\nfunction isBigIntTagged(value: unknown): value is BigIntTagged {\n return (\n value !== null &&\n typeof value === 'object' &&\n '__type' in value &&\n (value as BigIntTagged).__type === 'bigint' &&\n 'value' in value &&\n typeof (value as BigIntTagged).value === 'string'\n )\n}\n\n/**\n * Replacer function for JSON.stringify that tags BigInt values.\n */\nfunction replacer(_key: string, value: unknown): unknown {\n if (typeof value === 'bigint') {\n return {\n __type: 'bigint',\n value: value.toString(),\n } satisfies BigIntTagged\n }\n return value\n}\n\n/**\n * Reviver function for JSON.parse that restores tagged BigInt values.\n */\nfunction reviver(_key: string, value: unknown): unknown {\n if (isBigIntTagged(value)) {\n return BigInt(value.value)\n }\n return value\n}\n\n/**\n * BigInt-safe JSON serializer for the Panoptic v2 SDK.\n *\n * This serializer handles BigInt values by tagging them with a special format\n * that can be restored on parse. The format is compatible with superjson\n * patterns used in Next.js and Remix for SSR hydration.\n *\n * @example\n * ```typescript\n * import { jsonSerializer } from 'panoptic-v2-sdk'\n *\n * const data = { amount: 1000000000000000000n, nested: { value: 42n } }\n *\n * // Serialize to JSON string\n * const json = jsonSerializer.stringify(data)\n * // '{\"amount\":{\"__type\":\"bigint\",\"value\":\"1000000000000000000\"},\"nested\":{\"value\":{\"__type\":\"bigint\",\"value\":\"42\"}}}'\n *\n * // Parse back to original types\n * const parsed = jsonSerializer.parse(json)\n * // { amount: 1000000000000000000n, nested: { value: 42n } }\n * ```\n */\nexport const jsonSerializer = {\n /**\n * Serialize a value to a JSON string, handling BigInt values.\n *\n * @param value - The value to serialize\n * @param space - Optional indentation (same as JSON.stringify)\n * @returns JSON string with BigInt values tagged\n */\n stringify(value: unknown, space?: string | number): string {\n return JSON.stringify(value, replacer, space)\n },\n\n /**\n * Parse a JSON string, restoring tagged BigInt values.\n *\n * @param text - The JSON string to parse\n * @returns The parsed value with BigInt values restored\n */\n parse(text: string): unknown {\n return JSON.parse(text, reviver)\n },\n} as const\n","/**\n * Snapshot recovery from dispatch calldata.\n * @module v2/sync/snapshotRecovery\n */\n\nimport type { AbiFunction, Address, Hash, Hex, PublicClient } from 'viem'\nimport { decodeFunctionData, getAddress, parseAbi, toFunctionSelector } from 'viem'\n\nimport { panopticPoolV2Abi } from '../../../generated'\n\nconst LOG_SCAN_WINDOW = 10_000n\nconst rolesExecutionAbi = parseAbi([\n 'function execTransactionWithRole(address to, uint256 value, bytes data, uint8 operation, bytes32 roleKey, bool shouldRevert)',\n])\n\ntype SnapshotEventLog = Awaited<ReturnType<PublicClient['getLogs']>>[number]\ntype SnapshotCandidateEvent = SnapshotEventLog & {\n transactionHash: Hash\n blockNumber: bigint\n logIndex: number\n}\n\n/**\n * Parameters for recovering position snapshot from dispatch calldata.\n */\nexport interface RecoverSnapshotParams {\n /** viem public client */\n client: PublicClient\n /** Pool address */\n poolAddress: Address\n /** Account to recover positions for */\n account: Address\n /** Starting block for transaction search (defaults to 0) */\n fromBlock?: bigint\n /** Ending block for transaction search (defaults to latest) */\n toBlock?: bigint\n}\n\n/**\n * Snapshot recovery result.\n */\nexport interface SnapshotRecoveryResult {\n /** Whether recovery was successful */\n success: boolean\n /** Position IDs from the final position list */\n positionIds: bigint[]\n /** Block number of the recovery transaction */\n blockNumber: bigint\n /** Block hash of the recovery transaction */\n blockHash: Hash\n /** Transaction hash used for recovery */\n transactionHash: Hash\n}\n\n/**\n * Recover position snapshot from the last dispatch transaction.\n * This is the primary recovery method - it finds the most recent dispatch()\n * call and extracts the finalPositionIdList from the calldata.\n *\n * @param params - Recovery parameters\n * @returns Snapshot recovery result\n */\nexport async function recoverSnapshot(\n params: RecoverSnapshotParams,\n): Promise<SnapshotRecoveryResult | null> {\n const { client, poolAddress, account, toBlock } = params\n\n // Get the latest block if not specified\n const latestBlock = toBlock ?? (await client.getBlockNumber())\n\n // Search for transactions from the account to the pool\n // We need to find dispatch() or dispatchFrom() calls\n // Note: This requires the account to have sent transactions directly,\n // or we need to look at internal transactions\n\n // Strategy: Look for OptionMinted or OptionBurnt events to find transactions,\n // then decode the transaction input to get the full position list\n\n const searchFromBlock = params.fromBlock ?? 0n\n if (latestBlock < searchFromBlock) return null\n\n // Fast path: a single getLogs per event type over the entire\n // [searchFromBlock, latest] range. The queries are filtered by `address` and\n // an indexed account topic, so providers like Alchemy impose no block-range\n // cap on them (only a result-count cap) — one call per event type is enough\n // and the returned set is already complete, so there are no older windows to\n // scan. This avoids walking the whole chain in 10k-block chunks (4 getLogs\n // per chunk), which for accounts with no history is thousands of empty calls.\n try {\n const events = await getSnapshotEventsForWindow({\n client,\n poolAddress,\n account,\n fromBlock: searchFromBlock,\n toBlock: latestBlock,\n })\n return await recoverSnapshotFromEvents({ client, account, events })\n } catch (error) {\n // Only fall back to windowed scanning when the provider rejected the wide\n // range. Any other error (e.g. transport failure) should propagate.\n if (!isRangeLimitError(error)) throw error\n }\n\n // Fallback for providers that cap getLogs block range: scan newest-to-oldest\n // in 10k-block windows and stop at the first window that yields a snapshot.\n let windowToBlock = latestBlock\n while (true) {\n const windowFromBlock =\n windowToBlock - searchFromBlock + 1n > LOG_SCAN_WINDOW\n ? windowToBlock - LOG_SCAN_WINDOW + 1n\n : searchFromBlock\n\n const events = await getSnapshotEventsForWindow({\n client,\n poolAddress,\n account,\n fromBlock: windowFromBlock,\n toBlock: windowToBlock,\n })\n const snapshot = await recoverSnapshotFromEvents({ client, account, events })\n if (snapshot) return snapshot\n\n if (windowFromBlock === searchFromBlock) break\n windowToBlock = windowFromBlock - 1n\n }\n\n // No snapshot found\n return null\n}\n\n/**\n * Detect provider errors that indicate the requested getLogs block range was\n * too wide (so the caller should retry with smaller windows). Covers the common\n * phrasings used by Alchemy, Infura, and other JSON-RPC providers.\n */\nfunction isRangeLimitError(error: unknown): boolean {\n const parts: string[] = []\n let current: unknown = error\n let depth = 0\n while (current && typeof current === 'object' && depth < 5) {\n const obj = current as Record<string, unknown>\n if (typeof obj.message === 'string') parts.push(obj.message)\n if (typeof obj.details === 'string') parts.push(obj.details)\n current = obj.cause\n depth += 1\n }\n if (typeof error === 'string') parts.push(error)\n\n const message = parts.join(' ').toLowerCase()\n if (!message) return false\n\n return (\n message.includes('block range') ||\n message.includes('range is too large') ||\n message.includes('range too large') ||\n message.includes('query returned more than') ||\n message.includes('too many results') ||\n message.includes('log response size exceeded') ||\n message.includes('exceeds the limit') ||\n (message.includes('range') && message.includes('limit'))\n )\n}\n\nasync function getSnapshotEventsForWindow(params: {\n client: PublicClient\n poolAddress: Address\n account: Address\n fromBlock: bigint\n toBlock: bigint\n}): Promise<SnapshotEventLog[]> {\n const { client, poolAddress, account, fromBlock, toBlock } = params\n\n // OptionMinted/OptionBurnt cover the account's own dispatches.\n // ForcedExercised/AccountLiquidated cover third-party dispatchFrom calls\n // where the tx sender is not the account but calldata contains the final list.\n const [mintEvents, burnEvents, forceExerciseEvents, liquidationEvents] = await Promise.all([\n client.getLogs({\n address: poolAddress,\n event: {\n type: 'event',\n name: 'OptionMinted',\n inputs: [\n { type: 'address', name: 'recipient', indexed: true },\n { type: 'uint256', name: 'tokenId', indexed: true },\n { type: 'uint256', name: 'balanceData', indexed: false },\n ],\n },\n args: {\n recipient: account,\n },\n fromBlock,\n toBlock,\n }),\n client.getLogs({\n address: poolAddress,\n event: {\n type: 'event',\n name: 'OptionBurnt',\n inputs: [\n { type: 'address', name: 'recipient', indexed: true },\n { type: 'uint128', name: 'positionSize', indexed: false },\n { type: 'uint256', name: 'tokenId', indexed: true },\n { type: 'int256[4]', name: 'premiaByLeg', indexed: false },\n ],\n },\n args: {\n recipient: account,\n },\n fromBlock,\n toBlock,\n }),\n client.getLogs({\n address: poolAddress,\n event: {\n type: 'event',\n name: 'ForcedExercised',\n inputs: [\n { type: 'address', name: 'exercisor', indexed: true },\n { type: 'address', name: 'user', indexed: true },\n { type: 'uint256', name: 'tokenId', indexed: true },\n { type: 'int256', name: 'exerciseFee', indexed: false },\n ],\n },\n args: {\n user: account,\n },\n fromBlock,\n toBlock,\n }),\n client.getLogs({\n address: poolAddress,\n event: {\n type: 'event',\n name: 'AccountLiquidated',\n inputs: [\n { type: 'address', name: 'liquidator', indexed: true },\n { type: 'address', name: 'liquidatee', indexed: true },\n { type: 'int256', name: 'bonusAmounts', indexed: false },\n ],\n },\n args: {\n liquidatee: account,\n },\n fromBlock,\n toBlock,\n }),\n ])\n\n return [...mintEvents, ...burnEvents, ...forceExerciseEvents, ...liquidationEvents]\n}\n\nasync function recoverSnapshotFromEvents(params: {\n client: PublicClient\n account: Address\n events: SnapshotEventLog[]\n}): Promise<SnapshotRecoveryResult | null> {\n const { client, account, events } = params\n\n // Combine and sort by block number (descending) to get most recent first\n const allEvents = events.filter(isSnapshotCandidateEvent).sort((a, b) => {\n const blockDiff = Number(b.blockNumber - a.blockNumber)\n if (blockDiff !== 0) return blockDiff\n return Number(b.logIndex - a.logIndex)\n })\n\n // Deduplicate by transaction hash — multiple events from the same tx\n // (e.g. OptionMinted for each leg) would produce duplicate entries\n const seen = new Set<string>()\n const uniqueEvents = allEvents.filter((e) => {\n if (seen.has(e.transactionHash)) return false\n seen.add(e.transactionHash)\n return true\n })\n\n // Find the most recent transaction with position data\n for (const event of uniqueEvents) {\n try {\n const [tx, block] = await Promise.all([\n client.getTransaction({ hash: event.transactionHash }),\n client.getBlock({ blockNumber: event.blockNumber }),\n ])\n\n // A single tx (e.g. a force-exercise multicall) can embed several\n // dispatch/dispatchFrom calls — the exercisor's own dispatch alongside the\n // victim's dispatchFrom. Select a strict account match first, then allow a\n // plain dispatch only because this tx came from an account-indexed event.\n const candidates = decodeAllDispatchCalldata(tx.input)\n const decoded =\n selectDispatchForAccount(candidates, account, tx.from) ??\n selectDispatchProvenByAccountEvent(candidates)\n if (!decoded) {\n continue\n }\n\n return {\n success: true,\n positionIds: decoded.positionIds,\n blockNumber: event.blockNumber,\n blockHash: block.hash,\n transactionHash: event.transactionHash,\n }\n } catch {\n // Transaction fetch failed, continue\n }\n }\n\n return null\n}\n\nfunction isSnapshotCandidateEvent(event: SnapshotEventLog): event is SnapshotCandidateEvent {\n return event.transactionHash !== null && event.blockNumber !== null && event.logIndex !== null\n}\n\n/**\n * Parameters for recovering a snapshot from a known transaction hash.\n */\nexport interface RecoverSnapshotFromTxParams {\n /** viem public client */\n client: PublicClient\n /** Transaction hash of a known dispatch() call */\n transactionHash: Hash\n /** Account to verify. When set, rejects transactions not sent by (or targeting) this account. */\n account?: Address\n /** Pool address to validate against. When set, rejects transactions not sent to this pool. */\n pool?: Address\n /** Expected Zodiac Roles wrapper for bot-originated Safe dispatches. */\n rolesContext?: {\n modifier: Address\n member: Address\n roleKey: Hash\n }\n}\n\nexport interface RolesSnapshotContext {\n modifier: Address\n member: Address\n roleKey: Hash\n}\n\nexport function decodeSnapshotTransaction(params: {\n input: Hex\n from: Address\n to: Address | null\n account?: Address\n pool?: Address\n rolesContext?: RolesSnapshotContext\n}): DispatchCalldata | null {\n const { account, pool, rolesContext } = params\n let dispatchInput = params.input\n let dispatchSender = params.from\n\n if (rolesContext) {\n if (\n params.to === null ||\n getAddress(params.to) !== getAddress(rolesContext.modifier) ||\n getAddress(params.from) !== getAddress(rolesContext.member)\n ) {\n return null\n }\n try {\n const decodedRoleCall = decodeFunctionData({ abi: rolesExecutionAbi, data: params.input })\n const [target, value, data, operation, roleKey, shouldRevert] = decodedRoleCall.args\n if (\n !pool ||\n getAddress(target) !== getAddress(pool) ||\n value !== 0n ||\n operation !== 0 ||\n roleKey.toLowerCase() !== rolesContext.roleKey.toLowerCase() ||\n !shouldRevert\n ) {\n return null\n }\n dispatchInput = data\n if (!account) return null\n dispatchSender = account\n } catch {\n return null\n }\n } else if (pool && (params.to === null || getAddress(params.to) !== getAddress(pool))) {\n return null\n }\n\n const candidates = decodeAllDispatchCalldata(dispatchInput)\n if (candidates.length === 0) return null\n return account\n ? selectDispatchForAccount(candidates, account, dispatchSender)\n : candidates[candidates.length - 1]\n}\n\n/**\n * Recover position snapshot from a specific dispatch transaction hash.\n *\n * This is an O(1) alternative to {@link recoverSnapshot} when you already\n * know the tx hash of the most recent dispatch. It fetches the transaction,\n * decodes the `finalPositionIdList` from the calldata, and returns the result\n * — no event scanning required.\n *\n * @param params - Recovery parameters including the transaction hash\n * @returns Snapshot recovery result, or null if the tx is not a dispatch call\n *\n * @example\n * ```typescript\n * const snapshot = await recoverSnapshotFromTx({\n * client,\n * transactionHash: '0xabc...',\n * })\n * if (snapshot) {\n * console.log('Open positions:', snapshot.positionIds)\n * }\n * ```\n */\nexport async function recoverSnapshotFromTx(\n params: RecoverSnapshotFromTxParams,\n): Promise<SnapshotRecoveryResult | null> {\n const { client, transactionHash, account, pool, rolesContext } = params\n\n const tx = await client.getTransaction({ hash: transactionHash })\n\n // Pending transactions have no block number — cannot recover snapshot\n if (tx.blockNumber == null) return null\n\n const decoded = decodeSnapshotTransaction({\n input: tx.input,\n from: tx.from,\n to: tx.to,\n account,\n pool,\n rolesContext,\n })\n if (!decoded) return null\n\n const blockNumber = tx.blockNumber\n const block = await client.getBlock({ blockNumber })\n\n return {\n success: true,\n positionIds: decoded.positionIds,\n blockNumber,\n blockHash: block.hash,\n transactionHash,\n }\n}\n\n/**\n * Decoded dispatch calldata result.\n */\nexport interface DispatchCalldata {\n /** Final position ID list after the dispatch */\n positionIds: bigint[]\n /** Target account (only set for dispatchFrom) */\n targetAccount?: Address\n}\n\n/**\n * Decode position IDs from dispatch calldata.\n *\n * When the tx embeds multiple dispatch/dispatchFrom calls (e.g. a force-exercise\n * multicall), this returns the last one — prefer {@link decodeAllDispatchCalldata}\n * plus {@link selectDispatchForAccount} when the account context matters.\n *\n * @param input - Transaction input data\n * @returns Decoded dispatch data or null if not a dispatch call\n */\nexport function decodeDispatchCalldata(input: `0x${string}`): DispatchCalldata | null {\n const all = decodeAllDispatchCalldata(input)\n return all.length > 0 ? all[all.length - 1] : null\n}\n\n/**\n * Decode every dispatch/dispatchFrom call embedded in transaction calldata.\n *\n * A single tx can carry more than one such call — most importantly a force-exercise\n * `multicall` that bundles the exercisor's own `dispatch` together with the victim's\n * `dispatchFrom`. Returning all candidates lets the caller select the one attributable\n * to the relevant account ({@link selectDispatchForAccount}).\n *\n * @param input - Transaction input data\n * @returns All decoded dispatch calls, in calldata order (may be empty)\n */\nexport function decodeAllDispatchCalldata(input: `0x${string}`): DispatchCalldata[] {\n // Try direct dispatch/dispatchFrom first\n const direct = decodeDirectDispatch(input)\n if (direct) return [direct]\n\n // Try unwrapping smart contract wallet wrappers (executeBatch, execute, multicall)\n return decodeWrappedDispatch(input)\n}\n\n/**\n * Select the dispatch call attributable to `account` from a set of candidates.\n *\n * - `dispatchFrom`: matches when `targetAccount === account` (builder/exercisor acting\n * on behalf of the account).\n * - `dispatch` (no `targetAccount`): matches only when the tx sender is the account.\n *\n * Returns the LAST matching candidate (in calldata order), or null when none are\n * attributable to `account`. The last dispatch reflects the final post-transaction\n * state when a single tx contains multiple dispatches for the same account (e.g. a\n * multicall). Matching also prevents accepting a third party's `dispatch` (e.g. the\n * exercisor's own, bundled in a force-exercise multicall) as the account's snapshot.\n *\n * @param candidates - Decoded dispatch calls from a single tx, in calldata order\n * @param account - Account whose position list we are recovering\n * @param txFrom - The transaction sender (`tx.from`)\n */\nexport function selectDispatchForAccount(\n candidates: DispatchCalldata[],\n account: Address,\n txFrom: Address,\n): DispatchCalldata | null {\n const acct = account.toLowerCase()\n let match: DispatchCalldata | null = null\n for (const candidate of candidates) {\n if (candidate.targetAccount) {\n if (candidate.targetAccount.toLowerCase() === acct) match = candidate\n } else if (txFrom.toLowerCase() === acct) {\n match = candidate\n }\n }\n return match\n}\n\nfunction selectDispatchProvenByAccountEvent(\n candidates: DispatchCalldata[],\n): DispatchCalldata | null {\n let match: DispatchCalldata | null = null\n for (const candidate of candidates) {\n if (candidate.targetAccount === undefined) match = candidate\n }\n return match\n}\n\n/**\n * Try to decode input as a direct dispatch or dispatchFrom call.\n */\nfunction decodeDirectDispatch(input: `0x${string}`): DispatchCalldata | null {\n try {\n const decoded = decodeFunctionData({\n abi: panopticPoolV2Abi,\n data: input,\n })\n\n if (decoded.functionName === 'dispatch') {\n const args = decoded.args as readonly [\n bigint[],\n bigint[],\n bigint[],\n readonly [number, number, number][],\n boolean,\n bigint,\n ]\n return { positionIds: [...args[1]] } // finalPositionIdList\n }\n\n if (decoded.functionName === 'dispatchFrom') {\n const args = decoded.args as readonly [bigint[], Address, bigint[], bigint[], bigint]\n return {\n positionIds: [...args[3]], // positionIdListToFinal\n targetAccount: args[1],\n }\n }\n\n return null\n } catch {\n return null\n }\n}\n\n/**\n * 4-byte function selectors for dispatch/dispatchFrom, derived from the generated ABI.\n * Used for scanning raw calldata inside smart contract wallet wrappers.\n */\nconst DISPATCH_SELECTOR = toFunctionSelector(\n panopticPoolV2Abi.find((e) => e.type === 'function' && e.name === 'dispatch') as AbiFunction,\n).slice(2) // strip 0x prefix for hex scanning\n\nconst DISPATCH_FROM_SELECTOR = toFunctionSelector(\n panopticPoolV2Abi.find((e) => e.type === 'function' && e.name === 'dispatchFrom') as AbiFunction,\n).slice(2)\n\n/**\n * Scan raw transaction input for embedded dispatch calldata.\n *\n * Smart contract wallets (Safe, Turnkey, ERC-4337) and vault managers\n * wrap dispatch calls inside executeBatch → manage → dispatch chains.\n * Instead of decoding each wrapper layer, we scan the raw hex for the\n * dispatch function selector and attempt to decode from that offset.\n *\n * This handles arbitrary nesting depth without knowing wrapper ABIs.\n */\nfunction decodeWrappedDispatch(input: `0x${string}`): DispatchCalldata[] {\n const hex = input.slice(2).toLowerCase()\n const selectors = [DISPATCH_SELECTOR, DISPATCH_FROM_SELECTOR]\n\n // Single left-to-right pass: find the earliest selector match at each offset and\n // collect every successful decode, in calldata order. The caller selects the call\n // attributable to the relevant account rather than blindly taking one.\n const results: DispatchCalldata[] = []\n let offset = 0\n\n while (offset < hex.length) {\n // Find the nearest selector match from current offset\n let earliestIdx = -1\n for (const selector of selectors) {\n const idx = hex.indexOf(selector, offset)\n if (idx !== -1 && (earliestIdx === -1 || idx < earliestIdx)) {\n earliestIdx = idx\n }\n }\n if (earliestIdx === -1) break\n\n const candidate = `0x${hex.slice(earliestIdx)}` as `0x${string}`\n const result = decodeDirectDispatch(candidate)\n if (result) results.push(result)\n\n offset = earliestIdx + 8 // Move past this selector\n }\n\n return results\n}\n","/**\n * Get tracked position IDs from local cache.\n * @module v2/sync/getTrackedPositionIds\n */\n\nimport type { Address, Hash, PublicClient } from 'viem'\n\nimport { panopticPoolV2Abi } from '../../../generated'\nimport type { StorageAdapter } from '../storage'\nimport { getPositionsKey, jsonSerializer } from '../storage'\nimport {\n type SnapshotRecoveryResult,\n recoverSnapshot,\n recoverSnapshotFromTx,\n} from './snapshotRecovery'\n\n/**\n * Verify that a recovered position-id list still matches the account's current\n * on-chain state. `getFullPositionsData` reverts when the list contains a\n * tokenId the account no longer holds, so a successful call is proof the list\n * is live. Returns `false` on revert so the caller can fall back to an\n * authoritative event scan instead of trusting a stale checkpoint.\n */\nasync function isPositionListLive(params: {\n client: PublicClient\n poolAddress: Address\n account: Address\n positionIds: bigint[]\n blockNumber?: bigint\n}): Promise<boolean> {\n const { client, poolAddress, account, positionIds, blockNumber } = params\n // An empty list is always a valid (positionless) state — no need to probe.\n if (positionIds.length === 0) return true\n try {\n await client.readContract({\n address: poolAddress,\n abi: panopticPoolV2Abi,\n functionName: 'getFullPositionsData',\n args: [account, false, positionIds],\n blockNumber,\n })\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Parameters for getTrackedPositionIds.\n */\nexport interface GetTrackedPositionIdsParams {\n /** Chain ID */\n chainId: bigint\n /** Pool address */\n poolAddress: Address\n /** Account to get positions for */\n account: Address\n /** Storage adapter */\n storage: StorageAdapter\n}\n\n/**\n * Get all tracked position IDs for an account from local cache.\n *\n * This function reads from the storage adapter without making RPC calls.\n * The positions returned may include closed positions if the cache is stale.\n * Use `getPositions()` for authoritative on-chain data.\n *\n * @param params - Query parameters\n * @returns Array of position token IDs\n */\nexport async function getTrackedPositionIds(\n params: GetTrackedPositionIdsParams,\n): Promise<bigint[]> {\n const { chainId, poolAddress, account, storage } = params\n\n const key = getPositionsKey(chainId, poolAddress, account)\n const data = await storage.get(key)\n\n if (!data) {\n return []\n }\n\n try {\n const positionIds = jsonSerializer.parse(data) as bigint[]\n return positionIds\n } catch {\n // Corrupted data, return empty\n return []\n }\n}\n\n/**\n * Check if a specific position ID is tracked.\n *\n * @param params - Query parameters\n * @param tokenId - Token ID to check\n * @returns Whether the position is tracked\n */\nexport async function isPositionTracked(\n params: GetTrackedPositionIdsParams,\n tokenId: bigint,\n): Promise<boolean> {\n const positionIds = await getTrackedPositionIds(params)\n return positionIds.some((id) => id === tokenId)\n}\n\n/**\n * Clear all tracked positions for an account.\n *\n * @param params - Query parameters\n */\nexport async function clearTrackedPositions(params: GetTrackedPositionIdsParams): Promise<void> {\n const { chainId, poolAddress, account, storage } = params\n\n const key = getPositionsKey(chainId, poolAddress, account)\n await storage.delete(key)\n}\n\n/**\n * Parameters for getOpenPositionIds.\n */\nexport interface GetOpenPositionIdsParams {\n /** viem PublicClient */\n client: PublicClient\n /** Chain ID */\n chainId: bigint\n /** Pool address */\n poolAddress: Address\n /** Account to get positions for */\n account: Address\n /** Storage adapter (used to update local cache with the authoritative list) */\n storage?: StorageAdapter\n /**\n * Transaction hash of a known dispatch() call. When provided, the position\n * list is decoded directly from this tx's calldata (O(1)) instead of\n * scanning events to find the most recent dispatch.\n */\n lastDispatchTxHash?: Hash\n /**\n * Starting block for event scanning in recoverSnapshot.\n * When set, limits the getLogs window to [fromBlock, latest] instead of\n * scanning from block 0. Use the checkpoint's lastBlock for incremental syncs.\n */\n fromBlock?: bigint\n /** Upper bound for fallback event recovery. */\n toBlock?: bigint\n /** Expected Zodiac Roles wrapper for a bot-relayed Safe dispatch. */\n rolesContext?: {\n modifier: Address\n member: Address\n roleKey: Hash\n }\n}\n\n/**\n * Get the authoritative list of open position IDs from the chain.\n *\n * Recovers the `finalPositionIdList` from the account's most recent\n * `dispatch()` transaction calldata. This is the on-chain–validated set of\n * open positions (verified against `s_positionsHash` by the contract) and\n * requires only a few RPC calls regardless of account history length.\n *\n * This is the recommended way to get position IDs for `existingPositionIds`\n * (openPosition) and `positionIdList` (closePosition).\n *\n * If `storage` is provided, the local cache is updated with the result.\n *\n * @param params - Query parameters\n * @returns Array of currently open position token IDs, or null if no snapshot was found\n */\nexport async function getOpenPositionIds(\n params: GetOpenPositionIdsParams,\n): Promise<bigint[] | null> {\n const {\n client,\n chainId,\n poolAddress,\n account,\n storage,\n lastDispatchTxHash,\n fromBlock,\n toBlock,\n rolesContext,\n } = params\n\n // Fast path: decode directly from a known tx hash (O(1), no event scanning).\n // The tx's finalPositionIdList only reflects state as of THAT dispatch — if\n // positions changed afterwards (e.g. a dispatch this caller never recorded),\n // the list is stale and would revert downstream reads. So we validate the\n // recovered list against current on-chain state and fall through to the\n // authoritative event scan when it no longer matches.\n let snapshot: SnapshotRecoveryResult | null = null\n if (lastDispatchTxHash) {\n try {\n const candidate = await recoverSnapshotFromTx({\n client,\n transactionHash: lastDispatchTxHash,\n account,\n pool: poolAddress,\n rolesContext,\n })\n if (\n candidate &&\n (await isPositionListLive({\n client,\n poolAddress,\n account,\n positionIds: candidate.positionIds,\n blockNumber: toBlock,\n }))\n ) {\n snapshot = candidate\n }\n } catch {\n // Fast path failed (e.g. RPC error, validation mismatch); fall through to slow-path\n snapshot = null\n }\n }\n\n if (!snapshot) {\n snapshot = await recoverSnapshot({ client, poolAddress, account, fromBlock, toBlock })\n }\n\n if (!snapshot) {\n return null\n }\n\n // Update local cache if storage provided\n if (storage) {\n const key = getPositionsKey(chainId, poolAddress, account)\n await storage.set(key, jsonSerializer.stringify(snapshot.positionIds))\n }\n\n return snapshot.positionIds\n}\n"],"mappings":";;;;AAIA,MAAa,yBAAyB;CACpC;EAAE,MAAM;EAAe,QAAQ,CAAE;EAAE,iBAAiB;CAAc;CAClE;EACE,MAAM;EACN,QAAQ,CAAE;EACV,MAAM;EACN,SAAS,CAAE;EACX,iBAAiB;CAClB;CACD;EACE,MAAM;EACN,QAAQ,CACN;GAAE,MAAM;GAAS,cAAc;GAAW,MAAM;EAAW,GAC3D;GAAE,MAAM;GAAW,cAAc;GAAW,MAAM;EAAW,CAC9D;EACD,MAAM;EACN,SAAS,CAAC;GAAE,MAAM;GAAa,cAAc;GAAW,MAAM;EAAW,CAAC;EAC1E,iBAAiB;CAClB;CACD;EACE,MAAM;EACN,QAAQ,CACN;GAAE,MAAM;GAAW,cAAc;GAAW,MAAM;EAAW,GAC7D;GAAE,MAAM;GAAU,cAAc;GAAW,MAAM;EAAW,CAC7D;EACD,MAAM;EACN,SAAS,CAAC;GAAE,MAAM;GAAI,cAAc;GAAQ,MAAM;EAAQ,CAAC;EAC3D,iBAAiB;CAClB;CAC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d,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IAAE,MA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X,iBAAiB;CAClB;CACD;EACE,MAAM;EACN,QAAQ,CAAC;GAAE,MAAM;GAAI,cAAc;GAA2B,MAAM;EAAW,CAAC;EAChF,MAAM;EACN,SAAS,CAAC;GAAE,MAAM;GAAI,cAAc;GAAW,MAAM;EAAW,CAAC;EACjE,iBAAiB;CAClB;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ,CACN;GACE,MAAM;GACN,cAAc;GACd,MAAM;GACN,SAAS;EACV,CACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ,CACN;GACE,MAAM;GACN,cAAc;GACd,MAAM;GACN,SAAS;EACV,CACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ,CACN;GACE,MAAM;GACN,cAAc;GACd,MAAM;GACN,SAAS;EACV,GACD;GACE,MAAM;GACN,cAAc;GACd,MAAM;GACN,SAAS;EACV,CACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ,CACN;GACE,MAAM;GACN,cAAc;GACd,MAAM;GACN,SAAS;EACV,GACD;GACE,MAAM;GACN,cAAc;GACd,MAAM;GACN,SAAS;EACV,CACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ,CACN;GACE,MAAM;GACN,cAAc;GACd,MAAM;GACN,SAAS;EACV,CACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ,CACN;GACE,MAAM;GACN,cAAc;GACd,MAAM;GACN,SAAS;EACV,CACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ,C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c;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IAAE,MAAM;IAAQ,cAAc;IAAW,MAAM;IAAW,SAAS;GAAM;GACzE;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IAAE,MAAM;IAAQ,cAAc;IAAW,MAAM;IAAW,SAAS;GAAM;GACzE;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,QAAQ,CACN;GAAE,MAAM;GAAW,cAAc;GAAW,MAAM;EAAW,GAC7D;G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MAAM;EACN,QAAQ;GACN;IAAE,MAAM;IAAgB,cAAc;IAAU,MAAM;GAAU;GAChE;IAAE,MAAM;IAAgB,cAAc;IAAU,MAAM;GAAU;GAChE;IAAE,MAAM;IAAQ,cAAc;IAAS,MAAM;GAAS;EACvD;EACD,MAAM;EACN,SAAS,CAAE;EACX,iBAAiB;CAClB;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IAAE,MAAM;IAAY,cAAc;IAAQ,MAAM;IAAQ,SAAS;GAAO;EACzE;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IAAE,MAAM;IAAQ,cAAc;IAAW,MAAM;IAAW,SAAS;GAAM;GACzE;IAAE,MAAM;IAAM,cAAc;IAAW,MAAM;IAAW,SAAS;GAAM;GACvE;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IAAE,MAAM;IAAQ,cAAc;IAAW,MAAM;IAAW,SAAS;GAAM;GACzE;IAAE,MAAM;IAAM,cAAc;IAAW,MAAM;IAAW,SAAS;GAAM;GACvE;IAAE,MAAM;IAAM,cAAc;IAAW,MAAM;IAAW,SAAS;GAAO;GACxE;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EAAE,MAAM;EAAS,QAAQ,CA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zE;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IAAE,MAAM;IAAQ,cAAc;IAAU,MAAM;IAAW,SAAS;GAAM;GACxE;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IAAE,MAAM;IAAQ,cAAc;IAAU,MAAM;IAAW,SAAS;GAAM;GACxE;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;EACF;EACD,MAAM;CACP;CACD;EACE,MAAM;EACN,WAAW;EACX,QAAQ;GACN;IACE,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;GACV;GACD;IACE,MAAM;IACN,c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