@panoptic-eng/sdk 1.0.61 → 1.0.63
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/{chainDeployments-CmDzAmZ3.js → chainDeployments-BhXMBZ4B.js} +50 -12
- package/dist/{cow-BItQK2Bi.js → cow-BsSaoahK.js} +1 -1
- package/dist/deployments.d.ts +9 -1
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +50 -12
- package/dist/deployments.js.map +1 -1
- package/dist/index.d.ts +541 -45
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +551 -353
- package/dist/index.js.map +1 -1
- package/dist/{irm-BEug2-TH.js → irm-BDlcUNgJ.js} +1 -1
- package/dist/panoptic/v2/index.d.ts +122 -1
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +406 -25
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/panoptic/v2/react-public.d.ts +122 -1
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +406 -25
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/providers-1WdiaRbY.js +54 -0
- package/dist/{rates-CPHxWqpT.js → rates-BwZnK0tG.js} +1 -1
- package/dist/{router-BZGHjEcU.js → router-Dejb6MWu.js} +137 -10
- package/dist/{router-kTiatP_R.js → router-pm9PDlyH.js} +2 -2
- package/dist/rpc/index.d.ts +112 -0
- package/dist/rpc/index.d.ts.map +1 -0
- package/dist/rpc/index.js +242 -0
- package/dist/rpc/index.js.map +1 -0
- package/dist/test/index.d.ts +1 -1
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +1 -14
- package/dist/test/index.js.map +1 -1
- package/dist/{transactionFees-MocbcAyR.js → transactionFees-aXQlx-lq.js} +1 -1
- package/dist/uniswap/index.d.ts +310 -215
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +253 -20
- package/dist/uniswap/index.js.map +1 -1
- package/dist/{v2-odOz_0wM.js → v2-ccGPXWvq.js} +226 -9
- package/dist/vault-transaction-fees.js +49 -11
- package/dist/vault-transaction-fees.js.map +1 -1
- package/dist/{writes-gs0k0uoN.js → writes--fM_8ggw.js} +2 -2
- package/dist/zodiac/index.d.ts.map +1 -1
- package/package.json +5 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { StateViewAbi, getAccountCollateral, panopticQueryAbi$1 as panopticQueryAbi, readBlockAndAggregate, requireReturnData } from "./irm-
|
|
2
|
-
import { AccountInsolventError, ChunkLimitError, DEFAULT_VEGOID, InvalidHistoryRangeError, MulticallResultMissingError, NotEnoughTokensError, PanopticError, PanopticValidationError, SafeModeError, StaleDataError, StorageDataNotFoundError, UnhealthyPoolError, WrongUniswapPoolError, applyMintBufferPerToken, availableToBorrow, collateralTrackerV2Abi, decodeLeftRightSigned, decodeLeftRightUnsigned, decodePositionBalance, getBlockMeta, getClosedPositionsKey, getPendingPositionsKey, getPool, getPoolMetaKey, getPoolMetadata, getPositionMetaKey, getPositionsKey, getTrackedChunksKey, getTrackedPositionIds, isPanopticErrorType, jsonSerializer, mintableAfterBuffer, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi as panopticQueryAbi$1, parsePanopticError, riskEngineAbi, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, stateViewAbi, uniswapV3PoolAbi } from "./rates-
|
|
1
|
+
import { StateViewAbi, getAccountCollateral, panopticQueryAbi$1 as panopticQueryAbi, readBlockAndAggregate, requireReturnData } from "./irm-BDlcUNgJ.js";
|
|
2
|
+
import { AccountInsolventError, ChunkLimitError, DEFAULT_VEGOID, InvalidHistoryRangeError, MulticallResultMissingError, NotEnoughTokensError, PanopticError, PanopticValidationError, SafeModeError, StaleDataError, StorageDataNotFoundError, UnhealthyPoolError, WrongUniswapPoolError, applyMintBufferPerToken, availableToBorrow, collateralTrackerV2Abi, decodeLeftRightSigned, decodeLeftRightUnsigned, decodePositionBalance, getBlockMeta, getClosedPositionsKey, getPendingPositionsKey, getPool, getPoolMetaKey, getPoolMetadata, getPositionMetaKey, getPositionsKey, getTrackedChunksKey, getTrackedPositionIds, isPanopticErrorType, jsonSerializer, mintableAfterBuffer, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi as panopticQueryAbi$1, parsePanopticError, riskEngineAbi, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, stateViewAbi, uniswapV3PoolAbi } from "./rates-BwZnK0tG.js";
|
|
3
3
|
import { MAX_TICK, MAX_TRACKED_CHUNKS, MIN_TICK, NO_LOWER_LIQUIDATION_TICK, NO_UPPER_LIQUIDATION_TICK, WAD, calculatePositionDelta, calculatePositionDeltaDebtOnly, calculatePositionGamma, calculatePositionValue, priceToTick, sqrtPriceX96ToTick, tickLimits, tickToPriceDecimalScaled, tickToSqrtPriceX96, toVaultFrameAtTick } from "./greeks-CNi1-cnp.js";
|
|
4
|
-
import { addLegToTokenId, buildBatchDispatchArgs, buildUniqueCredit, buildUniqueLoan, countLegs, createTokenIdBuilder, decodeAllLegs, decodeTokenId, getPoolTokensForSimulation, loadCheckpoint, resolveTokenIndex, simulateDispatch, simulateOpenPosition, simulateWithTokenFlow } from "./writes
|
|
5
|
-
import { getLpPositionFunding, getMaxLpPositionSize } from "./router-
|
|
6
|
-
import { BaseError, ContractFunctionExecutionError, ContractFunctionRevertedError, ExecutionRevertedError, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, getAddress, hexToString, keccak256, parseAbi, toHex, trim, zeroAddress } from "viem";
|
|
4
|
+
import { addLegToTokenId, buildBatchDispatchArgs, buildUniqueCredit, buildUniqueLoan, countLegs, createTokenIdBuilder, decodeAllLegs, decodeTokenId, getPoolTokensForSimulation, loadCheckpoint, resolveTokenIndex, simulateDispatch, simulateOpenPosition, simulateWithTokenFlow } from "./writes--fM_8ggw.js";
|
|
5
|
+
import { getLpPositionFunding, getMaxLpPositionSize, preparePositionGamma } from "./router-Dejb6MWu.js";
|
|
6
|
+
import { BaseError, ContractFunctionExecutionError, ContractFunctionRevertedError, ExecutionRevertedError, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, getAddress, hexToString, keccak256, parseAbi, parseEventLogs, toHex, trim, zeroAddress } from "viem";
|
|
7
7
|
import { multicall } from "viem/actions";
|
|
8
8
|
import Decimal from "decimal.js";
|
|
9
9
|
|
|
@@ -4467,6 +4467,7 @@ async function fetchV3BlockSnapshot(client, poolAddress, blockNumber, uniqueTick
|
|
|
4467
4467
|
for (let i = 0; i < uniqueTicks.length; i++) {
|
|
4468
4468
|
const tickResult = results[3 + i];
|
|
4469
4469
|
tickData.set(uniqueTicks[i], {
|
|
4470
|
+
liquidityGross: tickResult[0],
|
|
4470
4471
|
feeGrowthOutside0: tickResult[2],
|
|
4471
4472
|
feeGrowthOutside1: tickResult[3]
|
|
4472
4473
|
});
|
|
@@ -4512,6 +4513,7 @@ async function fetchV4BlockSnapshot(client, stateViewAddress, poolId, blockNumbe
|
|
|
4512
4513
|
for (let i = 0; i < uniqueTicks.length; i++) {
|
|
4513
4514
|
const tickResult = results[2 + i];
|
|
4514
4515
|
tickData.set(uniqueTicks[i], {
|
|
4516
|
+
liquidityGross: tickResult[0],
|
|
4515
4517
|
feeGrowthOutside0: tickResult[2],
|
|
4516
4518
|
feeGrowthOutside1: tickResult[3]
|
|
4517
4519
|
});
|
|
@@ -4689,9 +4691,9 @@ async function readTokenText(client, blockNumber, calls) {
|
|
|
4689
4691
|
});
|
|
4690
4692
|
return asString.map((result, index) => {
|
|
4691
4693
|
if (result.status === "success") return result.result;
|
|
4692
|
-
const fallback = asBytes32[index];
|
|
4693
|
-
if (fallback.status !== "success") throw fallback.error;
|
|
4694
|
-
return hexToString(trim(fallback.result, { dir: "right" }));
|
|
4694
|
+
const fallback$1 = asBytes32[index];
|
|
4695
|
+
if (fallback$1.status !== "success") throw fallback$1.error;
|
|
4696
|
+
return hexToString(trim(fallback$1.result, { dir: "right" }));
|
|
4695
4697
|
});
|
|
4696
4698
|
}
|
|
4697
4699
|
/**
|
|
@@ -10094,4 +10096,219 @@ function preparePositionValueCurve(curve) {
|
|
|
10094
10096
|
}
|
|
10095
10097
|
|
|
10096
10098
|
//#endregion
|
|
10097
|
-
|
|
10099
|
+
//#region src/panoptic/v2/reads/positionVolatilityHistory.ts
|
|
10100
|
+
const signedSlot = (value) => BigInt.asIntN(128, value);
|
|
10101
|
+
const unpack = (value) => ({
|
|
10102
|
+
token0: signedSlot(value),
|
|
10103
|
+
token1: signedSlot(value >> 128n)
|
|
10104
|
+
});
|
|
10105
|
+
/** RPC accounting for exactly one mint lifecycle; candle prices are supplied by the application. */
|
|
10106
|
+
async function getPositionVolatilityHistory({ client, poolAddress, account, tokenId, mintBlock, endBlock, poolConfig, includeBaseFees = false }) {
|
|
10107
|
+
if (mintBlock <= 0n || endBlock <= mintBlock) throw new RangeError("Insufficient lifecycle history");
|
|
10108
|
+
const [mints, burns] = await Promise.all([client.getContractEvents({
|
|
10109
|
+
address: poolAddress,
|
|
10110
|
+
abi: panopticPoolV2Abi,
|
|
10111
|
+
eventName: "OptionMinted",
|
|
10112
|
+
args: {
|
|
10113
|
+
recipient: account,
|
|
10114
|
+
tokenId
|
|
10115
|
+
},
|
|
10116
|
+
fromBlock: mintBlock,
|
|
10117
|
+
toBlock: mintBlock,
|
|
10118
|
+
strict: true
|
|
10119
|
+
}), client.getContractEvents({
|
|
10120
|
+
address: poolAddress,
|
|
10121
|
+
abi: panopticPoolV2Abi,
|
|
10122
|
+
eventName: "OptionBurnt",
|
|
10123
|
+
args: {
|
|
10124
|
+
recipient: account,
|
|
10125
|
+
tokenId
|
|
10126
|
+
},
|
|
10127
|
+
fromBlock: mintBlock,
|
|
10128
|
+
toBlock: endBlock,
|
|
10129
|
+
strict: true
|
|
10130
|
+
})]);
|
|
10131
|
+
const mint = mints[0];
|
|
10132
|
+
if (mints.length !== 1 || !mint) throw new Error("Opening event is missing or ambiguous");
|
|
10133
|
+
const balance = decodePositionBalance(mint.args.balanceData);
|
|
10134
|
+
const close = burns.filter((burn) => burn.blockNumber > mintBlock || burn.logIndex > mint.logIndex).sort((a, b) => a.blockNumber === b.blockNumber ? a.logIndex - b.logIndex : a.blockNumber < b.blockNumber ? -1 : 1)[0];
|
|
10135
|
+
const finalBlock = close?.blockNumber ?? endBlock;
|
|
10136
|
+
if (finalBlock <= mintBlock) throw new Error("Intrablock lifecycle cannot be reconstructed");
|
|
10137
|
+
if (close && close.args.positionSize !== balance.positionSize) throw new Error("Position size changed");
|
|
10138
|
+
const [start, end, boundaryPrices] = await Promise.all([
|
|
10139
|
+
getBlockMeta({
|
|
10140
|
+
client,
|
|
10141
|
+
blockNumber: mintBlock
|
|
10142
|
+
}),
|
|
10143
|
+
getBlockMeta({
|
|
10144
|
+
client,
|
|
10145
|
+
blockNumber: finalBlock
|
|
10146
|
+
}),
|
|
10147
|
+
getPriceHistory({
|
|
10148
|
+
client,
|
|
10149
|
+
poolConfig,
|
|
10150
|
+
blockNumbers: [mintBlock, finalBlock]
|
|
10151
|
+
})
|
|
10152
|
+
]);
|
|
10153
|
+
const openingPrice = boundaryPrices.snapshots[0];
|
|
10154
|
+
const endingPrice = boundaryPrices.snapshots[1];
|
|
10155
|
+
if (!openingPrice || !endingPrice) throw new Error("Boundary prices unavailable");
|
|
10156
|
+
const pointCount = Math.min(200, Math.max(2, Number((end.blockTimestamp - start.blockTimestamp) / 900n) + 2));
|
|
10157
|
+
const blockNumbers = [...new Set(interpolateBlocks(mintBlock, finalBlock, pointCount))];
|
|
10158
|
+
const metadata = [];
|
|
10159
|
+
for (let i = 0; i < blockNumbers.length; i += 16) metadata.push(...await Promise.all(blockNumbers.slice(i, i + 16).map((blockNumber) => getBlockMeta({
|
|
10160
|
+
client,
|
|
10161
|
+
blockNumber
|
|
10162
|
+
}))));
|
|
10163
|
+
const timestamps = new Map(metadata.map((meta) => [meta.blockNumber, meta.blockTimestamp]));
|
|
10164
|
+
const chunks = preparePositionGamma({
|
|
10165
|
+
tokenId,
|
|
10166
|
+
positionSize: balance.positionSize,
|
|
10167
|
+
quoteIsToken0: false,
|
|
10168
|
+
quoteDecimals: 0
|
|
10169
|
+
}).chunks.filter((chunk) => chunk.liquidity > 0n);
|
|
10170
|
+
let premiumError = null;
|
|
10171
|
+
let feeError = includeBaseFees ? null : "Base fee history was not requested";
|
|
10172
|
+
let premium = null;
|
|
10173
|
+
let fees = null;
|
|
10174
|
+
try {
|
|
10175
|
+
const settlementLogs = await client.getContractEvents({
|
|
10176
|
+
address: poolAddress,
|
|
10177
|
+
abi: panopticPoolV2Abi,
|
|
10178
|
+
eventName: "PremiumSettled",
|
|
10179
|
+
args: {
|
|
10180
|
+
user: account,
|
|
10181
|
+
tokenId
|
|
10182
|
+
},
|
|
10183
|
+
fromBlock: mintBlock,
|
|
10184
|
+
toBlock: finalBlock,
|
|
10185
|
+
strict: true
|
|
10186
|
+
});
|
|
10187
|
+
const settled = [];
|
|
10188
|
+
const seen = new Set();
|
|
10189
|
+
for (const log of settlementLogs) {
|
|
10190
|
+
if (log.blockNumber === mintBlock && log.logIndex <= mint.logIndex) continue;
|
|
10191
|
+
if (close && log.blockNumber === finalBlock && log.logIndex >= close.logIndex) continue;
|
|
10192
|
+
const key = `${log.transactionHash}:${log.logIndex}`;
|
|
10193
|
+
if (seen.has(key)) continue;
|
|
10194
|
+
seen.add(key);
|
|
10195
|
+
const amounts = unpack(log.args.settledAmounts);
|
|
10196
|
+
settled.push({
|
|
10197
|
+
blockNumber: log.blockNumber,
|
|
10198
|
+
settled0: amounts.token0,
|
|
10199
|
+
settled1: amounts.token1
|
|
10200
|
+
});
|
|
10201
|
+
}
|
|
10202
|
+
if (close) {
|
|
10203
|
+
const receipt = await client.getTransactionReceipt({ hash: close.transactionHash });
|
|
10204
|
+
const liquidations = parseEventLogs({
|
|
10205
|
+
abi: panopticPoolV2Abi,
|
|
10206
|
+
logs: receipt.logs.filter((log) => log.address.toLowerCase() === poolAddress.toLowerCase()),
|
|
10207
|
+
eventName: "AccountLiquidated"
|
|
10208
|
+
});
|
|
10209
|
+
if (liquidations.some((event) => event.args.liquidatee.toLowerCase() === account.toLowerCase())) throw new Error("Liquidation premium requires haircut reconciliation");
|
|
10210
|
+
for (const packed of close.args.premiaByLeg) {
|
|
10211
|
+
const amounts = unpack(packed);
|
|
10212
|
+
settled.push({
|
|
10213
|
+
blockNumber: finalBlock,
|
|
10214
|
+
settled0: amounts.token0,
|
|
10215
|
+
settled1: amounts.token1
|
|
10216
|
+
});
|
|
10217
|
+
}
|
|
10218
|
+
}
|
|
10219
|
+
const readableBlocks = close ? blockNumbers.filter((block) => block < finalBlock) : blockNumbers;
|
|
10220
|
+
premium = [];
|
|
10221
|
+
for (let i = 0; i < readableBlocks.length; i += 16) {
|
|
10222
|
+
const history = await getStreamiaHistory({
|
|
10223
|
+
client,
|
|
10224
|
+
panopticPoolAddress: poolAddress,
|
|
10225
|
+
account,
|
|
10226
|
+
tokenId,
|
|
10227
|
+
blockNumbers: readableBlocks.slice(i, i + 16),
|
|
10228
|
+
legs: [],
|
|
10229
|
+
poolConfig,
|
|
10230
|
+
includeUniswapFees: false,
|
|
10231
|
+
settledEvents: settled,
|
|
10232
|
+
_meta: end
|
|
10233
|
+
});
|
|
10234
|
+
for (const snapshot of history.snapshots) {
|
|
10235
|
+
const timestamp = snapshot.blockNumber === void 0 ? void 0 : timestamps.get(snapshot.blockNumber);
|
|
10236
|
+
if (timestamp === void 0) throw new Error("Accounting timestamp missing");
|
|
10237
|
+
premium.push({
|
|
10238
|
+
timestamp,
|
|
10239
|
+
...snapshot.cumulativePanopticPremia
|
|
10240
|
+
});
|
|
10241
|
+
}
|
|
10242
|
+
}
|
|
10243
|
+
if (close) premium.push({
|
|
10244
|
+
timestamp: end.blockTimestamp,
|
|
10245
|
+
...settled.reduce((sum$1, event) => ({
|
|
10246
|
+
token0: sum$1.token0 + event.settled0,
|
|
10247
|
+
token1: sum$1.token1 + event.settled1
|
|
10248
|
+
}), {
|
|
10249
|
+
token0: 0n,
|
|
10250
|
+
token1: 0n
|
|
10251
|
+
})
|
|
10252
|
+
});
|
|
10253
|
+
const openingAccrual = premium[0];
|
|
10254
|
+
if (!openingAccrual || openingAccrual.timestamp !== start.blockTimestamp) throw new Error("Opening premium snapshot missing");
|
|
10255
|
+
premium = premium.map((snapshot) => ({
|
|
10256
|
+
timestamp: snapshot.timestamp,
|
|
10257
|
+
token0: snapshot.token0 - openingAccrual.token0,
|
|
10258
|
+
token1: snapshot.token1 - openingAccrual.token1
|
|
10259
|
+
}));
|
|
10260
|
+
} catch (error) {
|
|
10261
|
+
premium = null;
|
|
10262
|
+
premiumError = error instanceof Error ? error.message : "Premium history unavailable";
|
|
10263
|
+
}
|
|
10264
|
+
if (includeBaseFees) try {
|
|
10265
|
+
const feeBlocks = close ? blockNumbers.filter((block) => block < finalBlock) : blockNumbers;
|
|
10266
|
+
const data = [];
|
|
10267
|
+
for (let i = 0; i < feeBlocks.length; i += 16) data.push(...await fetchUniswapFeeData(client, feeBlocks.slice(i, i + 16), chunks, poolConfig));
|
|
10268
|
+
let total0 = 0n;
|
|
10269
|
+
let total1 = 0n;
|
|
10270
|
+
fees = [];
|
|
10271
|
+
for (let i = 0; i < data.length; i++) {
|
|
10272
|
+
const current = data[i];
|
|
10273
|
+
for (const chunk of chunks) {
|
|
10274
|
+
if ((current.tickData.get(chunk.lowerTick)?.liquidityGross ?? 0n) === 0n || (current.tickData.get(chunk.upperTick)?.liquidityGross ?? 0n) === 0n) throw new Error("LP range was uninitialized; complete base fee history is unavailable");
|
|
10275
|
+
if (i === 0) continue;
|
|
10276
|
+
const previous = feeGrowthInsideX128(data[i - 1], chunk.lowerTick, chunk.upperTick);
|
|
10277
|
+
const next = feeGrowthInsideX128(current, chunk.lowerTick, chunk.upperTick);
|
|
10278
|
+
if (!previous || !next) throw new Error("Range fee growth missing");
|
|
10279
|
+
if (BigInt.asUintN(256, next.feeGrowthInside0X128 - previous.feeGrowthInside0X128) > BigInt.asUintN(256, current.feeGrowthGlobal0 - data[i - 1].feeGrowthGlobal0) || BigInt.asUintN(256, next.feeGrowthInside1X128 - previous.feeGrowthInside1X128) > BigInt.asUintN(256, current.feeGrowthGlobal1 - data[i - 1].feeGrowthGlobal1)) throw new Error("Range fee growth is inconsistent with pool fee growth");
|
|
10280
|
+
const sign = chunk.isLong ? -1n : 1n;
|
|
10281
|
+
total0 += sign * feesFromFeeGrowthDelta(next.feeGrowthInside0X128, previous.feeGrowthInside0X128, chunk.liquidity);
|
|
10282
|
+
total1 += sign * feesFromFeeGrowthDelta(next.feeGrowthInside1X128, previous.feeGrowthInside1X128, chunk.liquidity);
|
|
10283
|
+
}
|
|
10284
|
+
fees.push({
|
|
10285
|
+
timestamp: metadata[i].blockTimestamp,
|
|
10286
|
+
token0: total0,
|
|
10287
|
+
token1: total1
|
|
10288
|
+
});
|
|
10289
|
+
}
|
|
10290
|
+
} catch (error) {
|
|
10291
|
+
fees = null;
|
|
10292
|
+
feeError = error instanceof Error ? error.message : "Base fee history unavailable";
|
|
10293
|
+
}
|
|
10294
|
+
return {
|
|
10295
|
+
start,
|
|
10296
|
+
end,
|
|
10297
|
+
positionSize: balance.positionSize,
|
|
10298
|
+
closed: close !== void 0,
|
|
10299
|
+
openingTick: BigInt(openingPrice.tick),
|
|
10300
|
+
endingTick: BigInt(endingPrice.tick),
|
|
10301
|
+
premium,
|
|
10302
|
+
fees,
|
|
10303
|
+
premiumError,
|
|
10304
|
+
feeError,
|
|
10305
|
+
accountingSamples: blockNumbers.length,
|
|
10306
|
+
maxAccountingIntervalSeconds: metadata.slice(1).reduce((maximum, meta, index) => {
|
|
10307
|
+
const interval = meta.blockTimestamp - metadata[index].blockTimestamp;
|
|
10308
|
+
return interval > maximum ? interval : maximum;
|
|
10309
|
+
}, 0n)
|
|
10310
|
+
};
|
|
10311
|
+
}
|
|
10312
|
+
|
|
10313
|
+
//#endregion
|
|
10314
|
+
export { DEFAULT_MIN_SWAP_RATIO_BPS, DEFAULT_RECONNECT_CONFIG, MARKET_INDICATOR_PERIODS, REQUIRED_BASE_ERROR_SENTINEL, STRIKE_LADDER_TARGET_STRIKES, VARIANCE_RATIO_LAG, addPendingPosition, addTrackedChunks, apportion, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertLpPositionFunded, assertTradeable, buildCreditWrappedDispatch, buildSfpmSwapCalldata, buildSfpmSwapPlan, buildTemporaryLoanRecoveryDispatch, buildTokenShortfallRecoveryDispatch, calculateAccountGreeksPure, calculateMarketIndicator, calculateSpreadWad, calculateVarianceProfile, checkCollateralAcrossTicks, classifyStrategyGroups, classifyStrike, cleanupStalePendingPositions, clearPendingPositions, clearTrackedChunks, clearTradeHistory, collateralCurveTicks, collateralRuleKindFor, computeV4PoolId, confirmPendingPosition, convertToAssets, convertToShares, createEventPoller, createEventSubscription, createFlowNeutralTokenId, decodePanopticTokenURI, emptyLiquidateParams, encodePoolKeyBytes, encodeV3PoolKeyBytes, ensureSfpmV3PoolInitialized, estimateBlockNumbers, estimateCollateralBreakdown, estimateCollateralRequired, failPendingPosition, feeGrowthInsideX128, feesFromFeeGrowthDelta, fetchSfpmV3PoolId, fetchUniswapFeeData, getAccountBuyingPower, getAccountGreeks, getAccountHistory, getChunkLiquidities, getChunkSpreads, getClosedPositions, getCollateralCurve, getCollateralCurveInputs, getCollateralRequiredBase, getCollateralSharePrices, getCollateralTotalAssetsBatch, getDeltaHedgeParams, getEnforcedTickLimits, getExecutableLpMaxSize, getFactoryConstructMetadata, getFactoryOwnerOf, getFactoryTokenURI, getGuardianUnlockState, getHedgeLimits, getItmAmounts, getMarginBuffer, getMaxPositionSize, getMaxRedeem, getMaxWithdrawable, getNativeTokenPrice, getNotEnoughTokensError, getOpenPositionPreview, getPanopticPoolAddress, getPanopticPoolFromPoolId, getPendingPositions, getPoolCollateralAddresses, getPoolLiquidities, getPortfolioValue, getPositionChunkData, getPositionEnrichmentData, getPositionValueCurve, getPositionVolatilityHistory, getPriceHistory, getRealizedPnL, getRequiredCreditForITM, getSafeMode, getStreamiaHistory, getSyncStatus, getTrackedChunks, getTradeHistory, getUniswapFeeHistory, getUniswapV3LpPositionState, getUniswapV3PoolFromId, getUniswapV3PoolInfo, getUniswapV3PoolLiquidities, getUniswapV4LpPositionState, getUniswapV4PoolBasicState, getUniswapV4PoolInfo, getUniswapV4PoolKeyFromId, getUniswapV4PoolLiquidities, interpolateBlocks, isGasError, isNonceError, isRetryableRpcError, isolateGroupTokenId, ladderStrikeSequence, logReturns, marketPnlInQuote, marketRiskFromValues, marketScenario, minePoolAddress, minePoolAddressLocalAsync, multicallRead, netLiquidationValueInQuote, optimizeTokenIdRiskPartners, parseCollateralLog, parsePoolLog, positionValueKey, positionValueTicks, prepareIndicatorCandles, preparePositionValueCurve, previewDeposit, previewMint, previewRedeem, previewWithdraw, quoteLiquidation, quoteOneTokenFlow, quoteSfpmSwap, quoteTemporaryLoanRecovery, quoteTokenShortfallRecovery, realizedBeta, removeTrackedChunks, resolveBlockNumbers, resolveLadderStrike, resolvePanopticPoolFromPoolId, resolveUniswapV4PoolKey, saveClosedPosition, scaleCollateralRequired, scanChunks, screenAccountExact, simulateBatchDispatch, simulateClosePosition, simulateDeployNewPool, simulateDeposit, simulateForceExercise, simulateLiquidate, simulateSFPMBurn, simulateSFPMMint, simulateSwapExactIn, simulateSwapExactOut, simulateWithdraw, slippageBpsToTickDistance, watchEvents };
|
|
@@ -114,15 +114,29 @@ var _4663 = {
|
|
|
114
114
|
"panoptic": {
|
|
115
115
|
"pool": {
|
|
116
116
|
"version": "v4",
|
|
117
|
-
"panopticPool": "
|
|
118
|
-
"collateralTracker0": "
|
|
119
|
-
"collateralTracker1": "
|
|
117
|
+
"panopticPool": "0x000000000c21b38c54AcA7c7145Df01ff09d69Bb",
|
|
118
|
+
"collateralTracker0": "0xDc508622CD7e3850c8240e88c10361Cf493465b6",
|
|
119
|
+
"collateralTracker1": "0x9212d804953bAf89C24ceFa6545aA293bA08a876"
|
|
120
|
+
},
|
|
121
|
+
"additionalPools": {
|
|
122
|
+
"spyUsdg30bpsV4": {
|
|
123
|
+
"version": "v4",
|
|
124
|
+
"panopticPool": "0x00000000989bcb6f24af4a1Ab2A6d6a31c98A58E",
|
|
125
|
+
"collateralTracker0": "0x49eaAC32A7CD4B8fB2209a12859a95E0b20aB0e5",
|
|
126
|
+
"collateralTracker1": "0x670C44a0FC35dbC410498e47A6290a1C3196d191"
|
|
127
|
+
},
|
|
128
|
+
"spyUsdg5bpsV4": {
|
|
129
|
+
"version": "v4",
|
|
130
|
+
"panopticPool": "0x000000000c21b38c54AcA7c7145Df01ff09d69Bb",
|
|
131
|
+
"collateralTracker0": "0xDc508622CD7e3850c8240e88c10361Cf493465b6",
|
|
132
|
+
"collateralTracker1": "0x9212d804953bAf89C24ceFa6545aA293bA08a876"
|
|
133
|
+
}
|
|
120
134
|
},
|
|
121
135
|
"v2": {
|
|
122
136
|
"semiFungiblePositionManagerV4": "0x00000000000005C3287f136Ef5AF56c68Ea6849f",
|
|
123
137
|
"semiFungiblePositionManagerV3": "0x00000000000005E4693aDc8Ec0f12D686f728198",
|
|
124
138
|
"builderFactory": "0x0000000000000a3D22E158417AA639D7F71b0FF7",
|
|
125
|
-
"riskEngine": "
|
|
139
|
+
"riskEngine": "0x0000000000000fE1E261f66ce2F44def4F5Ae0CB",
|
|
126
140
|
"panopticPoolImplementation": "0x000000000000135429F0DaCaB61639Bf6a63EbbC",
|
|
127
141
|
"collateralTrackerImplementation": "0x0000000000001d9c38CA405A2e04420865A08A33",
|
|
128
142
|
"panopticFactoryV4": "0x0000000000000c51d0f8cf4bd9adE7191372a625",
|
|
@@ -138,13 +152,29 @@ var _4663 = {
|
|
|
138
152
|
"0x0000000000000fe1e261f66ce2f44def4f5ae0cb",
|
|
139
153
|
"0x0000000000000f3fb82469581A74776178E76Ca4"
|
|
140
154
|
],
|
|
141
|
-
"markets": {
|
|
142
|
-
"
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
155
|
+
"markets": {
|
|
156
|
+
"spyUsdg": {
|
|
157
|
+
"currency0": "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",
|
|
158
|
+
"currency1": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
|
|
159
|
+
"fee": 500,
|
|
160
|
+
"tickSpacing": 5,
|
|
161
|
+
"poolId": "0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907"
|
|
162
|
+
},
|
|
163
|
+
"spyUsdg30bps": {
|
|
164
|
+
"currency0": "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",
|
|
165
|
+
"currency1": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
|
|
166
|
+
"fee": 3e3,
|
|
167
|
+
"tickSpacing": 60,
|
|
168
|
+
"poolId": "0xfe2a80bb5618fd14984b92ca6d45bf5ba67443ddb1435e28b2e48df2fc1526cd"
|
|
169
|
+
},
|
|
170
|
+
"spyUsdg5bps": {
|
|
171
|
+
"currency0": "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",
|
|
172
|
+
"currency1": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
|
|
173
|
+
"fee": 500,
|
|
174
|
+
"tickSpacing": 5,
|
|
175
|
+
"poolId": "0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
148
178
|
"subgraphs": {
|
|
149
179
|
"hypovault": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-robinhood/prod/gn",
|
|
150
180
|
"panoptic": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-robinhood/v2_prod/gn"
|
|
@@ -309,6 +339,10 @@ function getSpyUsdgMarket(deployment) {
|
|
|
309
339
|
if (market === void 0) throw new Error(`Missing SPY/USDG market for chainId ${deployment.chainId}`);
|
|
310
340
|
return market;
|
|
311
341
|
}
|
|
342
|
+
function requireDeploymentValue(value, label) {
|
|
343
|
+
if (value === void 0) throw new Error(`Missing deployment value: ${label}`);
|
|
344
|
+
return value;
|
|
345
|
+
}
|
|
312
346
|
const MAINNET_DEPLOYMENT = CHAIN_DEPLOYMENTS[MAINNET_CHAIN_ID];
|
|
313
347
|
const MAINNET_ETH_USDC_5BPS_V3_PANOPTIC_POOL_ADDRESSES = MAINNET_DEPLOYMENT.panoptic.additionalPools?.ethUsdc5bpsV3;
|
|
314
348
|
const MAINNET_PANOPTIC_V2_ADDRESSES = MAINNET_DEPLOYMENT.panoptic.v2;
|
|
@@ -337,9 +371,13 @@ const ROBINHOOD_HYPOVAULT_ADDRESSES = ROBINHOOD_DEPLOYMENT.hypovault.vaults;
|
|
|
337
371
|
const ROBINHOOD_HYPOVAULT_MANAGER_ADDRESSES = ROBINHOOD_DEPLOYMENT.hypovault.managers;
|
|
338
372
|
const ROBINHOOD_HYPOVAULT_MANAGER_TURNKEY_SIGNERS = ROBINHOOD_DEPLOYMENT.hypovault.turnkeySigners;
|
|
339
373
|
const ROBINHOOD_PANOPTIC_POOL_ADDRESSES = ROBINHOOD_DEPLOYMENT.panoptic.pool;
|
|
374
|
+
const ROBINHOOD_SPY_USDG_30BPS_PANOPTIC_POOL_ADDRESSES = requireDeploymentValue(ROBINHOOD_DEPLOYMENT.panoptic.additionalPools?.spyUsdg30bpsV4, "Robinhood SPY/USDG 30bps Panoptic pool");
|
|
375
|
+
const ROBINHOOD_SPY_USDG_5BPS_PANOPTIC_POOL_ADDRESSES = requireDeploymentValue(ROBINHOOD_DEPLOYMENT.panoptic.additionalPools?.spyUsdg5bpsV4, "Robinhood SPY/USDG 5bps Panoptic pool");
|
|
340
376
|
const ROBINHOOD_PANOPTIC_V2_ADDRESSES = ROBINHOOD_DEPLOYMENT.panoptic.v2;
|
|
341
377
|
const ROBINHOOD_RISK_ENGINES = ROBINHOOD_DEPLOYMENT.riskEngines;
|
|
342
378
|
const ROBINHOOD_SPY_USDG_MARKET = getSpyUsdgMarket(ROBINHOOD_DEPLOYMENT);
|
|
379
|
+
const ROBINHOOD_SPY_USDG_30BPS_MARKET = requireDeploymentValue(ROBINHOOD_DEPLOYMENT.markets.spyUsdg30bps, "Robinhood SPY/USDG 30bps market");
|
|
380
|
+
const ROBINHOOD_SPY_USDG_5BPS_MARKET = requireDeploymentValue(ROBINHOOD_DEPLOYMENT.markets.spyUsdg5bps, "Robinhood SPY/USDG 5bps market");
|
|
343
381
|
|
|
344
382
|
//#endregion
|
|
345
383
|
//#region ../deployments/src/vaultDisplayNames.js
|