@whetstone-research/doppler-sdk 1.0.4 → 1.0.6
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 +11 -0
- package/dist/evm/index.cjs +917 -354
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +674 -8
- package/dist/evm/index.d.ts +674 -8
- package/dist/evm/index.js +917 -356
- package/dist/evm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/evm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../chunk-PZ5AY32C.js';
|
|
2
|
-
import { parseEther, formatEther, getAddress, encodeAbiParameters, keccak256, decodeEventLog, toHex, decodeAbiParameters,
|
|
2
|
+
import { parseEther, formatEther, getAddress, encodeAbiParameters, keccak256, encodePacked, decodeEventLog, toHex, decodeAbiParameters, zeroAddress, zeroHash } from 'viem';
|
|
3
3
|
|
|
4
4
|
// src/evm/deployments.generated.ts
|
|
5
5
|
var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
@@ -297,6 +297,14 @@ var ADDRESSES = {
|
|
|
297
297
|
[CHAIN_IDS.MAINNET]: {
|
|
298
298
|
airlock: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.MAINNET].Airlock,
|
|
299
299
|
tokenFactory: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.MAINNET].CloneERC20Factory,
|
|
300
|
+
derc20V2Factory: getGeneratedAddress(
|
|
301
|
+
CHAIN_IDS.MAINNET,
|
|
302
|
+
"CloneDERC20VotesV2Factory"
|
|
303
|
+
),
|
|
304
|
+
derc20V2Implementation: getGeneratedAddress(
|
|
305
|
+
CHAIN_IDS.MAINNET,
|
|
306
|
+
"CloneDERC20VotesV2"
|
|
307
|
+
),
|
|
300
308
|
v3Initializer: ZERO_ADDRESS,
|
|
301
309
|
v3Quoter: ZERO_ADDRESS,
|
|
302
310
|
v4Initializer: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.MAINNET].UniswapV4Initializer,
|
|
@@ -329,6 +337,14 @@ var ADDRESSES = {
|
|
|
329
337
|
[CHAIN_IDS.ETH_SEPOLIA]: {
|
|
330
338
|
airlock: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.ETH_SEPOLIA].Airlock,
|
|
331
339
|
tokenFactory: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.ETH_SEPOLIA].CloneERC20Factory,
|
|
340
|
+
derc20V2Factory: getGeneratedAddress(
|
|
341
|
+
CHAIN_IDS.ETH_SEPOLIA,
|
|
342
|
+
"CloneDERC20VotesV2Factory"
|
|
343
|
+
),
|
|
344
|
+
derc20V2Implementation: getGeneratedAddress(
|
|
345
|
+
CHAIN_IDS.ETH_SEPOLIA,
|
|
346
|
+
"CloneDERC20VotesV2"
|
|
347
|
+
),
|
|
332
348
|
v3Initializer: ZERO_ADDRESS,
|
|
333
349
|
v3Quoter: ZERO_ADDRESS,
|
|
334
350
|
v4Initializer: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.ETH_SEPOLIA].UniswapV4Initializer,
|
|
@@ -359,6 +375,14 @@ var ADDRESSES = {
|
|
|
359
375
|
[CHAIN_IDS.BASE]: {
|
|
360
376
|
airlock: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE].Airlock,
|
|
361
377
|
tokenFactory: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE].TokenFactory80,
|
|
378
|
+
derc20V2Factory: getGeneratedAddress(
|
|
379
|
+
CHAIN_IDS.BASE,
|
|
380
|
+
"CloneDERC20VotesV2Factory"
|
|
381
|
+
),
|
|
382
|
+
derc20V2Implementation: getGeneratedAddress(
|
|
383
|
+
CHAIN_IDS.BASE,
|
|
384
|
+
"CloneDERC20VotesV2"
|
|
385
|
+
),
|
|
362
386
|
v3Initializer: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE].UniswapV3Initializer,
|
|
363
387
|
v3Quoter: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",
|
|
364
388
|
lockableV3Initializer: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE].LockableUniswapV3Initializer,
|
|
@@ -397,6 +421,14 @@ var ADDRESSES = {
|
|
|
397
421
|
[CHAIN_IDS.BASE_SEPOLIA]: {
|
|
398
422
|
airlock: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE_SEPOLIA].Airlock,
|
|
399
423
|
tokenFactory: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE_SEPOLIA].TokenFactory80,
|
|
424
|
+
derc20V2Factory: getGeneratedAddress(
|
|
425
|
+
CHAIN_IDS.BASE_SEPOLIA,
|
|
426
|
+
"CloneDERC20VotesV2Factory"
|
|
427
|
+
),
|
|
428
|
+
derc20V2Implementation: getGeneratedAddress(
|
|
429
|
+
CHAIN_IDS.BASE_SEPOLIA,
|
|
430
|
+
"CloneDERC20VotesV2"
|
|
431
|
+
),
|
|
400
432
|
doppler404Factory: "0xdd8cea2890f1b3498436f19ec8da8fecc2cb7af7",
|
|
401
433
|
v3Initializer: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE_SEPOLIA].UniswapV3Initializer,
|
|
402
434
|
v3Quoter: "0xC5290058841028F1614F3A6F0F5816cAd0df5E27",
|
|
@@ -439,6 +471,14 @@ var ADDRESSES = {
|
|
|
439
471
|
[CHAIN_IDS.INK]: {
|
|
440
472
|
airlock: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.INK].Airlock,
|
|
441
473
|
tokenFactory: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.INK].TokenFactory,
|
|
474
|
+
derc20V2Factory: getGeneratedAddress(
|
|
475
|
+
CHAIN_IDS.INK,
|
|
476
|
+
"CloneDERC20VotesV2Factory"
|
|
477
|
+
),
|
|
478
|
+
derc20V2Implementation: getGeneratedAddress(
|
|
479
|
+
CHAIN_IDS.INK,
|
|
480
|
+
"CloneDERC20VotesV2"
|
|
481
|
+
),
|
|
442
482
|
v3Initializer: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.INK].UniswapV3Initializer,
|
|
443
483
|
v3Quoter: "0x96b572D2d880cf2Fa2563651BD23ADE6f5516652",
|
|
444
484
|
v4Initializer: "0xC99b485499f78995C6F1640dbB1413c57f8BA684",
|
|
@@ -462,6 +502,14 @@ var ADDRESSES = {
|
|
|
462
502
|
[CHAIN_IDS.UNICHAIN]: {
|
|
463
503
|
airlock: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.UNICHAIN].Airlock,
|
|
464
504
|
tokenFactory: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.UNICHAIN].TokenFactory,
|
|
505
|
+
derc20V2Factory: getGeneratedAddress(
|
|
506
|
+
CHAIN_IDS.UNICHAIN,
|
|
507
|
+
"CloneDERC20VotesV2Factory"
|
|
508
|
+
),
|
|
509
|
+
derc20V2Implementation: getGeneratedAddress(
|
|
510
|
+
CHAIN_IDS.UNICHAIN,
|
|
511
|
+
"CloneDERC20VotesV2"
|
|
512
|
+
),
|
|
465
513
|
v3Initializer: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.UNICHAIN].UniswapV3Initializer,
|
|
466
514
|
v3Quoter: "0x385A5cf5F83e99f7BB2852b6A19C3538b9FA7658",
|
|
467
515
|
v4Initializer: "0x2F2BAcd46d3F5c9EE052Ab392b73711dB89129DB",
|
|
@@ -485,6 +533,14 @@ var ADDRESSES = {
|
|
|
485
533
|
[CHAIN_IDS.UNICHAIN_SEPOLIA]: {
|
|
486
534
|
airlock: "0x651ab94B4777e2e4cdf96082d90C65bd947b73A4",
|
|
487
535
|
tokenFactory: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.UNICHAIN_SEPOLIA].TokenFactory,
|
|
536
|
+
derc20V2Factory: getGeneratedAddress(
|
|
537
|
+
CHAIN_IDS.UNICHAIN_SEPOLIA,
|
|
538
|
+
"CloneDERC20VotesV2Factory"
|
|
539
|
+
),
|
|
540
|
+
derc20V2Implementation: getGeneratedAddress(
|
|
541
|
+
CHAIN_IDS.UNICHAIN_SEPOLIA,
|
|
542
|
+
"CloneDERC20VotesV2"
|
|
543
|
+
),
|
|
488
544
|
v3Initializer: "0x7Fb9a622186B4660A5988C223ebb9d3690dD5007",
|
|
489
545
|
v3Quoter: "0x6Dd37329A1A225a6Fca658265D460423DCafBF89",
|
|
490
546
|
v4Initializer: "0x992375478626E67F4e639d3298EbCAaE51C3dF0b",
|
|
@@ -508,6 +564,14 @@ var ADDRESSES = {
|
|
|
508
564
|
[CHAIN_IDS.MONAD_TESTNET]: {
|
|
509
565
|
airlock: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.MONAD_TESTNET].Airlock,
|
|
510
566
|
tokenFactory: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.MONAD_TESTNET].TokenFactory80,
|
|
567
|
+
derc20V2Factory: getGeneratedAddress(
|
|
568
|
+
CHAIN_IDS.MONAD_TESTNET,
|
|
569
|
+
"CloneDERC20VotesV2Factory"
|
|
570
|
+
),
|
|
571
|
+
derc20V2Implementation: getGeneratedAddress(
|
|
572
|
+
CHAIN_IDS.MONAD_TESTNET,
|
|
573
|
+
"CloneDERC20VotesV2"
|
|
574
|
+
),
|
|
511
575
|
v3Initializer: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.MONAD_TESTNET].UniswapV3Initializer,
|
|
512
576
|
v3Quoter: ZERO_ADDRESS,
|
|
513
577
|
v4Initializer: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.MONAD_TESTNET].UniswapV4Initializer,
|
|
@@ -532,6 +596,14 @@ var ADDRESSES = {
|
|
|
532
596
|
[CHAIN_IDS.MONAD_MAINNET]: {
|
|
533
597
|
airlock: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.MONAD_MAINNET].Airlock,
|
|
534
598
|
tokenFactory: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.MONAD_MAINNET].TokenFactory80,
|
|
599
|
+
derc20V2Factory: getGeneratedAddress(
|
|
600
|
+
CHAIN_IDS.MONAD_MAINNET,
|
|
601
|
+
"CloneDERC20VotesV2Factory"
|
|
602
|
+
),
|
|
603
|
+
derc20V2Implementation: getGeneratedAddress(
|
|
604
|
+
CHAIN_IDS.MONAD_MAINNET,
|
|
605
|
+
"CloneDERC20VotesV2"
|
|
606
|
+
),
|
|
535
607
|
v3Initializer: ZERO_ADDRESS,
|
|
536
608
|
v3Quoter: "0x66266174564170519409d8853898f065c719536b",
|
|
537
609
|
v4Initializer: ZERO_ADDRESS,
|
|
@@ -1772,6 +1844,87 @@ var derc20Abi = [
|
|
|
1772
1844
|
]
|
|
1773
1845
|
}
|
|
1774
1846
|
];
|
|
1847
|
+
var derc20V2Abi = [
|
|
1848
|
+
...derc20Abi,
|
|
1849
|
+
{
|
|
1850
|
+
type: "function",
|
|
1851
|
+
name: "computeAvailableVestedAmount",
|
|
1852
|
+
inputs: [
|
|
1853
|
+
{ name: "beneficiary", type: "address", internalType: "address" },
|
|
1854
|
+
{ name: "scheduleId", type: "uint256", internalType: "uint256" }
|
|
1855
|
+
],
|
|
1856
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
1857
|
+
stateMutability: "view"
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
type: "function",
|
|
1861
|
+
name: "getScheduleIdsOf",
|
|
1862
|
+
inputs: [{ name: "beneficiary", type: "address", internalType: "address" }],
|
|
1863
|
+
outputs: [{ name: "", type: "uint256[]", internalType: "uint256[]" }],
|
|
1864
|
+
stateMutability: "view"
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
type: "function",
|
|
1868
|
+
name: "release",
|
|
1869
|
+
inputs: [{ name: "scheduleId", type: "uint256", internalType: "uint256" }],
|
|
1870
|
+
outputs: [],
|
|
1871
|
+
stateMutability: "nonpayable"
|
|
1872
|
+
},
|
|
1873
|
+
{
|
|
1874
|
+
type: "function",
|
|
1875
|
+
name: "releaseFor",
|
|
1876
|
+
inputs: [
|
|
1877
|
+
{ name: "beneficiary", type: "address", internalType: "address" },
|
|
1878
|
+
{ name: "scheduleId", type: "uint256", internalType: "uint256" }
|
|
1879
|
+
],
|
|
1880
|
+
outputs: [],
|
|
1881
|
+
stateMutability: "nonpayable"
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
type: "function",
|
|
1885
|
+
name: "releaseFor",
|
|
1886
|
+
inputs: [{ name: "beneficiary", type: "address", internalType: "address" }],
|
|
1887
|
+
outputs: [],
|
|
1888
|
+
stateMutability: "nonpayable"
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
type: "function",
|
|
1892
|
+
name: "totalAllocatedOf",
|
|
1893
|
+
inputs: [{ name: "beneficiary", type: "address", internalType: "address" }],
|
|
1894
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
1895
|
+
stateMutability: "view"
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
type: "function",
|
|
1899
|
+
name: "vestingOf",
|
|
1900
|
+
inputs: [
|
|
1901
|
+
{ name: "beneficiary", type: "address", internalType: "address" },
|
|
1902
|
+
{ name: "scheduleId", type: "uint256", internalType: "uint256" }
|
|
1903
|
+
],
|
|
1904
|
+
outputs: [
|
|
1905
|
+
{ name: "totalAmount", type: "uint256", internalType: "uint256" },
|
|
1906
|
+
{ name: "releasedAmount", type: "uint256", internalType: "uint256" }
|
|
1907
|
+
],
|
|
1908
|
+
stateMutability: "view"
|
|
1909
|
+
},
|
|
1910
|
+
{
|
|
1911
|
+
type: "function",
|
|
1912
|
+
name: "vestingScheduleCount",
|
|
1913
|
+
inputs: [],
|
|
1914
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
1915
|
+
stateMutability: "view"
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
type: "function",
|
|
1919
|
+
name: "vestingSchedules",
|
|
1920
|
+
inputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
1921
|
+
outputs: [
|
|
1922
|
+
{ name: "cliff", type: "uint64", internalType: "uint64" },
|
|
1923
|
+
{ name: "duration", type: "uint64", internalType: "uint64" }
|
|
1924
|
+
],
|
|
1925
|
+
stateMutability: "view"
|
|
1926
|
+
}
|
|
1927
|
+
];
|
|
1775
1928
|
var uniswapV4InitializerAbi = [
|
|
1776
1929
|
{
|
|
1777
1930
|
type: "function",
|
|
@@ -4317,6 +4470,22 @@ var STANDARD_TOKEN_DATA_ABI = [
|
|
|
4317
4470
|
{ type: "uint256[]" },
|
|
4318
4471
|
{ type: "string" }
|
|
4319
4472
|
];
|
|
4473
|
+
var STANDARD_TOKEN_V2_DATA_ABI = [
|
|
4474
|
+
{ type: "string" },
|
|
4475
|
+
{ type: "string" },
|
|
4476
|
+
{ type: "uint256" },
|
|
4477
|
+
{
|
|
4478
|
+
type: "tuple[]",
|
|
4479
|
+
components: [
|
|
4480
|
+
{ type: "uint64", name: "cliff" },
|
|
4481
|
+
{ type: "uint64", name: "duration" }
|
|
4482
|
+
]
|
|
4483
|
+
},
|
|
4484
|
+
{ type: "address[]" },
|
|
4485
|
+
{ type: "uint256[]" },
|
|
4486
|
+
{ type: "uint256[]" },
|
|
4487
|
+
{ type: "string" }
|
|
4488
|
+
];
|
|
4320
4489
|
var DOPPLER404_TOKEN_DATA_ABI = [
|
|
4321
4490
|
{ type: "string" },
|
|
4322
4491
|
{ type: "string" },
|
|
@@ -4374,6 +4543,13 @@ function computeCreate2AddressFast(buffer) {
|
|
|
4374
4543
|
const hash = keccak256(bytesToHex(buffer));
|
|
4375
4544
|
return "0x" + hash.slice(-40).toLowerCase();
|
|
4376
4545
|
}
|
|
4546
|
+
function computeSoladyCloneInitCodeHash(implementation) {
|
|
4547
|
+
return keccak256(
|
|
4548
|
+
`0x602c3d8160093d39f33d3d3d3d363d3d37363d73${implementation.slice(
|
|
4549
|
+
2
|
|
4550
|
+
)}5af43d3d93803e602a57fd5bf3`
|
|
4551
|
+
);
|
|
4552
|
+
}
|
|
4377
4553
|
function buildTokenInitHash(params) {
|
|
4378
4554
|
const {
|
|
4379
4555
|
variant,
|
|
@@ -4382,7 +4558,8 @@ function buildTokenInitHash(params) {
|
|
|
4382
4558
|
initialSupply,
|
|
4383
4559
|
recipient,
|
|
4384
4560
|
owner,
|
|
4385
|
-
customBytecode
|
|
4561
|
+
customBytecode,
|
|
4562
|
+
v2Implementation
|
|
4386
4563
|
} = params;
|
|
4387
4564
|
if (variant === "doppler404") {
|
|
4388
4565
|
const [name2, symbol2, baseURI] = decodeAbiParameters(
|
|
@@ -4407,6 +4584,15 @@ function buildTokenInitHash(params) {
|
|
|
4407
4584
|
)
|
|
4408
4585
|
);
|
|
4409
4586
|
}
|
|
4587
|
+
if (variant === "standard-v2") {
|
|
4588
|
+
decodeAbiParameters(STANDARD_TOKEN_V2_DATA_ABI, tokenData);
|
|
4589
|
+
if (!v2Implementation) {
|
|
4590
|
+
throw new Error(
|
|
4591
|
+
"TokenAddressMiner: v2Implementation is required for standard-v2 tokens"
|
|
4592
|
+
);
|
|
4593
|
+
}
|
|
4594
|
+
return computeSoladyCloneInitCodeHash(v2Implementation);
|
|
4595
|
+
}
|
|
4410
4596
|
const [
|
|
4411
4597
|
name,
|
|
4412
4598
|
symbol,
|
|
@@ -4487,7 +4673,8 @@ function mineTokenAddress(params) {
|
|
|
4487
4673
|
initialSupply,
|
|
4488
4674
|
recipient,
|
|
4489
4675
|
owner,
|
|
4490
|
-
customBytecode
|
|
4676
|
+
customBytecode,
|
|
4677
|
+
v2Implementation: params.v2Implementation
|
|
4491
4678
|
});
|
|
4492
4679
|
const hookConfig = hook ? {
|
|
4493
4680
|
deployer: hook.deployer,
|
|
@@ -5092,6 +5279,8 @@ var erc20BalanceOfAbi = [
|
|
|
5092
5279
|
}
|
|
5093
5280
|
];
|
|
5094
5281
|
var TOKEN_FACTORY_80_ADDRESS2 = "0xf0b5141dd9096254b2ca624dff26024f46087229";
|
|
5282
|
+
var DERC20_V2_MIN_VESTING_DURATION = 24 * 60 * 60;
|
|
5283
|
+
var MAX_UINT64 = (1n << 64n) - 1n;
|
|
5095
5284
|
var DopplerFactory = class {
|
|
5096
5285
|
publicClient;
|
|
5097
5286
|
walletClient;
|
|
@@ -5103,6 +5292,285 @@ var DopplerFactory = class {
|
|
|
5103
5292
|
this.walletClient = walletClient;
|
|
5104
5293
|
this.chainId = chainId;
|
|
5105
5294
|
}
|
|
5295
|
+
hasCustomV2Schedules(vesting) {
|
|
5296
|
+
return (vesting?.schedules?.length ?? 0) > 0 || (vesting?.scheduleIds?.length ?? 0) > 0;
|
|
5297
|
+
}
|
|
5298
|
+
usesDerc20V2Vesting(vesting) {
|
|
5299
|
+
if (!vesting) {
|
|
5300
|
+
return false;
|
|
5301
|
+
}
|
|
5302
|
+
return this.hasCustomV2Schedules(vesting) || (vesting.cliffDuration ?? 0) > 0;
|
|
5303
|
+
}
|
|
5304
|
+
resolveVestingAllocations(args) {
|
|
5305
|
+
if (!args.vesting) {
|
|
5306
|
+
return { recipients: [], amounts: [] };
|
|
5307
|
+
}
|
|
5308
|
+
if (args.vesting.recipients && args.vesting.amounts) {
|
|
5309
|
+
return {
|
|
5310
|
+
recipients: args.vesting.recipients,
|
|
5311
|
+
amounts: args.vesting.amounts
|
|
5312
|
+
};
|
|
5313
|
+
}
|
|
5314
|
+
return {
|
|
5315
|
+
recipients: [args.userAddress],
|
|
5316
|
+
amounts: [args.sale.initialSupply - args.sale.numTokensToSell]
|
|
5317
|
+
};
|
|
5318
|
+
}
|
|
5319
|
+
normalizeV2ScheduleId(scheduleId, label) {
|
|
5320
|
+
if (!Number.isFinite(scheduleId) || !Number.isInteger(scheduleId)) {
|
|
5321
|
+
throw new Error(`${label} must be an integer`);
|
|
5322
|
+
}
|
|
5323
|
+
if (!Number.isSafeInteger(scheduleId)) {
|
|
5324
|
+
throw new Error(`${label} must be a safe integer`);
|
|
5325
|
+
}
|
|
5326
|
+
if (scheduleId < 0) {
|
|
5327
|
+
throw new Error(`${label} cannot be negative`);
|
|
5328
|
+
}
|
|
5329
|
+
return BigInt(scheduleId);
|
|
5330
|
+
}
|
|
5331
|
+
validateUint64LikeNumber(value, fieldPath, options = {}) {
|
|
5332
|
+
const { allowZero = true } = options;
|
|
5333
|
+
if (!Number.isFinite(value) || !Number.isInteger(value)) {
|
|
5334
|
+
throw new Error(`${fieldPath} must be a finite integer`);
|
|
5335
|
+
}
|
|
5336
|
+
if (!Number.isSafeInteger(value)) {
|
|
5337
|
+
throw new Error(`${fieldPath} must be a safe integer`);
|
|
5338
|
+
}
|
|
5339
|
+
if (value < 0) {
|
|
5340
|
+
throw new Error(`${fieldPath} cannot be negative`);
|
|
5341
|
+
}
|
|
5342
|
+
if (!allowZero && value === 0) {
|
|
5343
|
+
throw new Error(`${fieldPath} must be greater than zero`);
|
|
5344
|
+
}
|
|
5345
|
+
if (BigInt(value) > MAX_UINT64) {
|
|
5346
|
+
throw new Error(`${fieldPath} must fit in uint64`);
|
|
5347
|
+
}
|
|
5348
|
+
}
|
|
5349
|
+
resolveV2VestingSchedules(args) {
|
|
5350
|
+
if (!args.vesting) {
|
|
5351
|
+
return { schedules: [], scheduleIds: [] };
|
|
5352
|
+
}
|
|
5353
|
+
if (!this.hasCustomV2Schedules(args.vesting)) {
|
|
5354
|
+
return {
|
|
5355
|
+
schedules: [
|
|
5356
|
+
{
|
|
5357
|
+
cliff: BigInt(args.vesting.cliffDuration ?? 0),
|
|
5358
|
+
duration: BigInt(args.vesting.duration ?? 0)
|
|
5359
|
+
}
|
|
5360
|
+
],
|
|
5361
|
+
scheduleIds: Array.from({ length: args.recipientCount }, () => 0n)
|
|
5362
|
+
};
|
|
5363
|
+
}
|
|
5364
|
+
const schedules = args.vesting.schedules?.map((schedule) => ({
|
|
5365
|
+
cliff: BigInt(schedule.cliffDuration ?? 0),
|
|
5366
|
+
duration: BigInt(schedule.duration ?? 0)
|
|
5367
|
+
})) ?? [];
|
|
5368
|
+
const explicitScheduleIds = args.vesting.scheduleIds;
|
|
5369
|
+
if (explicitScheduleIds && explicitScheduleIds.length > 0) {
|
|
5370
|
+
return {
|
|
5371
|
+
schedules,
|
|
5372
|
+
scheduleIds: explicitScheduleIds.map(
|
|
5373
|
+
(scheduleId, index) => this.normalizeV2ScheduleId(
|
|
5374
|
+
scheduleId,
|
|
5375
|
+
`Vesting scheduleIds[${index}]`
|
|
5376
|
+
)
|
|
5377
|
+
)
|
|
5378
|
+
};
|
|
5379
|
+
}
|
|
5380
|
+
if (schedules.length === 1) {
|
|
5381
|
+
return {
|
|
5382
|
+
schedules,
|
|
5383
|
+
scheduleIds: Array.from({ length: args.recipientCount }, () => 0n)
|
|
5384
|
+
};
|
|
5385
|
+
}
|
|
5386
|
+
if (schedules.length === args.recipientCount) {
|
|
5387
|
+
return {
|
|
5388
|
+
schedules,
|
|
5389
|
+
scheduleIds: schedules.map((_, index) => BigInt(index))
|
|
5390
|
+
};
|
|
5391
|
+
}
|
|
5392
|
+
throw new Error(
|
|
5393
|
+
"Vesting schedules must either contain exactly one shared schedule or one schedule per recipient when scheduleIds are omitted"
|
|
5394
|
+
);
|
|
5395
|
+
}
|
|
5396
|
+
resolveStandardTokenFactoryMode(args) {
|
|
5397
|
+
if (this.usesDerc20V2Vesting(args.vesting)) {
|
|
5398
|
+
return "v2";
|
|
5399
|
+
}
|
|
5400
|
+
const v2Factory = args.addresses.derc20V2Factory;
|
|
5401
|
+
if (v2Factory && args.tokenFactory.toLowerCase() === v2Factory.toLowerCase()) {
|
|
5402
|
+
return "v2";
|
|
5403
|
+
}
|
|
5404
|
+
return "legacy";
|
|
5405
|
+
}
|
|
5406
|
+
assertStandardTokenFactoryCompatibility(args) {
|
|
5407
|
+
if (this.isDoppler404Token(args.token) || !this.usesDerc20V2Vesting(args.vesting)) {
|
|
5408
|
+
return;
|
|
5409
|
+
}
|
|
5410
|
+
const v2Factory = args.addresses.derc20V2Factory;
|
|
5411
|
+
if (!v2Factory || v2Factory === ZERO_ADDRESS2) {
|
|
5412
|
+
throw new Error(
|
|
5413
|
+
"Cliff vesting requires the DERC20 V2 factory, but no V2 factory is configured for this chain."
|
|
5414
|
+
);
|
|
5415
|
+
}
|
|
5416
|
+
if (args.tokenFactory.toLowerCase() !== v2Factory.toLowerCase()) {
|
|
5417
|
+
throw new Error(
|
|
5418
|
+
"Cliff vesting requires the DERC20 V2 factory. Remove the tokenFactory override or point it at the chain DERC20 V2 factory."
|
|
5419
|
+
);
|
|
5420
|
+
}
|
|
5421
|
+
}
|
|
5422
|
+
buildStandardTokenFactoryData(args) {
|
|
5423
|
+
const { recipients, amounts } = this.resolveVestingAllocations(args);
|
|
5424
|
+
const yearlyMintRate = args.token.yearlyMintRate ?? DEFAULT_V4_YEARLY_MINT_RATE;
|
|
5425
|
+
const mode = this.resolveStandardTokenFactoryMode({
|
|
5426
|
+
vesting: args.vesting,
|
|
5427
|
+
tokenFactory: args.tokenFactory,
|
|
5428
|
+
addresses: args.addresses
|
|
5429
|
+
});
|
|
5430
|
+
if (mode === "v2") {
|
|
5431
|
+
const implementation = args.addresses.derc20V2Implementation;
|
|
5432
|
+
if (!implementation || implementation === ZERO_ADDRESS2) {
|
|
5433
|
+
throw new Error(
|
|
5434
|
+
"DERC20 V2 implementation address not configured for this chain."
|
|
5435
|
+
);
|
|
5436
|
+
}
|
|
5437
|
+
const { schedules, scheduleIds } = this.resolveV2VestingSchedules({
|
|
5438
|
+
vesting: args.vesting,
|
|
5439
|
+
recipientCount: recipients.length
|
|
5440
|
+
});
|
|
5441
|
+
return {
|
|
5442
|
+
kind: "v2",
|
|
5443
|
+
name: args.token.name,
|
|
5444
|
+
symbol: args.token.symbol,
|
|
5445
|
+
initialSupply: args.sale.initialSupply,
|
|
5446
|
+
airlock: args.airlock,
|
|
5447
|
+
yearlyMintRate,
|
|
5448
|
+
schedules,
|
|
5449
|
+
beneficiaries: recipients,
|
|
5450
|
+
scheduleIds,
|
|
5451
|
+
amounts,
|
|
5452
|
+
tokenURI: args.token.tokenURI,
|
|
5453
|
+
implementation
|
|
5454
|
+
};
|
|
5455
|
+
}
|
|
5456
|
+
return {
|
|
5457
|
+
kind: "legacy",
|
|
5458
|
+
name: args.token.name,
|
|
5459
|
+
symbol: args.token.symbol,
|
|
5460
|
+
initialSupply: args.sale.initialSupply,
|
|
5461
|
+
airlock: args.airlock,
|
|
5462
|
+
yearlyMintRate,
|
|
5463
|
+
vestingDuration: BigInt(args.vesting?.duration ?? 0),
|
|
5464
|
+
recipients,
|
|
5465
|
+
amounts,
|
|
5466
|
+
tokenURI: args.token.tokenURI
|
|
5467
|
+
};
|
|
5468
|
+
}
|
|
5469
|
+
encodeStandardTokenFactoryData(tokenFactoryData) {
|
|
5470
|
+
if (tokenFactoryData.kind === "v2") {
|
|
5471
|
+
return encodeAbiParameters(
|
|
5472
|
+
[
|
|
5473
|
+
{ type: "string" },
|
|
5474
|
+
{ type: "string" },
|
|
5475
|
+
{ type: "uint256" },
|
|
5476
|
+
{
|
|
5477
|
+
type: "tuple[]",
|
|
5478
|
+
components: [
|
|
5479
|
+
{ type: "uint64", name: "cliff" },
|
|
5480
|
+
{ type: "uint64", name: "duration" }
|
|
5481
|
+
]
|
|
5482
|
+
},
|
|
5483
|
+
{ type: "address[]" },
|
|
5484
|
+
{ type: "uint256[]" },
|
|
5485
|
+
{ type: "uint256[]" },
|
|
5486
|
+
{ type: "string" }
|
|
5487
|
+
],
|
|
5488
|
+
[
|
|
5489
|
+
tokenFactoryData.name,
|
|
5490
|
+
tokenFactoryData.symbol,
|
|
5491
|
+
tokenFactoryData.yearlyMintRate,
|
|
5492
|
+
tokenFactoryData.schedules.map((schedule) => ({
|
|
5493
|
+
cliff: schedule.cliff,
|
|
5494
|
+
duration: schedule.duration
|
|
5495
|
+
})),
|
|
5496
|
+
tokenFactoryData.beneficiaries,
|
|
5497
|
+
tokenFactoryData.scheduleIds,
|
|
5498
|
+
tokenFactoryData.amounts,
|
|
5499
|
+
tokenFactoryData.tokenURI
|
|
5500
|
+
]
|
|
5501
|
+
);
|
|
5502
|
+
}
|
|
5503
|
+
return encodeAbiParameters(
|
|
5504
|
+
[
|
|
5505
|
+
{ type: "string" },
|
|
5506
|
+
{ type: "string" },
|
|
5507
|
+
{ type: "uint256" },
|
|
5508
|
+
{ type: "uint256" },
|
|
5509
|
+
{ type: "address[]" },
|
|
5510
|
+
{ type: "uint256[]" },
|
|
5511
|
+
{ type: "string" }
|
|
5512
|
+
],
|
|
5513
|
+
[
|
|
5514
|
+
tokenFactoryData.name,
|
|
5515
|
+
tokenFactoryData.symbol,
|
|
5516
|
+
tokenFactoryData.yearlyMintRate,
|
|
5517
|
+
tokenFactoryData.vestingDuration,
|
|
5518
|
+
tokenFactoryData.recipients,
|
|
5519
|
+
tokenFactoryData.amounts,
|
|
5520
|
+
tokenFactoryData.tokenURI
|
|
5521
|
+
]
|
|
5522
|
+
);
|
|
5523
|
+
}
|
|
5524
|
+
computeSoladyCloneInitCodeHash(implementation) {
|
|
5525
|
+
return keccak256(
|
|
5526
|
+
`0x602c3d8160093d39f33d3d3d3d363d3d37363d73${implementation.slice(
|
|
5527
|
+
2
|
|
5528
|
+
)}5af43d3d93803e602a57fd5bf3`
|
|
5529
|
+
);
|
|
5530
|
+
}
|
|
5531
|
+
computeStandardTokenInitHash(tokenFactoryData, tokenFactory) {
|
|
5532
|
+
if (tokenFactoryData.kind === "v2") {
|
|
5533
|
+
return this.computeSoladyCloneInitCodeHash(
|
|
5534
|
+
tokenFactoryData.implementation
|
|
5535
|
+
);
|
|
5536
|
+
}
|
|
5537
|
+
const initData = encodeAbiParameters(
|
|
5538
|
+
[
|
|
5539
|
+
{ type: "string" },
|
|
5540
|
+
{ type: "string" },
|
|
5541
|
+
{ type: "uint256" },
|
|
5542
|
+
{ type: "address" },
|
|
5543
|
+
{ type: "address" },
|
|
5544
|
+
{ type: "uint256" },
|
|
5545
|
+
{ type: "uint256" },
|
|
5546
|
+
{ type: "address[]" },
|
|
5547
|
+
{ type: "uint256[]" },
|
|
5548
|
+
{ type: "string" }
|
|
5549
|
+
],
|
|
5550
|
+
[
|
|
5551
|
+
tokenFactoryData.name,
|
|
5552
|
+
tokenFactoryData.symbol,
|
|
5553
|
+
tokenFactoryData.initialSupply,
|
|
5554
|
+
tokenFactoryData.airlock,
|
|
5555
|
+
tokenFactoryData.airlock,
|
|
5556
|
+
tokenFactoryData.yearlyMintRate,
|
|
5557
|
+
tokenFactoryData.vestingDuration,
|
|
5558
|
+
tokenFactoryData.recipients,
|
|
5559
|
+
tokenFactoryData.amounts,
|
|
5560
|
+
tokenFactoryData.tokenURI
|
|
5561
|
+
]
|
|
5562
|
+
);
|
|
5563
|
+
const isTokenFactory802 = tokenFactory.toLowerCase() === TOKEN_FACTORY_80_ADDRESS2;
|
|
5564
|
+
return keccak256(
|
|
5565
|
+
encodePacked(
|
|
5566
|
+
["bytes", "bytes"],
|
|
5567
|
+
[
|
|
5568
|
+
isTokenFactory802 ? derc2080_default : derc20_default,
|
|
5569
|
+
initData
|
|
5570
|
+
]
|
|
5571
|
+
)
|
|
5572
|
+
);
|
|
5573
|
+
}
|
|
5106
5574
|
/**
|
|
5107
5575
|
* Set a custom migration data encoder function
|
|
5108
5576
|
* @param encoder Custom function to encode migration data
|
|
@@ -5187,6 +5655,18 @@ var DopplerFactory = class {
|
|
|
5187
5655
|
numeraire: params.sale.numeraire,
|
|
5188
5656
|
overrides: params.modules
|
|
5189
5657
|
});
|
|
5658
|
+
const resolvedTokenFactory = params.modules?.tokenFactory ?? (this.isDoppler404Token(params.token) ? addresses.doppler404Factory : this.usesDerc20V2Vesting(params.vesting) ? addresses.derc20V2Factory : addresses.tokenFactory);
|
|
5659
|
+
if (!resolvedTokenFactory || resolvedTokenFactory === ZERO_ADDRESS2) {
|
|
5660
|
+
throw new Error(
|
|
5661
|
+
"Token factory address not configured. Provide an explicit address via builder.withTokenFactory(...) or ensure chain config includes a valid factory."
|
|
5662
|
+
);
|
|
5663
|
+
}
|
|
5664
|
+
this.assertStandardTokenFactoryCompatibility({
|
|
5665
|
+
token: params.token,
|
|
5666
|
+
vesting: params.vesting,
|
|
5667
|
+
tokenFactory: resolvedTokenFactory,
|
|
5668
|
+
addresses
|
|
5669
|
+
});
|
|
5190
5670
|
let tokenFactoryData;
|
|
5191
5671
|
if (this.isDoppler404Token(params.token)) {
|
|
5192
5672
|
const token404 = params.token;
|
|
@@ -5202,41 +5682,17 @@ var DopplerFactory = class {
|
|
|
5202
5682
|
[params.token.name, params.token.symbol, baseURI, unit]
|
|
5203
5683
|
);
|
|
5204
5684
|
} else {
|
|
5205
|
-
const
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
vestingAmounts = [
|
|
5217
|
-
params.sale.initialSupply - params.sale.numTokensToSell
|
|
5218
|
-
];
|
|
5219
|
-
}
|
|
5220
|
-
}
|
|
5221
|
-
tokenFactoryData = encodeAbiParameters(
|
|
5222
|
-
[
|
|
5223
|
-
{ type: "string" },
|
|
5224
|
-
{ type: "string" },
|
|
5225
|
-
{ type: "uint256" },
|
|
5226
|
-
{ type: "uint256" },
|
|
5227
|
-
{ type: "address[]" },
|
|
5228
|
-
{ type: "uint256[]" },
|
|
5229
|
-
{ type: "string" }
|
|
5230
|
-
],
|
|
5231
|
-
[
|
|
5232
|
-
tokenStd.name,
|
|
5233
|
-
tokenStd.symbol,
|
|
5234
|
-
yearlyMintRate,
|
|
5235
|
-
BigInt(vestingDuration),
|
|
5236
|
-
vestingRecipients,
|
|
5237
|
-
vestingAmounts,
|
|
5238
|
-
tokenStd.tokenURI
|
|
5239
|
-
]
|
|
5685
|
+
const standardTokenFactoryData = this.buildStandardTokenFactoryData({
|
|
5686
|
+
token: params.token,
|
|
5687
|
+
sale: params.sale,
|
|
5688
|
+
vesting: params.vesting,
|
|
5689
|
+
userAddress: params.userAddress,
|
|
5690
|
+
airlock: params.modules?.airlock ?? addresses.airlock,
|
|
5691
|
+
tokenFactory: resolvedTokenFactory,
|
|
5692
|
+
addresses
|
|
5693
|
+
});
|
|
5694
|
+
tokenFactoryData = this.encodeStandardTokenFactoryData(
|
|
5695
|
+
standardTokenFactoryData
|
|
5240
5696
|
);
|
|
5241
5697
|
}
|
|
5242
5698
|
const governanceFactoryData = (() => {
|
|
@@ -5291,12 +5747,6 @@ var DopplerFactory = class {
|
|
|
5291
5747
|
}
|
|
5292
5748
|
return resolved;
|
|
5293
5749
|
})();
|
|
5294
|
-
const resolvedTokenFactory = params.modules?.tokenFactory ?? (this.isDoppler404Token(params.token) ? addresses.doppler404Factory : addresses.tokenFactory);
|
|
5295
|
-
if (!resolvedTokenFactory || resolvedTokenFactory === ZERO_ADDRESS2) {
|
|
5296
|
-
throw new Error(
|
|
5297
|
-
"Token factory address not configured. Provide an explicit address via builder.withTokenFactory(...) or ensure chain config includes a valid factory."
|
|
5298
|
-
);
|
|
5299
|
-
}
|
|
5300
5750
|
const baseCreateParams = {
|
|
5301
5751
|
initialSupply: params.sale.initialSupply,
|
|
5302
5752
|
numTokensToSell: params.sale.numTokensToSell,
|
|
@@ -5582,7 +6032,18 @@ var DopplerFactory = class {
|
|
|
5582
6032
|
);
|
|
5583
6033
|
}
|
|
5584
6034
|
}
|
|
5585
|
-
const
|
|
6035
|
+
const resolvedTokenFactoryDyn = params.modules?.tokenFactory ?? (this.isDoppler404Token(params.token) ? addresses.doppler404Factory : this.usesDerc20V2Vesting(params.vesting) ? addresses.derc20V2Factory : addresses.tokenFactory);
|
|
6036
|
+
if (!resolvedTokenFactoryDyn || resolvedTokenFactoryDyn === ZERO_ADDRESS2) {
|
|
6037
|
+
throw new Error(
|
|
6038
|
+
"Token factory address not configured. Provide an explicit address via builder.withTokenFactory(...) or ensure chain config includes a valid factory."
|
|
6039
|
+
);
|
|
6040
|
+
}
|
|
6041
|
+
this.assertStandardTokenFactoryCompatibility({
|
|
6042
|
+
token: params.token,
|
|
6043
|
+
vesting: params.vesting,
|
|
6044
|
+
tokenFactory: resolvedTokenFactoryDyn,
|
|
6045
|
+
addresses
|
|
6046
|
+
});
|
|
5586
6047
|
const tokenFactoryData = this.isDoppler404Token(params.token) ? (() => {
|
|
5587
6048
|
const t = params.token;
|
|
5588
6049
|
return {
|
|
@@ -5591,39 +6052,15 @@ var DopplerFactory = class {
|
|
|
5591
6052
|
baseURI: t.baseURI,
|
|
5592
6053
|
unit: t.unit !== void 0 ? BigInt(t.unit) : 1000n
|
|
5593
6054
|
};
|
|
5594
|
-
})() : (
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
vestingRecipients = [params.userAddress];
|
|
5604
|
-
vestingAmounts = [
|
|
5605
|
-
params.sale.initialSupply - params.sale.numTokensToSell
|
|
5606
|
-
];
|
|
5607
|
-
}
|
|
5608
|
-
}
|
|
5609
|
-
return {
|
|
5610
|
-
name: t.name,
|
|
5611
|
-
symbol: t.symbol,
|
|
5612
|
-
initialSupply: params.sale.initialSupply,
|
|
5613
|
-
airlock: addresses.airlock,
|
|
5614
|
-
yearlyMintRate: t.yearlyMintRate ?? DEFAULT_V4_YEARLY_MINT_RATE,
|
|
5615
|
-
vestingDuration: BigInt(vestingDuration),
|
|
5616
|
-
recipients: vestingRecipients,
|
|
5617
|
-
amounts: vestingAmounts,
|
|
5618
|
-
tokenURI: t.tokenURI
|
|
5619
|
-
};
|
|
5620
|
-
})();
|
|
5621
|
-
const resolvedTokenFactoryDyn = params.modules?.tokenFactory ?? (this.isDoppler404Token(params.token) ? addresses.doppler404Factory : addresses.tokenFactory);
|
|
5622
|
-
if (!resolvedTokenFactoryDyn || resolvedTokenFactoryDyn === ZERO_ADDRESS2) {
|
|
5623
|
-
throw new Error(
|
|
5624
|
-
"Token factory address not configured. Provide an explicit address via builder.withTokenFactory(...) or ensure chain config includes a valid factory."
|
|
5625
|
-
);
|
|
5626
|
-
}
|
|
6055
|
+
})() : this.buildStandardTokenFactoryData({
|
|
6056
|
+
token: params.token,
|
|
6057
|
+
sale: params.sale,
|
|
6058
|
+
vesting: params.vesting,
|
|
6059
|
+
userAddress: params.userAddress,
|
|
6060
|
+
airlock: params.modules?.airlock ?? addresses.airlock,
|
|
6061
|
+
tokenFactory: resolvedTokenFactoryDyn,
|
|
6062
|
+
addresses
|
|
6063
|
+
});
|
|
5627
6064
|
const [
|
|
5628
6065
|
salt,
|
|
5629
6066
|
hookAddress,
|
|
@@ -5950,7 +6387,18 @@ var DopplerFactory = class {
|
|
|
5950
6387
|
);
|
|
5951
6388
|
}
|
|
5952
6389
|
}
|
|
5953
|
-
const
|
|
6390
|
+
const resolvedTokenFactory = params.modules?.tokenFactory ?? (this.isDoppler404Token(params.token) ? addresses.doppler404Factory : this.usesDerc20V2Vesting(params.vesting) ? addresses.derc20V2Factory : addresses.tokenFactory);
|
|
6391
|
+
if (!resolvedTokenFactory || resolvedTokenFactory === ZERO_ADDRESS2) {
|
|
6392
|
+
throw new Error(
|
|
6393
|
+
"Token factory address not configured. Provide an explicit address via builder.withTokenFactory(...) or ensure chain config includes a valid factory."
|
|
6394
|
+
);
|
|
6395
|
+
}
|
|
6396
|
+
this.assertStandardTokenFactoryCompatibility({
|
|
6397
|
+
token: params.token,
|
|
6398
|
+
vesting: params.vesting,
|
|
6399
|
+
tokenFactory: resolvedTokenFactory,
|
|
6400
|
+
addresses
|
|
6401
|
+
});
|
|
5954
6402
|
const tokenFactoryData = this.isDoppler404Token(params.token) ? (() => {
|
|
5955
6403
|
const t = params.token;
|
|
5956
6404
|
return {
|
|
@@ -5959,39 +6407,15 @@ var DopplerFactory = class {
|
|
|
5959
6407
|
baseURI: t.baseURI,
|
|
5960
6408
|
unit: t.unit !== void 0 ? BigInt(t.unit) : 1000n
|
|
5961
6409
|
};
|
|
5962
|
-
})() : (
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
vestingRecipients = [params.userAddress];
|
|
5972
|
-
vestingAmounts = [
|
|
5973
|
-
params.sale.initialSupply - params.sale.numTokensToSell
|
|
5974
|
-
];
|
|
5975
|
-
}
|
|
5976
|
-
}
|
|
5977
|
-
return {
|
|
5978
|
-
name: t.name,
|
|
5979
|
-
symbol: t.symbol,
|
|
5980
|
-
initialSupply: params.sale.initialSupply,
|
|
5981
|
-
airlock: params.modules?.airlock ?? addresses.airlock,
|
|
5982
|
-
yearlyMintRate: t.yearlyMintRate ?? DEFAULT_V4_YEARLY_MINT_RATE,
|
|
5983
|
-
vestingDuration: BigInt(vestingDuration),
|
|
5984
|
-
recipients: vestingRecipients,
|
|
5985
|
-
amounts: vestingAmounts,
|
|
5986
|
-
tokenURI: t.tokenURI
|
|
5987
|
-
};
|
|
5988
|
-
})();
|
|
5989
|
-
const resolvedTokenFactory = params.modules?.tokenFactory ?? (this.isDoppler404Token(params.token) ? addresses.doppler404Factory : addresses.tokenFactory);
|
|
5990
|
-
if (!resolvedTokenFactory || resolvedTokenFactory === ZERO_ADDRESS2) {
|
|
5991
|
-
throw new Error(
|
|
5992
|
-
"Token factory address not configured. Provide an explicit address via builder.withTokenFactory(...) or ensure chain config includes a valid factory."
|
|
5993
|
-
);
|
|
5994
|
-
}
|
|
6410
|
+
})() : this.buildStandardTokenFactoryData({
|
|
6411
|
+
token: params.token,
|
|
6412
|
+
sale: params.sale,
|
|
6413
|
+
vesting: params.vesting,
|
|
6414
|
+
userAddress: params.userAddress,
|
|
6415
|
+
airlock: params.modules?.airlock ?? addresses.airlock,
|
|
6416
|
+
tokenFactory: resolvedTokenFactory,
|
|
6417
|
+
addresses
|
|
6418
|
+
});
|
|
5995
6419
|
const auctionTokens = params.sale.numTokensToSell * BigInt(params.openingAuction.shareToAuctionBps) / 10000n;
|
|
5996
6420
|
if (auctionTokens <= 0n) {
|
|
5997
6421
|
throw new Error("Opening auction token allocation rounds to zero");
|
|
@@ -6765,69 +7189,23 @@ var DopplerFactory = class {
|
|
|
6765
7189
|
["bytes", "bytes"],
|
|
6766
7190
|
[openingAuction_default, initHashData]
|
|
6767
7191
|
)
|
|
6768
|
-
);
|
|
6769
|
-
const encodedTokenFactoryData = params.tokenVariant === "doppler404" ? (() => {
|
|
6770
|
-
const t = params.tokenFactoryData;
|
|
6771
|
-
return encodeAbiParameters(
|
|
6772
|
-
[
|
|
6773
|
-
{ type: "string" },
|
|
6774
|
-
{ type: "string" },
|
|
6775
|
-
{ type: "string" },
|
|
6776
|
-
{ type: "uint256" }
|
|
6777
|
-
],
|
|
6778
|
-
[t.name, t.symbol, t.baseURI, t.unit ?? 1000n]
|
|
6779
|
-
);
|
|
6780
|
-
})() : (() => {
|
|
6781
|
-
const t = params.tokenFactoryData;
|
|
6782
|
-
return encodeAbiParameters(
|
|
6783
|
-
[
|
|
6784
|
-
{ type: "string" },
|
|
6785
|
-
{ type: "string" },
|
|
6786
|
-
{ type: "uint256" },
|
|
6787
|
-
{ type: "uint256" },
|
|
6788
|
-
{ type: "address[]" },
|
|
6789
|
-
{ type: "uint256[]" },
|
|
6790
|
-
{ type: "string" }
|
|
6791
|
-
],
|
|
6792
|
-
[
|
|
6793
|
-
t.name,
|
|
6794
|
-
t.symbol,
|
|
6795
|
-
t.yearlyMintRate,
|
|
6796
|
-
t.vestingDuration,
|
|
6797
|
-
t.recipients,
|
|
6798
|
-
t.amounts,
|
|
6799
|
-
t.tokenURI
|
|
6800
|
-
]
|
|
6801
|
-
);
|
|
6802
|
-
})();
|
|
6803
|
-
let tokenInitHash;
|
|
6804
|
-
if (params.tokenVariant === "doppler404") {
|
|
6805
|
-
const t = params.tokenFactoryData;
|
|
6806
|
-
const initData = encodeAbiParameters(
|
|
6807
|
-
[
|
|
6808
|
-
{ type: "string" },
|
|
6809
|
-
{ type: "string" },
|
|
6810
|
-
{ type: "uint256" },
|
|
6811
|
-
{ type: "address" },
|
|
6812
|
-
{ type: "address" },
|
|
6813
|
-
{ type: "string" }
|
|
6814
|
-
],
|
|
6815
|
-
[
|
|
6816
|
-
t.name,
|
|
6817
|
-
t.symbol,
|
|
6818
|
-
params.initialSupply,
|
|
6819
|
-
params.airlock,
|
|
6820
|
-
params.airlock,
|
|
6821
|
-
t.baseURI
|
|
6822
|
-
]
|
|
6823
|
-
);
|
|
6824
|
-
tokenInitHash = keccak256(
|
|
6825
|
-
encodePacked(
|
|
6826
|
-
["bytes", "bytes"],
|
|
6827
|
-
[dopplerDN404_default, initData]
|
|
6828
|
-
)
|
|
7192
|
+
);
|
|
7193
|
+
const encodedTokenFactoryData = params.tokenVariant === "doppler404" ? (() => {
|
|
7194
|
+
const t = params.tokenFactoryData;
|
|
7195
|
+
return encodeAbiParameters(
|
|
7196
|
+
[
|
|
7197
|
+
{ type: "string" },
|
|
7198
|
+
{ type: "string" },
|
|
7199
|
+
{ type: "string" },
|
|
7200
|
+
{ type: "uint256" }
|
|
7201
|
+
],
|
|
7202
|
+
[t.name, t.symbol, t.baseURI, t.unit ?? 1000n]
|
|
6829
7203
|
);
|
|
6830
|
-
}
|
|
7204
|
+
})() : this.encodeStandardTokenFactoryData(
|
|
7205
|
+
params.tokenFactoryData
|
|
7206
|
+
);
|
|
7207
|
+
let tokenInitHash;
|
|
7208
|
+
if (params.tokenVariant === "doppler404") {
|
|
6831
7209
|
const t = params.tokenFactoryData;
|
|
6832
7210
|
const initData = encodeAbiParameters(
|
|
6833
7211
|
[
|
|
@@ -6836,10 +7214,6 @@ var DopplerFactory = class {
|
|
|
6836
7214
|
{ type: "uint256" },
|
|
6837
7215
|
{ type: "address" },
|
|
6838
7216
|
{ type: "address" },
|
|
6839
|
-
{ type: "uint256" },
|
|
6840
|
-
{ type: "uint256" },
|
|
6841
|
-
{ type: "address[]" },
|
|
6842
|
-
{ type: "uint256[]" },
|
|
6843
7217
|
{ type: "string" }
|
|
6844
7218
|
],
|
|
6845
7219
|
[
|
|
@@ -6848,23 +7222,20 @@ var DopplerFactory = class {
|
|
|
6848
7222
|
params.initialSupply,
|
|
6849
7223
|
params.airlock,
|
|
6850
7224
|
params.airlock,
|
|
6851
|
-
t.
|
|
6852
|
-
t.vestingDuration,
|
|
6853
|
-
t.recipients,
|
|
6854
|
-
t.amounts,
|
|
6855
|
-
t.tokenURI
|
|
7225
|
+
t.baseURI
|
|
6856
7226
|
]
|
|
6857
7227
|
);
|
|
6858
|
-
const isTokenFactory802 = params.tokenFactory.toLowerCase() === TOKEN_FACTORY_80_ADDRESS2;
|
|
6859
7228
|
tokenInitHash = keccak256(
|
|
6860
7229
|
encodePacked(
|
|
6861
7230
|
["bytes", "bytes"],
|
|
6862
|
-
[
|
|
6863
|
-
isTokenFactory802 ? derc2080_default : derc20_default,
|
|
6864
|
-
initData
|
|
6865
|
-
]
|
|
7231
|
+
[dopplerDN404_default, initData]
|
|
6866
7232
|
)
|
|
6867
7233
|
);
|
|
7234
|
+
} else {
|
|
7235
|
+
tokenInitHash = this.computeStandardTokenInitHash(
|
|
7236
|
+
params.tokenFactoryData,
|
|
7237
|
+
params.tokenFactory
|
|
7238
|
+
);
|
|
6868
7239
|
}
|
|
6869
7240
|
const isToken0 = isToken0Expected(params.numeraire);
|
|
6870
7241
|
const numeraireBigInt = BigInt(params.numeraire);
|
|
@@ -7540,6 +7911,18 @@ var DopplerFactory = class {
|
|
|
7540
7911
|
]
|
|
7541
7912
|
);
|
|
7542
7913
|
}
|
|
7914
|
+
const resolvedTokenFactory = params.modules?.tokenFactory ?? (this.isDoppler404Token(params.token) ? addresses.doppler404Factory : this.usesDerc20V2Vesting(params.vesting) ? addresses.derc20V2Factory : addresses.tokenFactory);
|
|
7915
|
+
if (!resolvedTokenFactory || resolvedTokenFactory === ZERO_ADDRESS2) {
|
|
7916
|
+
throw new Error(
|
|
7917
|
+
"Token factory address not configured. Provide an explicit address or ensure chain config includes a valid factory."
|
|
7918
|
+
);
|
|
7919
|
+
}
|
|
7920
|
+
this.assertStandardTokenFactoryCompatibility({
|
|
7921
|
+
token: params.token,
|
|
7922
|
+
vesting: params.vesting,
|
|
7923
|
+
tokenFactory: resolvedTokenFactory,
|
|
7924
|
+
addresses
|
|
7925
|
+
});
|
|
7543
7926
|
let tokenFactoryData;
|
|
7544
7927
|
if (this.isDoppler404Token(params.token)) {
|
|
7545
7928
|
const token404 = params.token;
|
|
@@ -7554,41 +7937,17 @@ var DopplerFactory = class {
|
|
|
7554
7937
|
[token404.name, token404.symbol, token404.baseURI, unit]
|
|
7555
7938
|
);
|
|
7556
7939
|
} else {
|
|
7557
|
-
const
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
vestingAmounts = [
|
|
7569
|
-
params.sale.initialSupply - params.sale.numTokensToSell
|
|
7570
|
-
];
|
|
7571
|
-
}
|
|
7572
|
-
}
|
|
7573
|
-
tokenFactoryData = encodeAbiParameters(
|
|
7574
|
-
[
|
|
7575
|
-
{ type: "string" },
|
|
7576
|
-
{ type: "string" },
|
|
7577
|
-
{ type: "uint256" },
|
|
7578
|
-
{ type: "uint256" },
|
|
7579
|
-
{ type: "address[]" },
|
|
7580
|
-
{ type: "uint256[]" },
|
|
7581
|
-
{ type: "string" }
|
|
7582
|
-
],
|
|
7583
|
-
[
|
|
7584
|
-
tokenStd.name,
|
|
7585
|
-
tokenStd.symbol,
|
|
7586
|
-
yearlyMintRate,
|
|
7587
|
-
BigInt(vestingDuration),
|
|
7588
|
-
vestingRecipients,
|
|
7589
|
-
vestingAmounts,
|
|
7590
|
-
tokenStd.tokenURI
|
|
7591
|
-
]
|
|
7940
|
+
const standardTokenFactoryData = this.buildStandardTokenFactoryData({
|
|
7941
|
+
token: params.token,
|
|
7942
|
+
sale: params.sale,
|
|
7943
|
+
vesting: params.vesting,
|
|
7944
|
+
userAddress: params.userAddress,
|
|
7945
|
+
airlock: params.modules?.airlock ?? addresses.airlock,
|
|
7946
|
+
tokenFactory: resolvedTokenFactory,
|
|
7947
|
+
addresses
|
|
7948
|
+
});
|
|
7949
|
+
tokenFactoryData = this.encodeStandardTokenFactoryData(
|
|
7950
|
+
standardTokenFactoryData
|
|
7592
7951
|
);
|
|
7593
7952
|
}
|
|
7594
7953
|
const governanceFactoryData = (() => {
|
|
@@ -7617,12 +7976,6 @@ var DopplerFactory = class {
|
|
|
7617
7976
|
);
|
|
7618
7977
|
})();
|
|
7619
7978
|
const salt = this.generateRandomSalt(params.userAddress);
|
|
7620
|
-
const resolvedTokenFactory = params.modules?.tokenFactory ?? (this.isDoppler404Token(params.token) ? addresses.doppler404Factory : addresses.tokenFactory);
|
|
7621
|
-
if (!resolvedTokenFactory || resolvedTokenFactory === ZERO_ADDRESS2) {
|
|
7622
|
-
throw new Error(
|
|
7623
|
-
"Token factory address not configured. Provide an explicit address or ensure chain config includes a valid factory."
|
|
7624
|
-
);
|
|
7625
|
-
}
|
|
7626
7979
|
const resolvedInitializer = (() => {
|
|
7627
7980
|
if (useDopplerHookInitializer) {
|
|
7628
7981
|
return params.modules?.dopplerHookInitializer ?? addresses.dopplerHookInitializer;
|
|
@@ -7875,6 +8228,109 @@ var DopplerFactory = class {
|
|
|
7875
8228
|
const rounded = Math.floor(MAX_TICK / tickSpacing) * tickSpacing;
|
|
7876
8229
|
return rounded;
|
|
7877
8230
|
}
|
|
8231
|
+
validateVestingConfig(sale, vesting) {
|
|
8232
|
+
if (!vesting) {
|
|
8233
|
+
return;
|
|
8234
|
+
}
|
|
8235
|
+
const cliffDuration = vesting.cliffDuration ?? 0;
|
|
8236
|
+
const duration = vesting.duration ?? 0;
|
|
8237
|
+
const hasCustomSchedules = this.hasCustomV2Schedules(vesting);
|
|
8238
|
+
if (hasCustomSchedules && (cliffDuration > 0 || duration > 0)) {
|
|
8239
|
+
throw new Error(
|
|
8240
|
+
"Use vesting.schedules instead of top-level duration/cliffDuration when configuring multiple vesting schedules"
|
|
8241
|
+
);
|
|
8242
|
+
}
|
|
8243
|
+
if (vesting.recipients && vesting.amounts) {
|
|
8244
|
+
if (vesting.recipients.length !== vesting.amounts.length) {
|
|
8245
|
+
throw new Error(
|
|
8246
|
+
"Vesting recipients and amounts arrays must have the same length"
|
|
8247
|
+
);
|
|
8248
|
+
}
|
|
8249
|
+
if (vesting.recipients.length === 0) {
|
|
8250
|
+
throw new Error("Vesting recipients array cannot be empty");
|
|
8251
|
+
}
|
|
8252
|
+
const totalVested = vesting.amounts.reduce((sum, amt) => sum + amt, 0n);
|
|
8253
|
+
const availableForVesting = sale.initialSupply - sale.numTokensToSell;
|
|
8254
|
+
if (totalVested > availableForVesting) {
|
|
8255
|
+
throw new Error(
|
|
8256
|
+
`Total vesting amount (${totalVested}) exceeds available tokens (${availableForVesting})`
|
|
8257
|
+
);
|
|
8258
|
+
}
|
|
8259
|
+
} else {
|
|
8260
|
+
const vestedAmount = sale.initialSupply - sale.numTokensToSell;
|
|
8261
|
+
if (vestedAmount <= 0n) {
|
|
8262
|
+
throw new Error("No tokens available for vesting");
|
|
8263
|
+
}
|
|
8264
|
+
}
|
|
8265
|
+
if (hasCustomSchedules) {
|
|
8266
|
+
const schedules = vesting.schedules;
|
|
8267
|
+
if (!schedules || schedules.length === 0) {
|
|
8268
|
+
throw new Error(
|
|
8269
|
+
"Vesting schedules are required when using scheduleIds or multiple vesting schedules"
|
|
8270
|
+
);
|
|
8271
|
+
}
|
|
8272
|
+
const recipientCount = vesting.recipients && vesting.amounts ? vesting.recipients.length : 1;
|
|
8273
|
+
if (vesting.scheduleIds) {
|
|
8274
|
+
if (vesting.scheduleIds.length !== recipientCount) {
|
|
8275
|
+
throw new Error(
|
|
8276
|
+
"Vesting scheduleIds array must have the same length as vesting recipients"
|
|
8277
|
+
);
|
|
8278
|
+
}
|
|
8279
|
+
for (const [index, scheduleId] of vesting.scheduleIds.entries()) {
|
|
8280
|
+
this.validateUint64LikeNumber(
|
|
8281
|
+
scheduleId,
|
|
8282
|
+
`Vesting scheduleIds[${index}]`
|
|
8283
|
+
);
|
|
8284
|
+
if (scheduleId >= schedules.length) {
|
|
8285
|
+
throw new Error(
|
|
8286
|
+
`Vesting scheduleIds[${index}] references missing schedule ${scheduleId}`
|
|
8287
|
+
);
|
|
8288
|
+
}
|
|
8289
|
+
}
|
|
8290
|
+
} else if (schedules.length !== 1 && schedules.length !== recipientCount) {
|
|
8291
|
+
throw new Error(
|
|
8292
|
+
"Vesting schedules must either contain exactly one shared schedule or one schedule per recipient when scheduleIds are omitted"
|
|
8293
|
+
);
|
|
8294
|
+
}
|
|
8295
|
+
for (const [index, schedule] of schedules.entries()) {
|
|
8296
|
+
const scheduleCliff = schedule.cliffDuration ?? 0;
|
|
8297
|
+
const scheduleDuration = schedule.duration ?? 0;
|
|
8298
|
+
this.validateUint64LikeNumber(
|
|
8299
|
+
scheduleCliff,
|
|
8300
|
+
`Vesting schedules[${index}].cliffDuration`
|
|
8301
|
+
);
|
|
8302
|
+
this.validateUint64LikeNumber(
|
|
8303
|
+
scheduleDuration,
|
|
8304
|
+
`Vesting schedules[${index}].duration`
|
|
8305
|
+
);
|
|
8306
|
+
if (scheduleCliff > scheduleDuration) {
|
|
8307
|
+
throw new Error(
|
|
8308
|
+
`Vesting schedules[${index}].cliffDuration cannot exceed duration`
|
|
8309
|
+
);
|
|
8310
|
+
}
|
|
8311
|
+
if (scheduleCliff > 0 && scheduleDuration > 0 && scheduleDuration < DERC20_V2_MIN_VESTING_DURATION) {
|
|
8312
|
+
throw new Error(
|
|
8313
|
+
`Vesting schedules[${index}].duration must be 0 or at least ${DERC20_V2_MIN_VESTING_DURATION} seconds when using cliffs`
|
|
8314
|
+
);
|
|
8315
|
+
}
|
|
8316
|
+
}
|
|
8317
|
+
return;
|
|
8318
|
+
}
|
|
8319
|
+
if (cliffDuration < 0) {
|
|
8320
|
+
throw new Error("Vesting cliff duration cannot be negative");
|
|
8321
|
+
}
|
|
8322
|
+
if (duration < 0) {
|
|
8323
|
+
throw new Error("Vesting duration cannot be negative");
|
|
8324
|
+
}
|
|
8325
|
+
if (cliffDuration > duration) {
|
|
8326
|
+
throw new Error("Vesting cliff duration cannot exceed vesting duration");
|
|
8327
|
+
}
|
|
8328
|
+
if (cliffDuration > 0 && duration > 0 && duration < DERC20_V2_MIN_VESTING_DURATION) {
|
|
8329
|
+
throw new Error(
|
|
8330
|
+
`Vesting duration must be 0 or at least ${DERC20_V2_MIN_VESTING_DURATION} seconds when using cliffs`
|
|
8331
|
+
);
|
|
8332
|
+
}
|
|
8333
|
+
}
|
|
7878
8334
|
validateStaticAuctionParams(params) {
|
|
7879
8335
|
if (!params.token.name || params.token.name.trim().length === 0) {
|
|
7880
8336
|
throw new Error("Token name is required");
|
|
@@ -7912,33 +8368,7 @@ var DopplerFactory = class {
|
|
|
7912
8368
|
if (params.sale.numTokensToSell > params.sale.initialSupply) {
|
|
7913
8369
|
throw new Error("Cannot sell more tokens than initial supply");
|
|
7914
8370
|
}
|
|
7915
|
-
|
|
7916
|
-
if (params.vesting.recipients && params.vesting.amounts) {
|
|
7917
|
-
if (params.vesting.recipients.length !== params.vesting.amounts.length) {
|
|
7918
|
-
throw new Error(
|
|
7919
|
-
"Vesting recipients and amounts arrays must have the same length"
|
|
7920
|
-
);
|
|
7921
|
-
}
|
|
7922
|
-
if (params.vesting.recipients.length === 0) {
|
|
7923
|
-
throw new Error("Vesting recipients array cannot be empty");
|
|
7924
|
-
}
|
|
7925
|
-
const totalVested = params.vesting.amounts.reduce(
|
|
7926
|
-
(sum, amt) => sum + amt,
|
|
7927
|
-
BigInt(0)
|
|
7928
|
-
);
|
|
7929
|
-
const availableForVesting = params.sale.initialSupply - params.sale.numTokensToSell;
|
|
7930
|
-
if (totalVested > availableForVesting) {
|
|
7931
|
-
throw new Error(
|
|
7932
|
-
`Total vesting amount (${totalVested}) exceeds available tokens (${availableForVesting})`
|
|
7933
|
-
);
|
|
7934
|
-
}
|
|
7935
|
-
} else {
|
|
7936
|
-
const vestedAmount = params.sale.initialSupply - params.sale.numTokensToSell;
|
|
7937
|
-
if (vestedAmount <= BigInt(0)) {
|
|
7938
|
-
throw new Error("No tokens available for vesting");
|
|
7939
|
-
}
|
|
7940
|
-
}
|
|
7941
|
-
}
|
|
8371
|
+
this.validateVestingConfig(params.sale, params.vesting);
|
|
7942
8372
|
if (params.migration.type === "dopplerHook") {
|
|
7943
8373
|
throw new Error(
|
|
7944
8374
|
"dopplerHook migration is only supported for dynamic auctions"
|
|
@@ -8003,6 +8433,7 @@ var DopplerFactory = class {
|
|
|
8003
8433
|
if (params.sale.numTokensToSell > params.sale.initialSupply) {
|
|
8004
8434
|
throw new Error("Cannot sell more tokens than initial supply");
|
|
8005
8435
|
}
|
|
8436
|
+
this.validateVestingConfig(params.sale, params.vesting);
|
|
8006
8437
|
if (params.auction.duration <= 0) {
|
|
8007
8438
|
throw new Error("Auction duration must be positive");
|
|
8008
8439
|
}
|
|
@@ -8231,28 +8662,7 @@ var DopplerFactory = class {
|
|
|
8231
8662
|
throw new Error("Cannot sell more tokens than initial supply");
|
|
8232
8663
|
}
|
|
8233
8664
|
this.resolveMulticurveInitializerMode(params);
|
|
8234
|
-
|
|
8235
|
-
if (params.vesting.recipients && params.vesting.amounts) {
|
|
8236
|
-
if (params.vesting.recipients.length !== params.vesting.amounts.length) {
|
|
8237
|
-
throw new Error(
|
|
8238
|
-
"Vesting recipients and amounts arrays must have the same length"
|
|
8239
|
-
);
|
|
8240
|
-
}
|
|
8241
|
-
if (params.vesting.recipients.length === 0) {
|
|
8242
|
-
throw new Error("Vesting recipients array cannot be empty");
|
|
8243
|
-
}
|
|
8244
|
-
const totalVested = params.vesting.amounts.reduce(
|
|
8245
|
-
(sum, amt) => sum + amt,
|
|
8246
|
-
BigInt(0)
|
|
8247
|
-
);
|
|
8248
|
-
const availableForVesting = params.sale.initialSupply - params.sale.numTokensToSell;
|
|
8249
|
-
if (totalVested > availableForVesting) {
|
|
8250
|
-
throw new Error(
|
|
8251
|
-
`Total vesting amount (${totalVested}) exceeds available tokens (${availableForVesting})`
|
|
8252
|
-
);
|
|
8253
|
-
}
|
|
8254
|
-
}
|
|
8255
|
-
}
|
|
8665
|
+
this.validateVestingConfig(params.sale, params.vesting);
|
|
8256
8666
|
if (params.pool.beneficiaries && params.pool.beneficiaries.length > 0) {
|
|
8257
8667
|
const beneficiaries = params.pool.beneficiaries;
|
|
8258
8668
|
const totalShares = beneficiaries.reduce((sum, b) => sum + b.shares, 0n);
|
|
@@ -8652,37 +9062,9 @@ var DopplerFactory = class {
|
|
|
8652
9062
|
],
|
|
8653
9063
|
[t.name, t.symbol, t.baseURI, t.unit ?? 1000n]
|
|
8654
9064
|
);
|
|
8655
|
-
})() : (
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
symbol,
|
|
8659
|
-
yearlyMintRate,
|
|
8660
|
-
vestingDuration,
|
|
8661
|
-
recipients,
|
|
8662
|
-
amounts,
|
|
8663
|
-
tokenURI
|
|
8664
|
-
} = params.tokenFactoryData;
|
|
8665
|
-
return encodeAbiParameters(
|
|
8666
|
-
[
|
|
8667
|
-
{ type: "string" },
|
|
8668
|
-
{ type: "string" },
|
|
8669
|
-
{ type: "uint256" },
|
|
8670
|
-
{ type: "uint256" },
|
|
8671
|
-
{ type: "address[]" },
|
|
8672
|
-
{ type: "uint256[]" },
|
|
8673
|
-
{ type: "string" }
|
|
8674
|
-
],
|
|
8675
|
-
[
|
|
8676
|
-
name,
|
|
8677
|
-
symbol,
|
|
8678
|
-
yearlyMintRate,
|
|
8679
|
-
vestingDuration,
|
|
8680
|
-
recipients,
|
|
8681
|
-
amounts,
|
|
8682
|
-
tokenURI
|
|
8683
|
-
]
|
|
8684
|
-
);
|
|
8685
|
-
})();
|
|
9065
|
+
})() : this.encodeStandardTokenFactoryData(
|
|
9066
|
+
params.tokenFactoryData
|
|
9067
|
+
);
|
|
8686
9068
|
let tokenInitHash;
|
|
8687
9069
|
if (params.tokenVariant === "doppler404") {
|
|
8688
9070
|
const { name, symbol, baseURI } = params.tokenFactoryData;
|
|
@@ -8705,47 +9087,45 @@ var DopplerFactory = class {
|
|
|
8705
9087
|
)
|
|
8706
9088
|
);
|
|
8707
9089
|
} else {
|
|
8708
|
-
const
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
encodePacked(["bytes", "bytes"], [bytecode, initHashData])
|
|
8748
|
-
);
|
|
9090
|
+
const standardTokenFactoryData = params.tokenFactoryData;
|
|
9091
|
+
if (standardTokenFactoryData.kind === "v2") {
|
|
9092
|
+
tokenInitHash = this.computeStandardTokenInitHash(
|
|
9093
|
+
standardTokenFactoryData,
|
|
9094
|
+
params.tokenFactory
|
|
9095
|
+
);
|
|
9096
|
+
} else {
|
|
9097
|
+
const initHashData = encodeAbiParameters(
|
|
9098
|
+
[
|
|
9099
|
+
{ type: "string" },
|
|
9100
|
+
{ type: "string" },
|
|
9101
|
+
{ type: "uint256" },
|
|
9102
|
+
{ type: "address" },
|
|
9103
|
+
{ type: "address" },
|
|
9104
|
+
{ type: "uint256" },
|
|
9105
|
+
{ type: "uint256" },
|
|
9106
|
+
{ type: "address[]" },
|
|
9107
|
+
{ type: "uint256[]" },
|
|
9108
|
+
{ type: "string" }
|
|
9109
|
+
],
|
|
9110
|
+
[
|
|
9111
|
+
standardTokenFactoryData.name,
|
|
9112
|
+
standardTokenFactoryData.symbol,
|
|
9113
|
+
standardTokenFactoryData.initialSupply,
|
|
9114
|
+
standardTokenFactoryData.airlock,
|
|
9115
|
+
standardTokenFactoryData.airlock,
|
|
9116
|
+
standardTokenFactoryData.yearlyMintRate,
|
|
9117
|
+
standardTokenFactoryData.vestingDuration,
|
|
9118
|
+
standardTokenFactoryData.recipients,
|
|
9119
|
+
standardTokenFactoryData.amounts,
|
|
9120
|
+
standardTokenFactoryData.tokenURI
|
|
9121
|
+
]
|
|
9122
|
+
);
|
|
9123
|
+
const isTokenFactory802 = params.tokenFactory.toLowerCase() === TOKEN_FACTORY_80_ADDRESS2;
|
|
9124
|
+
const bytecode = isTokenFactory802 ? derc2080_default : params.customDerc20Bytecode ?? derc20_default;
|
|
9125
|
+
tokenInitHash = keccak256(
|
|
9126
|
+
encodePacked(["bytes", "bytes"], [bytecode, initHashData])
|
|
9127
|
+
);
|
|
9128
|
+
}
|
|
8749
9129
|
}
|
|
8750
9130
|
const flags = BigInt(
|
|
8751
9131
|
1 << 13 | // BEFORE_INITIALIZE_FLAG
|
|
@@ -13026,6 +13406,108 @@ var Derc20 = class _Derc20 {
|
|
|
13026
13406
|
);
|
|
13027
13407
|
}
|
|
13028
13408
|
};
|
|
13409
|
+
|
|
13410
|
+
// src/evm/entities/token/derc20/Derc20V2.ts
|
|
13411
|
+
var Derc20V2 = class extends Derc20 {
|
|
13412
|
+
async getVestingScheduleCount() {
|
|
13413
|
+
return await this.rpc.readContract({
|
|
13414
|
+
address: this.address,
|
|
13415
|
+
abi: derc20V2Abi,
|
|
13416
|
+
functionName: "vestingScheduleCount"
|
|
13417
|
+
});
|
|
13418
|
+
}
|
|
13419
|
+
async getVestingSchedule(scheduleId) {
|
|
13420
|
+
const result = await this.rpc.readContract({
|
|
13421
|
+
address: this.address,
|
|
13422
|
+
abi: derc20V2Abi,
|
|
13423
|
+
functionName: "vestingSchedules",
|
|
13424
|
+
args: [scheduleId]
|
|
13425
|
+
});
|
|
13426
|
+
return {
|
|
13427
|
+
cliffDuration: BigInt(result[0]),
|
|
13428
|
+
duration: BigInt(result[1])
|
|
13429
|
+
};
|
|
13430
|
+
}
|
|
13431
|
+
async getScheduleIdsOf(beneficiary) {
|
|
13432
|
+
const result = await this.rpc.readContract({
|
|
13433
|
+
address: this.address,
|
|
13434
|
+
abi: derc20V2Abi,
|
|
13435
|
+
functionName: "getScheduleIdsOf",
|
|
13436
|
+
args: [beneficiary]
|
|
13437
|
+
});
|
|
13438
|
+
return Array.from(result);
|
|
13439
|
+
}
|
|
13440
|
+
async getTotalAllocatedOf(beneficiary) {
|
|
13441
|
+
return await this.rpc.readContract({
|
|
13442
|
+
address: this.address,
|
|
13443
|
+
abi: derc20V2Abi,
|
|
13444
|
+
functionName: "totalAllocatedOf",
|
|
13445
|
+
args: [beneficiary]
|
|
13446
|
+
});
|
|
13447
|
+
}
|
|
13448
|
+
async getAvailableVestedAmountForSchedule(beneficiary, scheduleId) {
|
|
13449
|
+
return await this.rpc.readContract({
|
|
13450
|
+
address: this.address,
|
|
13451
|
+
abi: derc20V2Abi,
|
|
13452
|
+
functionName: "computeAvailableVestedAmount",
|
|
13453
|
+
args: [beneficiary, scheduleId]
|
|
13454
|
+
});
|
|
13455
|
+
}
|
|
13456
|
+
async getVestingDataForSchedule(beneficiary, scheduleId) {
|
|
13457
|
+
const result = await this.rpc.readContract({
|
|
13458
|
+
address: this.address,
|
|
13459
|
+
abi: derc20V2Abi,
|
|
13460
|
+
functionName: "vestingOf",
|
|
13461
|
+
args: [beneficiary, scheduleId]
|
|
13462
|
+
});
|
|
13463
|
+
return {
|
|
13464
|
+
totalAmount: result[0],
|
|
13465
|
+
releasedAmount: result[1]
|
|
13466
|
+
};
|
|
13467
|
+
}
|
|
13468
|
+
async releaseSchedule(scheduleId, options) {
|
|
13469
|
+
if (!this.walletClient) {
|
|
13470
|
+
throw new Error("Wallet client required for write operations");
|
|
13471
|
+
}
|
|
13472
|
+
const { request } = await this.rpc.simulateContract({
|
|
13473
|
+
address: this.address,
|
|
13474
|
+
abi: derc20V2Abi,
|
|
13475
|
+
functionName: "release",
|
|
13476
|
+
args: [scheduleId],
|
|
13477
|
+
account: this.walletClient.account
|
|
13478
|
+
});
|
|
13479
|
+
return await this.walletClient.writeContract(
|
|
13480
|
+
options?.gas ? { ...request, gas: options.gas } : request
|
|
13481
|
+
);
|
|
13482
|
+
}
|
|
13483
|
+
async releaseFor(beneficiary, scheduleId, options) {
|
|
13484
|
+
if (!this.walletClient) {
|
|
13485
|
+
throw new Error("Wallet client required for write operations");
|
|
13486
|
+
}
|
|
13487
|
+
if (scheduleId === void 0) {
|
|
13488
|
+
const { request: request2 } = await this.rpc.simulateContract({
|
|
13489
|
+
address: this.address,
|
|
13490
|
+
abi: derc20V2Abi,
|
|
13491
|
+
functionName: "releaseFor",
|
|
13492
|
+
args: [beneficiary],
|
|
13493
|
+
account: this.walletClient.account
|
|
13494
|
+
});
|
|
13495
|
+
return await this.walletClient.writeContract(
|
|
13496
|
+
options?.gas ? { ...request2, gas: options.gas } : request2
|
|
13497
|
+
);
|
|
13498
|
+
}
|
|
13499
|
+
const { request } = await this.rpc.simulateContract({
|
|
13500
|
+
address: this.address,
|
|
13501
|
+
abi: derc20V2Abi,
|
|
13502
|
+
functionName: "releaseFor",
|
|
13503
|
+
args: [beneficiary, scheduleId],
|
|
13504
|
+
account: this.walletClient.account
|
|
13505
|
+
});
|
|
13506
|
+
return await this.walletClient.writeContract(
|
|
13507
|
+
options?.gas ? { ...request, gas: options.gas } : request
|
|
13508
|
+
);
|
|
13509
|
+
}
|
|
13510
|
+
};
|
|
13029
13511
|
var Eth = class {
|
|
13030
13512
|
publicClient;
|
|
13031
13513
|
get rpc() {
|
|
@@ -13081,6 +13563,35 @@ var Eth = class {
|
|
|
13081
13563
|
};
|
|
13082
13564
|
|
|
13083
13565
|
// src/evm/builders/shared.ts
|
|
13566
|
+
var MAX_SAFE_INTEGER_BIGINT = BigInt(Number.MAX_SAFE_INTEGER);
|
|
13567
|
+
function normalizeBuilderVestingScheduleDuration(value, fieldPath) {
|
|
13568
|
+
const duration = value ?? 0n;
|
|
13569
|
+
if (duration < 0n) {
|
|
13570
|
+
throw new RangeError(`${fieldPath} cannot be negative`);
|
|
13571
|
+
}
|
|
13572
|
+
if (duration > MAX_SAFE_INTEGER_BIGINT) {
|
|
13573
|
+
throw new RangeError(`${fieldPath} must be a safe integer`);
|
|
13574
|
+
}
|
|
13575
|
+
return Number(duration);
|
|
13576
|
+
}
|
|
13577
|
+
function normalizeBuilderScheduleId(scheduleId, fieldPath) {
|
|
13578
|
+
if (typeof scheduleId === "bigint") {
|
|
13579
|
+
if (scheduleId < 0n) {
|
|
13580
|
+
throw new RangeError(`${fieldPath} cannot be negative`);
|
|
13581
|
+
}
|
|
13582
|
+
if (scheduleId > MAX_SAFE_INTEGER_BIGINT) {
|
|
13583
|
+
throw new RangeError(`${fieldPath} must be a safe integer`);
|
|
13584
|
+
}
|
|
13585
|
+
return Number(scheduleId);
|
|
13586
|
+
}
|
|
13587
|
+
if (!Number.isSafeInteger(scheduleId)) {
|
|
13588
|
+
throw new RangeError(`${fieldPath} must be a safe integer`);
|
|
13589
|
+
}
|
|
13590
|
+
if (scheduleId < 0) {
|
|
13591
|
+
throw new RangeError(`${fieldPath} cannot be negative`);
|
|
13592
|
+
}
|
|
13593
|
+
return scheduleId;
|
|
13594
|
+
}
|
|
13084
13595
|
function computeTicks(priceRange, tickSpacing) {
|
|
13085
13596
|
const startTick = Math.floor(
|
|
13086
13597
|
Math.log(priceRange.startPrice) / Math.log(1.0001) / tickSpacing
|
|
@@ -13376,11 +13887,24 @@ var StaticAuctionBuilder = class _StaticAuctionBuilder {
|
|
|
13376
13887
|
this.vesting = void 0;
|
|
13377
13888
|
return this;
|
|
13378
13889
|
}
|
|
13890
|
+
const hasCustomSchedules = (params.schedules?.length ?? 0) > 0 || (params.scheduleIds?.length ?? 0) > 0;
|
|
13379
13891
|
this.vesting = {
|
|
13380
|
-
duration: Number(
|
|
13892
|
+
duration: Number(
|
|
13893
|
+
params.duration ?? (hasCustomSchedules ? 0n : DEFAULT_V3_VESTING_DURATION)
|
|
13894
|
+
),
|
|
13381
13895
|
cliffDuration: params.cliffDuration ?? 0,
|
|
13382
13896
|
recipients: params.recipients,
|
|
13383
|
-
amounts: params.amounts
|
|
13897
|
+
amounts: params.amounts,
|
|
13898
|
+
schedules: params.schedules?.map((schedule) => ({
|
|
13899
|
+
duration: normalizeBuilderVestingScheduleDuration(
|
|
13900
|
+
schedule.duration,
|
|
13901
|
+
"Vesting schedule duration"
|
|
13902
|
+
),
|
|
13903
|
+
cliffDuration: schedule.cliffDuration ?? 0
|
|
13904
|
+
})),
|
|
13905
|
+
scheduleIds: params.scheduleIds?.map(
|
|
13906
|
+
(scheduleId, index) => normalizeBuilderScheduleId(scheduleId, `Vesting scheduleIds[${index}]`)
|
|
13907
|
+
)
|
|
13384
13908
|
};
|
|
13385
13909
|
return this;
|
|
13386
13910
|
}
|
|
@@ -13712,7 +14236,17 @@ var DynamicAuctionBuilder = class _DynamicAuctionBuilder {
|
|
|
13712
14236
|
duration: Number(params.duration ?? 0n),
|
|
13713
14237
|
cliffDuration: params.cliffDuration ?? 0,
|
|
13714
14238
|
recipients: params.recipients,
|
|
13715
|
-
amounts: params.amounts
|
|
14239
|
+
amounts: params.amounts,
|
|
14240
|
+
schedules: params.schedules?.map((schedule) => ({
|
|
14241
|
+
duration: normalizeBuilderVestingScheduleDuration(
|
|
14242
|
+
schedule.duration,
|
|
14243
|
+
"Vesting schedule duration"
|
|
14244
|
+
),
|
|
14245
|
+
cliffDuration: schedule.cliffDuration ?? 0
|
|
14246
|
+
})),
|
|
14247
|
+
scheduleIds: params.scheduleIds?.map(
|
|
14248
|
+
(scheduleId, index) => normalizeBuilderScheduleId(scheduleId, `Vesting scheduleIds[${index}]`)
|
|
14249
|
+
)
|
|
13716
14250
|
};
|
|
13717
14251
|
return this;
|
|
13718
14252
|
}
|
|
@@ -14318,7 +14852,17 @@ var MulticurveBuilder = class _MulticurveBuilder {
|
|
|
14318
14852
|
duration: Number(params.duration ?? 0n),
|
|
14319
14853
|
cliffDuration: params.cliffDuration ?? 0,
|
|
14320
14854
|
recipients: params.recipients,
|
|
14321
|
-
amounts: params.amounts
|
|
14855
|
+
amounts: params.amounts,
|
|
14856
|
+
schedules: params.schedules?.map((schedule) => ({
|
|
14857
|
+
duration: normalizeBuilderVestingScheduleDuration(
|
|
14858
|
+
schedule.duration,
|
|
14859
|
+
"Vesting schedule duration"
|
|
14860
|
+
),
|
|
14861
|
+
cliffDuration: schedule.cliffDuration ?? 0
|
|
14862
|
+
})),
|
|
14863
|
+
scheduleIds: params.scheduleIds?.map(
|
|
14864
|
+
(scheduleId, index) => normalizeBuilderScheduleId(scheduleId, `Vesting scheduleIds[${index}]`)
|
|
14865
|
+
)
|
|
14322
14866
|
};
|
|
14323
14867
|
return this;
|
|
14324
14868
|
}
|
|
@@ -14707,7 +15251,17 @@ var OpeningAuctionBuilder = class _OpeningAuctionBuilder {
|
|
|
14707
15251
|
duration: Number(params.duration ?? 0n),
|
|
14708
15252
|
cliffDuration: params.cliffDuration ?? 0,
|
|
14709
15253
|
recipients: params.recipients,
|
|
14710
|
-
amounts: params.amounts
|
|
15254
|
+
amounts: params.amounts,
|
|
15255
|
+
schedules: params.schedules?.map((schedule) => ({
|
|
15256
|
+
duration: normalizeBuilderVestingScheduleDuration(
|
|
15257
|
+
schedule.duration,
|
|
15258
|
+
"Vesting schedule duration"
|
|
15259
|
+
),
|
|
15260
|
+
cliffDuration: schedule.cliffDuration ?? 0
|
|
15261
|
+
})),
|
|
15262
|
+
scheduleIds: params.scheduleIds?.map(
|
|
15263
|
+
(scheduleId, index) => normalizeBuilderScheduleId(scheduleId, `Vesting scheduleIds[${index}]`)
|
|
15264
|
+
)
|
|
14711
15265
|
};
|
|
14712
15266
|
return this;
|
|
14713
15267
|
}
|
|
@@ -15153,6 +15707,13 @@ var DopplerSDK = class {
|
|
|
15153
15707
|
getDerc20(tokenAddress) {
|
|
15154
15708
|
return new Derc20(this.publicClient, this.walletClient, tokenAddress);
|
|
15155
15709
|
}
|
|
15710
|
+
/**
|
|
15711
|
+
* Get a DERC20 V2 token instance for interacting with cliffed / multi-schedule vesting tokens
|
|
15712
|
+
* @param tokenAddress The address of the DERC20 V2 token
|
|
15713
|
+
*/
|
|
15714
|
+
getDerc20V2(tokenAddress) {
|
|
15715
|
+
return new Derc20V2(this.publicClient, this.walletClient, tokenAddress);
|
|
15716
|
+
}
|
|
15156
15717
|
/**
|
|
15157
15718
|
* Get information about a static auction pool
|
|
15158
15719
|
* @param poolAddress The address of the pool
|
|
@@ -15225,6 +15786,6 @@ var DopplerSDK = class {
|
|
|
15225
15786
|
// src/evm/index.ts
|
|
15226
15787
|
var VERSION = "1.0.0";
|
|
15227
15788
|
|
|
15228
|
-
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, doppler_default as DopplerBytecode, dopplerDN404_default as DopplerDN404Bytecode, 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, 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, RehypeDopplerHookMigrator, RehypeFeeRoutingMode, SECONDS_PER_DAY, SECONDS_PER_YEAR, SUPPORTED_CHAIN_IDS, stateView_default as StateViewBytecode, StaticAuction, StaticAuctionBuilder, TICK_SPACINGS, V3_FEE_TIERS, V4_MAX_FEE, VALID_FEE_TIERS, VERSION, WAD, ZERO_ADDRESS2 as ZERO_ADDRESS, airlockAbi, applyTickOffsets, bundlerAbi, calculateFDV, calculateGamma, calculateMarketCap, calculateTickRange, calculateTokensToSell, computeOptimalGamma, computePoolId, createAirlockBeneficiary, decayMulticurveInitializerHookAbi, decodeBalanceDelta, derc20Abi, dopplerHookAbi, dopplerHookInitializerAbi, dopplerLensAbi, encodeRehypeDopplerHookMigratorCalldata, estimatePriceAtEpoch, estimateSlippage, formatTickAsPrice, getAddresses, getAirlockBeneficiary, getAirlockOwner, getAmount0ForLiquidity, getAmount1ForLiquidity, getLiquidityForAmount0, getLiquidityForAmount1, getMaxTickRounded, getNearestUsableTick, getSqrtRatioAtTick, getTickAtSqrtRatio, isLaunchpadEnabledChain, isNoOpEnabledChain, isSupportedChainId, isToken0Expected, isToken1, lockableUniswapV3InitializerAbi, marketCapToTickForMulticurve, marketCapToTicksForDynamicAuction, marketCapToTicksForMulticurve, marketCapToTicksForStaticAuction, marketCapToTokenPrice, mineTokenAddress, normalizePoolKey, openingAuctionAbi, openingAuctionInitializerAbi, openingAuctionPositionManagerAbi, poolManagerAbi, priceToSqrtPriceX96, priceToTick, quoterV2Abi, ratioToTick, rehypeDopplerHookAbi, rehypeDopplerHookMigratorAbi, resolveGasEstimate, sqrtPriceX96ToPrice, streamableFeesLockerAbi, tickToMarketCap, tickToPrice, tokenPriceToRatio, uniswapV2Router02Abi, uniswapV3InitializerAbi, uniswapV3PoolAbi, uniswapV4InitializerAbi, v2MigratorAbi, v3MigratorAbi, v4MigratorAbi, v4MulticurveInitializerAbi, v4MulticurveMigratorAbi, v4QuoterAbi, validateMarketCapParameters, weth9Abi };
|
|
15789
|
+
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_default as DopplerDN404Bytecode, 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, 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, RehypeDopplerHookMigrator, RehypeFeeRoutingMode, SECONDS_PER_DAY, SECONDS_PER_YEAR, SUPPORTED_CHAIN_IDS, stateView_default as StateViewBytecode, StaticAuction, StaticAuctionBuilder, TICK_SPACINGS, V3_FEE_TIERS, V4_MAX_FEE, VALID_FEE_TIERS, VERSION, WAD, ZERO_ADDRESS2 as ZERO_ADDRESS, airlockAbi, applyTickOffsets, bundlerAbi, calculateFDV, calculateGamma, calculateMarketCap, calculateTickRange, calculateTokensToSell, computeOptimalGamma, computePoolId, createAirlockBeneficiary, decayMulticurveInitializerHookAbi, decodeBalanceDelta, derc20Abi, derc20V2Abi, dopplerHookAbi, dopplerHookInitializerAbi, dopplerLensAbi, encodeRehypeDopplerHookMigratorCalldata, estimatePriceAtEpoch, estimateSlippage, formatTickAsPrice, getAddresses, getAirlockBeneficiary, getAirlockOwner, getAmount0ForLiquidity, getAmount1ForLiquidity, getLiquidityForAmount0, getLiquidityForAmount1, getMaxTickRounded, getNearestUsableTick, getSqrtRatioAtTick, getTickAtSqrtRatio, isLaunchpadEnabledChain, isNoOpEnabledChain, isSupportedChainId, isToken0Expected, isToken1, lockableUniswapV3InitializerAbi, marketCapToTickForMulticurve, marketCapToTicksForDynamicAuction, marketCapToTicksForMulticurve, marketCapToTicksForStaticAuction, marketCapToTokenPrice, mineTokenAddress, normalizePoolKey, openingAuctionAbi, openingAuctionInitializerAbi, openingAuctionPositionManagerAbi, poolManagerAbi, priceToSqrtPriceX96, priceToTick, quoterV2Abi, ratioToTick, rehypeDopplerHookAbi, rehypeDopplerHookMigratorAbi, resolveGasEstimate, sqrtPriceX96ToPrice, streamableFeesLockerAbi, tickToMarketCap, tickToPrice, tokenPriceToRatio, uniswapV2Router02Abi, uniswapV3InitializerAbi, uniswapV3PoolAbi, uniswapV4InitializerAbi, v2MigratorAbi, v3MigratorAbi, v4MigratorAbi, v4MulticurveInitializerAbi, v4MulticurveMigratorAbi, v4QuoterAbi, validateMarketCapParameters, weth9Abi };
|
|
15229
15790
|
//# sourceMappingURL=index.js.map
|
|
15230
15791
|
//# sourceMappingURL=index.js.map
|