@whetstone-research/doppler-sdk 1.0.34 → 1.0.35
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/README.md +4 -0
- package/dist/{chunk-PSLY7M7C.js → chunk-4N5U2MXE.js} +305 -4
- package/dist/chunk-4N5U2MXE.js.map +1 -0
- package/dist/{chunk-7PXLEMBJ.cjs → chunk-AANZBN5X.cjs} +345 -36
- package/dist/chunk-AANZBN5X.cjs.map +1 -0
- package/dist/{chunk-4CI2M2F6.cjs → chunk-O2Z5ORGF.cjs} +39 -2
- package/dist/chunk-O2Z5ORGF.cjs.map +1 -0
- package/dist/{chunk-AFXFT3BD.js → chunk-PWBQLC5V.js} +39 -3
- package/dist/chunk-PWBQLC5V.js.map +1 -0
- package/dist/evm/index.cjs +343 -79
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +118 -5
- package/dist/evm/index.d.ts +118 -5
- package/dist/evm/index.js +341 -81
- package/dist/evm/index.js.map +1 -1
- package/dist/{pda-44IHEORD.cjs → pda-4VCQGO3F.cjs} +22 -18
- package/dist/{pda-44IHEORD.cjs.map → pda-4VCQGO3F.cjs.map} +1 -1
- package/dist/pda-IRVGRDQX.js +4 -0
- package/dist/pda-IRVGRDQX.js.map +1 -0
- package/dist/solana/index.cjs +481 -436
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +243 -11
- package/dist/solana/index.d.ts +243 -11
- package/dist/solana/index.js +62 -17
- 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-4CI2M2F6.cjs.map +0 -1
- package/dist/chunk-7PXLEMBJ.cjs.map +0 -1
- package/dist/chunk-AFXFT3BD.js.map +0 -1
- package/dist/chunk-PSLY7M7C.js.map +0 -1
- package/dist/pda-WJVDXQPW.js +0 -4
- package/dist/pda-WJVDXQPW.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, isAddress, zeroAddress, decodeAbiParameters, encodePacked, decodeEventLog, toHex,
|
|
2
|
+
import { parseEther, formatEther, getAddress, encodeAbiParameters, keccak256, isAddress, zeroAddress, decodeAbiParameters, encodePacked, decodeEventLog, toHex, ContractFunctionRevertedError, ExecutionRevertedError, BaseError, encodeFunctionData, zeroHash, multicall3Abi, decodeFunctionResult, ContractFunctionZeroDataError, isHex, decodeErrorResult } from 'viem';
|
|
3
3
|
|
|
4
4
|
// src/evm/deployments.generated.ts
|
|
5
5
|
var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
@@ -7660,6 +7660,173 @@ function encodeRehypeDopplerHookMigratorCalldata(params) {
|
|
|
7660
7660
|
]
|
|
7661
7661
|
);
|
|
7662
7662
|
}
|
|
7663
|
+
var AirlockCreateReceiptError = class extends Error {
|
|
7664
|
+
code;
|
|
7665
|
+
expected;
|
|
7666
|
+
actual;
|
|
7667
|
+
constructor(code, options = {}) {
|
|
7668
|
+
super(`Airlock Create receipt verification failed: ${code}`);
|
|
7669
|
+
this.name = "AirlockCreateReceiptError";
|
|
7670
|
+
this.code = code;
|
|
7671
|
+
this.expected = options.expected;
|
|
7672
|
+
this.actual = options.actual;
|
|
7673
|
+
}
|
|
7674
|
+
};
|
|
7675
|
+
function addressesEqual(left, right) {
|
|
7676
|
+
return left?.toLowerCase() === right.toLowerCase();
|
|
7677
|
+
}
|
|
7678
|
+
function decodeAirlockCreateLogs(receipt, expectedAirlock) {
|
|
7679
|
+
const matches = [];
|
|
7680
|
+
for (const log of receipt.logs) {
|
|
7681
|
+
if (!addressesEqual(log.address, expectedAirlock)) continue;
|
|
7682
|
+
try {
|
|
7683
|
+
const decoded = decodeEventLog({
|
|
7684
|
+
abi: airlockAbi,
|
|
7685
|
+
data: log.data,
|
|
7686
|
+
topics: log.topics,
|
|
7687
|
+
eventName: "Create"
|
|
7688
|
+
});
|
|
7689
|
+
const args = decoded.args;
|
|
7690
|
+
matches.push({
|
|
7691
|
+
airlock: log.address,
|
|
7692
|
+
tokenAddress: args.asset,
|
|
7693
|
+
numeraire: args.numeraire,
|
|
7694
|
+
initializer: args.initializer,
|
|
7695
|
+
poolOrHookAddress: args.poolOrHook,
|
|
7696
|
+
logIndex: log.logIndex
|
|
7697
|
+
});
|
|
7698
|
+
} catch {
|
|
7699
|
+
}
|
|
7700
|
+
}
|
|
7701
|
+
return matches;
|
|
7702
|
+
}
|
|
7703
|
+
function parseAirlockCreateReceipt({
|
|
7704
|
+
receipt,
|
|
7705
|
+
expectedAirlock
|
|
7706
|
+
}) {
|
|
7707
|
+
const matches = decodeAirlockCreateLogs(receipt, expectedAirlock);
|
|
7708
|
+
if (matches.length === 0) return null;
|
|
7709
|
+
if (matches.length > 1) {
|
|
7710
|
+
throw new AirlockCreateReceiptError("MULTIPLE_CREATE_EVENTS", {
|
|
7711
|
+
expected: 1,
|
|
7712
|
+
actual: matches.length
|
|
7713
|
+
});
|
|
7714
|
+
}
|
|
7715
|
+
return {
|
|
7716
|
+
...matches[0],
|
|
7717
|
+
transactionHash: receipt.transactionHash,
|
|
7718
|
+
blockNumber: receipt.blockNumber
|
|
7719
|
+
};
|
|
7720
|
+
}
|
|
7721
|
+
function assertAddressMatch(code, expected, actual) {
|
|
7722
|
+
if (!addressesEqual(actual, expected)) {
|
|
7723
|
+
throw new AirlockCreateReceiptError(code, { expected, actual });
|
|
7724
|
+
}
|
|
7725
|
+
}
|
|
7726
|
+
function verifyPreparedCreateReceipt({
|
|
7727
|
+
prepared,
|
|
7728
|
+
receipt
|
|
7729
|
+
}) {
|
|
7730
|
+
if (receipt.status !== "success") {
|
|
7731
|
+
throw new AirlockCreateReceiptError("RECEIPT_FAILED", {
|
|
7732
|
+
expected: "success",
|
|
7733
|
+
actual: receipt.status
|
|
7734
|
+
});
|
|
7735
|
+
}
|
|
7736
|
+
assertAddressMatch(
|
|
7737
|
+
"WRONG_TRANSACTION_TARGET",
|
|
7738
|
+
prepared.transaction.to,
|
|
7739
|
+
receipt.to
|
|
7740
|
+
);
|
|
7741
|
+
assertAddressMatch(
|
|
7742
|
+
"WRONG_TRANSACTION_SENDER",
|
|
7743
|
+
prepared.account,
|
|
7744
|
+
receipt.from
|
|
7745
|
+
);
|
|
7746
|
+
const receiptIdentity = parseAirlockCreateReceipt({
|
|
7747
|
+
receipt,
|
|
7748
|
+
expectedAirlock: prepared.airlock
|
|
7749
|
+
});
|
|
7750
|
+
if (!receiptIdentity) {
|
|
7751
|
+
throw new AirlockCreateReceiptError("MISSING_CREATE_EVENT", {
|
|
7752
|
+
expected: prepared.airlock,
|
|
7753
|
+
actual: null
|
|
7754
|
+
});
|
|
7755
|
+
}
|
|
7756
|
+
assertAddressMatch(
|
|
7757
|
+
"TOKEN_MISMATCH",
|
|
7758
|
+
prepared.prediction.tokenAddress,
|
|
7759
|
+
receiptIdentity.tokenAddress
|
|
7760
|
+
);
|
|
7761
|
+
assertAddressMatch(
|
|
7762
|
+
"NUMERAIRE_MISMATCH",
|
|
7763
|
+
prepared.createParams.numeraire,
|
|
7764
|
+
receiptIdentity.numeraire
|
|
7765
|
+
);
|
|
7766
|
+
assertAddressMatch(
|
|
7767
|
+
"INITIALIZER_MISMATCH",
|
|
7768
|
+
prepared.createParams.poolInitializer,
|
|
7769
|
+
receiptIdentity.initializer
|
|
7770
|
+
);
|
|
7771
|
+
assertAddressMatch(
|
|
7772
|
+
"POOL_OR_HOOK_MISMATCH",
|
|
7773
|
+
prepared.prediction.poolOrHookAddress,
|
|
7774
|
+
receiptIdentity.poolOrHookAddress
|
|
7775
|
+
);
|
|
7776
|
+
return {
|
|
7777
|
+
receiptIdentity,
|
|
7778
|
+
preparedIdentity: {
|
|
7779
|
+
chainId: prepared.chainId,
|
|
7780
|
+
tokenAddress: prepared.prediction.tokenAddress,
|
|
7781
|
+
poolOrHookAddress: prepared.prediction.poolOrHookAddress,
|
|
7782
|
+
governanceAddress: prepared.prediction.governanceAddress,
|
|
7783
|
+
timelockAddress: prepared.prediction.timelockAddress,
|
|
7784
|
+
migrationPoolAddress: prepared.prediction.migrationPoolAddress,
|
|
7785
|
+
poolKey: prepared.prediction.poolKey,
|
|
7786
|
+
poolId: prepared.prediction.poolId,
|
|
7787
|
+
tokenIsCurrency0: prepared.prediction.tokenIsCurrency0
|
|
7788
|
+
}
|
|
7789
|
+
};
|
|
7790
|
+
}
|
|
7791
|
+
async function verifyPreparedCreateExecution({
|
|
7792
|
+
prepared,
|
|
7793
|
+
receipt,
|
|
7794
|
+
publicClient
|
|
7795
|
+
}) {
|
|
7796
|
+
const verified = verifyPreparedCreateReceipt({ prepared, receipt });
|
|
7797
|
+
const transaction = await publicClient.getTransaction({
|
|
7798
|
+
hash: receipt.transactionHash
|
|
7799
|
+
});
|
|
7800
|
+
if (transaction.hash.toLowerCase() !== receipt.transactionHash.toLowerCase()) {
|
|
7801
|
+
throw new AirlockCreateReceiptError("TRANSACTION_HASH_MISMATCH", {
|
|
7802
|
+
expected: receipt.transactionHash,
|
|
7803
|
+
actual: transaction.hash
|
|
7804
|
+
});
|
|
7805
|
+
}
|
|
7806
|
+
assertAddressMatch(
|
|
7807
|
+
"WRONG_TRANSACTION_TARGET",
|
|
7808
|
+
prepared.transaction.to,
|
|
7809
|
+
transaction.to
|
|
7810
|
+
);
|
|
7811
|
+
assertAddressMatch(
|
|
7812
|
+
"WRONG_TRANSACTION_SENDER",
|
|
7813
|
+
prepared.account,
|
|
7814
|
+
transaction.from
|
|
7815
|
+
);
|
|
7816
|
+
if (transaction.input.toLowerCase() !== prepared.transaction.data.toLowerCase()) {
|
|
7817
|
+
throw new AirlockCreateReceiptError("TRANSACTION_INPUT_MISMATCH", {
|
|
7818
|
+
expected: keccak256(prepared.transaction.data),
|
|
7819
|
+
actual: keccak256(transaction.input)
|
|
7820
|
+
});
|
|
7821
|
+
}
|
|
7822
|
+
if (transaction.value !== prepared.transaction.value) {
|
|
7823
|
+
throw new AirlockCreateReceiptError("TRANSACTION_VALUE_MISMATCH", {
|
|
7824
|
+
expected: prepared.transaction.value.toString(),
|
|
7825
|
+
actual: transaction.value.toString()
|
|
7826
|
+
});
|
|
7827
|
+
}
|
|
7828
|
+
return verified;
|
|
7829
|
+
}
|
|
7663
7830
|
|
|
7664
7831
|
// src/evm/utils/marketCapHelpers.ts
|
|
7665
7832
|
function getMaxTickRounded(tickSpacing) {
|
|
@@ -10615,25 +10782,45 @@ var DopplerFactory = class {
|
|
|
10615
10782
|
}
|
|
10616
10783
|
throw new Error("Unable to mine opening auction salt");
|
|
10617
10784
|
}
|
|
10618
|
-
|
|
10785
|
+
isCreateGasRevert(error) {
|
|
10786
|
+
if (error instanceof ContractFunctionRevertedError || error instanceof ExecutionRevertedError) {
|
|
10787
|
+
return true;
|
|
10788
|
+
}
|
|
10789
|
+
if (!(error instanceof BaseError)) return false;
|
|
10790
|
+
return Boolean(
|
|
10791
|
+
error.walk(
|
|
10792
|
+
(cause) => cause instanceof ContractFunctionRevertedError || cause instanceof ExecutionRevertedError
|
|
10793
|
+
)
|
|
10794
|
+
);
|
|
10795
|
+
}
|
|
10796
|
+
async resolveInternalCreateGasEstimate(args) {
|
|
10619
10797
|
const { request, address, createParams, account } = args;
|
|
10620
|
-
|
|
10621
|
-
if (
|
|
10622
|
-
|
|
10798
|
+
let gasFromRequest;
|
|
10799
|
+
if (request && typeof request === "object" && "gas" in request && typeof request.gas === "bigint") {
|
|
10800
|
+
gasFromRequest = request.gas;
|
|
10801
|
+
}
|
|
10802
|
+
if (gasFromRequest !== void 0) {
|
|
10803
|
+
return { status: "estimated", gas: gasFromRequest };
|
|
10623
10804
|
}
|
|
10624
10805
|
try {
|
|
10625
|
-
const
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
return
|
|
10806
|
+
const gas = await this.publicClient.estimateContractGas(
|
|
10807
|
+
{
|
|
10808
|
+
address,
|
|
10809
|
+
abi: airlockAbi,
|
|
10810
|
+
functionName: "create",
|
|
10811
|
+
args: [{ ...createParams }],
|
|
10812
|
+
account
|
|
10813
|
+
}
|
|
10814
|
+
);
|
|
10815
|
+
return { status: "estimated", gas };
|
|
10816
|
+
} catch (error) {
|
|
10817
|
+
return this.isCreateGasRevert(error) ? { status: "reverted", error } : { status: "unavailable" };
|
|
10635
10818
|
}
|
|
10636
10819
|
}
|
|
10820
|
+
async resolveCreateGasEstimate(args) {
|
|
10821
|
+
const estimate = await this.resolveInternalCreateGasEstimate(args);
|
|
10822
|
+
return estimate.status === "estimated" ? estimate.gas : void 0;
|
|
10823
|
+
}
|
|
10637
10824
|
isDoppler404Token(token) {
|
|
10638
10825
|
return token.type === "doppler404";
|
|
10639
10826
|
}
|
|
@@ -11389,86 +11576,157 @@ var DopplerFactory = class {
|
|
|
11389
11576
|
};
|
|
11390
11577
|
return createParams;
|
|
11391
11578
|
}
|
|
11392
|
-
async
|
|
11579
|
+
async resolveFinalMulticurveCreate(args) {
|
|
11580
|
+
const { params, simulationAccount } = args;
|
|
11393
11581
|
const addresses = getAddresses(this.chainId);
|
|
11394
|
-
const
|
|
11395
|
-
const
|
|
11396
|
-
const
|
|
11397
|
-
address:
|
|
11582
|
+
const airlock = params.modules?.airlock ?? addresses.airlock;
|
|
11583
|
+
const initialCreateParams = args.createParams ?? this.encodeCreateMulticurveParams(params);
|
|
11584
|
+
const initialSimulation = await this.publicClient.simulateContract({
|
|
11585
|
+
address: airlock,
|
|
11398
11586
|
abi: airlockAbi,
|
|
11399
11587
|
functionName: "create",
|
|
11400
|
-
args: [{ ...
|
|
11401
|
-
account:
|
|
11402
|
-
});
|
|
11403
|
-
const simResult = result;
|
|
11404
|
-
const gasEstimate = await this.resolveCreateGasEstimate({
|
|
11405
|
-
request,
|
|
11406
|
-
address: airlockAddress,
|
|
11407
|
-
createParams,
|
|
11408
|
-
account: this.walletClient?.account ?? params.userAddress
|
|
11588
|
+
args: [{ ...initialCreateParams }],
|
|
11589
|
+
account: simulationAccount
|
|
11409
11590
|
});
|
|
11410
|
-
|
|
11591
|
+
const initialResult = initialSimulation.result;
|
|
11592
|
+
if (!initialResult || !Array.isArray(initialResult) || initialResult.length < 5) {
|
|
11411
11593
|
throw new Error("Failed to simulate multicurve create");
|
|
11412
11594
|
}
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11595
|
+
let createParams = initialCreateParams;
|
|
11596
|
+
let request = initialSimulation.request;
|
|
11597
|
+
let result = initialResult;
|
|
11598
|
+
if (!args.createParams) {
|
|
11599
|
+
const enrichedCreateParams = this.withSimulationGovernanceTimelockExclusion({
|
|
11600
|
+
createParams,
|
|
11601
|
+
simResult: initialResult,
|
|
11602
|
+
token: params.token,
|
|
11603
|
+
governance: params.governance,
|
|
11604
|
+
modules: params.modules,
|
|
11605
|
+
addresses
|
|
11606
|
+
});
|
|
11607
|
+
if (enrichedCreateParams.tokenFactoryData !== createParams.tokenFactoryData) {
|
|
11608
|
+
createParams = enrichedCreateParams;
|
|
11609
|
+
const finalSimulation = await this.publicClient.simulateContract({
|
|
11610
|
+
address: airlock,
|
|
11611
|
+
abi: airlockAbi,
|
|
11612
|
+
functionName: "create",
|
|
11613
|
+
args: [{ ...createParams }],
|
|
11614
|
+
account: simulationAccount
|
|
11615
|
+
});
|
|
11616
|
+
const finalResult = finalSimulation.result;
|
|
11617
|
+
if (!finalResult || !Array.isArray(finalResult) || finalResult.length < 5) {
|
|
11618
|
+
throw new Error("Failed to simulate enriched multicurve create");
|
|
11619
|
+
}
|
|
11620
|
+
request = finalSimulation.request;
|
|
11621
|
+
result = finalResult;
|
|
11622
|
+
}
|
|
11623
|
+
}
|
|
11624
|
+
const tokenAddress = result[0];
|
|
11625
|
+
const poolIdentity = await this.computeMulticurvePoolIdentity(
|
|
11626
|
+
params,
|
|
11627
|
+
tokenAddress
|
|
11628
|
+
);
|
|
11629
|
+
const prediction = {
|
|
11630
|
+
tokenAddress,
|
|
11631
|
+
poolOrHookAddress: result[1],
|
|
11632
|
+
governanceAddress: result[2],
|
|
11633
|
+
timelockAddress: result[3],
|
|
11634
|
+
migrationPoolAddress: result[4],
|
|
11635
|
+
...poolIdentity
|
|
11636
|
+
};
|
|
11637
|
+
return { airlock, createParams, prediction, request };
|
|
11638
|
+
}
|
|
11639
|
+
async prepareCreateMulticurve(params, options) {
|
|
11640
|
+
const resolved = await this.resolveFinalMulticurveCreate({
|
|
11641
|
+
params,
|
|
11642
|
+
simulationAccount: options.account
|
|
11643
|
+
});
|
|
11644
|
+
const internalGasEstimate = await this.resolveInternalCreateGasEstimate({
|
|
11645
|
+
request: resolved.request,
|
|
11646
|
+
address: resolved.airlock,
|
|
11647
|
+
createParams: resolved.createParams,
|
|
11648
|
+
account: options.account
|
|
11422
11649
|
});
|
|
11650
|
+
if (internalGasEstimate.status === "reverted") {
|
|
11651
|
+
throw internalGasEstimate.error;
|
|
11652
|
+
}
|
|
11653
|
+
const gasEstimate = internalGasEstimate;
|
|
11423
11654
|
return {
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11655
|
+
chainId: this.chainId,
|
|
11656
|
+
account: options.account,
|
|
11657
|
+
airlock: resolved.airlock,
|
|
11658
|
+
createParams: resolved.createParams,
|
|
11659
|
+
prediction: resolved.prediction,
|
|
11660
|
+
transaction: {
|
|
11661
|
+
to: resolved.airlock,
|
|
11662
|
+
data: encodeFunctionData({
|
|
11663
|
+
abi: airlockAbi,
|
|
11664
|
+
functionName: "create",
|
|
11665
|
+
args: [{ ...resolved.createParams }]
|
|
11666
|
+
}),
|
|
11667
|
+
value: 0n
|
|
11668
|
+
},
|
|
11669
|
+
gasEstimate
|
|
11670
|
+
};
|
|
11671
|
+
}
|
|
11672
|
+
async simulateCreateMulticurve(params) {
|
|
11673
|
+
const resolved = await this.resolveFinalMulticurveCreate({
|
|
11674
|
+
params,
|
|
11675
|
+
simulationAccount: this.walletClient?.account
|
|
11676
|
+
});
|
|
11677
|
+
const gasEstimate = await this.resolveCreateGasEstimate({
|
|
11678
|
+
request: resolved.request,
|
|
11679
|
+
address: resolved.airlock,
|
|
11680
|
+
createParams: resolved.createParams,
|
|
11681
|
+
account: this.walletClient?.account ?? params.userAddress
|
|
11682
|
+
});
|
|
11683
|
+
return {
|
|
11684
|
+
createParams: resolved.createParams,
|
|
11685
|
+
tokenAddress: resolved.prediction.tokenAddress,
|
|
11686
|
+
poolId: resolved.prediction.poolId,
|
|
11427
11687
|
gasEstimate,
|
|
11428
11688
|
execute: () => this.createMulticurve(params, {
|
|
11429
|
-
_createParams:
|
|
11689
|
+
_createParams: resolved.createParams
|
|
11430
11690
|
})
|
|
11431
11691
|
};
|
|
11432
11692
|
}
|
|
11433
11693
|
async createMulticurve(params, options) {
|
|
11434
|
-
|
|
11435
|
-
if (!this.walletClient)
|
|
11694
|
+
if (!this.walletClient) {
|
|
11436
11695
|
throw new Error("Wallet client required for write operations");
|
|
11437
|
-
|
|
11438
|
-
const
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
functionName: "create",
|
|
11443
|
-
args: [{ ...createParams }],
|
|
11444
|
-
account: this.walletClient.account
|
|
11696
|
+
}
|
|
11697
|
+
const resolved = await this.resolveFinalMulticurveCreate({
|
|
11698
|
+
params,
|
|
11699
|
+
simulationAccount: this.walletClient.account,
|
|
11700
|
+
createParams: options?._createParams
|
|
11445
11701
|
});
|
|
11446
|
-
const simResult = result;
|
|
11447
11702
|
const gasEstimate = await this.resolveCreateGasEstimate({
|
|
11448
|
-
request,
|
|
11449
|
-
address:
|
|
11450
|
-
createParams,
|
|
11703
|
+
request: resolved.request,
|
|
11704
|
+
address: resolved.airlock,
|
|
11705
|
+
createParams: resolved.createParams,
|
|
11451
11706
|
account: this.walletClient.account
|
|
11452
11707
|
});
|
|
11453
11708
|
const gas = params.gas ?? gasEstimate ?? DEFAULT_CREATE_GAS_LIMIT;
|
|
11454
|
-
const hash = await this.walletClient.writeContract({
|
|
11709
|
+
const hash = await this.walletClient.writeContract({
|
|
11710
|
+
...resolved.request,
|
|
11711
|
+
gas
|
|
11712
|
+
});
|
|
11455
11713
|
const receipt = await this.publicClient.waitForTransactionReceipt({ hash, confirmations: 2 });
|
|
11456
|
-
const
|
|
11457
|
-
|
|
11714
|
+
const createResult = parseAirlockCreateReceipt({
|
|
11715
|
+
receipt,
|
|
11716
|
+
expectedAirlock: resolved.airlock
|
|
11717
|
+
});
|
|
11718
|
+
if (!createResult) {
|
|
11458
11719
|
throw new Error(
|
|
11459
11720
|
"Failed to extract token address from Create event in transaction logs"
|
|
11460
11721
|
);
|
|
11461
11722
|
}
|
|
11462
|
-
const actualTokenAddress =
|
|
11463
|
-
if (
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
`[DopplerSDK] Simulation predicted token ${simulatedToken} but actual is ${actualTokenAddress}. This may indicate state divergence between simulation and execution.`
|
|
11468
|
-
);
|
|
11469
|
-
}
|
|
11723
|
+
const actualTokenAddress = createResult.tokenAddress;
|
|
11724
|
+
if (resolved.prediction.tokenAddress.toLowerCase() !== actualTokenAddress.toLowerCase()) {
|
|
11725
|
+
console.warn(
|
|
11726
|
+
`[DopplerSDK] Simulation predicted token ${resolved.prediction.tokenAddress} but actual is ${actualTokenAddress}. This may indicate state divergence between simulation and execution.`
|
|
11727
|
+
);
|
|
11470
11728
|
}
|
|
11471
|
-
const poolId = await this.
|
|
11729
|
+
const { poolId } = await this.computeMulticurvePoolIdentity(
|
|
11472
11730
|
params,
|
|
11473
11731
|
actualTokenAddress
|
|
11474
11732
|
);
|
|
@@ -12651,10 +12909,10 @@ var DopplerFactory = class {
|
|
|
12651
12909
|
return keccak256(encoded);
|
|
12652
12910
|
}
|
|
12653
12911
|
/**
|
|
12654
|
-
* Compute the V4
|
|
12655
|
-
* the initializer will register on-chain.
|
|
12912
|
+
* Compute the complete V4 multicurve pool identity from the same pool-key
|
|
12913
|
+
* fields the initializer will register on-chain.
|
|
12656
12914
|
*/
|
|
12657
|
-
async
|
|
12915
|
+
async computeMulticurvePoolIdentity(params, tokenAddress) {
|
|
12658
12916
|
const addresses = getAddresses(this.chainId);
|
|
12659
12917
|
const initializerMode = this.resolveMulticurveInitializerMode(params);
|
|
12660
12918
|
let hookAddress;
|
|
@@ -12684,16 +12942,18 @@ var DopplerFactory = class {
|
|
|
12684
12942
|
}
|
|
12685
12943
|
const numeraire = params.sale.numeraire;
|
|
12686
12944
|
const tokenIsCurrency0 = BigInt(tokenAddress) < BigInt(numeraire);
|
|
12687
|
-
const
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
currency0,
|
|
12692
|
-
currency1,
|
|
12693
|
-
fee,
|
|
12945
|
+
const poolKey = {
|
|
12946
|
+
currency0: tokenIsCurrency0 ? tokenAddress : numeraire,
|
|
12947
|
+
currency1: tokenIsCurrency0 ? numeraire : tokenAddress,
|
|
12948
|
+
fee: initializerMode.type === "decay" || initializerMode.type === "rehype" && initializerMode.hookConfig ? DYNAMIC_FEE_FLAG : params.pool.fee,
|
|
12694
12949
|
tickSpacing: params.pool.tickSpacing,
|
|
12695
12950
|
hooks: hookAddress
|
|
12696
|
-
}
|
|
12951
|
+
};
|
|
12952
|
+
return {
|
|
12953
|
+
poolKey,
|
|
12954
|
+
poolId: this.computePoolId(poolKey),
|
|
12955
|
+
tokenIsCurrency0
|
|
12956
|
+
};
|
|
12697
12957
|
}
|
|
12698
12958
|
async ensureMulticurveBundlerSupport(bundler) {
|
|
12699
12959
|
if (this.multicurveBundlerSupport.get(bundler)) {
|
|
@@ -20339,6 +20599,6 @@ var DopplerSDK = class {
|
|
|
20339
20599
|
// src/evm/index.ts
|
|
20340
20600
|
var VERSION = "1.0.0";
|
|
20341
20601
|
|
|
20342
|
-
export { ADDRESSES, BASIS_POINTS, CHAIN_IDS, DAY_SECONDS, DEAD_ADDRESS, DECAY_MAX_START_FEE, DEFAULT_AIRLOCK_BENEFICIARY_SHARES, DEFAULT_AUCTION_DURATION, DEFAULT_EPOCH_LENGTH, DEFAULT_LOCK_DURATION, DEFAULT_MULTICURVE_LOWER_TICKS, DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES, DEFAULT_MULTICURVE_NUM_POSITIONS, DEFAULT_MULTICURVE_UPPER_TICKS, DEFAULT_OPENING_AUCTION_DURATION, DEFAULT_OPENING_AUCTION_FEE, DEFAULT_OPENING_AUCTION_INCENTIVE_SHARE_BPS, DEFAULT_OPENING_AUCTION_MIN_ACCEPTABLE_TICK_TOKEN0, DEFAULT_OPENING_AUCTION_MIN_ACCEPTABLE_TICK_TOKEN1, DEFAULT_OPENING_AUCTION_MIN_LIQUIDITY, DEFAULT_OPENING_AUCTION_SHARE_TO_AUCTION_BPS, DEFAULT_OPENING_DOPPLER_DURATION, DEFAULT_OPENING_DOPPLER_EPOCH_LENGTH, DEFAULT_OPENING_DOPPLER_FEE, DEFAULT_OPENING_DOPPLER_NUM_PD_SLUGS, DEFAULT_OPENING_DOPPLER_TICK_SPACING, DEFAULT_PD_SLUGS, DEFAULT_V3_END_TICK, DEFAULT_V3_FEE, DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V3_INITIAL_SUPPLY, DEFAULT_V3_INITIAL_VOTING_DELAY, DEFAULT_V3_INITIAL_VOTING_PERIOD, DEFAULT_V3_MAX_SHARE_TO_BE_SOLD, DEFAULT_V3_NUM_POSITIONS, DEFAULT_V3_NUM_TOKENS_TO_SELL, DEFAULT_V3_PRE_MINT, DEFAULT_V3_START_TICK, DEFAULT_V3_VESTING_DURATION, DEFAULT_V3_YEARLY_MINT_RATE, DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V4_INITIAL_VOTING_DELAY, DEFAULT_V4_INITIAL_VOTING_PERIOD, DEFAULT_V4_YEARLY_MINT_RATE, derc2080_default as DERC2080Bytecode, derc20_default as DERC20Bytecode, DOPPLER_FLAGS, DOPPLER_MAX_TICK_SPACING, DYNAMIC_FEE_FLAG, Derc20, Derc20V2, doppler_default as DopplerBytecode, DopplerDN404, dopplerDN404BaseSepolia_default as DopplerDN404BaseSepoliaBytecode, dopplerDN404_default as DopplerDN404Bytecode, DopplerERC20V1, DopplerFactory, DopplerSDK, DynamicAuction, DynamicAuctionBuilder, Eth, FEE_AMOUNT_MASK, FEE_TIERS, FLAG_MASK, INT24_MAX, INT24_MIN, LAUNCHPAD_ENABLED_CHAIN_IDS, LockablePoolStatus, MAX_SQRT_RATIO, MAX_TICK, MIN_SQRT_RATIO, MIN_TICK, MulticurveBuilder, MulticurveFees, MulticurvePool, NO_OP_ENABLED_CHAIN_IDS, OPENING_AUCTION_FLAGS, OPENING_AUCTION_PHASE_ACTIVE, OPENING_AUCTION_PHASE_CLOSED, OPENING_AUCTION_PHASE_NOT_STARTED, OPENING_AUCTION_PHASE_SETTLED, OPENING_AUCTION_STATUS_ACTIVE, OPENING_AUCTION_STATUS_DOPPLER_ACTIVE, OPENING_AUCTION_STATUS_EXITED, OPENING_AUCTION_STATUS_UNINITIALIZED, OpeningAuction, OpeningAuctionBidManager, OpeningAuctionBuilder, openingAuction_default as OpeningAuctionBytecode, OpeningAuctionLifecycle, OpeningAuctionPhase, OpeningAuctionPositionManager, OpeningAuctionStatus, Q96, Quoter, RehypeDopplerHook, RehypeDopplerHookInitializer, RehypeDopplerHookMigrator, RehypeFeeRoutingMode, SECONDS_PER_DAY, SECONDS_PER_YEAR, SUPPORTED_CHAIN_IDS, stateView_default as StateViewBytecode, StaticAuction, StaticAuctionBuilder, TICK_SPACINGS, TopUpDistributor, V3_FEE_TIERS, V4_MAX_FEE, VALID_FEE_TIERS, VERSION, WAD, ZERO_ADDRESS, airlockAbi, applyTickOffsets, bundlerAbi, calculateFDV, calculateGamma, calculateMarketCap, calculateTickRange, calculateTokensToSell, computeOptimalGamma, computePoolId, createAirlockBeneficiary, decayMulticurveInitializerHookAbi, decodeBalanceDelta, derc20Abi, derc20V2Abi, dopplerDN404Abi, dopplerERC20V1Abi, dopplerHookAbi, dopplerHookInitializerAbi, dopplerLensAbi, encodeRehypeDopplerHookInitializerData, encodeRehypeDopplerHookMigratorCalldata, estimatePriceAtEpoch, estimateSlippage, feeClaimsInitializerAbi, feesManagerAbi, formatTickAsPrice, getAddresses, getAirlockBeneficiary, getAirlockOwner, getAmount0ForLiquidity, getAmount1ForLiquidity, getLiquidityForAmount0, getLiquidityForAmount1, getMaxLiquiditySafeMulticurveTickUpper, getMaxTickRounded, getNearestUsableTick, getSqrtRatioAtTick, getTickAtSqrtRatio, isLaunchpadEnabledChain, isNoOpEnabledChain, isSupportedChainId, isToken0Expected, isToken1, lockableUniswapV3InitializerAbi, marketCapToTickForMulticurve, marketCapToTicksForDynamicAuction, marketCapToTicksForMulticurve, marketCapToTicksForStaticAuction, marketCapToTokenPrice, mineTokenAddress, normalizeBeneficiaries, normalizePoolKey, normalizeRehypeDopplerHookInitializerConfig, openingAuctionAbi, openingAuctionInitializerAbi, openingAuctionPositionManagerAbi, poolManagerAbi, priceToSqrtPriceX96, priceToTick, quoterV2Abi, ratioToTick, rehypeDopplerHookAbi, rehypeDopplerHookInitializerAbi, rehypeDopplerHookMigratorAbi, resolveGasEstimate, sortBeneficiaries, sqrtPriceX96ToPrice, streamableFeesLockerAbi, streamableFeesLockerV2Abi, tickToMarketCap, tickToPrice, tokenPriceToRatio, topUpDistributorAbi, uniswapV2Router02Abi, uniswapV3InitializerAbi, uniswapV3PoolAbi, uniswapV4InitializerAbi, v2MigratorAbi, v3MigratorAbi, v4MigratorAbi, v4MulticurveInitializerAbi, v4MulticurveMigratorAbi, v4QuoterAbi, validateMarketCapParameters, weth9Abi };
|
|
20602
|
+
export { ADDRESSES, AirlockCreateReceiptError, BASIS_POINTS, CHAIN_IDS, DAY_SECONDS, DEAD_ADDRESS, DECAY_MAX_START_FEE, DEFAULT_AIRLOCK_BENEFICIARY_SHARES, DEFAULT_AUCTION_DURATION, DEFAULT_EPOCH_LENGTH, DEFAULT_LOCK_DURATION, DEFAULT_MULTICURVE_LOWER_TICKS, DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES, DEFAULT_MULTICURVE_NUM_POSITIONS, DEFAULT_MULTICURVE_UPPER_TICKS, DEFAULT_OPENING_AUCTION_DURATION, DEFAULT_OPENING_AUCTION_FEE, DEFAULT_OPENING_AUCTION_INCENTIVE_SHARE_BPS, DEFAULT_OPENING_AUCTION_MIN_ACCEPTABLE_TICK_TOKEN0, DEFAULT_OPENING_AUCTION_MIN_ACCEPTABLE_TICK_TOKEN1, DEFAULT_OPENING_AUCTION_MIN_LIQUIDITY, DEFAULT_OPENING_AUCTION_SHARE_TO_AUCTION_BPS, DEFAULT_OPENING_DOPPLER_DURATION, DEFAULT_OPENING_DOPPLER_EPOCH_LENGTH, DEFAULT_OPENING_DOPPLER_FEE, DEFAULT_OPENING_DOPPLER_NUM_PD_SLUGS, DEFAULT_OPENING_DOPPLER_TICK_SPACING, DEFAULT_PD_SLUGS, DEFAULT_V3_END_TICK, DEFAULT_V3_FEE, DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V3_INITIAL_SUPPLY, DEFAULT_V3_INITIAL_VOTING_DELAY, DEFAULT_V3_INITIAL_VOTING_PERIOD, DEFAULT_V3_MAX_SHARE_TO_BE_SOLD, DEFAULT_V3_NUM_POSITIONS, DEFAULT_V3_NUM_TOKENS_TO_SELL, DEFAULT_V3_PRE_MINT, DEFAULT_V3_START_TICK, DEFAULT_V3_VESTING_DURATION, DEFAULT_V3_YEARLY_MINT_RATE, DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V4_INITIAL_VOTING_DELAY, DEFAULT_V4_INITIAL_VOTING_PERIOD, DEFAULT_V4_YEARLY_MINT_RATE, derc2080_default as DERC2080Bytecode, derc20_default as DERC20Bytecode, DOPPLER_FLAGS, DOPPLER_MAX_TICK_SPACING, DYNAMIC_FEE_FLAG, Derc20, Derc20V2, doppler_default as DopplerBytecode, DopplerDN404, dopplerDN404BaseSepolia_default as DopplerDN404BaseSepoliaBytecode, dopplerDN404_default as DopplerDN404Bytecode, DopplerERC20V1, DopplerFactory, DopplerSDK, DynamicAuction, DynamicAuctionBuilder, Eth, FEE_AMOUNT_MASK, FEE_TIERS, FLAG_MASK, INT24_MAX, INT24_MIN, LAUNCHPAD_ENABLED_CHAIN_IDS, LockablePoolStatus, MAX_SQRT_RATIO, MAX_TICK, MIN_SQRT_RATIO, MIN_TICK, MulticurveBuilder, MulticurveFees, MulticurvePool, NO_OP_ENABLED_CHAIN_IDS, OPENING_AUCTION_FLAGS, OPENING_AUCTION_PHASE_ACTIVE, OPENING_AUCTION_PHASE_CLOSED, OPENING_AUCTION_PHASE_NOT_STARTED, OPENING_AUCTION_PHASE_SETTLED, OPENING_AUCTION_STATUS_ACTIVE, OPENING_AUCTION_STATUS_DOPPLER_ACTIVE, OPENING_AUCTION_STATUS_EXITED, OPENING_AUCTION_STATUS_UNINITIALIZED, OpeningAuction, OpeningAuctionBidManager, OpeningAuctionBuilder, openingAuction_default as OpeningAuctionBytecode, OpeningAuctionLifecycle, OpeningAuctionPhase, OpeningAuctionPositionManager, OpeningAuctionStatus, Q96, Quoter, RehypeDopplerHook, RehypeDopplerHookInitializer, RehypeDopplerHookMigrator, RehypeFeeRoutingMode, SECONDS_PER_DAY, SECONDS_PER_YEAR, SUPPORTED_CHAIN_IDS, stateView_default as StateViewBytecode, StaticAuction, StaticAuctionBuilder, TICK_SPACINGS, TopUpDistributor, V3_FEE_TIERS, V4_MAX_FEE, VALID_FEE_TIERS, VERSION, WAD, ZERO_ADDRESS, airlockAbi, applyTickOffsets, bundlerAbi, calculateFDV, calculateGamma, calculateMarketCap, calculateTickRange, calculateTokensToSell, computeOptimalGamma, computePoolId, createAirlockBeneficiary, decayMulticurveInitializerHookAbi, decodeBalanceDelta, derc20Abi, derc20V2Abi, dopplerDN404Abi, dopplerERC20V1Abi, dopplerHookAbi, dopplerHookInitializerAbi, dopplerLensAbi, encodeRehypeDopplerHookInitializerData, encodeRehypeDopplerHookMigratorCalldata, estimatePriceAtEpoch, estimateSlippage, feeClaimsInitializerAbi, feesManagerAbi, formatTickAsPrice, getAddresses, getAirlockBeneficiary, getAirlockOwner, getAmount0ForLiquidity, getAmount1ForLiquidity, getLiquidityForAmount0, getLiquidityForAmount1, getMaxLiquiditySafeMulticurveTickUpper, getMaxTickRounded, getNearestUsableTick, getSqrtRatioAtTick, getTickAtSqrtRatio, isLaunchpadEnabledChain, isNoOpEnabledChain, isSupportedChainId, isToken0Expected, isToken1, lockableUniswapV3InitializerAbi, marketCapToTickForMulticurve, marketCapToTicksForDynamicAuction, marketCapToTicksForMulticurve, marketCapToTicksForStaticAuction, marketCapToTokenPrice, mineTokenAddress, normalizeBeneficiaries, normalizePoolKey, normalizeRehypeDopplerHookInitializerConfig, openingAuctionAbi, openingAuctionInitializerAbi, openingAuctionPositionManagerAbi, parseAirlockCreateReceipt, poolManagerAbi, priceToSqrtPriceX96, priceToTick, quoterV2Abi, ratioToTick, rehypeDopplerHookAbi, rehypeDopplerHookInitializerAbi, rehypeDopplerHookMigratorAbi, resolveGasEstimate, sortBeneficiaries, sqrtPriceX96ToPrice, streamableFeesLockerAbi, streamableFeesLockerV2Abi, tickToMarketCap, tickToPrice, tokenPriceToRatio, topUpDistributorAbi, uniswapV2Router02Abi, uniswapV3InitializerAbi, uniswapV3PoolAbi, uniswapV4InitializerAbi, v2MigratorAbi, v3MigratorAbi, v4MigratorAbi, v4MulticurveInitializerAbi, v4MulticurveMigratorAbi, v4QuoterAbi, validateMarketCapParameters, verifyPreparedCreateExecution, verifyPreparedCreateReceipt, weth9Abi };
|
|
20343
20603
|
//# sourceMappingURL=index.js.map
|
|
20344
20604
|
//# sourceMappingURL=index.js.map
|