@whetstone-research/doppler-sdk 1.0.32 → 1.0.33
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/evm/index.cjs +173 -60
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +25 -6
- package/dist/evm/index.d.ts +25 -6
- package/dist/evm/index.js +173 -60
- package/dist/evm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/evm/index.cjs
CHANGED
|
@@ -24,10 +24,10 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
24
24
|
LockableUniswapV3Initializer: "0xA2E0435225D52a8B950122752978007D758056d7",
|
|
25
25
|
NoOpGovernanceFactory: "0xddAE8B3eD08184682f7Bc32B74d943cEEfEab638",
|
|
26
26
|
NoOpMigrator: "0x233A71A7bB928b1357A1Ebf454298320989Ca5B5",
|
|
27
|
-
Quoter: "
|
|
27
|
+
Quoter: "0x076838736F90Cd1d30dED756A3B89E576BE972F8",
|
|
28
28
|
RehypeDopplerHook: "0x3Ec4798A9B11e8243A8Db99687f7A23597B96623",
|
|
29
|
-
RehypeDopplerHookInitializer: "
|
|
30
|
-
RehypeDopplerHookMigrator: "
|
|
29
|
+
RehypeDopplerHookInitializer: "0x9982538F41f2ae29ddb9d3D9307010052984FDbB",
|
|
30
|
+
RehypeDopplerHookMigrator: "0x975f9d1939cf6e4A3c9D99f9d41e6411CF4dA23b",
|
|
31
31
|
StreamableFeesLocker: "0xe24FC2F7191e850e2D4514aBb4d39305b1871eC6",
|
|
32
32
|
StreamableFeesLockerV2: "0xcE3212e6536F33cD6fbFEE265224131353Ca3D47",
|
|
33
33
|
TimelockFactory: "0x9fd40af2baAfAF03513f091444e821c0d5b06ea0",
|
|
@@ -77,10 +77,10 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
77
77
|
LockableUniswapV3Initializer: "0x8b4C7DB9121FC885689C0A50D5a1429F15AEc2a0",
|
|
78
78
|
NoOpGovernanceFactory: "0xb4deE32EB70A5E55f3D2d861F49Fb3D79f7a14d9",
|
|
79
79
|
NoOpMigrator: "0x5F3bA43D44375286296Cb85F1EA2EBfa25dde731",
|
|
80
|
-
Quoter: "
|
|
80
|
+
Quoter: "0x076838736F90Cd1d30dED756A3B89E576BE972F8",
|
|
81
81
|
RehypeDopplerHook: "0x97cAD5684FB7Cc2bEd9a9b5eBfba67138F4f2503",
|
|
82
|
-
RehypeDopplerHookInitializer: "
|
|
83
|
-
RehypeDopplerHookMigrator: "
|
|
82
|
+
RehypeDopplerHookInitializer: "0x9982538F41f2ae29ddb9d3D9307010052984FDbB",
|
|
83
|
+
RehypeDopplerHookMigrator: "0x975f9d1939cf6e4A3c9D99f9d41e6411CF4dA23b",
|
|
84
84
|
StreamableFeesLocker: "0x63f8C8F9beFaab2FaCD7Ece0b0242f78B920Ee90",
|
|
85
85
|
StreamableFeesLockerV2: "0xcE3212e6536F33cD6fbFEE265224131353Ca3D47",
|
|
86
86
|
TimelockFactory: "0x44610355465c1F5914C8B8ea0E7c887CC67459b2",
|
|
@@ -142,9 +142,9 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
142
142
|
LockableUniswapV3Initializer: "0xde8886A0019Ea060B8378Ee37b8A23b8117F29A3",
|
|
143
143
|
NoOpGovernanceFactory: "0x85f37f74Ef2478A770318bc810177a9835911aD7",
|
|
144
144
|
NoOpMigrator: "0xba2F330EDb16cD8056f5988d8CE19BbC63475A0e",
|
|
145
|
-
Quoter: "
|
|
146
|
-
RehypeDopplerHookInitializer: "
|
|
147
|
-
RehypeDopplerHookMigrator: "
|
|
145
|
+
Quoter: "0x076838736F90Cd1d30dED756A3B89E576BE972F8",
|
|
146
|
+
RehypeDopplerHookInitializer: "0x9982538F41f2ae29ddb9d3D9307010052984FDbB",
|
|
147
|
+
RehypeDopplerHookMigrator: "0x975f9d1939cf6e4A3c9D99f9d41e6411CF4dA23b",
|
|
148
148
|
StreamableFeesLockerV2: "0x7B6147AC3F615bdb764e7EbD5f517dac1AD163B8",
|
|
149
149
|
SwapRestrictorDopplerHook: "0xC16c826F75338A5Ea626f94f8992191B4ce5abA2",
|
|
150
150
|
TimelockFactory: "0x6076fdDFCaC0dD980e0350dfF5239feC3f86C578",
|
|
@@ -185,10 +185,10 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
185
185
|
LockableUniswapV3Initializer: "0xE0dC4012AC9C868F09c6e4b20d66ED46D6F258d0",
|
|
186
186
|
NoOpGovernanceFactory: "0xe7dfbd5b0A2C3B4464653A9beCdc489229eF090E",
|
|
187
187
|
NoOpMigrator: "0x6ddfED58D238Ca3195E49d8ac3d4cEa6386E5C33",
|
|
188
|
-
Quoter: "
|
|
188
|
+
Quoter: "0x076838736F90Cd1d30dED756A3B89E576BE972F8",
|
|
189
189
|
RehypeDopplerHook: "0x3Ec4798A9B11e8243A8Db99687f7A23597B96623",
|
|
190
|
-
RehypeDopplerHookInitializer: "
|
|
191
|
-
RehypeDopplerHookMigrator: "
|
|
190
|
+
RehypeDopplerHookInitializer: "0x9982538F41f2ae29ddb9d3D9307010052984FDbB",
|
|
191
|
+
RehypeDopplerHookMigrator: "0x975f9d1939cf6e4A3c9D99f9d41e6411CF4dA23b",
|
|
192
192
|
StreamableFeesLocker: "0x0A00775D71a42cd33D62780003035e7F5b47bD3A",
|
|
193
193
|
StreamableFeesLockerV2: "0xcE3212e6536F33cD6fbFEE265224131353Ca3D47",
|
|
194
194
|
TimelockFactory: "0xa636bD5F9179E80e9EdB371Ed90956fA5ebdCB33",
|
|
@@ -7360,37 +7360,18 @@ function normalizeUint32(value, label) {
|
|
|
7360
7360
|
}
|
|
7361
7361
|
return normalized;
|
|
7362
7362
|
}
|
|
7363
|
-
function encodeRehypeDopplerHookInitializerData(numeraire, config
|
|
7364
|
-
|
|
7365
|
-
return viem.encodeAbiParameters(rehypeInitializerDataAbi, [
|
|
7366
|
-
{
|
|
7367
|
-
numeraire,
|
|
7368
|
-
buybackDst: config.buybackDestination ?? ZERO_ADDRESS,
|
|
7369
|
-
startFee: config.startFee,
|
|
7370
|
-
endFee: config.endFee,
|
|
7371
|
-
durationSeconds: config.durationSeconds,
|
|
7372
|
-
startingTime: config.startingTime,
|
|
7373
|
-
feeRoutingMode: config.feeRoutingMode,
|
|
7374
|
-
feeDistributionInfo: config.feeDistributionInfo,
|
|
7375
|
-
feeBeneficiaries: config.feeBeneficiaries ?? []
|
|
7376
|
-
}
|
|
7377
|
-
]);
|
|
7378
|
-
}
|
|
7379
|
-
if (config.feeBeneficiaries !== void 0) {
|
|
7380
|
-
throw new Error(
|
|
7381
|
-
"Rehype fee beneficiaries are temporarily supported only on Base Sepolia until the remaining initializer deployments are upgraded"
|
|
7382
|
-
);
|
|
7383
|
-
}
|
|
7384
|
-
return viem.encodeAbiParameters(legacyRehypeInitializerDataAbi, [
|
|
7363
|
+
function encodeRehypeDopplerHookInitializerData(numeraire, config) {
|
|
7364
|
+
return viem.encodeAbiParameters(rehypeInitializerDataAbi, [
|
|
7385
7365
|
{
|
|
7386
7366
|
numeraire,
|
|
7387
|
-
buybackDst: config.buybackDestination,
|
|
7367
|
+
buybackDst: config.buybackDestination ?? ZERO_ADDRESS,
|
|
7388
7368
|
startFee: config.startFee,
|
|
7389
7369
|
endFee: config.endFee,
|
|
7390
7370
|
durationSeconds: config.durationSeconds,
|
|
7391
7371
|
startingTime: config.startingTime,
|
|
7392
7372
|
feeRoutingMode: config.feeRoutingMode,
|
|
7393
|
-
feeDistributionInfo: config.feeDistributionInfo
|
|
7373
|
+
feeDistributionInfo: config.feeDistributionInfo,
|
|
7374
|
+
feeBeneficiaries: config.feeBeneficiaries ?? []
|
|
7394
7375
|
}
|
|
7395
7376
|
]);
|
|
7396
7377
|
}
|
|
@@ -7408,25 +7389,6 @@ var feeDistributionComponents = [
|
|
|
7408
7389
|
{ name: "numeraireFeesToBeneficiaryWad", type: "uint256" },
|
|
7409
7390
|
{ name: "numeraireFeesToLpWad", type: "uint256" }
|
|
7410
7391
|
];
|
|
7411
|
-
var legacyRehypeInitializerDataAbi = [
|
|
7412
|
-
{
|
|
7413
|
-
type: "tuple",
|
|
7414
|
-
components: [
|
|
7415
|
-
{ name: "numeraire", type: "address" },
|
|
7416
|
-
{ name: "buybackDst", type: "address" },
|
|
7417
|
-
{ name: "startFee", type: "uint24" },
|
|
7418
|
-
{ name: "endFee", type: "uint24" },
|
|
7419
|
-
{ name: "durationSeconds", type: "uint32" },
|
|
7420
|
-
{ name: "startingTime", type: "uint32" },
|
|
7421
|
-
{ name: "feeRoutingMode", type: "uint8" },
|
|
7422
|
-
{
|
|
7423
|
-
name: "feeDistributionInfo",
|
|
7424
|
-
type: "tuple",
|
|
7425
|
-
components: feeDistributionComponents
|
|
7426
|
-
}
|
|
7427
|
-
]
|
|
7428
|
-
}
|
|
7429
|
-
];
|
|
7430
7392
|
var rehypeInitializerDataAbi = [
|
|
7431
7393
|
{
|
|
7432
7394
|
type: "tuple",
|
|
@@ -10937,8 +10899,7 @@ var DopplerFactory = class {
|
|
|
10937
10899
|
dopplerHookAddress = hookConfig.hookAddress;
|
|
10938
10900
|
onInitializationDopplerHookCalldata = encodeRehypeDopplerHookInitializerData(
|
|
10939
10901
|
params.sale.numeraire,
|
|
10940
|
-
hookConfig
|
|
10941
|
-
this.chainId
|
|
10902
|
+
hookConfig
|
|
10942
10903
|
);
|
|
10943
10904
|
graduationDopplerHookCalldata = hookConfig.graduationCalldata ?? "0x";
|
|
10944
10905
|
}
|
|
@@ -13230,9 +13191,11 @@ function parseMulticurveInitializerDiscoveryResult({
|
|
|
13230
13191
|
stateData
|
|
13231
13192
|
}) {
|
|
13232
13193
|
const parsedState = kind === "dopplerHook" ? parseDopplerHookInitializerState(stateData) : parseStandardInitializerState(stateData);
|
|
13233
|
-
const { numeraire, status, poolKey, farTick } = parsedState;
|
|
13194
|
+
const { numeraire, status, poolKey, farTick, dopplerHookAddress } = parsedState;
|
|
13234
13195
|
return {
|
|
13235
13196
|
initializerAddress,
|
|
13197
|
+
initializerKind: kind,
|
|
13198
|
+
dopplerHookAddress,
|
|
13236
13199
|
state: {
|
|
13237
13200
|
asset: tokenAddress,
|
|
13238
13201
|
numeraire,
|
|
@@ -13270,7 +13233,8 @@ function parseStandardInitializerState(stateData) {
|
|
|
13270
13233
|
numeraire: state.numeraire ?? state[0],
|
|
13271
13234
|
status: Number(state.status ?? state[1]),
|
|
13272
13235
|
poolKey: parseMulticurvePoolKey(state.poolKey ?? state[2]),
|
|
13273
|
-
farTick: Number(state.farTick ?? state[3])
|
|
13236
|
+
farTick: Number(state.farTick ?? state[3]),
|
|
13237
|
+
dopplerHookAddress: viem.zeroAddress
|
|
13274
13238
|
};
|
|
13275
13239
|
}
|
|
13276
13240
|
function parseDopplerHookInitializerState(stateData) {
|
|
@@ -13279,7 +13243,8 @@ function parseDopplerHookInitializerState(stateData) {
|
|
|
13279
13243
|
numeraire: state.numeraire ?? state[0],
|
|
13280
13244
|
status: Number(state.status ?? state[4]),
|
|
13281
13245
|
poolKey: parseMulticurvePoolKey(state.poolKey ?? state[5]),
|
|
13282
|
-
farTick: Number(state.farTick ?? state[6])
|
|
13246
|
+
farTick: Number(state.farTick ?? state[6]),
|
|
13247
|
+
dopplerHookAddress: state.dopplerHook ?? state[2]
|
|
13283
13248
|
};
|
|
13284
13249
|
}
|
|
13285
13250
|
function isAbsentPoolReadFailure(error) {
|
|
@@ -13772,6 +13737,129 @@ var MulticurvePool = class {
|
|
|
13772
13737
|
return getMulticurveFeeSchedule(this.rpc, state);
|
|
13773
13738
|
}
|
|
13774
13739
|
};
|
|
13740
|
+
var REHYPE_NOT_CONFIGURED = {
|
|
13741
|
+
mode: "notConfigured",
|
|
13742
|
+
fees0: 0n,
|
|
13743
|
+
fees1: 0n
|
|
13744
|
+
};
|
|
13745
|
+
var REHYPE_UNSUPPORTED = {
|
|
13746
|
+
mode: "unsupported",
|
|
13747
|
+
fees0: 0n,
|
|
13748
|
+
fees1: 0n
|
|
13749
|
+
};
|
|
13750
|
+
async function getPendingFeeBreakdownForMulticurveTokens({
|
|
13751
|
+
client,
|
|
13752
|
+
beneficiary,
|
|
13753
|
+
tokenAddresses
|
|
13754
|
+
}) {
|
|
13755
|
+
if (tokenAddresses.length === 0) {
|
|
13756
|
+
return [];
|
|
13757
|
+
}
|
|
13758
|
+
const feeClient = client;
|
|
13759
|
+
const poolContexts = await discoverMulticurveFeePoolContexts(
|
|
13760
|
+
feeClient,
|
|
13761
|
+
tokenAddresses
|
|
13762
|
+
);
|
|
13763
|
+
const plans = poolContexts.map(
|
|
13764
|
+
(poolContext) => createPendingFeeBreakdownPreviewPlan(poolContext, beneficiary)
|
|
13765
|
+
);
|
|
13766
|
+
const calls = plans.flatMap(({ calls: planCalls }) => planCalls);
|
|
13767
|
+
const results = await callAggregate3(feeClient, calls);
|
|
13768
|
+
if (results.length !== calls.length) {
|
|
13769
|
+
throw new Error(
|
|
13770
|
+
"Multicall3 aggregate3 returned an incomplete pending fee breakdown result"
|
|
13771
|
+
);
|
|
13772
|
+
}
|
|
13773
|
+
let resultOffset = 0;
|
|
13774
|
+
return plans.map((plan) => {
|
|
13775
|
+
const planResults = results.slice(
|
|
13776
|
+
resultOffset,
|
|
13777
|
+
resultOffset + plan.calls.length
|
|
13778
|
+
);
|
|
13779
|
+
resultOffset += plan.calls.length;
|
|
13780
|
+
return decodePendingFeeBreakdownPreview(plan, planResults);
|
|
13781
|
+
});
|
|
13782
|
+
}
|
|
13783
|
+
function createPendingFeeBreakdownPreviewPlan(poolContext, beneficiary) {
|
|
13784
|
+
const poolId = computePoolId(poolContext.state.poolKey);
|
|
13785
|
+
const poolCalls = createPendingFeePreviewCalls(
|
|
13786
|
+
poolContext.initializerAddress,
|
|
13787
|
+
poolId,
|
|
13788
|
+
beneficiary
|
|
13789
|
+
);
|
|
13790
|
+
if (poolContext.initializerKind !== "dopplerHook" || poolContext.dopplerHookAddress === viem.zeroAddress) {
|
|
13791
|
+
return {
|
|
13792
|
+
kind: "poolOnly",
|
|
13793
|
+
poolContext,
|
|
13794
|
+
calls: poolCalls
|
|
13795
|
+
};
|
|
13796
|
+
}
|
|
13797
|
+
return {
|
|
13798
|
+
kind: "rehype",
|
|
13799
|
+
poolContext,
|
|
13800
|
+
poolId,
|
|
13801
|
+
calls: [
|
|
13802
|
+
...poolCalls,
|
|
13803
|
+
createRehypeCapabilityProbe(poolContext.dopplerHookAddress, poolId),
|
|
13804
|
+
...createPendingFeePreviewCalls(
|
|
13805
|
+
poolContext.dopplerHookAddress,
|
|
13806
|
+
poolId,
|
|
13807
|
+
beneficiary
|
|
13808
|
+
)
|
|
13809
|
+
]
|
|
13810
|
+
};
|
|
13811
|
+
}
|
|
13812
|
+
function createRehypeCapabilityProbe(target, poolId) {
|
|
13813
|
+
return {
|
|
13814
|
+
target,
|
|
13815
|
+
allowFailure: true,
|
|
13816
|
+
callData: viem.encodeFunctionData({
|
|
13817
|
+
abi: feesManagerAbi,
|
|
13818
|
+
functionName: "getPoolKey",
|
|
13819
|
+
args: [poolId]
|
|
13820
|
+
})
|
|
13821
|
+
};
|
|
13822
|
+
}
|
|
13823
|
+
function decodePendingFeeBreakdownPreview(plan, results) {
|
|
13824
|
+
const poolInitializerFees = calculatePendingFees(
|
|
13825
|
+
results.slice(0, PENDING_FEE_PREVIEW_CALL_COUNT)
|
|
13826
|
+
);
|
|
13827
|
+
return {
|
|
13828
|
+
tokenAddress: plan.poolContext.state.asset,
|
|
13829
|
+
poolInitializerFees,
|
|
13830
|
+
rehypeFees: plan.kind === "poolOnly" ? REHYPE_NOT_CONFIGURED : decodeRehypePendingFees(plan, results)
|
|
13831
|
+
};
|
|
13832
|
+
}
|
|
13833
|
+
function decodeRehypePendingFees(plan, results) {
|
|
13834
|
+
const capabilityResult = results[PENDING_FEE_PREVIEW_CALL_COUNT];
|
|
13835
|
+
if (!capabilityResult?.success || !capabilityResult.returnData || capabilityResult.returnData === "0x") {
|
|
13836
|
+
return REHYPE_UNSUPPORTED;
|
|
13837
|
+
}
|
|
13838
|
+
const poolKey = parseMulticurvePoolKey(
|
|
13839
|
+
viem.decodeFunctionResult({
|
|
13840
|
+
abi: feesManagerAbi,
|
|
13841
|
+
functionName: "getPoolKey",
|
|
13842
|
+
data: capabilityResult.returnData
|
|
13843
|
+
})
|
|
13844
|
+
);
|
|
13845
|
+
if (poolKey.hooks === viem.zeroAddress) {
|
|
13846
|
+
return REHYPE_UNSUPPORTED;
|
|
13847
|
+
}
|
|
13848
|
+
if (computePoolId(poolKey) !== plan.poolId) {
|
|
13849
|
+
throw new Error(
|
|
13850
|
+
"Rehype FeesManager pool key does not match the discovered pool"
|
|
13851
|
+
);
|
|
13852
|
+
}
|
|
13853
|
+
return {
|
|
13854
|
+
mode: "feesManager",
|
|
13855
|
+
...calculatePendingFees(
|
|
13856
|
+
results.slice(
|
|
13857
|
+
PENDING_FEE_PREVIEW_CALL_COUNT + 1,
|
|
13858
|
+
PENDING_FEE_PREVIEW_CALL_COUNT * 2 + 1
|
|
13859
|
+
)
|
|
13860
|
+
)
|
|
13861
|
+
};
|
|
13862
|
+
}
|
|
13775
13863
|
|
|
13776
13864
|
// src/evm/entities/auction/MulticurveFees.ts
|
|
13777
13865
|
var MulticurveFees = class {
|
|
@@ -13808,6 +13896,31 @@ var MulticurveFees = class {
|
|
|
13808
13896
|
}
|
|
13809
13897
|
return pendingFees;
|
|
13810
13898
|
}
|
|
13899
|
+
async getPendingFeeBreakdown(beneficiary, tokenAddressesOrOptions, options) {
|
|
13900
|
+
const hasTokenAddressOverride = isTokenAddressList(tokenAddressesOrOptions);
|
|
13901
|
+
const tokenAddresses = hasTokenAddressOverride ? tokenAddressesOrOptions : this.tokenAddresses;
|
|
13902
|
+
const callOptions = hasTokenAddressOverride ? options : tokenAddressesOrOptions;
|
|
13903
|
+
const tokenBatchSize = getTokenBatchSize(
|
|
13904
|
+
callOptions?.tokenBatchSize ?? this.options.tokenBatchSize
|
|
13905
|
+
);
|
|
13906
|
+
if (!tokenBatchSize || tokenAddresses.length <= tokenBatchSize) {
|
|
13907
|
+
return getPendingFeeBreakdownForMulticurveTokens({
|
|
13908
|
+
client: this.client,
|
|
13909
|
+
beneficiary,
|
|
13910
|
+
tokenAddresses
|
|
13911
|
+
});
|
|
13912
|
+
}
|
|
13913
|
+
let pendingFees = [];
|
|
13914
|
+
for (let index = 0; index < tokenAddresses.length; index += tokenBatchSize) {
|
|
13915
|
+
const batchPendingFees = await getPendingFeeBreakdownForMulticurveTokens({
|
|
13916
|
+
client: this.client,
|
|
13917
|
+
beneficiary,
|
|
13918
|
+
tokenAddresses: tokenAddresses.slice(index, index + tokenBatchSize)
|
|
13919
|
+
});
|
|
13920
|
+
pendingFees = [...pendingFees, ...batchPendingFees];
|
|
13921
|
+
}
|
|
13922
|
+
return pendingFees;
|
|
13923
|
+
}
|
|
13811
13924
|
};
|
|
13812
13925
|
function isTokenAddressList(value) {
|
|
13813
13926
|
return Array.isArray(value);
|