@panoptic-eng/sdk 1.0.38 → 1.0.40
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 +804 -5
- package/dist/cow/index.d.ts.map +1 -0
- package/dist/cow/index.js +5268 -5
- package/dist/cow/index.js.map +1 -0
- package/dist/{cow-DB8siv6M.js → cow-tRUtAUZy.js} +2 -3
- package/dist/{getTrackedPositionIds-zYPIs5dt.js → getTrackedPositionIds-ms3W9dYB.js} +1 -2
- package/dist/greeks-GysWXct-.js +1 -2
- package/dist/index.d.ts +5752 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11952 -2130
- package/dist/index.js.map +1 -1
- package/dist/{irm-ChkvYphK.js → irm-SPC2KxLA.js} +321 -3
- package/dist/panoptic/v2/greeks/index.d.ts +277 -4
- package/dist/panoptic/v2/greeks/index.d.ts.map +1 -0
- package/dist/panoptic/v2/greeks/index.js +620 -2
- package/dist/panoptic/v2/greeks/index.js.map +1 -0
- package/dist/panoptic/v2/index.d.ts +14633 -7
- package/dist/panoptic/v2/index.d.ts.map +1 -0
- package/dist/panoptic/v2/index.js +27875 -9
- package/dist/panoptic/v2/index.js.map +1 -0
- package/dist/panoptic/v2/react-public.d.ts +14779 -15
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +29463 -89
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/{router-tCRa0ekE.js → router-BTfbaRfg.js} +2 -3
- package/dist/{router-BCUJkY8j.js → router-mLWy0MD9.js} +3 -4
- package/dist/test/index.d.ts +3 -3
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +2 -2
- package/dist/{transactionFees-CVi2TrJh.js → transactionFees-C_Qx07mx.js} +1 -2
- package/dist/uniswap/index.d.ts +813 -78
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +5884 -13
- package/dist/uniswap/index.js.map +1 -1
- package/dist/{v2-BxtzpUnV.js → v2-DG7qG6di.js} +4 -5
- package/dist/vault-transaction-fees.d.ts +63 -2
- package/dist/vault-transaction-fees.d.ts.map +1 -0
- package/dist/vault-transaction-fees.js +174 -2
- package/dist/vault-transaction-fees.js.map +1 -0
- package/dist/{writes-D3bj1wth.js → writes-Xp9Wa8GQ.js} +2 -3
- package/dist/zodiac/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/dist/cow/types.d.ts +0 -4
- package/dist/cow/types.js +0 -0
- package/dist/cow-DB8siv6M.js.map +0 -1
- package/dist/getTrackedPositionIds-zYPIs5dt.js.map +0 -1
- package/dist/greeks-GysWXct-.js.map +0 -1
- package/dist/hypoVault/vaultDisplayNames.d.ts +0 -2
- package/dist/hypoVault/vaultDisplayNames.js +0 -4
- package/dist/index-BhEBx83X.d.ts +0 -9760
- package/dist/index-BhEBx83X.d.ts.map +0 -1
- package/dist/index-Bo9tHtD7.d.ts +0 -1901
- package/dist/index-Bo9tHtD7.d.ts.map +0 -1
- package/dist/index-CttjEZ-S.d.ts +0 -275
- package/dist/index-CttjEZ-S.d.ts.map +0 -1
- package/dist/index-DktZq9Kb.d.ts +0 -261
- package/dist/index-DktZq9Kb.d.ts.map +0 -1
- package/dist/irm-ChkvYphK.js.map +0 -1
- package/dist/irm-D2WTHtuo.d.ts +0 -5667
- package/dist/irm-D2WTHtuo.d.ts.map +0 -1
- package/dist/irm-D5plRhpB.d.ts +0 -32
- package/dist/irm-D5plRhpB.d.ts.map +0 -1
- package/dist/panoptic/v2/types/index.d.ts +0 -3
- package/dist/panoptic/v2/types/index.js +0 -0
- package/dist/quote-DeHNUR0Z.d.ts +0 -52
- package/dist/quote-DeHNUR0Z.d.ts.map +0 -1
- package/dist/router-BCUJkY8j.js.map +0 -1
- package/dist/router-tCRa0ekE.js.map +0 -1
- package/dist/src-CRAtPwWk.js +0 -321
- package/dist/src-CRAtPwWk.js.map +0 -1
- package/dist/transactionFees-CVi2TrJh.js.map +0 -1
- package/dist/transactionFees-DzDyt50k.d.ts +0 -63
- package/dist/transactionFees-DzDyt50k.d.ts.map +0 -1
- package/dist/types-Cad5m4Td.d.ts +0 -246
- package/dist/types-Cad5m4Td.d.ts.map +0 -1
- package/dist/types-DM0nxlZr.d.ts +0 -128
- package/dist/types-DM0nxlZr.d.ts.map +0 -1
- package/dist/v2-BxtzpUnV.js.map +0 -1
- package/dist/vaultDisplayNames-CKpz51Hu.js +0 -0
- package/dist/vaultDisplayNames-Q6htUcch.d.ts +0 -2
- package/dist/writes-D3bj1wth.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MulticallNoDataError, MulticallResultFailedError, MulticallResultMissingError, PanopticValidationError
|
|
1
|
+
import { MulticallNoDataError, MulticallResultFailedError, MulticallResultMissingError, PanopticValidationError, collateralTrackerV2Abi, decodeLeftRightUnsigned, getBlockMeta, getPool, getPositions, panopticPoolV2Abi, riskEngineAbi } from "./getTrackedPositionIds-ms3W9dYB.js";
|
|
2
2
|
import { tickToSqrtPriceX96 } from "./greeks-GysWXct-.js";
|
|
3
3
|
import { decodeFunctionResult, encodeFunctionData } from "viem";
|
|
4
4
|
import { call } from "viem/actions";
|
|
@@ -2285,6 +2285,325 @@ async function getInterestState(params) {
|
|
|
2285
2285
|
};
|
|
2286
2286
|
}
|
|
2287
2287
|
|
|
2288
|
+
//#endregion
|
|
2289
|
+
//#region ../deployments/src/chainDeployments.data.json
|
|
2290
|
+
var _1 = {
|
|
2291
|
+
"chainId": 1,
|
|
2292
|
+
"infrastructure": {
|
|
2293
|
+
"uniswapV3Factory": "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
2294
|
+
"poolManager": "0x000000000004444c5dc75cB358380D2e3dE08A90",
|
|
2295
|
+
"stateView": "0x7ffe42c4a5deea5b0fec41c94c136cf115597227"
|
|
2296
|
+
},
|
|
2297
|
+
"hypovault": {
|
|
2298
|
+
"core": {
|
|
2299
|
+
"hypoVaultImplementation": "0xF16714665955DBd0361D997eFc50fe391D96E8D0",
|
|
2300
|
+
"factory": "0xd5049B2647de57141dE7F65E5124707B99A452A3",
|
|
2301
|
+
"accountant": "0x65aA902AE3135658587FFC36ED51B61c927114e1",
|
|
2302
|
+
"rolesAuthority": "0xb952D345c413Ddb7850173422bAe4968e0330598",
|
|
2303
|
+
"collateralTrackerDecoderAndSanitizer": "0xC87c45d2dbE5acb56013e2591427ECC84Fa251E6"
|
|
2304
|
+
},
|
|
2305
|
+
"vaults": {
|
|
2306
|
+
"wethPlpVault": "0xd4e2c720a760049cc4151bcf61e3a9348db9cd92",
|
|
2307
|
+
"usdcPlpVault": "0x236d0558f06cd60780b232d4Ec4c92d2cb7e4D18"
|
|
2308
|
+
},
|
|
2309
|
+
"managers": {
|
|
2310
|
+
"wethPlpVaultManager": "0xB6Fc48e658C9B1a7dbdFA51A5E153ab60BB2e04d",
|
|
2311
|
+
"usdcPlpVaultManager": "0x2ce65016366ef7320078e0758D58Cf1038bc7C4e"
|
|
2312
|
+
},
|
|
2313
|
+
"turnkeySigners": {
|
|
2314
|
+
"wethPlpVaultManager": "0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F",
|
|
2315
|
+
"usdcPlpVaultManager": "0x3c1c79d0cfc316Ba959194c89696a8382d7d283b"
|
|
2316
|
+
}
|
|
2317
|
+
},
|
|
2318
|
+
"panoptic": {
|
|
2319
|
+
"pool": {
|
|
2320
|
+
"version": "v4",
|
|
2321
|
+
"panopticPool": "0x00000000563b70d704f4c6675a5f6ac989fbae13",
|
|
2322
|
+
"collateralTracker0": "0x1e46b0289B7E0F710E2Db8Ab87800dd782D624f7",
|
|
2323
|
+
"collateralTracker1": "0x12bF31955522BAC337D93e1bC0a39F68D8BDa216"
|
|
2324
|
+
},
|
|
2325
|
+
"additionalPools": { "ethUsdc5bpsV3": {
|
|
2326
|
+
"version": "v3",
|
|
2327
|
+
"panopticPool": "0x00000000009C7B687e833559e34503f64d7ed7c4",
|
|
2328
|
+
"collateralTracker0": "0x3CCdA7d5E841d6543D90BcEc20b36a724C184DE9",
|
|
2329
|
+
"collateralTracker1": "0x69E9f9e44E5F52237493b980dd7306198C64A4E4"
|
|
2330
|
+
} },
|
|
2331
|
+
"v2": {
|
|
2332
|
+
"semiFungiblePositionManagerV4": "0x000000000000047534b9E1D528ED997169865a64",
|
|
2333
|
+
"semiFungiblePositionManagerV3": "0x000000000000031d296bBA22f188472157eEb01f",
|
|
2334
|
+
"builderFactory": "0x00000000000008D41F2cd5bF144F61cEB3661F98",
|
|
2335
|
+
"riskEngine": "0x0000000000000e673aECBDB5f5fE5DFAf4a8e9Ac",
|
|
2336
|
+
"panopticPoolImplementation": "0x00000000000010bb6695dAAC60D0515c0A01a948",
|
|
2337
|
+
"collateralTrackerImplementation": "0x0000000000002038055dB8f2B2Fd356598935C51",
|
|
2338
|
+
"panopticFactoryV4": "0x0000000000000c51d0f8cf4bd9adE7191372a625",
|
|
2339
|
+
"panopticFactoryV3": "0x0000000000000aDC9A108591e718F2aee963a2a7",
|
|
2340
|
+
"panopticHelper": "0x0000000000000000000000000000000000000000",
|
|
2341
|
+
"panopticMath": "0x000000000000301F5BC0171C75967b8e78a92b10",
|
|
2342
|
+
"panopticQuery": "0x0000000000000e1aE9c66C1c3B0A547D23389C93",
|
|
2343
|
+
"interactionHelper": "0x00000000000040ae7CD505F4E0e3F34195D8c08C"
|
|
2344
|
+
}
|
|
2345
|
+
},
|
|
2346
|
+
"riskEngines": [
|
|
2347
|
+
"0x000000000000075e29cdaa9cb640a69e148ca7da",
|
|
2348
|
+
"0x0000000000000fe1e261f66ce2f44def4f5ae0cb",
|
|
2349
|
+
"0x0000000000000e673aECBDB5f5fE5DFAf4a8e9Ac"
|
|
2350
|
+
],
|
|
2351
|
+
"markets": { "ethUsdc30bps": {
|
|
2352
|
+
"currency0": "0x0000000000000000000000000000000000000000",
|
|
2353
|
+
"currency1": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
2354
|
+
"fee": 3e3,
|
|
2355
|
+
"tickSpacing": 60,
|
|
2356
|
+
"poolId": "0x3C08AE4977F78D"
|
|
2357
|
+
} },
|
|
2358
|
+
"subgraphs": {
|
|
2359
|
+
"hypovault": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-mainnet/prod/gn",
|
|
2360
|
+
"panoptic": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-mainnet/v2_prod/gn"
|
|
2361
|
+
},
|
|
2362
|
+
"sfpmSwap": {
|
|
2363
|
+
"version": "v3",
|
|
2364
|
+
"sfpm": "0x00000000000005E4693aDc8Ec0f12D686f728198",
|
|
2365
|
+
"poolAddress": "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640",
|
|
2366
|
+
"poolId": "2824133844976349",
|
|
2367
|
+
"fee": 500,
|
|
2368
|
+
"weth": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
|
2369
|
+
}
|
|
2370
|
+
};
|
|
2371
|
+
var _8453 = {
|
|
2372
|
+
"chainId": 8453,
|
|
2373
|
+
"infrastructure": {
|
|
2374
|
+
"uniswapV3Factory": "0x33128a8fC17869897dcE68Ed026d694621f6FDfD",
|
|
2375
|
+
"poolManager": "0x498581fF718922c3f8e6A244956aF099B2652b2b",
|
|
2376
|
+
"stateView": "0xA3c0c9b65baD0b08107Aa264b0f3dB444b867A71"
|
|
2377
|
+
},
|
|
2378
|
+
"hypovault": {
|
|
2379
|
+
"core": {
|
|
2380
|
+
"hypoVaultImplementation": "0xec311aE06486ad44Ba782133b502A34aCE0f479E",
|
|
2381
|
+
"factory": "0x9bE53b169a41030f1710A9B82e9eA6413f14D12E",
|
|
2382
|
+
"accountant": "0x345cA3407942f9d175c9eA8B90e83A36F570f852",
|
|
2383
|
+
"rolesAuthority": "0x278D37CaBFFB4B72D2866E30fEFE08aef773E0B6",
|
|
2384
|
+
"collateralTrackerDecoderAndSanitizer": "0x4A290b3EC46cF320421Bb2aaee96d445de31CF0b"
|
|
2385
|
+
},
|
|
2386
|
+
"vaults": {
|
|
2387
|
+
"wethPlpVault": "0x41b7D0515d709A4Fd2CF27f9d141D0c2F8713D04",
|
|
2388
|
+
"usdcPlpVault": "0xb452af299c565D04B05E601efF2840e000C922f1"
|
|
2389
|
+
},
|
|
2390
|
+
"managers": {
|
|
2391
|
+
"wethPlpVaultManager": "0x2a4923456c79E9ebD10F5Bf5305a5C742bBc1D7C",
|
|
2392
|
+
"usdcPlpVaultManager": "0xdd6E2406a044582463CFE9F0C774870eAf4A310B"
|
|
2393
|
+
},
|
|
2394
|
+
"turnkeySigners": {
|
|
2395
|
+
"wethPlpVaultManager": "0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F",
|
|
2396
|
+
"usdcPlpVaultManager": "0x3c1c79d0cfc316Ba959194c89696a8382d7d283b"
|
|
2397
|
+
}
|
|
2398
|
+
},
|
|
2399
|
+
"panoptic": {
|
|
2400
|
+
"pool": {
|
|
2401
|
+
"version": "v4",
|
|
2402
|
+
"panopticPool": "0xB50e8bb68f5855DA742f4579274902a20454174a",
|
|
2403
|
+
"collateralTracker0": "0x0d82b189c96EbB1f44A7207e6A9cfB1e490f2869",
|
|
2404
|
+
"collateralTracker1": "0x9ba1082Ab3cb9edEA988697A14BBe543A3dABEd2"
|
|
2405
|
+
},
|
|
2406
|
+
"v2": {
|
|
2407
|
+
"semiFungiblePositionManagerV4": "0x8dcAa08cF298F8b4830FAf56d47930981AdE33af",
|
|
2408
|
+
"semiFungiblePositionManagerV3": "0xFB1c06B491305d618bb8a7a368C6e50c001C153A",
|
|
2409
|
+
"builderFactory": "0x6d26E916a18d522f7DdA2a26d9E1645564ccDcA5",
|
|
2410
|
+
"riskEngine": "0x8bbce8b1eb64118cfe6c1eab0afe13b80ea41481",
|
|
2411
|
+
"panopticPoolImplementation": "0x5BA68a018fF149c38ec52D181Dd24aBabE9a07DB",
|
|
2412
|
+
"collateralTrackerImplementation": "0x34B3a4e4F14f292575ECe3EF67886C4598af459f",
|
|
2413
|
+
"panopticFactoryV4": "0x9ac0317fcd124aff0b5429beb8de17020bc45f9a",
|
|
2414
|
+
"panopticFactoryV3": "0x687f616d68c483a7223e6922f59aef7452e26c1d",
|
|
2415
|
+
"panopticHelper": "0x0000000000000000000000000000000000000000",
|
|
2416
|
+
"panopticMath": "0x6d21699192f5aF112C87e53b32ff846782afF407",
|
|
2417
|
+
"panopticQuery": "0xd2586E1bbdd1169F597F3A370117EdF7372A7350",
|
|
2418
|
+
"interactionHelper": "0x643d8DD5372FD6c71f8fAbCce4Eb8857704F3E15"
|
|
2419
|
+
}
|
|
2420
|
+
},
|
|
2421
|
+
"riskEngines": ["0x8bbce8b1eb64118cfe6c1eab0afe13b80ea41481"],
|
|
2422
|
+
"markets": { "ethUsdc5bps": {
|
|
2423
|
+
"currency0": "0x0000000000000000000000000000000000000000",
|
|
2424
|
+
"currency1": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
2425
|
+
"fee": 500,
|
|
2426
|
+
"tickSpacing": 10,
|
|
2427
|
+
"poolId": "0x96d4b53a38337a5733179751781178a2613306063c511b78cd02684739288c0a"
|
|
2428
|
+
} },
|
|
2429
|
+
"subgraphs": {
|
|
2430
|
+
"hypovault": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-base/prod/gn",
|
|
2431
|
+
"panoptic": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-base/v2_prod/gn"
|
|
2432
|
+
}
|
|
2433
|
+
};
|
|
2434
|
+
var _11155111 = {
|
|
2435
|
+
"chainId": 11155111,
|
|
2436
|
+
"infrastructure": {
|
|
2437
|
+
"uniswapV3Factory": "0x0227628f3F023bb0B980b67D528571c95c6DaC1c",
|
|
2438
|
+
"poolManager": "0xE03A1074c86CFeDd5C142C4F04F1a1536e203543",
|
|
2439
|
+
"stateView": "0xE1Dd9c3fA50EDB962E442f60DfBc432e24537E4C"
|
|
2440
|
+
},
|
|
2441
|
+
"hypovault": {
|
|
2442
|
+
"core": {
|
|
2443
|
+
"hypoVaultImplementation": "0xC5b415Db4087228Af817893769DC3a205160160B",
|
|
2444
|
+
"factory": "0x363a9d605ca45cBfF3b597350DeADb53cdC292c7",
|
|
2445
|
+
"accountant": "0x25BBef1DF262c24aa1AACD1F7eCeEcc1a7AD08ab",
|
|
2446
|
+
"rolesAuthority": "0x673BfafB4e2712215B422347c1571421B83E8A3d",
|
|
2447
|
+
"collateralTrackerDecoderAndSanitizer": "0xb899BE50BAF25BBB3A3ca3403256B3c703E5AB5d"
|
|
2448
|
+
},
|
|
2449
|
+
"vaults": {
|
|
2450
|
+
"wethPlpVault": "0xD58C4F9AEe5bBfcf28dC9a8d3D57b323fA6521b1",
|
|
2451
|
+
"usdcPlpVault": "0xdd7a8d6c6975488e801129bC84302d74e2361208"
|
|
2452
|
+
},
|
|
2453
|
+
"managers": {
|
|
2454
|
+
"wethPlpVaultManager": "0x95eC124FAAB70D7aE147c3BE0336E01a828AE2d5",
|
|
2455
|
+
"usdcPlpVaultManager": "0xFB5aa3e0b46F3859D90B14b52ffd287013b5Ec53"
|
|
2456
|
+
},
|
|
2457
|
+
"turnkeySigners": {
|
|
2458
|
+
"wethPlpVaultManager": "0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F",
|
|
2459
|
+
"usdcPlpVaultManager": "0x3c1c79d0cfc316Ba959194c89696a8382d7d283b"
|
|
2460
|
+
}
|
|
2461
|
+
},
|
|
2462
|
+
"panoptic": {
|
|
2463
|
+
"pool": {
|
|
2464
|
+
"version": "v4",
|
|
2465
|
+
"panopticPool": "0x872b98C46b2062F663BEb2CC9D4cE046Da2a2918",
|
|
2466
|
+
"collateralTracker0": "0x09a60b78d06a03e5148faedd3bfee6f58b22012f",
|
|
2467
|
+
"collateralTracker1": "0x7365664c8101ff7e9422ae2b203822253c31e69c"
|
|
2468
|
+
},
|
|
2469
|
+
"v2": {
|
|
2470
|
+
"semiFungiblePositionManagerV3": "0x9DaD2C40107Db4B29a5450401BB7A28e6eA00e43",
|
|
2471
|
+
"semiFungiblePositionManagerV4": "0xD2615995A71644E122cC2FD7FeC2392b971220DE",
|
|
2472
|
+
"builderFactory": "0x55f3D2d9D065AA5Fcc11D94c55a6085849e8b6C3",
|
|
2473
|
+
"riskEngine": "0x1376aF5ca426B6B9fad6a712c21f6Cf58a94b93c",
|
|
2474
|
+
"panopticPoolImplementation": "0x969235B5830f13b58BB699305d9c70A8Cd3BD97C",
|
|
2475
|
+
"collateralTrackerImplementation": "0xafcd5F651Ae0403Ff668bb2dAc38BEa907a35Dba",
|
|
2476
|
+
"panopticFactoryV3": "0xd9FFCa53C0A6155001Ce8cbcAEfe89DB204690F1",
|
|
2477
|
+
"panopticFactoryV4": "0x8FCBb59b05779818D9BAD2686cc44B705603ce03",
|
|
2478
|
+
"panopticHelper": "0xfFEbB3A4ab793cB244209d4dA0Cb3e6B07133bd0",
|
|
2479
|
+
"panopticMath": "0x6d21699192f5aF112C87e53b32ff846782afF407",
|
|
2480
|
+
"panopticQuery": "0x74057945467Fb4eAE9193B46A60ae66a53f06A5b",
|
|
2481
|
+
"interactionHelper": "0x643d8DD5372FD6c71f8fAbCce4Eb8857704F3E15"
|
|
2482
|
+
}
|
|
2483
|
+
},
|
|
2484
|
+
"riskEngines": ["0x1376aF5ca426B6B9fad6a712c21f6Cf58a94b93c"],
|
|
2485
|
+
"markets": { "ethUsdc5bps": {
|
|
2486
|
+
"currency0": "0x0000000000000000000000000000000000000000",
|
|
2487
|
+
"currency1": "0xFFFeD8254566B7F800f6D8CDb843ec75AE49B07A",
|
|
2488
|
+
"fee": 500,
|
|
2489
|
+
"tickSpacing": 10,
|
|
2490
|
+
"poolId": "0xba6673bcb27568a73a93dd23b20c8174fa16193cd90905be859144e8f13097a5"
|
|
2491
|
+
} },
|
|
2492
|
+
"subgraphs": {
|
|
2493
|
+
"hypovault": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-sepolia/prod/gn",
|
|
2494
|
+
"panoptic": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-sepolia/v2_prod/gn"
|
|
2495
|
+
}
|
|
2496
|
+
};
|
|
2497
|
+
var chainDeployments_data_default = {
|
|
2498
|
+
"1": _1,
|
|
2499
|
+
"8453": _8453,
|
|
2500
|
+
"11155111": _11155111
|
|
2501
|
+
};
|
|
2502
|
+
|
|
2503
|
+
//#endregion
|
|
2504
|
+
//#region ../deployments/src/chainDeployments.js
|
|
2505
|
+
const MAINNET_CHAIN_ID = 1;
|
|
2506
|
+
const SEPOLIA_CHAIN_ID = 11155111;
|
|
2507
|
+
const BASE_CHAIN_ID = 8453;
|
|
2508
|
+
const CHAIN_DEPLOYMENTS = chainDeployments_data_default;
|
|
2509
|
+
function getChainDeployment(chainId) {
|
|
2510
|
+
return CHAIN_DEPLOYMENTS[chainId];
|
|
2511
|
+
}
|
|
2512
|
+
function requireChainDeployment(chainId) {
|
|
2513
|
+
const deployment = getChainDeployment(chainId);
|
|
2514
|
+
if (deployment === void 0) throw new Error(`Unsupported chain deployment for chainId ${chainId}`);
|
|
2515
|
+
return deployment;
|
|
2516
|
+
}
|
|
2517
|
+
function isSupportedChain(chainId) {
|
|
2518
|
+
return getChainDeployment(chainId) !== void 0;
|
|
2519
|
+
}
|
|
2520
|
+
function getEthUsdcMarket(deployment) {
|
|
2521
|
+
const market = deployment.markets.ethUsdc5bps ?? deployment.markets.ethUsdc30bps;
|
|
2522
|
+
if (market === void 0) throw new Error(`Missing ETH/USDC market for chainId ${deployment.chainId}`);
|
|
2523
|
+
return market;
|
|
2524
|
+
}
|
|
2525
|
+
const MAINNET_DEPLOYMENT = CHAIN_DEPLOYMENTS[MAINNET_CHAIN_ID];
|
|
2526
|
+
const MAINNET_ETH_USDC_5BPS_V3_PANOPTIC_POOL_ADDRESSES = MAINNET_DEPLOYMENT.panoptic.additionalPools?.ethUsdc5bpsV3;
|
|
2527
|
+
const MAINNET_PANOPTIC_V2_ADDRESSES = MAINNET_DEPLOYMENT.panoptic.v2;
|
|
2528
|
+
const SEPOLIA_DEPLOYMENT = CHAIN_DEPLOYMENTS[SEPOLIA_CHAIN_ID];
|
|
2529
|
+
const SEPOLIA_HYPOVAULT_CORE_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.core;
|
|
2530
|
+
const SEPOLIA_HYPOVAULT_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.vaults;
|
|
2531
|
+
const SEPOLIA_HYPOVAULT_MANAGER_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.managers;
|
|
2532
|
+
const SEPOLIA_HYPOVAULT_MANAGER_TURNKEY_SIGNERS = SEPOLIA_DEPLOYMENT.hypovault.turnkeySigners;
|
|
2533
|
+
const SEPOLIA_PANOPTIC_POOL_ADDRESSES = SEPOLIA_DEPLOYMENT.panoptic.pool;
|
|
2534
|
+
const SEPOLIA_PANOPTIC_V2_ADDRESSES = SEPOLIA_DEPLOYMENT.panoptic.v2;
|
|
2535
|
+
const BASE_DEPLOYMENT = CHAIN_DEPLOYMENTS[BASE_CHAIN_ID];
|
|
2536
|
+
const BASE_HYPOVAULT_CORE_ADDRESSES = BASE_DEPLOYMENT.hypovault.core;
|
|
2537
|
+
const BASE_HYPOVAULT_ADDRESSES = BASE_DEPLOYMENT.hypovault.vaults;
|
|
2538
|
+
const BASE_HYPOVAULT_MANAGER_ADDRESSES = BASE_DEPLOYMENT.hypovault.managers;
|
|
2539
|
+
const BASE_HYPOVAULT_MANAGER_TURNKEY_SIGNERS = BASE_DEPLOYMENT.hypovault.turnkeySigners;
|
|
2540
|
+
const BASE_PANOPTIC_POOL_ADDRESSES = BASE_DEPLOYMENT.panoptic.pool;
|
|
2541
|
+
const BASE_PANOPTIC_V2_ADDRESSES = BASE_DEPLOYMENT.panoptic.v2;
|
|
2542
|
+
const BASE_ETH_USDC_5BPS_MARKET = getEthUsdcMarket(BASE_DEPLOYMENT);
|
|
2543
|
+
const SEPOLIA_ETH_USDC_5BPS_MARKET = getEthUsdcMarket(SEPOLIA_DEPLOYMENT);
|
|
2544
|
+
const MAINNET_RISK_ENGINES = MAINNET_DEPLOYMENT.riskEngines;
|
|
2545
|
+
const BASE_RISK_ENGINES = BASE_DEPLOYMENT.riskEngines;
|
|
2546
|
+
const SEPOLIA_RISK_ENGINES = SEPOLIA_DEPLOYMENT.riskEngines;
|
|
2547
|
+
|
|
2548
|
+
//#endregion
|
|
2549
|
+
//#region ../deployments/src/vaultDisplayNames.js
|
|
2550
|
+
const mainnetDeployment = requireChainDeployment(MAINNET_CHAIN_ID);
|
|
2551
|
+
const mainnetVaults = mainnetDeployment.hypovault.vaults;
|
|
2552
|
+
const legacyMainnetVaults = {
|
|
2553
|
+
wethPlpVault: "0x779a2aa634A004b3a3f3b322083744869BBC6D66",
|
|
2554
|
+
usdcPlpVault: "0x963Fe9c93bc353602656ee4051A75114bA74d6c5"
|
|
2555
|
+
};
|
|
2556
|
+
const sepoliaDeployment = requireChainDeployment(SEPOLIA_CHAIN_ID);
|
|
2557
|
+
const sepoliaVaults = sepoliaDeployment.hypovault.vaults;
|
|
2558
|
+
const baseDeployment = requireChainDeployment(BASE_CHAIN_ID);
|
|
2559
|
+
const baseVaults = baseDeployment.hypovault.vaults;
|
|
2560
|
+
const VAULT_DISPLAY_NAMES_PER_CHAIN = {
|
|
2561
|
+
[MAINNET_CHAIN_ID]: {
|
|
2562
|
+
[mainnetVaults.wethPlpVault.toLowerCase()]: "PLP Vault",
|
|
2563
|
+
[mainnetVaults.usdcPlpVault.toLowerCase()]: "Unicorn Vault",
|
|
2564
|
+
[legacyMainnetVaults.wethPlpVault.toLowerCase()]: "PLP Vault",
|
|
2565
|
+
[legacyMainnetVaults.usdcPlpVault.toLowerCase()]: "Unicorn Vault"
|
|
2566
|
+
},
|
|
2567
|
+
[BASE_CHAIN_ID]: {
|
|
2568
|
+
[baseVaults.wethPlpVault.toLowerCase()]: "PLP Vault",
|
|
2569
|
+
[baseVaults.usdcPlpVault.toLowerCase()]: "Unicorn Vault"
|
|
2570
|
+
},
|
|
2571
|
+
[SEPOLIA_CHAIN_ID]: {
|
|
2572
|
+
[sepoliaVaults.wethPlpVault.toLowerCase()]: "PLP Vault",
|
|
2573
|
+
[sepoliaVaults.usdcPlpVault.toLowerCase()]: "Unicorn Vault"
|
|
2574
|
+
}
|
|
2575
|
+
};
|
|
2576
|
+
const VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN = {
|
|
2577
|
+
[MAINNET_CHAIN_ID]: {
|
|
2578
|
+
[mainnetVaults.wethPlpVault.toLowerCase()]: () => "PLP Vault",
|
|
2579
|
+
[mainnetVaults.usdcPlpVault.toLowerCase()]: () => "Unicorn Vault",
|
|
2580
|
+
[legacyMainnetVaults.wethPlpVault.toLowerCase()]: () => "PLP Vault",
|
|
2581
|
+
[legacyMainnetVaults.usdcPlpVault.toLowerCase()]: () => "Unicorn Vault"
|
|
2582
|
+
},
|
|
2583
|
+
[BASE_CHAIN_ID]: {
|
|
2584
|
+
[baseVaults.wethPlpVault.toLowerCase()]: () => "PLP Vault",
|
|
2585
|
+
[baseVaults.usdcPlpVault.toLowerCase()]: () => "Unicorn Vault"
|
|
2586
|
+
},
|
|
2587
|
+
[SEPOLIA_CHAIN_ID]: {
|
|
2588
|
+
[sepoliaVaults.wethPlpVault.toLowerCase()]: () => "PLP Vault",
|
|
2589
|
+
[sepoliaVaults.usdcPlpVault.toLowerCase()]: () => "Unicorn Vault"
|
|
2590
|
+
}
|
|
2591
|
+
};
|
|
2592
|
+
function resolveVaultDisplayName({ chainId, vaultAddress, underlyingSymbol, fallbackName }) {
|
|
2593
|
+
const vaultAddressLower = vaultAddress.toLowerCase();
|
|
2594
|
+
const resolver = VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN[chainId]?.[vaultAddressLower];
|
|
2595
|
+
if (resolver !== void 0) return resolver({
|
|
2596
|
+
chainId,
|
|
2597
|
+
vaultAddress: vaultAddressLower,
|
|
2598
|
+
underlyingSymbol,
|
|
2599
|
+
fallbackName
|
|
2600
|
+
});
|
|
2601
|
+
const staticName = VAULT_DISPLAY_NAMES_PER_CHAIN[chainId]?.[vaultAddressLower];
|
|
2602
|
+
if (staticName !== void 0) return staticName;
|
|
2603
|
+
if (fallbackName !== void 0 && fallbackName !== null) return fallbackName;
|
|
2604
|
+
return "Vault";
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2288
2607
|
//#endregion
|
|
2289
2608
|
//#region src/panoptic/v2/formatters/amount.ts
|
|
2290
2609
|
/**
|
|
@@ -2686,5 +3005,4 @@ async function getIrmCurve(params) {
|
|
|
2686
3005
|
}
|
|
2687
3006
|
|
|
2688
3007
|
//#endregion
|
|
2689
|
-
export { BORROW_INDEX_BITS, BPS_SCALE, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, Multicall3Abi, RATE_AT_TARGET_BITS, SECONDS_PER_YEAR, StateViewAbi, UNREALIZED_INTEREST_BITS, WAD as WAD$
|
|
2690
|
-
//# sourceMappingURL=irm-ChkvYphK.js.map
|
|
3008
|
+
export { BASE_CHAIN_ID, BASE_DEPLOYMENT, BASE_ETH_USDC_5BPS_MARKET, BASE_HYPOVAULT_ADDRESSES, BASE_HYPOVAULT_CORE_ADDRESSES, BASE_HYPOVAULT_MANAGER_ADDRESSES, BASE_HYPOVAULT_MANAGER_TURNKEY_SIGNERS, BASE_PANOPTIC_POOL_ADDRESSES, BASE_PANOPTIC_V2_ADDRESSES, BORROW_INDEX_BITS, BPS_SCALE, CHAIN_DEPLOYMENTS, MAINNET_CHAIN_ID, MAINNET_DEPLOYMENT, MAINNET_ETH_USDC_5BPS_V3_PANOPTIC_POOL_ADDRESSES, MAINNET_PANOPTIC_V2_ADDRESSES, MAINNET_RISK_ENGINES, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, Multicall3Abi, RATE_AT_TARGET_BITS, SECONDS_PER_YEAR, SEPOLIA_CHAIN_ID, SEPOLIA_DEPLOYMENT, SEPOLIA_ETH_USDC_5BPS_MARKET, SEPOLIA_HYPOVAULT_ADDRESSES, SEPOLIA_HYPOVAULT_CORE_ADDRESSES, SEPOLIA_HYPOVAULT_MANAGER_ADDRESSES, SEPOLIA_HYPOVAULT_MANAGER_TURNKEY_SIGNERS, SEPOLIA_PANOPTIC_POOL_ADDRESSES, SEPOLIA_PANOPTIC_V2_ADDRESSES, StateViewAbi, UNREALIZED_INTEREST_BITS, VAULT_DISPLAY_NAMES_PER_CHAIN, VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN, WAD as WAD$1, annualizePerSecondRateWad, deriveSupplyRatePerSecWad, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatRateWad, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatWad, formatWadPercent, formatWadSigned, getAccountCollateral, getAccountSummaryBasic, getAccountSummaryRisk, getChainDeployment, getCollateralAddresses, getCollateralData, getCurrentRates, getEthUsdcMarket, getInterestState, getIrmCurrent, getIrmCurve, getLiquidationPrices, getNetLiquidationValue, getNetLiquidationValues, isLiquidatable, isSupportedChain, packMarketState, panopticQueryAbi as panopticQueryAbi$1, parseTokenAmount, parseWad, ratePerSecWadToAprPct, readBlockAndAggregate, requireChainDeployment, requireReturnData, resolveVaultDisplayName, utilizationBpsToWad, utilizationPctToWad };
|
|
@@ -1,4 +1,277 @@
|
|
|
1
|
-
import "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import "viem";
|
|
2
|
+
|
|
3
|
+
//#region src/panoptic/v2/types/position.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A single leg of a TokenId.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A single leg of a TokenId.
|
|
10
|
+
*/
|
|
11
|
+
interface TokenIdLeg {
|
|
12
|
+
/** Leg index (0-3) */
|
|
13
|
+
index: bigint;
|
|
14
|
+
/** Asset index (0 or 1) */
|
|
15
|
+
asset: bigint;
|
|
16
|
+
/** Option ratio (1-127) */
|
|
17
|
+
optionRatio: bigint;
|
|
18
|
+
/** Whether this is a long position (true) or short (false) */
|
|
19
|
+
isLong: boolean;
|
|
20
|
+
/** Token type (0 or 1) - which token is being moved */
|
|
21
|
+
tokenType: bigint;
|
|
22
|
+
/** Risk partner leg index (for spreads) */
|
|
23
|
+
riskPartner: bigint;
|
|
24
|
+
/** Strike tick (center of the range) */
|
|
25
|
+
strike: bigint;
|
|
26
|
+
/** Width in tick spacing units */
|
|
27
|
+
width: bigint;
|
|
28
|
+
/** Lower tick of the range */
|
|
29
|
+
tickLower: bigint;
|
|
30
|
+
/** Upper tick of the range */
|
|
31
|
+
tickUpper: bigint;
|
|
32
|
+
} //#endregion
|
|
33
|
+
//#region src/panoptic/v2/greeks/index.d.ts
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Position data.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Calculate the NET (user-experienced) payoff value for a width=0 (loan/credit) leg.
|
|
41
|
+
*
|
|
42
|
+
* Unlike `getLegValueWidth0` (debt-only), this includes the collateral/holding side and
|
|
43
|
+
* therefore depends on how the position was opened:
|
|
44
|
+
*
|
|
45
|
+
* - **Cover at mint** (`swapAtMint = false`): the collateral is sourced in the SAME token as
|
|
46
|
+
* the debt/credit, so the holding side exactly offsets it → net PnL is FLAT (0 everywhere,
|
|
47
|
+
* mint-relative), regardless of which token the leg is denominated in.
|
|
48
|
+
* - **Zap** (`swapAtMint = true`): the collateral is sourced in the OTHER token, leaving a
|
|
49
|
+
* ±1-delta line in the asset (ETH), anchored to 0 at the mint price:
|
|
50
|
+
* - USDC loan → zap to ETH: +1 (long ETH)
|
|
51
|
+
* - ETH loan → zap to USDC: −1 (short ETH)
|
|
52
|
+
* - USDC credit ← zap from ETH: −1 (short ETH)
|
|
53
|
+
* - ETH credit ← zap from USDC: +1 (long ETH)
|
|
54
|
+
*
|
|
55
|
+
* @returns Net leg value in numeraire token smallest units (mint-relative PnL).
|
|
56
|
+
*/
|
|
57
|
+
declare function getLegNetValueWidth0(leg: TokenIdLeg, m: bigint, qCurrentTick: bigint, qMintTick: bigint, isAssetToken0: boolean, swapAtMint: boolean, itmOffsetNotional?: bigint): bigint;
|
|
58
|
+
/**
|
|
59
|
+
* Check if leg is a call option (vs put).
|
|
60
|
+
*
|
|
61
|
+
* A call is when the leg moves the asset token:
|
|
62
|
+
* - If asset is token0: call when tokenType=0
|
|
63
|
+
* - If asset is token1: call when tokenType=1
|
|
64
|
+
*/
|
|
65
|
+
declare function isCall(tokenType: bigint, isAssetToken0: boolean): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Check if position has defined risk (is a spread).
|
|
68
|
+
*
|
|
69
|
+
* A position is defined risk if it has 2+ legs of the same tokenType
|
|
70
|
+
* with both long and short exposure.
|
|
71
|
+
*/
|
|
72
|
+
declare function isDefinedRisk(legs: Pick<TokenIdLeg, 'tokenType' | 'isLong'>[]): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Calculate the value of a single leg.
|
|
75
|
+
*
|
|
76
|
+
* Value represents the current P&L of the position in numeraire token units.
|
|
77
|
+
* Combines base value (from Panoptic's piecewise formula), debt, and ITM adjustment.
|
|
78
|
+
*
|
|
79
|
+
* Uses sqrtPriceX96 for all calculations to maintain precision and on-chain fidelity.
|
|
80
|
+
*
|
|
81
|
+
* @param leg - The leg to calculate
|
|
82
|
+
* @param currentTick - Current pool tick
|
|
83
|
+
* @param mintTick - Tick at position mint
|
|
84
|
+
* @param positionSize - Position size in asset token smallest units
|
|
85
|
+
* @param poolTickSpacing - Pool tick spacing
|
|
86
|
+
* @param definedRisk - Whether position is defined risk
|
|
87
|
+
* @param assetIndex - Optional override for leg.asset (0n = token0 is asset, 1n = token1)
|
|
88
|
+
* @returns Leg value in numeraire token smallest units
|
|
89
|
+
*/
|
|
90
|
+
declare function getLegValue(leg: TokenIdLeg, currentTick: bigint, mintTick: bigint, positionSize: bigint, poolTickSpacing: bigint, definedRisk: boolean, assetIndex?: bigint, swapAtMint?: boolean): bigint;
|
|
91
|
+
/**
|
|
92
|
+
* Calculate the delta of a single leg.
|
|
93
|
+
*
|
|
94
|
+
* Delta is the rate of change of position value with respect to price.
|
|
95
|
+
* For puts: delta = vDelta
|
|
96
|
+
* For calls: delta = debtDelta + vDelta + itmDelta (if not defined risk)
|
|
97
|
+
*
|
|
98
|
+
* Uses sqrtPriceX96 for all price calculations to maintain precision.
|
|
99
|
+
*
|
|
100
|
+
* @param leg - The leg to calculate
|
|
101
|
+
* @param currentTick - Current pool tick
|
|
102
|
+
* @param positionSize - Position size in asset token smallest units
|
|
103
|
+
* @param poolTickSpacing - Pool tick spacing
|
|
104
|
+
* @param mintTick - Tick at mint (optional, for ITM adjustment)
|
|
105
|
+
* @param definedRisk - Whether position is defined risk
|
|
106
|
+
* @param assetIndex - Optional override for leg.asset (0n = token0 is asset, 1n = token1)
|
|
107
|
+
* @returns Leg delta in asset token smallest units
|
|
108
|
+
*/
|
|
109
|
+
declare function getLegDelta(leg: TokenIdLeg, currentTick: bigint, positionSize: bigint, poolTickSpacing: bigint, mintTick: bigint | undefined, definedRisk: boolean, assetIndex?: bigint): bigint;
|
|
110
|
+
/** Convert a delta between token frames at the current pool tick. */
|
|
111
|
+
declare function toVaultFrameAtTick(delta: bigint, fromAsset: bigint, vaultAssetIndex: 0n | 1n, currentTick: bigint, flipSignOnAssetInversion?: boolean): bigint;
|
|
112
|
+
/**
|
|
113
|
+
* Calculate one leg's wallet-aware delta in the vault asset frame.
|
|
114
|
+
*
|
|
115
|
+
* Width-zero loans and credits must be evaluated directly in the vault frame.
|
|
116
|
+
* Option legs remain in their natural leg frame until converted at the mark tick.
|
|
117
|
+
*/
|
|
118
|
+
declare function getLegDeltaInVaultFrame(leg: TokenIdLeg, currentTick: bigint, positionSize: bigint, poolTickSpacing: bigint, mintTick: bigint | undefined, definedRisk: boolean, vaultAssetIndex: 0n | 1n): bigint;
|
|
119
|
+
/**
|
|
120
|
+
* Calculate the gamma (dollar gamma) of a single leg.
|
|
121
|
+
*
|
|
122
|
+
* Formula: gamma = (m * sqrt(K * P * r)) / (2 * (r - 1))
|
|
123
|
+
* where:
|
|
124
|
+
* - m = positionSize * optionRatio (with sign based on long/short)
|
|
125
|
+
* - K = strike price (numeraire/asset)
|
|
126
|
+
* - P = current price (numeraire/asset)
|
|
127
|
+
* - r = 1.0001^(width*tickSpacing/2) ≈ 1 (dimensionless ratio)
|
|
128
|
+
*
|
|
129
|
+
* Uses sqrtPriceX96 arithmetic:
|
|
130
|
+
* - sqrt(K*P*r) = tickToSqrtPriceX96(strikeₜ + currentₜ + widthₜ/2)
|
|
131
|
+
* - Keeps X96/X192 precision until final division
|
|
132
|
+
*
|
|
133
|
+
* @param leg - The leg to calculate
|
|
134
|
+
* @param currentTick - Current pool tick
|
|
135
|
+
* @param positionSize - Position size in asset token smallest units
|
|
136
|
+
* @param poolTickSpacing - Pool tick spacing
|
|
137
|
+
* @param assetIndex - Optional override for leg.asset (0n = token0 is asset, 1n = token1)
|
|
138
|
+
* @returns Leg gamma in numeraire token smallest units
|
|
139
|
+
*/
|
|
140
|
+
declare function getLegGamma(leg: TokenIdLeg, currentTick: bigint, positionSize: bigint, poolTickSpacing: bigint, assetIndex?: bigint): bigint;
|
|
141
|
+
/**
|
|
142
|
+
* Parameters for position-level greek calculations.
|
|
143
|
+
*/
|
|
144
|
+
interface PositionGreeksInput {
|
|
145
|
+
/** Position legs */
|
|
146
|
+
legs: TokenIdLeg[];
|
|
147
|
+
/** Current pool tick */
|
|
148
|
+
currentTick: bigint;
|
|
149
|
+
/** Tick at position mint */
|
|
150
|
+
mintTick: bigint;
|
|
151
|
+
/** Position size in asset token smallest units */
|
|
152
|
+
positionSize: bigint;
|
|
153
|
+
/** Pool tick spacing */
|
|
154
|
+
poolTickSpacing: bigint;
|
|
155
|
+
/** Optional override for leg.asset on all legs (0n = token0 is asset, 1n = token1) */
|
|
156
|
+
assetIndex?: bigint;
|
|
157
|
+
/**
|
|
158
|
+
* How width=0 (loan/credit) legs were opened. When provided, `calculatePositionValue`
|
|
159
|
+
* returns the NET user-experienced payoff for those legs (Zap = ±1 line, Cover = flat)
|
|
160
|
+
* instead of the debt-only value. Leave undefined for delta/greeks aggregation, which
|
|
161
|
+
* accounts for the held collateral separately.
|
|
162
|
+
*/
|
|
163
|
+
swapAtMint?: boolean;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Calculate total value across all legs.
|
|
167
|
+
*/
|
|
168
|
+
declare function calculatePositionValue(input: PositionGreeksInput): bigint;
|
|
169
|
+
/**
|
|
170
|
+
* Calculate total delta across all legs.
|
|
171
|
+
*/
|
|
172
|
+
declare function calculatePositionDelta(input: PositionGreeksInput): bigint;
|
|
173
|
+
/**
|
|
174
|
+
* Calculate debt-only position delta in a single target asset frame.
|
|
175
|
+
*
|
|
176
|
+
* Option legs are first valued in their natural `leg.asset` frame, then
|
|
177
|
+
* converted into `assetIndex` using the current pool price. Width-zero legs
|
|
178
|
+
* are evaluated directly in the target frame.
|
|
179
|
+
*
|
|
180
|
+
* Width=0 loan/credit legs include only their debt obligation. The held-token
|
|
181
|
+
* side must be added separately from account collateral balances, preventing a
|
|
182
|
+
* zap from being counted once in the position and again in collateral.
|
|
183
|
+
*/
|
|
184
|
+
declare function calculatePositionDeltaDebtOnly(input: Omit<PositionGreeksInput, 'assetIndex' | 'swapAtMint'> & {
|
|
185
|
+
assetIndex: 0n | 1n;
|
|
186
|
+
}): bigint;
|
|
187
|
+
/**
|
|
188
|
+
* Calculate total gamma across all legs.
|
|
189
|
+
*/
|
|
190
|
+
declare function calculatePositionGamma(input: PositionGreeksInput): bigint;
|
|
191
|
+
/**
|
|
192
|
+
* Position greeks result.
|
|
193
|
+
*/
|
|
194
|
+
interface PositionGreeksResult {
|
|
195
|
+
/** Position value in numeraire token smallest units */
|
|
196
|
+
value: bigint;
|
|
197
|
+
/** Position delta in asset token smallest units */
|
|
198
|
+
delta: bigint;
|
|
199
|
+
/** Position gamma in numeraire token smallest units */
|
|
200
|
+
gamma: bigint;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Calculate all greeks for a position.
|
|
204
|
+
*/
|
|
205
|
+
declare function calculatePositionGreeks(input: PositionGreeksInput): PositionGreeksResult;
|
|
206
|
+
/**
|
|
207
|
+
* Aggregate value across multiple independent positions.
|
|
208
|
+
*
|
|
209
|
+
* Each entry is valued with its OWN `positionSize`, `mintTick`, and legs, then
|
|
210
|
+
* summed. Do NOT collapse multiple positions into one synthetic `PositionGreeksInput`
|
|
211
|
+
* with a shared `positionSize` — `m = positionSize * optionRatio` is per-position, so a
|
|
212
|
+
* shared size double-counts (and integer `optionRatio` cannot encode fractional shares).
|
|
213
|
+
*
|
|
214
|
+
* @param positions - One `PositionGreeksInput` per open position
|
|
215
|
+
* @returns Total value in numeraire token smallest units
|
|
216
|
+
*/
|
|
217
|
+
declare function calculatePortfolioValue(positions: PositionGreeksInput[]): bigint;
|
|
218
|
+
/**
|
|
219
|
+
* Aggregate delta across multiple independent positions.
|
|
220
|
+
*
|
|
221
|
+
* See {@link calculatePortfolioValue} for why each position must keep its own
|
|
222
|
+
* `positionSize` rather than being merged into one synthetic position.
|
|
223
|
+
*
|
|
224
|
+
* @param positions - One `PositionGreeksInput` per open position
|
|
225
|
+
* @returns Total delta in asset token smallest units
|
|
226
|
+
*/
|
|
227
|
+
declare function calculatePortfolioDelta(positions: PositionGreeksInput[]): bigint;
|
|
228
|
+
/**
|
|
229
|
+
* Aggregate gamma across multiple independent positions.
|
|
230
|
+
*
|
|
231
|
+
* See {@link calculatePortfolioValue} for why each position must keep its own
|
|
232
|
+
* `positionSize` rather than being merged into one synthetic position.
|
|
233
|
+
*
|
|
234
|
+
* @param positions - One `PositionGreeksInput` per open position
|
|
235
|
+
* @returns Total gamma in numeraire token smallest units
|
|
236
|
+
*/
|
|
237
|
+
declare function calculatePortfolioGamma(positions: PositionGreeksInput[]): bigint;
|
|
238
|
+
/**
|
|
239
|
+
* Calculate all greeks aggregated across multiple independent positions.
|
|
240
|
+
*/
|
|
241
|
+
declare function calculatePortfolioGreeks(positions: PositionGreeksInput[]): PositionGreeksResult;
|
|
242
|
+
/**
|
|
243
|
+
* Calculate the effective delta of a loan leg accounting for swapAtMint.
|
|
244
|
+
*
|
|
245
|
+
* A loan borrows one token and (optionally) swaps it for the other at mint.
|
|
246
|
+
* The net delta depends on whether the swap occurred:
|
|
247
|
+
*
|
|
248
|
+
* | Scenario | Result |
|
|
249
|
+
* |-----------------------|-------------------------------------------------|
|
|
250
|
+
* | No swap | 0n (hold what you owe, net zero) |
|
|
251
|
+
* | Swap + borrows asset | -m (hold numeraire, owe asset → short exposure) |
|
|
252
|
+
* | Swap + borrows numer. | +m (hold asset, owe numeraire → long exposure) |
|
|
253
|
+
*
|
|
254
|
+
* Only meaningful for legs with `width === 0n`. For options, use `getLegDelta`.
|
|
255
|
+
*
|
|
256
|
+
* @param leg - The loan leg
|
|
257
|
+
* @param positionSize - Position size in asset token smallest units
|
|
258
|
+
* @param swapAtMint - Whether the borrowed tokens were swapped at mint
|
|
259
|
+
* @param assetIndex - Optional override for leg.asset (0n = token0 is asset)
|
|
260
|
+
* @returns Effective delta in asset token smallest units
|
|
261
|
+
*/
|
|
262
|
+
declare function getLoanEffectiveDelta(leg: TokenIdLeg, positionSize: bigint, swapAtMint: boolean, assetIndex?: bigint): bigint;
|
|
263
|
+
/**
|
|
264
|
+
* Calculate total delta for a position, using swap-aware delta for loan legs.
|
|
265
|
+
*
|
|
266
|
+
* For legs with `width === 0n` (loans/credits), uses `getLoanEffectiveDelta`
|
|
267
|
+
* which accounts for the swapAtMint flag. For option legs (`width > 0n`),
|
|
268
|
+
* uses the standard `getLegDelta`.
|
|
269
|
+
*
|
|
270
|
+
* @param input - Position greeks input plus swapAtMint flag
|
|
271
|
+
* @returns Total delta in asset token smallest units
|
|
272
|
+
*/
|
|
273
|
+
declare function calculatePositionDeltaWithSwap(input: PositionGreeksInput & {
|
|
274
|
+
swapAtMint: boolean;
|
|
275
|
+
}): bigint; //#endregion
|
|
276
|
+
export { PositionGreeksInput, PositionGreeksResult, calculatePortfolioDelta, calculatePortfolioGamma, calculatePortfolioGreeks, calculatePortfolioValue, calculatePositionDelta, calculatePositionDeltaDebtOnly, calculatePositionDeltaWithSwap, calculatePositionGamma, calculatePositionGreeks, calculatePositionValue, getLegDelta, getLegDeltaInVaultFrame, getLegGamma, getLegNetValueWidth0, getLegValue, getLoanEffectiveDelta, isCall, isDefinedRisk, toVaultFrameAtTick };
|
|
277
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["Address","BlockMeta","TokenIdLeg","Position","LegGreeksParams","PositionGreeks","ClosedPosition","RealizedPnL","StoredPositionData","StoredPoolMeta","TokenIdLeg","getLegNetValueWidth0","isCall","isDefinedRisk","Pick","getLegValue","getLegDelta","toVaultFrameAtTick","getLegDeltaInVaultFrame","getLegGamma","PositionGreeksInput","calculatePositionValue","calculatePositionDelta","calculatePositionDeltaDebtOnly","Omit","calculatePositionGamma","PositionGreeksResult","calculatePositionGreeks","calculatePortfolioValue","calculatePortfolioDelta","calculatePortfolioGamma","calculatePortfolioGreeks","getLoanEffectiveDelta","calculatePositionDeltaWithSwap"],"sources":["../../../../src/panoptic/v2/types/position.d.ts","../../../../src/panoptic/v2/greeks/index.d.ts"],"sourcesContent":null,"mappings":";;;;;;;AASA;;;UAAiBU,UAAAA;;;;;;;;;;;;;;;;;;;EC0BOC;;;;;;;;;;;;;;;;;;;;AAAxB;;;;;;;iBAAwBA,oBAAAA,MAA0BD;AAQlD;;;;;;;AAOwBG,iBAPAD,MAAAA,CAOa,SAAA,EAAA,MAAA,EAAA,aAAA,EAAA,OAAA,CAAA,EAAA,OAAA;;;;AAAW;;;iBAAxBC,aAAAA,OAAoBC,KAAKJ;;;;;;;;;;;;;;;AAkBjD;;;iBAAwBK,WAAAA,MAAiBL;;;;;;;;;;;;;;;;AAmBzC;;AAEA;iBAFwBM,WAAAA,MAAiBN;;iBAEjBO,kBAAAA;;;;AAOxB;;;iBAAwBC,uBAAAA,MAA6BR;;;;;;;;;;;;;;;;;;;AAsBrD;;;iBAAwBS,WAAAA,MAAiBT;AAIzC;;;UAAiBU,mBAAAA;EAwBOC;QAtBdX;;;EA0BcY;;;;;;;;;;;;AAYxB;;EAAsD,UAAaF,CAAAA,EAAAA,OAAAA;;AAAD;;;iBAhB1CC,sBAAAA,QAA8BD;AAsBtD;;;iBAlBwBE,sBAAAA,QAA8BF;AAsBtD;;;;AAWA;;;;AAAiG;;;iBArBzEG,8BAAAA,QAAsCC,KAAKJ;;;;;;iBAM3CK,sBAAAA,QAA8BL;;;AA2BtD;UAvBiBM,oBAAAA;;;;;;;;;AAiCjB;;iBAtBwBC,uBAAAA,QAA+BP,sBAAsBM;;;;;;;;AAgC7E;;;;AAIwBK,iBAxBAH,uBAAAA,CAwBwB,SAAA,EAxBWR,mBAwBX,EAAA,CAAA,EAAA,MAAA;;;;AAAwD;;;;;;iBAdhFS,uBAAAA,YAAmCT;;;;;;;;;;iBAUnCU,uBAAAA,YAAmCV;;;;iBAInCW,wBAAAA,YAAoCX,wBAAwBM;AAqBpF;;;;;;;;;;;AAWA;;;;;;;;;iBAXwBM,qBAAAA,MAA2BtB;;;;;;;;;;;iBAW3BuB,8BAAAA,QAAsCb"}
|