@whetstone-research/doppler-sdk 1.0.6 → 1.0.8
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 +14 -8
- package/dist/evm/index.cjs +144 -177
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +42 -61
- package/dist/evm/index.d.ts +42 -61
- package/dist/evm/index.js +144 -177
- package/dist/evm/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,13 +88,19 @@ const params = new StaticAuctionBuilder()
|
|
|
88
88
|
// Optional: specify multiple recipients and amounts
|
|
89
89
|
// recipients: ['0xTeam...', '0xAdvisor...'],
|
|
90
90
|
// amounts: [parseEther('50000000'), parseEther('50000000')]
|
|
91
|
-
// Optional: define per-beneficiary
|
|
92
|
-
//
|
|
93
|
-
// {
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
91
|
+
// Optional: define per-beneficiary vesting allocations on the DERC20 V2 path
|
|
92
|
+
// allocations: [
|
|
93
|
+
// {
|
|
94
|
+
// recipient: '0xTeam...',
|
|
95
|
+
// amount: parseEther('50000000'),
|
|
96
|
+
// schedule: { duration: BigInt(180 * 24 * 60 * 60), cliffDuration: 30 * 24 * 60 * 60 },
|
|
97
|
+
// },
|
|
98
|
+
// {
|
|
99
|
+
// recipient: '0xAdvisor...',
|
|
100
|
+
// amount: parseEther('50000000'),
|
|
101
|
+
// schedule: { duration: BigInt(365 * 24 * 60 * 60), cliffDuration: 90 * 24 * 60 * 60 },
|
|
102
|
+
// },
|
|
103
|
+
// ]
|
|
98
104
|
})
|
|
99
105
|
.withMigration({ type: 'uniswapV2' })
|
|
100
106
|
.withUserAddress('0x...')
|
|
@@ -105,7 +111,7 @@ console.log('Pool address:', result.poolAddress);
|
|
|
105
111
|
console.log('Token address:', result.tokenAddress);
|
|
106
112
|
```
|
|
107
113
|
|
|
108
|
-
If you set `cliffDuration > 0` or provide `
|
|
114
|
+
If you set `cliffDuration > 0` or provide `allocations`, the SDK automatically uses the DERC20 V2 factory and exposes schedule-aware token reads via `sdk.getDerc20V2(tokenAddress)`. When `allocations` is provided, the SDK dedupes identical schedules internally and maps each recipient to the correct on-chain schedule.
|
|
109
115
|
|
|
110
116
|
For a runnable example, see [examples/multicurve-per-beneficiary-vesting.ts](./examples/multicurve-per-beneficiary-vesting.ts).
|
|
111
117
|
|
package/dist/evm/index.cjs
CHANGED
|
@@ -19,10 +19,10 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
19
19
|
GovernanceFactory: "0x9F309D79BEe3E8b2f56FaCF74b7195Df176c8F61",
|
|
20
20
|
NoOpGovernanceFactory: "0xddAE8B3eD08184682f7Bc32B74d943cEEfEab638",
|
|
21
21
|
NoOpMigrator: "0x233A71A7bB928b1357A1Ebf454298320989Ca5B5",
|
|
22
|
-
Quoter: "
|
|
22
|
+
Quoter: "0xFD44B773B21AC485C95Db1Ff38554b7699f8C042",
|
|
23
23
|
RehypeDopplerHook: "0x3Ec4798A9B11e8243A8Db99687f7A23597B96623",
|
|
24
|
-
RehypeDopplerHookInitializer: "
|
|
25
|
-
RehypeDopplerHookMigrator: "
|
|
24
|
+
RehypeDopplerHookInitializer: "0xBF4195ab0B03e1eB3345dd1e83BeD7650b1ed123",
|
|
25
|
+
RehypeDopplerHookMigrator: "0xea95DfdF69B90c65C827070852F7039D6aF6Dd7b",
|
|
26
26
|
StreamableFeesLocker: "0xe24FC2F7191e850e2D4514aBb4d39305b1871eC6",
|
|
27
27
|
StreamableFeesLockerV2: "0xcE3212e6536F33cD6fbFEE265224131353Ca3D47",
|
|
28
28
|
TimelockFactory: "0x9fd40af2baAfAF03513f091444e821c0d5b06ea0",
|
|
@@ -138,12 +138,12 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
138
138
|
GovernanceFactory: "0xa82c66b6ddEb92089015C3565E05B5c9750b2d4B",
|
|
139
139
|
LaunchpadGovernanceFactory: "0x40Bcb4dDA3BcF7dba30C5d10c31EE2791ed9ddCa",
|
|
140
140
|
LockableUniswapV3Initializer: "0xE0dC4012AC9C868F09c6e4b20d66ED46D6F258d0",
|
|
141
|
-
NoOpGovernanceFactory: "
|
|
141
|
+
NoOpGovernanceFactory: "0xe7dfbd5b0A2C3B4464653A9beCdc489229eF090E",
|
|
142
142
|
NoOpMigrator: "0x6ddfED58D238Ca3195E49d8ac3d4cEa6386E5C33",
|
|
143
|
-
Quoter: "
|
|
143
|
+
Quoter: "0xFD44B773B21AC485C95Db1Ff38554b7699f8C042",
|
|
144
144
|
RehypeDopplerHook: "0x3Ec4798A9B11e8243A8Db99687f7A23597B96623",
|
|
145
|
-
RehypeDopplerHookInitializer: "
|
|
146
|
-
RehypeDopplerHookMigrator: "
|
|
145
|
+
RehypeDopplerHookInitializer: "0xBF4195ab0B03e1eB3345dd1e83BeD7650b1ed123",
|
|
146
|
+
RehypeDopplerHookMigrator: "0xea95DfdF69B90c65C827070852F7039D6aF6Dd7b",
|
|
147
147
|
StreamableFeesLocker: "0x0A00775D71a42cd33D62780003035e7F5b47bD3A",
|
|
148
148
|
StreamableFeesLockerV2: "0xcE3212e6536F33cD6fbFEE265224131353Ca3D47",
|
|
149
149
|
TokenFactory: "0x4225C632b62622Bd7B0A3eC9745C0a866Ff94F6F",
|
|
@@ -212,14 +212,15 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
212
212
|
DopplerHookMigrator: "0x1E40b0875DDa35f41E15cFB475403859B8c860c4",
|
|
213
213
|
DopplerLensQuoter: "0x4a8d81Db741248a36D9eb3bc6eF648Bf798B47a7",
|
|
214
214
|
GovernanceFactory: "0x9dBFaaDC8c0cB2c34bA698DD9426555336992e20",
|
|
215
|
+
LaunchpadGovernanceFactory: "0x0902e7C7207df8ed6303Aef4382bcab181b5fBFA",
|
|
215
216
|
LockableUniswapV3Initializer: "0x16AdA5Be50C3c2D94Af5fEae6b539C40A78Ad53c",
|
|
216
217
|
MulticurveLibrary: "0x32238a39ba5aF060EFbfAda59979B639E0945fE0",
|
|
217
218
|
NoOpGovernanceFactory: "0x7bD798fafC99A3b17E261F8308A8C11B56935ea1",
|
|
218
219
|
NoOpMigrator: "0xF11066abbd329ac4bBA39455340539322C222eb0",
|
|
219
|
-
Quoter: "
|
|
220
|
+
Quoter: "0xFD44B773B21AC485C95Db1Ff38554b7699f8C042",
|
|
220
221
|
RehypeDopplerHook: "0x3Ec4798A9B11e8243A8Db99687f7A23597B96623",
|
|
221
|
-
RehypeDopplerHookInitializer: "
|
|
222
|
-
RehypeDopplerHookMigrator: "
|
|
222
|
+
RehypeDopplerHookInitializer: "0xBF4195ab0B03e1eB3345dd1e83BeD7650b1ed123",
|
|
223
|
+
RehypeDopplerHookMigrator: "0xea95DfdF69B90c65C827070852F7039D6aF6Dd7b",
|
|
223
224
|
StreamableFeesLocker: "0x3345E557c5C0b474bE1eb4693264008B8562Aa9c",
|
|
224
225
|
TeamGovernanceFactory: "0x8aF3001ED75F86f4Dd910577ECa9C5dB7CEa765c",
|
|
225
226
|
TokenFactory: "0x9D8fd79B2a59c5d91ccBd79c3AEb4de56451Bb02",
|
|
@@ -257,10 +258,10 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
257
258
|
GovernanceFactory: "0x9F309D79BEe3E8b2f56FaCF74b7195Df176c8F61",
|
|
258
259
|
NoOpGovernanceFactory: "0xddAE8B3eD08184682f7Bc32B74d943cEEfEab638",
|
|
259
260
|
NoOpMigrator: "0x233A71A7bB928b1357A1Ebf454298320989Ca5B5",
|
|
260
|
-
Quoter: "
|
|
261
|
+
Quoter: "0xFD44B773B21AC485C95Db1Ff38554b7699f8C042",
|
|
261
262
|
RehypeDopplerHook: "0x3Ec4798A9B11e8243A8Db99687f7A23597B96623",
|
|
262
|
-
RehypeDopplerHookInitializer: "
|
|
263
|
-
RehypeDopplerHookMigrator: "
|
|
263
|
+
RehypeDopplerHookInitializer: "0xBF4195ab0B03e1eB3345dd1e83BeD7650b1ed123",
|
|
264
|
+
RehypeDopplerHookMigrator: "0xea95DfdF69B90c65C827070852F7039D6aF6Dd7b",
|
|
264
265
|
StreamableFeesLocker: "0xe24FC2F7191e850e2D4514aBb4d39305b1871eC6",
|
|
265
266
|
StreamableFeesLockerV2: "0xcE3212e6536F33cD6fbFEE265224131353Ca3D47",
|
|
266
267
|
TimelockFactory: "0x9fd40af2baAfAF03513f091444e821c0d5b06ea0",
|
|
@@ -410,7 +411,7 @@ var ADDRESSES = {
|
|
|
410
411
|
rehypeDopplerHookMigrator: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE].RehypeDopplerHookMigrator,
|
|
411
412
|
noOpMigrator: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE].NoOpMigrator,
|
|
412
413
|
governanceFactory: "0xb4deE32EB70A5E55f3D2d861F49Fb3D79f7a14d9",
|
|
413
|
-
noOpGovernanceFactory:
|
|
414
|
+
noOpGovernanceFactory: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE].NoOpGovernanceFactory,
|
|
414
415
|
launchpadGovernanceFactory: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE].LaunchpadGovernanceFactory,
|
|
415
416
|
streamableFeesLocker: GENERATED_DOPPLER_DEPLOYMENTS[CHAIN_IDS.BASE].StreamableFeesLocker,
|
|
416
417
|
universalRouter: "0x6ff5693b99212da76ad316178a184ab56d299b43",
|
|
@@ -5295,7 +5296,7 @@ var DopplerFactory = class {
|
|
|
5295
5296
|
this.chainId = chainId;
|
|
5296
5297
|
}
|
|
5297
5298
|
hasCustomV2Schedules(vesting) {
|
|
5298
|
-
return (vesting?.
|
|
5299
|
+
return (vesting?.allocations?.length ?? 0) > 0;
|
|
5299
5300
|
}
|
|
5300
5301
|
usesDerc20V2Vesting(vesting) {
|
|
5301
5302
|
if (!vesting) {
|
|
@@ -5307,6 +5308,16 @@ var DopplerFactory = class {
|
|
|
5307
5308
|
if (!args.vesting) {
|
|
5308
5309
|
return { recipients: [], amounts: [] };
|
|
5309
5310
|
}
|
|
5311
|
+
if (args.vesting.allocations) {
|
|
5312
|
+
return {
|
|
5313
|
+
recipients: args.vesting.allocations.map(
|
|
5314
|
+
(allocation) => allocation.recipient
|
|
5315
|
+
),
|
|
5316
|
+
amounts: args.vesting.allocations.map(
|
|
5317
|
+
(allocation) => allocation.amount
|
|
5318
|
+
)
|
|
5319
|
+
};
|
|
5320
|
+
}
|
|
5310
5321
|
if (args.vesting.recipients && args.vesting.amounts) {
|
|
5311
5322
|
return {
|
|
5312
5323
|
recipients: args.vesting.recipients,
|
|
@@ -5318,18 +5329,6 @@ var DopplerFactory = class {
|
|
|
5318
5329
|
amounts: [args.sale.initialSupply - args.sale.numTokensToSell]
|
|
5319
5330
|
};
|
|
5320
5331
|
}
|
|
5321
|
-
normalizeV2ScheduleId(scheduleId, label) {
|
|
5322
|
-
if (!Number.isFinite(scheduleId) || !Number.isInteger(scheduleId)) {
|
|
5323
|
-
throw new Error(`${label} must be an integer`);
|
|
5324
|
-
}
|
|
5325
|
-
if (!Number.isSafeInteger(scheduleId)) {
|
|
5326
|
-
throw new Error(`${label} must be a safe integer`);
|
|
5327
|
-
}
|
|
5328
|
-
if (scheduleId < 0) {
|
|
5329
|
-
throw new Error(`${label} cannot be negative`);
|
|
5330
|
-
}
|
|
5331
|
-
return BigInt(scheduleId);
|
|
5332
|
-
}
|
|
5333
5332
|
validateUint64LikeNumber(value, fieldPath, options = {}) {
|
|
5334
5333
|
const { allowZero = true } = options;
|
|
5335
5334
|
if (!Number.isFinite(value) || !Number.isInteger(value)) {
|
|
@@ -5363,37 +5362,22 @@ var DopplerFactory = class {
|
|
|
5363
5362
|
scheduleIds: Array.from({ length: args.recipientCount }, () => 0n)
|
|
5364
5363
|
};
|
|
5365
5364
|
}
|
|
5366
|
-
const schedules =
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
};
|
|
5381
|
-
}
|
|
5382
|
-
if (schedules.length === 1) {
|
|
5383
|
-
return {
|
|
5384
|
-
schedules,
|
|
5385
|
-
scheduleIds: Array.from({ length: args.recipientCount }, () => 0n)
|
|
5386
|
-
};
|
|
5387
|
-
}
|
|
5388
|
-
if (schedules.length === args.recipientCount) {
|
|
5389
|
-
return {
|
|
5390
|
-
schedules,
|
|
5391
|
-
scheduleIds: schedules.map((_, index) => BigInt(index))
|
|
5392
|
-
};
|
|
5365
|
+
const schedules = [];
|
|
5366
|
+
const scheduleIds = [];
|
|
5367
|
+
const scheduleIdsByKey = /* @__PURE__ */ new Map();
|
|
5368
|
+
for (const allocation of args.vesting.allocations ?? []) {
|
|
5369
|
+
const cliff = BigInt(allocation.schedule.cliffDuration ?? 0);
|
|
5370
|
+
const duration = BigInt(allocation.schedule.duration ?? 0);
|
|
5371
|
+
const key = `${cliff}:${duration}`;
|
|
5372
|
+
let scheduleId = scheduleIdsByKey.get(key);
|
|
5373
|
+
if (scheduleId === void 0) {
|
|
5374
|
+
scheduleId = BigInt(schedules.length);
|
|
5375
|
+
schedules.push({ cliff, duration });
|
|
5376
|
+
scheduleIdsByKey.set(key, scheduleId);
|
|
5377
|
+
}
|
|
5378
|
+
scheduleIds.push(scheduleId);
|
|
5393
5379
|
}
|
|
5394
|
-
|
|
5395
|
-
"Vesting schedules must either contain exactly one shared schedule or one schedule per recipient when scheduleIds are omitted"
|
|
5396
|
-
);
|
|
5380
|
+
return { schedules, scheduleIds };
|
|
5397
5381
|
}
|
|
5398
5382
|
resolveStandardTokenFactoryMode(args) {
|
|
5399
5383
|
if (this.usesDerc20V2Vesting(args.vesting)) {
|
|
@@ -8237,87 +8221,70 @@ var DopplerFactory = class {
|
|
|
8237
8221
|
const cliffDuration = vesting.cliffDuration ?? 0;
|
|
8238
8222
|
const duration = vesting.duration ?? 0;
|
|
8239
8223
|
const hasCustomSchedules = this.hasCustomV2Schedules(vesting);
|
|
8240
|
-
if (hasCustomSchedules && (cliffDuration > 0 || duration > 0)) {
|
|
8224
|
+
if (hasCustomSchedules && (cliffDuration > 0 || duration > 0 || vesting.recipients !== void 0 || vesting.amounts !== void 0)) {
|
|
8241
8225
|
throw new Error(
|
|
8242
|
-
"Use vesting.
|
|
8226
|
+
"Use vesting.allocations instead of top-level duration/cliffDuration/recipients/amounts when configuring per-beneficiary vesting"
|
|
8243
8227
|
);
|
|
8244
8228
|
}
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
);
|
|
8229
|
+
const availableForVesting = sale.initialSupply - sale.numTokensToSell;
|
|
8230
|
+
if (vesting.allocations) {
|
|
8231
|
+
if (vesting.allocations.length === 0) {
|
|
8232
|
+
throw new Error("Vesting allocations array cannot be empty");
|
|
8250
8233
|
}
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
const availableForVesting = sale.initialSupply - sale.numTokensToSell;
|
|
8234
|
+
const totalVested = vesting.allocations.reduce(
|
|
8235
|
+
(sum, allocation) => sum + allocation.amount,
|
|
8236
|
+
0n
|
|
8237
|
+
);
|
|
8256
8238
|
if (totalVested > availableForVesting) {
|
|
8257
8239
|
throw new Error(
|
|
8258
8240
|
`Total vesting amount (${totalVested}) exceeds available tokens (${availableForVesting})`
|
|
8259
8241
|
);
|
|
8260
8242
|
}
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
throw new Error("No tokens available for vesting");
|
|
8265
|
-
}
|
|
8266
|
-
}
|
|
8267
|
-
if (hasCustomSchedules) {
|
|
8268
|
-
const schedules = vesting.schedules;
|
|
8269
|
-
if (!schedules || schedules.length === 0) {
|
|
8270
|
-
throw new Error(
|
|
8271
|
-
"Vesting schedules are required when using scheduleIds or multiple vesting schedules"
|
|
8272
|
-
);
|
|
8273
|
-
}
|
|
8274
|
-
const recipientCount = vesting.recipients && vesting.amounts ? vesting.recipients.length : 1;
|
|
8275
|
-
if (vesting.scheduleIds) {
|
|
8276
|
-
if (vesting.scheduleIds.length !== recipientCount) {
|
|
8277
|
-
throw new Error(
|
|
8278
|
-
"Vesting scheduleIds array must have the same length as vesting recipients"
|
|
8279
|
-
);
|
|
8280
|
-
}
|
|
8281
|
-
for (const [index, scheduleId] of vesting.scheduleIds.entries()) {
|
|
8282
|
-
this.validateUint64LikeNumber(
|
|
8283
|
-
scheduleId,
|
|
8284
|
-
`Vesting scheduleIds[${index}]`
|
|
8285
|
-
);
|
|
8286
|
-
if (scheduleId >= schedules.length) {
|
|
8287
|
-
throw new Error(
|
|
8288
|
-
`Vesting scheduleIds[${index}] references missing schedule ${scheduleId}`
|
|
8289
|
-
);
|
|
8290
|
-
}
|
|
8291
|
-
}
|
|
8292
|
-
} else if (schedules.length !== 1 && schedules.length !== recipientCount) {
|
|
8293
|
-
throw new Error(
|
|
8294
|
-
"Vesting schedules must either contain exactly one shared schedule or one schedule per recipient when scheduleIds are omitted"
|
|
8295
|
-
);
|
|
8296
|
-
}
|
|
8297
|
-
for (const [index, schedule] of schedules.entries()) {
|
|
8298
|
-
const scheduleCliff = schedule.cliffDuration ?? 0;
|
|
8299
|
-
const scheduleDuration = schedule.duration ?? 0;
|
|
8243
|
+
for (const [index, allocation] of vesting.allocations.entries()) {
|
|
8244
|
+
const scheduleCliff = allocation.schedule.cliffDuration ?? 0;
|
|
8245
|
+
const scheduleDuration = allocation.schedule.duration ?? 0;
|
|
8300
8246
|
this.validateUint64LikeNumber(
|
|
8301
8247
|
scheduleCliff,
|
|
8302
|
-
`Vesting
|
|
8248
|
+
`Vesting allocations[${index}].schedule.cliffDuration`
|
|
8303
8249
|
);
|
|
8304
8250
|
this.validateUint64LikeNumber(
|
|
8305
8251
|
scheduleDuration,
|
|
8306
|
-
`Vesting
|
|
8252
|
+
`Vesting allocations[${index}].schedule.duration`
|
|
8307
8253
|
);
|
|
8308
8254
|
if (scheduleCliff > scheduleDuration) {
|
|
8309
8255
|
throw new Error(
|
|
8310
|
-
`Vesting
|
|
8256
|
+
`Vesting allocations[${index}].schedule.cliffDuration cannot exceed duration`
|
|
8311
8257
|
);
|
|
8312
8258
|
}
|
|
8313
8259
|
if (scheduleCliff > 0 && scheduleDuration > 0 && scheduleDuration < DERC20_V2_MIN_VESTING_DURATION) {
|
|
8314
8260
|
throw new Error(
|
|
8315
|
-
`Vesting
|
|
8261
|
+
`Vesting allocations[${index}].schedule.duration must be 0 or at least ${DERC20_V2_MIN_VESTING_DURATION} seconds when using cliffs`
|
|
8316
8262
|
);
|
|
8317
8263
|
}
|
|
8318
8264
|
}
|
|
8319
8265
|
return;
|
|
8320
8266
|
}
|
|
8267
|
+
if (vesting.recipients && vesting.amounts) {
|
|
8268
|
+
if (vesting.recipients.length !== vesting.amounts.length) {
|
|
8269
|
+
throw new Error(
|
|
8270
|
+
"Vesting recipients and amounts arrays must have the same length"
|
|
8271
|
+
);
|
|
8272
|
+
}
|
|
8273
|
+
if (vesting.recipients.length === 0) {
|
|
8274
|
+
throw new Error("Vesting recipients array cannot be empty");
|
|
8275
|
+
}
|
|
8276
|
+
const totalVested = vesting.amounts.reduce((sum, amt) => sum + amt, 0n);
|
|
8277
|
+
if (totalVested > availableForVesting) {
|
|
8278
|
+
throw new Error(
|
|
8279
|
+
`Total vesting amount (${totalVested}) exceeds available tokens (${availableForVesting})`
|
|
8280
|
+
);
|
|
8281
|
+
}
|
|
8282
|
+
} else {
|
|
8283
|
+
const vestedAmount = sale.initialSupply - sale.numTokensToSell;
|
|
8284
|
+
if (vestedAmount <= 0n) {
|
|
8285
|
+
throw new Error("No tokens available for vesting");
|
|
8286
|
+
}
|
|
8287
|
+
}
|
|
8321
8288
|
if (cliffDuration < 0) {
|
|
8322
8289
|
throw new Error("Vesting cliff duration cannot be negative");
|
|
8323
8290
|
}
|
|
@@ -13576,23 +13543,14 @@ function normalizeBuilderVestingScheduleDuration(value, fieldPath) {
|
|
|
13576
13543
|
}
|
|
13577
13544
|
return Number(duration);
|
|
13578
13545
|
}
|
|
13579
|
-
function
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
return Number(scheduleId);
|
|
13588
|
-
}
|
|
13589
|
-
if (!Number.isSafeInteger(scheduleId)) {
|
|
13590
|
-
throw new RangeError(`${fieldPath} must be a safe integer`);
|
|
13591
|
-
}
|
|
13592
|
-
if (scheduleId < 0) {
|
|
13593
|
-
throw new RangeError(`${fieldPath} cannot be negative`);
|
|
13594
|
-
}
|
|
13595
|
-
return scheduleId;
|
|
13546
|
+
function normalizeBuilderVestingSchedule(schedule, fieldPath) {
|
|
13547
|
+
return {
|
|
13548
|
+
duration: normalizeBuilderVestingScheduleDuration(
|
|
13549
|
+
schedule.duration,
|
|
13550
|
+
`${fieldPath}.duration`
|
|
13551
|
+
),
|
|
13552
|
+
cliffDuration: schedule.cliffDuration ?? 0
|
|
13553
|
+
};
|
|
13596
13554
|
}
|
|
13597
13555
|
function computeTicks(priceRange, tickSpacing) {
|
|
13598
13556
|
const startTick = Math.floor(
|
|
@@ -13889,24 +13847,24 @@ var StaticAuctionBuilder = class _StaticAuctionBuilder {
|
|
|
13889
13847
|
this.vesting = void 0;
|
|
13890
13848
|
return this;
|
|
13891
13849
|
}
|
|
13892
|
-
|
|
13850
|
+
if (params.allocations) {
|
|
13851
|
+
this.vesting = {
|
|
13852
|
+
allocations: params.allocations.map((allocation, index) => ({
|
|
13853
|
+
recipient: allocation.recipient,
|
|
13854
|
+
amount: allocation.amount,
|
|
13855
|
+
schedule: normalizeBuilderVestingSchedule(
|
|
13856
|
+
allocation.schedule,
|
|
13857
|
+
`Vesting allocations[${index}].schedule`
|
|
13858
|
+
)
|
|
13859
|
+
}))
|
|
13860
|
+
};
|
|
13861
|
+
return this;
|
|
13862
|
+
}
|
|
13893
13863
|
this.vesting = {
|
|
13894
|
-
duration: Number(
|
|
13895
|
-
params.duration ?? (hasCustomSchedules ? 0n : DEFAULT_V3_VESTING_DURATION)
|
|
13896
|
-
),
|
|
13864
|
+
duration: Number(params.duration ?? DEFAULT_V3_VESTING_DURATION),
|
|
13897
13865
|
cliffDuration: params.cliffDuration ?? 0,
|
|
13898
13866
|
recipients: params.recipients,
|
|
13899
|
-
amounts: params.amounts
|
|
13900
|
-
schedules: params.schedules?.map((schedule) => ({
|
|
13901
|
-
duration: normalizeBuilderVestingScheduleDuration(
|
|
13902
|
-
schedule.duration,
|
|
13903
|
-
"Vesting schedule duration"
|
|
13904
|
-
),
|
|
13905
|
-
cliffDuration: schedule.cliffDuration ?? 0
|
|
13906
|
-
})),
|
|
13907
|
-
scheduleIds: params.scheduleIds?.map(
|
|
13908
|
-
(scheduleId, index) => normalizeBuilderScheduleId(scheduleId, `Vesting scheduleIds[${index}]`)
|
|
13909
|
-
)
|
|
13867
|
+
amounts: params.amounts
|
|
13910
13868
|
};
|
|
13911
13869
|
return this;
|
|
13912
13870
|
}
|
|
@@ -14234,21 +14192,24 @@ var DynamicAuctionBuilder = class _DynamicAuctionBuilder {
|
|
|
14234
14192
|
this.vesting = void 0;
|
|
14235
14193
|
return this;
|
|
14236
14194
|
}
|
|
14195
|
+
if (params.allocations) {
|
|
14196
|
+
this.vesting = {
|
|
14197
|
+
allocations: params.allocations.map((allocation, index) => ({
|
|
14198
|
+
recipient: allocation.recipient,
|
|
14199
|
+
amount: allocation.amount,
|
|
14200
|
+
schedule: normalizeBuilderVestingSchedule(
|
|
14201
|
+
allocation.schedule,
|
|
14202
|
+
`Vesting allocations[${index}].schedule`
|
|
14203
|
+
)
|
|
14204
|
+
}))
|
|
14205
|
+
};
|
|
14206
|
+
return this;
|
|
14207
|
+
}
|
|
14237
14208
|
this.vesting = {
|
|
14238
14209
|
duration: Number(params.duration ?? 0n),
|
|
14239
14210
|
cliffDuration: params.cliffDuration ?? 0,
|
|
14240
14211
|
recipients: params.recipients,
|
|
14241
|
-
amounts: params.amounts
|
|
14242
|
-
schedules: params.schedules?.map((schedule) => ({
|
|
14243
|
-
duration: normalizeBuilderVestingScheduleDuration(
|
|
14244
|
-
schedule.duration,
|
|
14245
|
-
"Vesting schedule duration"
|
|
14246
|
-
),
|
|
14247
|
-
cliffDuration: schedule.cliffDuration ?? 0
|
|
14248
|
-
})),
|
|
14249
|
-
scheduleIds: params.scheduleIds?.map(
|
|
14250
|
-
(scheduleId, index) => normalizeBuilderScheduleId(scheduleId, `Vesting scheduleIds[${index}]`)
|
|
14251
|
-
)
|
|
14212
|
+
amounts: params.amounts
|
|
14252
14213
|
};
|
|
14253
14214
|
return this;
|
|
14254
14215
|
}
|
|
@@ -14850,21 +14811,24 @@ var MulticurveBuilder = class _MulticurveBuilder {
|
|
|
14850
14811
|
this.vesting = void 0;
|
|
14851
14812
|
return this;
|
|
14852
14813
|
}
|
|
14814
|
+
if (params.allocations) {
|
|
14815
|
+
this.vesting = {
|
|
14816
|
+
allocations: params.allocations.map((allocation, index) => ({
|
|
14817
|
+
recipient: allocation.recipient,
|
|
14818
|
+
amount: allocation.amount,
|
|
14819
|
+
schedule: normalizeBuilderVestingSchedule(
|
|
14820
|
+
allocation.schedule,
|
|
14821
|
+
`Vesting allocations[${index}].schedule`
|
|
14822
|
+
)
|
|
14823
|
+
}))
|
|
14824
|
+
};
|
|
14825
|
+
return this;
|
|
14826
|
+
}
|
|
14853
14827
|
this.vesting = {
|
|
14854
14828
|
duration: Number(params.duration ?? 0n),
|
|
14855
14829
|
cliffDuration: params.cliffDuration ?? 0,
|
|
14856
14830
|
recipients: params.recipients,
|
|
14857
|
-
amounts: params.amounts
|
|
14858
|
-
schedules: params.schedules?.map((schedule) => ({
|
|
14859
|
-
duration: normalizeBuilderVestingScheduleDuration(
|
|
14860
|
-
schedule.duration,
|
|
14861
|
-
"Vesting schedule duration"
|
|
14862
|
-
),
|
|
14863
|
-
cliffDuration: schedule.cliffDuration ?? 0
|
|
14864
|
-
})),
|
|
14865
|
-
scheduleIds: params.scheduleIds?.map(
|
|
14866
|
-
(scheduleId, index) => normalizeBuilderScheduleId(scheduleId, `Vesting scheduleIds[${index}]`)
|
|
14867
|
-
)
|
|
14831
|
+
amounts: params.amounts
|
|
14868
14832
|
};
|
|
14869
14833
|
return this;
|
|
14870
14834
|
}
|
|
@@ -15249,21 +15213,24 @@ var OpeningAuctionBuilder = class _OpeningAuctionBuilder {
|
|
|
15249
15213
|
this.vesting = void 0;
|
|
15250
15214
|
return this;
|
|
15251
15215
|
}
|
|
15216
|
+
if (params.allocations) {
|
|
15217
|
+
this.vesting = {
|
|
15218
|
+
allocations: params.allocations.map((allocation, index) => ({
|
|
15219
|
+
recipient: allocation.recipient,
|
|
15220
|
+
amount: allocation.amount,
|
|
15221
|
+
schedule: normalizeBuilderVestingSchedule(
|
|
15222
|
+
allocation.schedule,
|
|
15223
|
+
`Vesting allocations[${index}].schedule`
|
|
15224
|
+
)
|
|
15225
|
+
}))
|
|
15226
|
+
};
|
|
15227
|
+
return this;
|
|
15228
|
+
}
|
|
15252
15229
|
this.vesting = {
|
|
15253
15230
|
duration: Number(params.duration ?? 0n),
|
|
15254
15231
|
cliffDuration: params.cliffDuration ?? 0,
|
|
15255
15232
|
recipients: params.recipients,
|
|
15256
|
-
amounts: params.amounts
|
|
15257
|
-
schedules: params.schedules?.map((schedule) => ({
|
|
15258
|
-
duration: normalizeBuilderVestingScheduleDuration(
|
|
15259
|
-
schedule.duration,
|
|
15260
|
-
"Vesting schedule duration"
|
|
15261
|
-
),
|
|
15262
|
-
cliffDuration: schedule.cliffDuration ?? 0
|
|
15263
|
-
})),
|
|
15264
|
-
scheduleIds: params.scheduleIds?.map(
|
|
15265
|
-
(scheduleId, index) => normalizeBuilderScheduleId(scheduleId, `Vesting scheduleIds[${index}]`)
|
|
15266
|
-
)
|
|
15233
|
+
amounts: params.amounts
|
|
15267
15234
|
};
|
|
15268
15235
|
return this;
|
|
15269
15236
|
}
|