@whetstone-research/doppler-sdk 1.0.27 → 1.0.29
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/{chunk-U6B52TBT.cjs → chunk-4CI2M2F6.cjs} +27 -2
- package/dist/chunk-4CI2M2F6.cjs.map +1 -0
- package/dist/{chunk-XTL2GBZ4.cjs → chunk-7PXLEMBJ.cjs} +439 -91
- package/dist/chunk-7PXLEMBJ.cjs.map +1 -0
- package/dist/{chunk-WD5VOZGI.js → chunk-AFXFT3BD.js} +24 -3
- package/dist/chunk-AFXFT3BD.js.map +1 -0
- package/dist/{chunk-RVDRWCJN.js → chunk-PSLY7M7C.js} +392 -63
- package/dist/chunk-PSLY7M7C.js.map +1 -0
- package/dist/evm/index.cjs +243 -175
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +36 -60
- package/dist/evm/index.d.ts +36 -60
- package/dist/evm/index.js +244 -176
- package/dist/evm/index.js.map +1 -1
- package/dist/{pda-H6VMGONM.cjs → pda-44IHEORD.cjs} +21 -17
- package/dist/pda-44IHEORD.cjs.map +1 -0
- package/dist/{pda-UJLXCO6I.js → pda-WJVDXQPW.js} +3 -3
- package/dist/pda-WJVDXQPW.js.map +1 -0
- package/dist/solana/index.cjs +1664 -925
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +748 -159
- package/dist/solana/index.d.ts +748 -159
- package/dist/solana/index.js +1311 -577
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/react/index.cjs +45 -45
- package/dist/solana/react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-RVDRWCJN.js.map +0 -1
- package/dist/chunk-U6B52TBT.cjs.map +0 -1
- package/dist/chunk-WD5VOZGI.js.map +0 -1
- package/dist/chunk-XTL2GBZ4.cjs.map +0 -1
- package/dist/pda-H6VMGONM.cjs.map +0 -1
- package/dist/pda-UJLXCO6I.js.map +0 -1
package/dist/evm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../chunk-PZ5AY32C.js';
|
|
2
|
-
import { parseEther, formatEther, getAddress, encodeAbiParameters, keccak256, decodeAbiParameters, encodePacked, decodeEventLog, toHex, zeroAddress, zeroHash, encodeFunctionData, BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError, multicall3Abi, decodeFunctionResult, decodeErrorResult } from 'viem';
|
|
2
|
+
import { parseEther, formatEther, getAddress, encodeAbiParameters, keccak256, decodeAbiParameters, encodePacked, decodeEventLog, toHex, zeroAddress, zeroHash, encodeFunctionData, isAddress, BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError, isHex, multicall3Abi, decodeFunctionResult, decodeErrorResult } from 'viem';
|
|
3
3
|
|
|
4
4
|
// src/evm/deployments.generated.ts
|
|
5
5
|
var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
@@ -6777,11 +6777,14 @@ function computeOptimalGamma(startTick, endTick, duration, epochLength, tickSpac
|
|
|
6777
6777
|
|
|
6778
6778
|
// src/evm/utils/gasEstimate.ts
|
|
6779
6779
|
async function resolveGasEstimate(request, fallback) {
|
|
6780
|
-
if (
|
|
6780
|
+
if (isGasEstimateRequest(request)) {
|
|
6781
6781
|
return request.gas;
|
|
6782
6782
|
}
|
|
6783
6783
|
return await fallback();
|
|
6784
6784
|
}
|
|
6785
|
+
function isGasEstimateRequest(request) {
|
|
6786
|
+
return typeof request === "object" && request !== null && "gas" in request && typeof request.gas === "bigint";
|
|
6787
|
+
}
|
|
6785
6788
|
|
|
6786
6789
|
// src/evm/utils/isToken0Expected.ts
|
|
6787
6790
|
function isToken0Expected(numeraire) {
|
|
@@ -12126,6 +12129,214 @@ var DopplerFactory = class {
|
|
|
12126
12129
|
}
|
|
12127
12130
|
};
|
|
12128
12131
|
var MULTICURVE_BUNDLER_SELECTORS = ["0xe2e9faa1", "0x07087b06"];
|
|
12132
|
+
function parseAirlockPoolOrHook(rawAssetData, context = "Airlock getAssetData") {
|
|
12133
|
+
const rawPoolOrHook = readContractResultField(
|
|
12134
|
+
rawAssetData,
|
|
12135
|
+
["poolOrHook", "pool"],
|
|
12136
|
+
5,
|
|
12137
|
+
context
|
|
12138
|
+
);
|
|
12139
|
+
return parseAddress(rawPoolOrHook, context, "poolOrHook");
|
|
12140
|
+
}
|
|
12141
|
+
function parseAirlockLiquidityMigrator(rawAssetData, context = "Airlock getAssetData") {
|
|
12142
|
+
const rawLiquidityMigrator = readContractResultField(
|
|
12143
|
+
rawAssetData,
|
|
12144
|
+
["liquidityMigrator"],
|
|
12145
|
+
3,
|
|
12146
|
+
context
|
|
12147
|
+
);
|
|
12148
|
+
return parseAddress(rawLiquidityMigrator, context, "liquidityMigrator");
|
|
12149
|
+
}
|
|
12150
|
+
function normalizeDynamicHookState(rawState, context = "DopplerHook state") {
|
|
12151
|
+
return {
|
|
12152
|
+
totalTokensSold: parseBigIntField(rawState, "totalTokensSold", 2, context),
|
|
12153
|
+
totalProceeds: parseBigIntField(rawState, "totalProceeds", 3, context)
|
|
12154
|
+
};
|
|
12155
|
+
}
|
|
12156
|
+
function normalizeRehypeFeeDistributionInfo(rawInfo, context = "Rehype getFeeDistributionInfo") {
|
|
12157
|
+
return {
|
|
12158
|
+
assetFeesToAssetBuybackWad: parseBigIntField(
|
|
12159
|
+
rawInfo,
|
|
12160
|
+
"assetFeesToAssetBuybackWad",
|
|
12161
|
+
0,
|
|
12162
|
+
context
|
|
12163
|
+
),
|
|
12164
|
+
assetFeesToNumeraireBuybackWad: parseBigIntField(
|
|
12165
|
+
rawInfo,
|
|
12166
|
+
"assetFeesToNumeraireBuybackWad",
|
|
12167
|
+
1,
|
|
12168
|
+
context
|
|
12169
|
+
),
|
|
12170
|
+
assetFeesToBeneficiaryWad: parseBigIntField(
|
|
12171
|
+
rawInfo,
|
|
12172
|
+
"assetFeesToBeneficiaryWad",
|
|
12173
|
+
2,
|
|
12174
|
+
context
|
|
12175
|
+
),
|
|
12176
|
+
assetFeesToLpWad: parseBigIntField(rawInfo, "assetFeesToLpWad", 3, context),
|
|
12177
|
+
numeraireFeesToAssetBuybackWad: parseBigIntField(
|
|
12178
|
+
rawInfo,
|
|
12179
|
+
"numeraireFeesToAssetBuybackWad",
|
|
12180
|
+
4,
|
|
12181
|
+
context
|
|
12182
|
+
),
|
|
12183
|
+
numeraireFeesToNumeraireBuybackWad: parseBigIntField(
|
|
12184
|
+
rawInfo,
|
|
12185
|
+
"numeraireFeesToNumeraireBuybackWad",
|
|
12186
|
+
5,
|
|
12187
|
+
context
|
|
12188
|
+
),
|
|
12189
|
+
numeraireFeesToBeneficiaryWad: parseBigIntField(
|
|
12190
|
+
rawInfo,
|
|
12191
|
+
"numeraireFeesToBeneficiaryWad",
|
|
12192
|
+
6,
|
|
12193
|
+
context
|
|
12194
|
+
),
|
|
12195
|
+
numeraireFeesToLpWad: parseBigIntField(
|
|
12196
|
+
rawInfo,
|
|
12197
|
+
"numeraireFeesToLpWad",
|
|
12198
|
+
7,
|
|
12199
|
+
context
|
|
12200
|
+
)
|
|
12201
|
+
};
|
|
12202
|
+
}
|
|
12203
|
+
function normalizeRehypeFeeSchedule(rawSchedule, context = "Rehype getFeeSchedule") {
|
|
12204
|
+
return {
|
|
12205
|
+
startingTime: parseNumberField(rawSchedule, "startingTime", 0, context),
|
|
12206
|
+
startFee: parseNumberField(rawSchedule, "startFee", 1, context),
|
|
12207
|
+
endFee: parseNumberField(rawSchedule, "endFee", 2, context),
|
|
12208
|
+
lastFee: parseNumberField(rawSchedule, "lastFee", 3, context),
|
|
12209
|
+
durationSeconds: parseNumberField(
|
|
12210
|
+
rawSchedule,
|
|
12211
|
+
"durationSeconds",
|
|
12212
|
+
4,
|
|
12213
|
+
context
|
|
12214
|
+
)
|
|
12215
|
+
};
|
|
12216
|
+
}
|
|
12217
|
+
function normalizeRehypeHookFees(rawFees, context = "Rehype getHookFees") {
|
|
12218
|
+
return {
|
|
12219
|
+
fees0: parseBigIntField(rawFees, "fees0", 0, context),
|
|
12220
|
+
fees1: parseBigIntField(rawFees, "fees1", 1, context),
|
|
12221
|
+
beneficiaryFees0: parseBigIntField(rawFees, "beneficiaryFees0", 2, context),
|
|
12222
|
+
beneficiaryFees1: parseBigIntField(rawFees, "beneficiaryFees1", 3, context),
|
|
12223
|
+
airlockOwnerFees0: parseBigIntField(
|
|
12224
|
+
rawFees,
|
|
12225
|
+
"airlockOwnerFees0",
|
|
12226
|
+
4,
|
|
12227
|
+
context
|
|
12228
|
+
),
|
|
12229
|
+
airlockOwnerFees1: parseBigIntField(
|
|
12230
|
+
rawFees,
|
|
12231
|
+
"airlockOwnerFees1",
|
|
12232
|
+
5,
|
|
12233
|
+
context
|
|
12234
|
+
),
|
|
12235
|
+
customFee: parseNumberField(rawFees, "customFee", 6, context)
|
|
12236
|
+
};
|
|
12237
|
+
}
|
|
12238
|
+
function normalizeRehypePoolInfo(rawInfo, context = "Rehype getPoolInfo") {
|
|
12239
|
+
return {
|
|
12240
|
+
asset: parseAddressField(rawInfo, "asset", 0, context),
|
|
12241
|
+
numeraire: parseAddressField(rawInfo, "numeraire", 1, context),
|
|
12242
|
+
buybackDst: parseAddressField(rawInfo, "buybackDst", 2, context)
|
|
12243
|
+
};
|
|
12244
|
+
}
|
|
12245
|
+
function normalizeRehypePosition(rawPosition, context = "Rehype getPosition") {
|
|
12246
|
+
return {
|
|
12247
|
+
tickLower: parseNumberField(rawPosition, "tickLower", 0, context),
|
|
12248
|
+
tickUpper: parseNumberField(rawPosition, "tickUpper", 1, context),
|
|
12249
|
+
liquidity: parseBigIntField(rawPosition, "liquidity", 2, context),
|
|
12250
|
+
salt: parseHexField(rawPosition, "salt", 3, context)
|
|
12251
|
+
};
|
|
12252
|
+
}
|
|
12253
|
+
function parseAddressField(rawResult, fieldName, tupleIndex, context) {
|
|
12254
|
+
const rawField = readContractResultField(
|
|
12255
|
+
rawResult,
|
|
12256
|
+
[fieldName],
|
|
12257
|
+
tupleIndex,
|
|
12258
|
+
context
|
|
12259
|
+
);
|
|
12260
|
+
return parseAddress(rawField, context, fieldName);
|
|
12261
|
+
}
|
|
12262
|
+
function parseBigIntField(rawResult, fieldName, tupleIndex, context) {
|
|
12263
|
+
const rawField = readContractResultField(
|
|
12264
|
+
rawResult,
|
|
12265
|
+
[fieldName],
|
|
12266
|
+
tupleIndex,
|
|
12267
|
+
context
|
|
12268
|
+
);
|
|
12269
|
+
if (typeof rawField === "bigint") {
|
|
12270
|
+
return rawField;
|
|
12271
|
+
}
|
|
12272
|
+
if (typeof rawField === "number" && Number.isSafeInteger(rawField)) {
|
|
12273
|
+
return BigInt(rawField);
|
|
12274
|
+
}
|
|
12275
|
+
if (typeof rawField === "string" && rawField.trim() !== "") {
|
|
12276
|
+
try {
|
|
12277
|
+
return BigInt(rawField);
|
|
12278
|
+
} catch {
|
|
12279
|
+
throw new Error(`${context}: ${fieldName} must be bigint-compatible`);
|
|
12280
|
+
}
|
|
12281
|
+
}
|
|
12282
|
+
throw new Error(`${context}: ${fieldName} must be bigint-compatible`);
|
|
12283
|
+
}
|
|
12284
|
+
function parseNumberField(rawResult, fieldName, tupleIndex, context) {
|
|
12285
|
+
const rawField = readContractResultField(
|
|
12286
|
+
rawResult,
|
|
12287
|
+
[fieldName],
|
|
12288
|
+
tupleIndex,
|
|
12289
|
+
context
|
|
12290
|
+
);
|
|
12291
|
+
const numericField = typeof rawField === "bigint" || typeof rawField === "number" ? Number(rawField) : Number.NaN;
|
|
12292
|
+
if (!Number.isSafeInteger(numericField)) {
|
|
12293
|
+
throw new Error(`${context}: ${fieldName} must be a safe integer`);
|
|
12294
|
+
}
|
|
12295
|
+
return numericField;
|
|
12296
|
+
}
|
|
12297
|
+
function parseHexField(rawResult, fieldName, tupleIndex, context) {
|
|
12298
|
+
const rawField = readContractResultField(
|
|
12299
|
+
rawResult,
|
|
12300
|
+
[fieldName],
|
|
12301
|
+
tupleIndex,
|
|
12302
|
+
context
|
|
12303
|
+
);
|
|
12304
|
+
if (typeof rawField === "string" && isHex(rawField)) {
|
|
12305
|
+
return rawField;
|
|
12306
|
+
}
|
|
12307
|
+
throw new Error(`${context}: ${fieldName} must be hex`);
|
|
12308
|
+
}
|
|
12309
|
+
function parseAddress(rawField, context, fieldName) {
|
|
12310
|
+
if (typeof rawField === "string" && isAddress(rawField, { strict: false })) {
|
|
12311
|
+
return rawField;
|
|
12312
|
+
}
|
|
12313
|
+
throw new Error(`${context}: ${fieldName} must be an address`);
|
|
12314
|
+
}
|
|
12315
|
+
function readContractResultField(rawResult, fieldNames, tupleIndex, context) {
|
|
12316
|
+
if (Array.isArray(rawResult)) {
|
|
12317
|
+
if (tupleIndex < rawResult.length && rawResult[tupleIndex] !== void 0) {
|
|
12318
|
+
return rawResult[tupleIndex];
|
|
12319
|
+
}
|
|
12320
|
+
throw new Error(
|
|
12321
|
+
`${context}: missing tuple field ${fieldNames.join("/")} at index ${tupleIndex}`
|
|
12322
|
+
);
|
|
12323
|
+
}
|
|
12324
|
+
if (isRecord(rawResult)) {
|
|
12325
|
+
for (const fieldName of fieldNames) {
|
|
12326
|
+
const rawField = rawResult[fieldName];
|
|
12327
|
+
if (rawField !== void 0) {
|
|
12328
|
+
return rawField;
|
|
12329
|
+
}
|
|
12330
|
+
}
|
|
12331
|
+
throw new Error(`${context}: missing field ${fieldNames.join("/")}`);
|
|
12332
|
+
}
|
|
12333
|
+
throw new Error(`${context}: expected tuple or object result`);
|
|
12334
|
+
}
|
|
12335
|
+
function isRecord(rawResult) {
|
|
12336
|
+
return typeof rawResult === "object" && rawResult !== null;
|
|
12337
|
+
}
|
|
12338
|
+
|
|
12339
|
+
// src/evm/entities/auction/StaticAuction.ts
|
|
12129
12340
|
var StaticAuction = class {
|
|
12130
12341
|
client;
|
|
12131
12342
|
poolAddress;
|
|
@@ -12181,13 +12392,7 @@ var StaticAuction = class {
|
|
|
12181
12392
|
functionName: "getAssetData",
|
|
12182
12393
|
args: [token0]
|
|
12183
12394
|
});
|
|
12184
|
-
|
|
12185
|
-
if (Array.isArray(assetData)) {
|
|
12186
|
-
poolOrHook0 = assetData[5];
|
|
12187
|
-
} else if (assetData && typeof assetData === "object") {
|
|
12188
|
-
poolOrHook0 = assetData.poolOrHook ?? assetData.pool;
|
|
12189
|
-
}
|
|
12190
|
-
const isToken0AuctionToken = poolOrHook0 && poolOrHook0 !== zeroAddress;
|
|
12395
|
+
const isToken0AuctionToken = this.isRegisteredAirlockAsset(assetData);
|
|
12191
12396
|
return {
|
|
12192
12397
|
address: this.poolAddress,
|
|
12193
12398
|
tokenAddress: isToken0AuctionToken ? token0 : token1,
|
|
@@ -12218,7 +12423,7 @@ var StaticAuction = class {
|
|
|
12218
12423
|
functionName: "getAssetData",
|
|
12219
12424
|
args: [tokenAddress]
|
|
12220
12425
|
});
|
|
12221
|
-
const liquidityMigrator =
|
|
12426
|
+
const liquidityMigrator = parseAirlockLiquidityMigrator(assetData);
|
|
12222
12427
|
return liquidityMigrator === zeroAddress;
|
|
12223
12428
|
}
|
|
12224
12429
|
/**
|
|
@@ -12227,18 +12432,11 @@ var StaticAuction = class {
|
|
|
12227
12432
|
*/
|
|
12228
12433
|
async getCurrentPrice() {
|
|
12229
12434
|
const poolInfo = await this.getPoolInfo();
|
|
12230
|
-
const
|
|
12231
|
-
this.
|
|
12232
|
-
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
}),
|
|
12236
|
-
this.rpc.readContract({
|
|
12237
|
-
address: this.poolAddress,
|
|
12238
|
-
abi: uniswapV3PoolAbi,
|
|
12239
|
-
functionName: "token1"
|
|
12240
|
-
})
|
|
12241
|
-
]);
|
|
12435
|
+
const token0 = await this.rpc.readContract({
|
|
12436
|
+
address: this.poolAddress,
|
|
12437
|
+
abi: uniswapV3PoolAbi,
|
|
12438
|
+
functionName: "token0"
|
|
12439
|
+
});
|
|
12242
12440
|
const sqrtPriceX96 = poolInfo.sqrtPriceX96;
|
|
12243
12441
|
const Q962 = BigInt(2) ** BigInt(96);
|
|
12244
12442
|
const sqrtPriceX96Squared = sqrtPriceX96 * sqrtPriceX96;
|
|
@@ -12260,6 +12458,13 @@ var StaticAuction = class {
|
|
|
12260
12458
|
functionName: "liquidity"
|
|
12261
12459
|
});
|
|
12262
12460
|
}
|
|
12461
|
+
isRegisteredAirlockAsset(assetData) {
|
|
12462
|
+
try {
|
|
12463
|
+
return parseAirlockPoolOrHook(assetData) !== zeroAddress;
|
|
12464
|
+
} catch {
|
|
12465
|
+
return false;
|
|
12466
|
+
}
|
|
12467
|
+
}
|
|
12263
12468
|
};
|
|
12264
12469
|
var DynamicAuction = class {
|
|
12265
12470
|
client;
|
|
@@ -12345,11 +12550,11 @@ var DynamicAuction = class {
|
|
|
12345
12550
|
const currentTime = BigInt(Math.floor(Date.now() / 1e3));
|
|
12346
12551
|
const elapsedTime = currentTime > startingTime ? currentTime - startingTime : BigInt(0);
|
|
12347
12552
|
const currentEpoch = epochLength > 0n ? Number(elapsedTime / epochLength) : 0;
|
|
12348
|
-
const poolKey =
|
|
12553
|
+
const poolKey = normalizePoolKey(poolKeyRaw);
|
|
12349
12554
|
const isToken0 = poolKey.currency0 !== zeroAddress;
|
|
12350
12555
|
const tokenAddress = isToken0 ? poolKey.currency0 : poolKey.currency1;
|
|
12351
12556
|
const numeraireAddress = isToken0 ? poolKey.currency1 : poolKey.currency0;
|
|
12352
|
-
const poolId =
|
|
12557
|
+
const poolId = computePoolId(poolKey);
|
|
12353
12558
|
return {
|
|
12354
12559
|
hookAddress: this.hookAddress,
|
|
12355
12560
|
tokenAddress,
|
|
@@ -12376,7 +12581,7 @@ var DynamicAuction = class {
|
|
|
12376
12581
|
abi: dopplerHookAbi,
|
|
12377
12582
|
functionName: "poolKey"
|
|
12378
12583
|
});
|
|
12379
|
-
const poolKey =
|
|
12584
|
+
const poolKey = normalizePoolKey(poolKeyRaw);
|
|
12380
12585
|
const isToken0 = await this.rpc.readContract({
|
|
12381
12586
|
address: this.hookAddress,
|
|
12382
12587
|
abi: dopplerHookAbi,
|
|
@@ -12393,8 +12598,8 @@ var DynamicAuction = class {
|
|
|
12393
12598
|
abi: dopplerHookAbi,
|
|
12394
12599
|
functionName: "poolKey"
|
|
12395
12600
|
});
|
|
12396
|
-
const poolKey =
|
|
12397
|
-
return
|
|
12601
|
+
const poolKey = normalizePoolKey(poolKeyRaw);
|
|
12602
|
+
return computePoolId(poolKey);
|
|
12398
12603
|
}
|
|
12399
12604
|
/**
|
|
12400
12605
|
* Check if the auction has graduated (ready for migration)
|
|
@@ -12409,7 +12614,7 @@ var DynamicAuction = class {
|
|
|
12409
12614
|
functionName: "getAssetData",
|
|
12410
12615
|
args: [tokenAddress]
|
|
12411
12616
|
});
|
|
12412
|
-
const liquidityMigrator =
|
|
12617
|
+
const liquidityMigrator = parseAirlockLiquidityMigrator(assetData);
|
|
12413
12618
|
return liquidityMigrator === zeroAddress;
|
|
12414
12619
|
}
|
|
12415
12620
|
/**
|
|
@@ -12437,8 +12642,7 @@ var DynamicAuction = class {
|
|
|
12437
12642
|
* Returns the current tick based on the epoch and gamma parameters
|
|
12438
12643
|
*/
|
|
12439
12644
|
async getCurrentPrice() {
|
|
12440
|
-
const [
|
|
12441
|
-
this.readHookState(),
|
|
12645
|
+
const [startingTick, endingTick, gamma, startingTime, epochLength] = await Promise.all([
|
|
12442
12646
|
this.rpc.readContract({
|
|
12443
12647
|
address: this.hookAddress,
|
|
12444
12648
|
abi: dopplerHookAbi,
|
|
@@ -12490,64 +12694,13 @@ var DynamicAuction = class {
|
|
|
12490
12694
|
functionName: "earlyExit"
|
|
12491
12695
|
});
|
|
12492
12696
|
}
|
|
12493
|
-
/**
|
|
12494
|
-
* Compute V4 pool ID from pool key components
|
|
12495
|
-
*/
|
|
12496
|
-
computePoolId(poolKey) {
|
|
12497
|
-
const encoded = encodeAbiParameters(
|
|
12498
|
-
[
|
|
12499
|
-
{ type: "address" },
|
|
12500
|
-
{ type: "address" },
|
|
12501
|
-
{ type: "uint24" },
|
|
12502
|
-
{ type: "int24" },
|
|
12503
|
-
{ type: "address" }
|
|
12504
|
-
],
|
|
12505
|
-
[
|
|
12506
|
-
poolKey.currency0,
|
|
12507
|
-
poolKey.currency1,
|
|
12508
|
-
poolKey.fee,
|
|
12509
|
-
poolKey.tickSpacing,
|
|
12510
|
-
poolKey.hooks
|
|
12511
|
-
]
|
|
12512
|
-
);
|
|
12513
|
-
return keccak256(encoded);
|
|
12514
|
-
}
|
|
12515
|
-
/**
|
|
12516
|
-
* Read hook state with backward-compatible decoding.
|
|
12517
|
-
* Falls back to legacy state() ABI if the latest ABI fails to decode.
|
|
12518
|
-
*/
|
|
12519
12697
|
async readHookState() {
|
|
12520
|
-
const
|
|
12698
|
+
const rawState = await this.rpc.readContract({
|
|
12521
12699
|
address: this.hookAddress,
|
|
12522
12700
|
abi: dopplerHookAbi,
|
|
12523
12701
|
functionName: "state"
|
|
12524
12702
|
});
|
|
12525
|
-
|
|
12526
|
-
const [
|
|
12527
|
-
lastEpoch,
|
|
12528
|
-
tickAccumulator,
|
|
12529
|
-
totalTokensSold,
|
|
12530
|
-
totalProceeds,
|
|
12531
|
-
totalTokensSoldLastEpoch,
|
|
12532
|
-
feesAccrued
|
|
12533
|
-
] = result;
|
|
12534
|
-
return {
|
|
12535
|
-
lastEpoch,
|
|
12536
|
-
tickAccumulator,
|
|
12537
|
-
totalTokensSold,
|
|
12538
|
-
totalProceeds,
|
|
12539
|
-
totalTokensSoldLastEpoch,
|
|
12540
|
-
feesAccrued
|
|
12541
|
-
};
|
|
12542
|
-
}
|
|
12543
|
-
return result;
|
|
12544
|
-
}
|
|
12545
|
-
normalizePoolKey(value) {
|
|
12546
|
-
if (Array.isArray(value)) {
|
|
12547
|
-
const [currency0, currency1, fee, tickSpacing, hooks] = value;
|
|
12548
|
-
return { currency0, currency1, fee, tickSpacing, hooks };
|
|
12549
|
-
}
|
|
12550
|
-
return value;
|
|
12703
|
+
return normalizeDynamicHookState(rawState);
|
|
12551
12704
|
}
|
|
12552
12705
|
};
|
|
12553
12706
|
var ABSENT_POOL_ERROR_ABI = [
|
|
@@ -13302,29 +13455,7 @@ var RehypeDopplerHook = class {
|
|
|
13302
13455
|
functionName: "getFeeDistributionInfo",
|
|
13303
13456
|
args: [poolId]
|
|
13304
13457
|
});
|
|
13305
|
-
|
|
13306
|
-
return {
|
|
13307
|
-
assetFeesToAssetBuybackWad: BigInt(
|
|
13308
|
-
info.assetFeesToAssetBuybackWad ?? info[0]
|
|
13309
|
-
),
|
|
13310
|
-
assetFeesToNumeraireBuybackWad: BigInt(
|
|
13311
|
-
info.assetFeesToNumeraireBuybackWad ?? info[1]
|
|
13312
|
-
),
|
|
13313
|
-
assetFeesToBeneficiaryWad: BigInt(
|
|
13314
|
-
info.assetFeesToBeneficiaryWad ?? info[2]
|
|
13315
|
-
),
|
|
13316
|
-
assetFeesToLpWad: BigInt(info.assetFeesToLpWad ?? info[3]),
|
|
13317
|
-
numeraireFeesToAssetBuybackWad: BigInt(
|
|
13318
|
-
info.numeraireFeesToAssetBuybackWad ?? info[4]
|
|
13319
|
-
),
|
|
13320
|
-
numeraireFeesToNumeraireBuybackWad: BigInt(
|
|
13321
|
-
info.numeraireFeesToNumeraireBuybackWad ?? info[5]
|
|
13322
|
-
),
|
|
13323
|
-
numeraireFeesToBeneficiaryWad: BigInt(
|
|
13324
|
-
info.numeraireFeesToBeneficiaryWad ?? info[6]
|
|
13325
|
-
),
|
|
13326
|
-
numeraireFeesToLpWad: BigInt(info.numeraireFeesToLpWad ?? info[7])
|
|
13327
|
-
};
|
|
13458
|
+
return normalizeRehypeFeeDistributionInfo(result);
|
|
13328
13459
|
}
|
|
13329
13460
|
async getFeeRoutingMode(poolId) {
|
|
13330
13461
|
const mode = await this.rpc.readContract({
|
|
@@ -13342,14 +13473,7 @@ var RehypeDopplerHook = class {
|
|
|
13342
13473
|
functionName: "getFeeSchedule",
|
|
13343
13474
|
args: [poolId]
|
|
13344
13475
|
});
|
|
13345
|
-
|
|
13346
|
-
return {
|
|
13347
|
-
startingTime: Number(schedule.startingTime ?? schedule[0] ?? 0),
|
|
13348
|
-
startFee: Number(schedule.startFee ?? schedule[1] ?? 0),
|
|
13349
|
-
endFee: Number(schedule.endFee ?? schedule[2] ?? 0),
|
|
13350
|
-
lastFee: Number(schedule.lastFee ?? schedule[3] ?? 0),
|
|
13351
|
-
durationSeconds: Number(schedule.durationSeconds ?? schedule[4] ?? 0)
|
|
13352
|
-
};
|
|
13476
|
+
return normalizeRehypeFeeSchedule(result);
|
|
13353
13477
|
}
|
|
13354
13478
|
async getHookFees(poolId) {
|
|
13355
13479
|
const result = await this.rpc.readContract({
|
|
@@ -13358,16 +13482,7 @@ var RehypeDopplerHook = class {
|
|
|
13358
13482
|
functionName: "getHookFees",
|
|
13359
13483
|
args: [poolId]
|
|
13360
13484
|
});
|
|
13361
|
-
|
|
13362
|
-
return {
|
|
13363
|
-
fees0: BigInt(fees.fees0 ?? fees[0] ?? 0),
|
|
13364
|
-
fees1: BigInt(fees.fees1 ?? fees[1] ?? 0),
|
|
13365
|
-
beneficiaryFees0: BigInt(fees.beneficiaryFees0 ?? fees[2] ?? 0),
|
|
13366
|
-
beneficiaryFees1: BigInt(fees.beneficiaryFees1 ?? fees[3] ?? 0),
|
|
13367
|
-
airlockOwnerFees0: BigInt(fees.airlockOwnerFees0 ?? fees[4] ?? 0),
|
|
13368
|
-
airlockOwnerFees1: BigInt(fees.airlockOwnerFees1 ?? fees[5] ?? 0),
|
|
13369
|
-
customFee: Number(fees.customFee ?? fees[6] ?? 0)
|
|
13370
|
-
};
|
|
13485
|
+
return normalizeRehypeHookFees(result);
|
|
13371
13486
|
}
|
|
13372
13487
|
async getPoolInfo(poolId) {
|
|
13373
13488
|
const result = await this.rpc.readContract({
|
|
@@ -13376,12 +13491,7 @@ var RehypeDopplerHook = class {
|
|
|
13376
13491
|
functionName: "getPoolInfo",
|
|
13377
13492
|
args: [poolId]
|
|
13378
13493
|
});
|
|
13379
|
-
|
|
13380
|
-
return {
|
|
13381
|
-
asset: info.asset ?? info[0],
|
|
13382
|
-
numeraire: info.numeraire ?? info[1],
|
|
13383
|
-
buybackDst: info.buybackDst ?? info[2]
|
|
13384
|
-
};
|
|
13494
|
+
return normalizeRehypePoolInfo(result);
|
|
13385
13495
|
}
|
|
13386
13496
|
};
|
|
13387
13497
|
|
|
@@ -13469,29 +13579,7 @@ var RehypeDopplerHookMigrator = class {
|
|
|
13469
13579
|
functionName: "getFeeDistributionInfo",
|
|
13470
13580
|
args: [poolId]
|
|
13471
13581
|
});
|
|
13472
|
-
|
|
13473
|
-
return {
|
|
13474
|
-
assetFeesToAssetBuybackWad: BigInt(
|
|
13475
|
-
info.assetFeesToAssetBuybackWad ?? info[0]
|
|
13476
|
-
),
|
|
13477
|
-
assetFeesToNumeraireBuybackWad: BigInt(
|
|
13478
|
-
info.assetFeesToNumeraireBuybackWad ?? info[1]
|
|
13479
|
-
),
|
|
13480
|
-
assetFeesToBeneficiaryWad: BigInt(
|
|
13481
|
-
info.assetFeesToBeneficiaryWad ?? info[2]
|
|
13482
|
-
),
|
|
13483
|
-
assetFeesToLpWad: BigInt(info.assetFeesToLpWad ?? info[3]),
|
|
13484
|
-
numeraireFeesToAssetBuybackWad: BigInt(
|
|
13485
|
-
info.numeraireFeesToAssetBuybackWad ?? info[4]
|
|
13486
|
-
),
|
|
13487
|
-
numeraireFeesToNumeraireBuybackWad: BigInt(
|
|
13488
|
-
info.numeraireFeesToNumeraireBuybackWad ?? info[5]
|
|
13489
|
-
),
|
|
13490
|
-
numeraireFeesToBeneficiaryWad: BigInt(
|
|
13491
|
-
info.numeraireFeesToBeneficiaryWad ?? info[6]
|
|
13492
|
-
),
|
|
13493
|
-
numeraireFeesToLpWad: BigInt(info.numeraireFeesToLpWad ?? info[7])
|
|
13494
|
-
};
|
|
13582
|
+
return normalizeRehypeFeeDistributionInfo(result);
|
|
13495
13583
|
}
|
|
13496
13584
|
async getFeeRoutingMode(poolId) {
|
|
13497
13585
|
const mode = await this.rpc.readContract({
|
|
@@ -13509,16 +13597,7 @@ var RehypeDopplerHookMigrator = class {
|
|
|
13509
13597
|
functionName: "getHookFees",
|
|
13510
13598
|
args: [poolId]
|
|
13511
13599
|
});
|
|
13512
|
-
|
|
13513
|
-
return {
|
|
13514
|
-
fees0: BigInt(fees.fees0 ?? fees[0] ?? 0),
|
|
13515
|
-
fees1: BigInt(fees.fees1 ?? fees[1] ?? 0),
|
|
13516
|
-
beneficiaryFees0: BigInt(fees.beneficiaryFees0 ?? fees[2] ?? 0),
|
|
13517
|
-
beneficiaryFees1: BigInt(fees.beneficiaryFees1 ?? fees[3] ?? 0),
|
|
13518
|
-
airlockOwnerFees0: BigInt(fees.airlockOwnerFees0 ?? fees[4] ?? 0),
|
|
13519
|
-
airlockOwnerFees1: BigInt(fees.airlockOwnerFees1 ?? fees[5] ?? 0),
|
|
13520
|
-
customFee: Number(fees.customFee ?? fees[6] ?? 0)
|
|
13521
|
-
};
|
|
13600
|
+
return normalizeRehypeHookFees(result);
|
|
13522
13601
|
}
|
|
13523
13602
|
async getPoolInfo(poolId) {
|
|
13524
13603
|
const result = await this.rpc.readContract({
|
|
@@ -13527,12 +13606,7 @@ var RehypeDopplerHookMigrator = class {
|
|
|
13527
13606
|
functionName: "getPoolInfo",
|
|
13528
13607
|
args: [poolId]
|
|
13529
13608
|
});
|
|
13530
|
-
|
|
13531
|
-
return {
|
|
13532
|
-
asset: info.asset ?? info[0],
|
|
13533
|
-
numeraire: info.numeraire ?? info[1],
|
|
13534
|
-
buybackDst: info.buybackDst ?? info[2]
|
|
13535
|
-
};
|
|
13609
|
+
return normalizeRehypePoolInfo(result);
|
|
13536
13610
|
}
|
|
13537
13611
|
async getPosition(poolId) {
|
|
13538
13612
|
const result = await this.rpc.readContract({
|
|
@@ -13541,13 +13615,7 @@ var RehypeDopplerHookMigrator = class {
|
|
|
13541
13615
|
functionName: "getPosition",
|
|
13542
13616
|
args: [poolId]
|
|
13543
13617
|
});
|
|
13544
|
-
|
|
13545
|
-
return {
|
|
13546
|
-
tickLower: Number(position.tickLower ?? position[0] ?? 0),
|
|
13547
|
-
tickUpper: Number(position.tickUpper ?? position[1] ?? 0),
|
|
13548
|
-
liquidity: BigInt(position.liquidity ?? position[2] ?? 0),
|
|
13549
|
-
salt: position.salt ?? position[3]
|
|
13550
|
-
};
|
|
13618
|
+
return normalizeRehypePosition(result);
|
|
13551
13619
|
}
|
|
13552
13620
|
};
|
|
13553
13621
|
var OpeningAuctionPositionManager = class _OpeningAuctionPositionManager {
|