@masterpeach/launchpad-sdk 0.0.0-experimental-20260818121657
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 +262 -0
- package/README.zh-CN.md +242 -0
- package/dist/abi/index.cjs +2786 -0
- package/dist/abi/index.cjs.map +1 -0
- package/dist/abi/index.d.cts +2121 -0
- package/dist/abi/index.d.ts +2121 -0
- package/dist/abi/index.js +19 -0
- package/dist/abi/index.js.map +1 -0
- package/dist/chunk-PGZCTPUB.js +127 -0
- package/dist/chunk-PGZCTPUB.js.map +1 -0
- package/dist/chunk-SH2Y5F5L.js +2754 -0
- package/dist/chunk-SH2Y5F5L.js.map +1 -0
- package/dist/core.cjs +163 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +48 -0
- package/dist/core.d.ts +48 -0
- package/dist/core.js +27 -0
- package/dist/core.js.map +1 -0
- package/dist/index.cjs +4420 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1273 -0
- package/dist/index.d.ts +1273 -0
- package/dist/index.js +1840 -0
- package/dist/index.js.map +1 -0
- package/dist/transaction-BiLcoXyx.d.cts +13 -0
- package/dist/transaction-BiLcoXyx.d.ts +13 -0
- package/package.json +81 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,4420 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
BPS: () => BPS,
|
|
24
|
+
DEFAULT_DEADLINE_SECONDS: () => DEFAULT_DEADLINE_SECONDS,
|
|
25
|
+
ForgedPreparedTransactionError: () => ForgedPreparedTransactionError,
|
|
26
|
+
InvalidDeadlineError: () => InvalidDeadlineError,
|
|
27
|
+
InvalidLaunchpadChainConfigError: () => InvalidLaunchpadChainConfigError,
|
|
28
|
+
InvalidLaunchpadDeploymentError: () => InvalidLaunchpadDeploymentError,
|
|
29
|
+
InvalidLaunchpadReadInputError: () => InvalidLaunchpadReadInputError,
|
|
30
|
+
InvalidLaunchpadStateError: () => InvalidLaunchpadStateError,
|
|
31
|
+
InvalidSlippageError: () => InvalidSlippageError,
|
|
32
|
+
LaunchpadApprovalRequiredError: () => LaunchpadApprovalRequiredError,
|
|
33
|
+
LaunchpadDeadlineExpiredError: () => LaunchpadDeadlineExpiredError,
|
|
34
|
+
LaunchpadDeploymentVerificationError: () => LaunchpadDeploymentVerificationError,
|
|
35
|
+
LaunchpadError: () => LaunchpadError,
|
|
36
|
+
LaunchpadInsufficientBalanceError: () => LaunchpadInsufficientBalanceError,
|
|
37
|
+
LaunchpadNothingToClaimError: () => LaunchpadNothingToClaimError,
|
|
38
|
+
LaunchpadOfficialPoolLockedError: () => LaunchpadOfficialPoolLockedError,
|
|
39
|
+
LaunchpadPhaseUnavailableError: () => LaunchpadPhaseUnavailableError,
|
|
40
|
+
LaunchpadProtectionError: () => LaunchpadProtectionError,
|
|
41
|
+
LaunchpadSlippageError: () => LaunchpadSlippageError,
|
|
42
|
+
LaunchpadTradingPausedError: () => LaunchpadTradingPausedError,
|
|
43
|
+
LaunchpadUnknownPositionError: () => LaunchpadUnknownPositionError,
|
|
44
|
+
MAX_PROTECTION_BLOCKS: () => MAX_PROTECTION_BLOCKS,
|
|
45
|
+
MAX_SLIPPAGE_BPS: () => MAX_SLIPPAGE_BPS,
|
|
46
|
+
MissingWalletClientError: () => MissingWalletClientError,
|
|
47
|
+
PRICE_WAD_SCALE: () => PRICE_WAD_SCALE,
|
|
48
|
+
PreparedAccountMismatchError: () => PreparedAccountMismatchError,
|
|
49
|
+
TRADE_FEE_BPS: () => TRADE_FEE_BPS,
|
|
50
|
+
UnpinnableBlockTagError: () => UnpinnableBlockTagError,
|
|
51
|
+
UnsupportedLaunchpadCapabilityError: () => UnsupportedLaunchpadCapabilityError,
|
|
52
|
+
WrongWalletChainError: () => WrongWalletChainError,
|
|
53
|
+
applySlippageToMinimumOut: () => applySlippageToMinimumOut,
|
|
54
|
+
arcTestnetChainId: () => arcTestnetChainId,
|
|
55
|
+
arcTestnetLaunchpadDeployment: () => arcTestnetLaunchpadDeployment,
|
|
56
|
+
assertSlippage: () => assertSlippage,
|
|
57
|
+
buyPriceImpactBps: () => buyPriceImpactBps,
|
|
58
|
+
createLaunchpadClient: () => createLaunchpadClient,
|
|
59
|
+
createLaunchpadPortalClient: () => createLaunchpadPortalClient,
|
|
60
|
+
createdTokenAddress: () => createdTokenAddress,
|
|
61
|
+
creatorFirstBuyFee: () => creatorFirstBuyFee,
|
|
62
|
+
curvePriceWadAt: () => curvePriceWadAt,
|
|
63
|
+
defineLaunchpadChain: () => defineLaunchpadChain,
|
|
64
|
+
defineLaunchpadDeployment: () => defineLaunchpadDeployment,
|
|
65
|
+
defineLaunchpadDeploymentRegistry: () => defineLaunchpadDeploymentRegistry,
|
|
66
|
+
defineLaunchpadTokenId: () => defineLaunchpadTokenId,
|
|
67
|
+
firstTradableBlock: () => firstTradableBlock,
|
|
68
|
+
getClaimableLaunchpadReward: () => getClaimableLaunchpadReward,
|
|
69
|
+
getErc20Allowance: () => getErc20Allowance,
|
|
70
|
+
getErc20Balance: () => getErc20Balance,
|
|
71
|
+
getErc20Metadata: () => getErc20Metadata,
|
|
72
|
+
getLaunchpadApprovalStatus: () => getLaunchpadApprovalStatus,
|
|
73
|
+
getLaunchpadCurveConstants: () => getLaunchpadCurveConstants,
|
|
74
|
+
getLaunchpadCurveProgress: () => getLaunchpadCurveProgress,
|
|
75
|
+
getLaunchpadPrice: () => getLaunchpadPrice,
|
|
76
|
+
getLaunchpadTokenMetadata: () => getLaunchpadTokenMetadata,
|
|
77
|
+
getLaunchpadTokenState: () => getLaunchpadTokenState,
|
|
78
|
+
getLaunchpadTradeAvailability: () => getLaunchpadTradeAvailability,
|
|
79
|
+
getLockedLaunchpadPosition: () => getLockedLaunchpadPosition,
|
|
80
|
+
graduationMarketCapQuote: () => graduationMarketCapQuote,
|
|
81
|
+
graduationProgress: () => graduationProgress,
|
|
82
|
+
initialCurveState: () => initialCurveState,
|
|
83
|
+
isLaunchBlockTradingDisabled: () => isLaunchBlockTradingDisabled,
|
|
84
|
+
launchpadDeploymentRegistry: () => launchpadDeploymentRegistry,
|
|
85
|
+
marketCapQuote: () => marketCapQuote,
|
|
86
|
+
mulDivUp: () => mulDivUp,
|
|
87
|
+
parseLaunchpadMetadata: () => parseLaunchpadMetadata,
|
|
88
|
+
parseLaunchpadReceiptEvents: () => parseLaunchpadReceiptEvents,
|
|
89
|
+
predictLaunchpadTokenAddress: () => predictLaunchpadTokenAddress,
|
|
90
|
+
prepareApproveErc20: () => prepareApproveErc20,
|
|
91
|
+
prepareClaimLaunchpadReward: () => prepareClaimLaunchpadReward,
|
|
92
|
+
prepareCollectLaunchpadFees: () => prepareCollectLaunchpadFees,
|
|
93
|
+
prepareCreateToken: () => prepareCreateToken,
|
|
94
|
+
prepareLaunchpadBuy: () => prepareLaunchpadBuy,
|
|
95
|
+
prepareLaunchpadMigration: () => prepareLaunchpadMigration,
|
|
96
|
+
prepareLaunchpadSell: () => prepareLaunchpadSell,
|
|
97
|
+
priceImpactBps: () => priceImpactBps,
|
|
98
|
+
priceWadPerWholeToken: () => priceWadPerWholeToken,
|
|
99
|
+
quoteCreatorFirstBuy: () => quoteCreatorFirstBuy,
|
|
100
|
+
quoteLaunchpadBuy: () => quoteLaunchpadBuy,
|
|
101
|
+
quoteLaunchpadSell: () => quoteLaunchpadSell,
|
|
102
|
+
resolveLaunchpadDeployment: () => resolveLaunchpadDeployment,
|
|
103
|
+
resolvePinnedBlockNumber: () => resolvePinnedBlockNumber,
|
|
104
|
+
revertErrorName: () => revertErrorName,
|
|
105
|
+
sellPriceImpactBps: () => sellPriceImpactBps,
|
|
106
|
+
sendPreparedLaunchpadTransaction: () => sendPreparedLaunchpadTransaction,
|
|
107
|
+
toCreatorFirstBuyQuote: () => toCreatorFirstBuyQuote,
|
|
108
|
+
toDeadline: () => toDeadline,
|
|
109
|
+
toLaunchpadError: () => toLaunchpadError,
|
|
110
|
+
toLaunchpadPauseMode: () => toLaunchpadPauseMode,
|
|
111
|
+
toLaunchpadPhase: () => toLaunchpadPhase,
|
|
112
|
+
toLaunchpadTokenState: () => toLaunchpadTokenState,
|
|
113
|
+
toLaunchpadTradeAvailability: () => toLaunchpadTradeAvailability,
|
|
114
|
+
tradeFee: () => tradeFee,
|
|
115
|
+
tradeFeeBpsAt: () => tradeFeeBpsAt,
|
|
116
|
+
verifyLaunchpadDeployment: () => verifyLaunchpadDeployment,
|
|
117
|
+
waitForLaunchpadTransaction: () => waitForLaunchpadTransaction
|
|
118
|
+
});
|
|
119
|
+
module.exports = __toCommonJS(index_exports);
|
|
120
|
+
|
|
121
|
+
// src/actions/read.ts
|
|
122
|
+
var import_viem2 = require("viem");
|
|
123
|
+
|
|
124
|
+
// src/abi/generated/constant-product-curve.ts
|
|
125
|
+
var constantProductCurveAbi = [
|
|
126
|
+
{
|
|
127
|
+
type: "function",
|
|
128
|
+
name: "quoteBuy",
|
|
129
|
+
inputs: [
|
|
130
|
+
{
|
|
131
|
+
name: "state",
|
|
132
|
+
type: "tuple",
|
|
133
|
+
internalType: "struct ICurve.State",
|
|
134
|
+
components: [
|
|
135
|
+
{
|
|
136
|
+
name: "totalSupply",
|
|
137
|
+
type: "uint256",
|
|
138
|
+
internalType: "uint256"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "circulatingSupply",
|
|
142
|
+
type: "uint256",
|
|
143
|
+
internalType: "uint256"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "quoteReserve",
|
|
147
|
+
type: "uint256",
|
|
148
|
+
internalType: "uint256"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "virtualTokenReserve",
|
|
152
|
+
type: "uint256",
|
|
153
|
+
internalType: "uint256"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "virtualQuoteReserve",
|
|
157
|
+
type: "uint256",
|
|
158
|
+
internalType: "uint256"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "k",
|
|
162
|
+
type: "uint256",
|
|
163
|
+
internalType: "uint256"
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "quoteIn",
|
|
169
|
+
type: "uint256",
|
|
170
|
+
internalType: "uint256"
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
outputs: [
|
|
174
|
+
{
|
|
175
|
+
name: "tokenOut",
|
|
176
|
+
type: "uint256",
|
|
177
|
+
internalType: "uint256"
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
stateMutability: "pure"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
type: "function",
|
|
184
|
+
name: "quoteBuyExactOut",
|
|
185
|
+
inputs: [
|
|
186
|
+
{
|
|
187
|
+
name: "state",
|
|
188
|
+
type: "tuple",
|
|
189
|
+
internalType: "struct ICurve.State",
|
|
190
|
+
components: [
|
|
191
|
+
{
|
|
192
|
+
name: "totalSupply",
|
|
193
|
+
type: "uint256",
|
|
194
|
+
internalType: "uint256"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: "circulatingSupply",
|
|
198
|
+
type: "uint256",
|
|
199
|
+
internalType: "uint256"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: "quoteReserve",
|
|
203
|
+
type: "uint256",
|
|
204
|
+
internalType: "uint256"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: "virtualTokenReserve",
|
|
208
|
+
type: "uint256",
|
|
209
|
+
internalType: "uint256"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "virtualQuoteReserve",
|
|
213
|
+
type: "uint256",
|
|
214
|
+
internalType: "uint256"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "k",
|
|
218
|
+
type: "uint256",
|
|
219
|
+
internalType: "uint256"
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "tokenOut",
|
|
225
|
+
type: "uint256",
|
|
226
|
+
internalType: "uint256"
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
outputs: [
|
|
230
|
+
{
|
|
231
|
+
name: "quoteIn",
|
|
232
|
+
type: "uint256",
|
|
233
|
+
internalType: "uint256"
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
stateMutability: "pure"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
type: "function",
|
|
240
|
+
name: "quoteSell",
|
|
241
|
+
inputs: [
|
|
242
|
+
{
|
|
243
|
+
name: "state",
|
|
244
|
+
type: "tuple",
|
|
245
|
+
internalType: "struct ICurve.State",
|
|
246
|
+
components: [
|
|
247
|
+
{
|
|
248
|
+
name: "totalSupply",
|
|
249
|
+
type: "uint256",
|
|
250
|
+
internalType: "uint256"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: "circulatingSupply",
|
|
254
|
+
type: "uint256",
|
|
255
|
+
internalType: "uint256"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: "quoteReserve",
|
|
259
|
+
type: "uint256",
|
|
260
|
+
internalType: "uint256"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: "virtualTokenReserve",
|
|
264
|
+
type: "uint256",
|
|
265
|
+
internalType: "uint256"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: "virtualQuoteReserve",
|
|
269
|
+
type: "uint256",
|
|
270
|
+
internalType: "uint256"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: "k",
|
|
274
|
+
type: "uint256",
|
|
275
|
+
internalType: "uint256"
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: "tokenIn",
|
|
281
|
+
type: "uint256",
|
|
282
|
+
internalType: "uint256"
|
|
283
|
+
}
|
|
284
|
+
],
|
|
285
|
+
outputs: [
|
|
286
|
+
{
|
|
287
|
+
name: "quoteOut",
|
|
288
|
+
type: "uint256",
|
|
289
|
+
internalType: "uint256"
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
stateMutability: "pure"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
type: "error",
|
|
296
|
+
name: "InvalidAmount",
|
|
297
|
+
inputs: []
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
type: "error",
|
|
301
|
+
name: "InvalidState",
|
|
302
|
+
inputs: []
|
|
303
|
+
}
|
|
304
|
+
];
|
|
305
|
+
|
|
306
|
+
// src/abi/generated/liquidity-locker.ts
|
|
307
|
+
var liquidityLockerAbi = [
|
|
308
|
+
{
|
|
309
|
+
type: "constructor",
|
|
310
|
+
inputs: [
|
|
311
|
+
{
|
|
312
|
+
name: "owner_",
|
|
313
|
+
type: "address",
|
|
314
|
+
internalType: "address"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: "positionManager_",
|
|
318
|
+
type: "address",
|
|
319
|
+
internalType: "address"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: "platformTreasury_",
|
|
323
|
+
type: "address",
|
|
324
|
+
internalType: "address"
|
|
325
|
+
}
|
|
326
|
+
],
|
|
327
|
+
stateMutability: "nonpayable"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
type: "function",
|
|
331
|
+
name: "BPS",
|
|
332
|
+
inputs: [],
|
|
333
|
+
outputs: [
|
|
334
|
+
{
|
|
335
|
+
name: "",
|
|
336
|
+
type: "uint16",
|
|
337
|
+
internalType: "uint16"
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
stateMutability: "view"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
type: "function",
|
|
344
|
+
name: "MAX_PLATFORM_FEE_BPS",
|
|
345
|
+
inputs: [],
|
|
346
|
+
outputs: [
|
|
347
|
+
{
|
|
348
|
+
name: "",
|
|
349
|
+
type: "uint16",
|
|
350
|
+
internalType: "uint16"
|
|
351
|
+
}
|
|
352
|
+
],
|
|
353
|
+
stateMutability: "view"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
type: "function",
|
|
357
|
+
name: "acceptOwnership",
|
|
358
|
+
inputs: [],
|
|
359
|
+
outputs: [],
|
|
360
|
+
stateMutability: "nonpayable"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
type: "function",
|
|
364
|
+
name: "claim",
|
|
365
|
+
inputs: [
|
|
366
|
+
{
|
|
367
|
+
name: "asset",
|
|
368
|
+
type: "address",
|
|
369
|
+
internalType: "address"
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
name: "recipient",
|
|
373
|
+
type: "address",
|
|
374
|
+
internalType: "address"
|
|
375
|
+
}
|
|
376
|
+
],
|
|
377
|
+
outputs: [
|
|
378
|
+
{
|
|
379
|
+
name: "amount",
|
|
380
|
+
type: "uint256",
|
|
381
|
+
internalType: "uint256"
|
|
382
|
+
}
|
|
383
|
+
],
|
|
384
|
+
stateMutability: "nonpayable"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
type: "function",
|
|
388
|
+
name: "collectFees",
|
|
389
|
+
inputs: [
|
|
390
|
+
{
|
|
391
|
+
name: "tokenId",
|
|
392
|
+
type: "uint256",
|
|
393
|
+
internalType: "uint256"
|
|
394
|
+
}
|
|
395
|
+
],
|
|
396
|
+
outputs: [
|
|
397
|
+
{
|
|
398
|
+
name: "amount0",
|
|
399
|
+
type: "uint256",
|
|
400
|
+
internalType: "uint256"
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
name: "amount1",
|
|
404
|
+
type: "uint256",
|
|
405
|
+
internalType: "uint256"
|
|
406
|
+
}
|
|
407
|
+
],
|
|
408
|
+
stateMutability: "nonpayable"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
type: "function",
|
|
412
|
+
name: "creditMigrationDust",
|
|
413
|
+
inputs: [
|
|
414
|
+
{
|
|
415
|
+
name: "asset",
|
|
416
|
+
type: "address",
|
|
417
|
+
internalType: "address"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
name: "creator",
|
|
421
|
+
type: "address",
|
|
422
|
+
internalType: "address"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
name: "amount",
|
|
426
|
+
type: "uint256",
|
|
427
|
+
internalType: "uint256"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "platformBps",
|
|
431
|
+
type: "uint16",
|
|
432
|
+
internalType: "uint16"
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
outputs: [],
|
|
436
|
+
stateMutability: "nonpayable"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
type: "function",
|
|
440
|
+
name: "migrators",
|
|
441
|
+
inputs: [
|
|
442
|
+
{
|
|
443
|
+
name: "",
|
|
444
|
+
type: "address",
|
|
445
|
+
internalType: "address"
|
|
446
|
+
}
|
|
447
|
+
],
|
|
448
|
+
outputs: [
|
|
449
|
+
{
|
|
450
|
+
name: "",
|
|
451
|
+
type: "bool",
|
|
452
|
+
internalType: "bool"
|
|
453
|
+
}
|
|
454
|
+
],
|
|
455
|
+
stateMutability: "view"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
type: "function",
|
|
459
|
+
name: "onERC721Received",
|
|
460
|
+
inputs: [
|
|
461
|
+
{
|
|
462
|
+
name: "",
|
|
463
|
+
type: "address",
|
|
464
|
+
internalType: "address"
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
name: "",
|
|
468
|
+
type: "address",
|
|
469
|
+
internalType: "address"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
name: "",
|
|
473
|
+
type: "uint256",
|
|
474
|
+
internalType: "uint256"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
name: "",
|
|
478
|
+
type: "bytes",
|
|
479
|
+
internalType: "bytes"
|
|
480
|
+
}
|
|
481
|
+
],
|
|
482
|
+
outputs: [
|
|
483
|
+
{
|
|
484
|
+
name: "",
|
|
485
|
+
type: "bytes4",
|
|
486
|
+
internalType: "bytes4"
|
|
487
|
+
}
|
|
488
|
+
],
|
|
489
|
+
stateMutability: "view"
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
type: "function",
|
|
493
|
+
name: "owner",
|
|
494
|
+
inputs: [],
|
|
495
|
+
outputs: [
|
|
496
|
+
{
|
|
497
|
+
name: "",
|
|
498
|
+
type: "address",
|
|
499
|
+
internalType: "address"
|
|
500
|
+
}
|
|
501
|
+
],
|
|
502
|
+
stateMutability: "view"
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
type: "function",
|
|
506
|
+
name: "pendingOwner",
|
|
507
|
+
inputs: [],
|
|
508
|
+
outputs: [
|
|
509
|
+
{
|
|
510
|
+
name: "",
|
|
511
|
+
type: "address",
|
|
512
|
+
internalType: "address"
|
|
513
|
+
}
|
|
514
|
+
],
|
|
515
|
+
stateMutability: "view"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
type: "function",
|
|
519
|
+
name: "pendingRewards",
|
|
520
|
+
inputs: [
|
|
521
|
+
{
|
|
522
|
+
name: "",
|
|
523
|
+
type: "address",
|
|
524
|
+
internalType: "address"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
name: "",
|
|
528
|
+
type: "address",
|
|
529
|
+
internalType: "address"
|
|
530
|
+
}
|
|
531
|
+
],
|
|
532
|
+
outputs: [
|
|
533
|
+
{
|
|
534
|
+
name: "",
|
|
535
|
+
type: "uint256",
|
|
536
|
+
internalType: "uint256"
|
|
537
|
+
}
|
|
538
|
+
],
|
|
539
|
+
stateMutability: "view"
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
type: "function",
|
|
543
|
+
name: "platformTreasury",
|
|
544
|
+
inputs: [],
|
|
545
|
+
outputs: [
|
|
546
|
+
{
|
|
547
|
+
name: "",
|
|
548
|
+
type: "address",
|
|
549
|
+
internalType: "address"
|
|
550
|
+
}
|
|
551
|
+
],
|
|
552
|
+
stateMutability: "view"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
type: "function",
|
|
556
|
+
name: "positionManager",
|
|
557
|
+
inputs: [],
|
|
558
|
+
outputs: [
|
|
559
|
+
{
|
|
560
|
+
name: "",
|
|
561
|
+
type: "address",
|
|
562
|
+
internalType: "address"
|
|
563
|
+
}
|
|
564
|
+
],
|
|
565
|
+
stateMutability: "view"
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
type: "function",
|
|
569
|
+
name: "positions",
|
|
570
|
+
inputs: [
|
|
571
|
+
{
|
|
572
|
+
name: "",
|
|
573
|
+
type: "uint256",
|
|
574
|
+
internalType: "uint256"
|
|
575
|
+
}
|
|
576
|
+
],
|
|
577
|
+
outputs: [
|
|
578
|
+
{
|
|
579
|
+
name: "token0",
|
|
580
|
+
type: "address",
|
|
581
|
+
internalType: "address"
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
name: "token1",
|
|
585
|
+
type: "address",
|
|
586
|
+
internalType: "address"
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
name: "creator",
|
|
590
|
+
type: "address",
|
|
591
|
+
internalType: "address"
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
name: "platformFeeBps",
|
|
595
|
+
type: "uint16",
|
|
596
|
+
internalType: "uint16"
|
|
597
|
+
}
|
|
598
|
+
],
|
|
599
|
+
stateMutability: "view"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
type: "function",
|
|
603
|
+
name: "registerPosition",
|
|
604
|
+
inputs: [
|
|
605
|
+
{
|
|
606
|
+
name: "tokenId",
|
|
607
|
+
type: "uint256",
|
|
608
|
+
internalType: "uint256"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
name: "token0",
|
|
612
|
+
type: "address",
|
|
613
|
+
internalType: "address"
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
name: "token1",
|
|
617
|
+
type: "address",
|
|
618
|
+
internalType: "address"
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
name: "creator",
|
|
622
|
+
type: "address",
|
|
623
|
+
internalType: "address"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
name: "platformFeeBps",
|
|
627
|
+
type: "uint16",
|
|
628
|
+
internalType: "uint16"
|
|
629
|
+
}
|
|
630
|
+
],
|
|
631
|
+
outputs: [],
|
|
632
|
+
stateMutability: "nonpayable"
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
type: "function",
|
|
636
|
+
name: "setMigrator",
|
|
637
|
+
inputs: [
|
|
638
|
+
{
|
|
639
|
+
name: "migrator",
|
|
640
|
+
type: "address",
|
|
641
|
+
internalType: "address"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
name: "allowed",
|
|
645
|
+
type: "bool",
|
|
646
|
+
internalType: "bool"
|
|
647
|
+
}
|
|
648
|
+
],
|
|
649
|
+
outputs: [],
|
|
650
|
+
stateMutability: "nonpayable"
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
type: "function",
|
|
654
|
+
name: "setPlatformTreasury",
|
|
655
|
+
inputs: [
|
|
656
|
+
{
|
|
657
|
+
name: "treasury",
|
|
658
|
+
type: "address",
|
|
659
|
+
internalType: "address"
|
|
660
|
+
}
|
|
661
|
+
],
|
|
662
|
+
outputs: [],
|
|
663
|
+
stateMutability: "nonpayable"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
type: "function",
|
|
667
|
+
name: "transferOwnership",
|
|
668
|
+
inputs: [
|
|
669
|
+
{
|
|
670
|
+
name: "newOwner",
|
|
671
|
+
type: "address",
|
|
672
|
+
internalType: "address"
|
|
673
|
+
}
|
|
674
|
+
],
|
|
675
|
+
outputs: [],
|
|
676
|
+
stateMutability: "nonpayable"
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
type: "event",
|
|
680
|
+
name: "FeesCollected",
|
|
681
|
+
inputs: [
|
|
682
|
+
{
|
|
683
|
+
name: "tokenId",
|
|
684
|
+
type: "uint256",
|
|
685
|
+
indexed: true,
|
|
686
|
+
internalType: "uint256"
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
name: "amount0",
|
|
690
|
+
type: "uint256",
|
|
691
|
+
indexed: false,
|
|
692
|
+
internalType: "uint256"
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
name: "amount1",
|
|
696
|
+
type: "uint256",
|
|
697
|
+
indexed: false,
|
|
698
|
+
internalType: "uint256"
|
|
699
|
+
}
|
|
700
|
+
],
|
|
701
|
+
anonymous: false
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
type: "event",
|
|
705
|
+
name: "MigrationDustCredited",
|
|
706
|
+
inputs: [
|
|
707
|
+
{
|
|
708
|
+
name: "creator",
|
|
709
|
+
type: "address",
|
|
710
|
+
indexed: true,
|
|
711
|
+
internalType: "address"
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
name: "asset",
|
|
715
|
+
type: "address",
|
|
716
|
+
indexed: true,
|
|
717
|
+
internalType: "address"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
name: "amount",
|
|
721
|
+
type: "uint256",
|
|
722
|
+
indexed: false,
|
|
723
|
+
internalType: "uint256"
|
|
724
|
+
}
|
|
725
|
+
],
|
|
726
|
+
anonymous: false
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
type: "event",
|
|
730
|
+
name: "MigratorSet",
|
|
731
|
+
inputs: [
|
|
732
|
+
{
|
|
733
|
+
name: "migrator",
|
|
734
|
+
type: "address",
|
|
735
|
+
indexed: true,
|
|
736
|
+
internalType: "address"
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
name: "allowed",
|
|
740
|
+
type: "bool",
|
|
741
|
+
indexed: false,
|
|
742
|
+
internalType: "bool"
|
|
743
|
+
}
|
|
744
|
+
],
|
|
745
|
+
anonymous: false
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
type: "event",
|
|
749
|
+
name: "OwnershipTransferStarted",
|
|
750
|
+
inputs: [
|
|
751
|
+
{
|
|
752
|
+
name: "owner",
|
|
753
|
+
type: "address",
|
|
754
|
+
indexed: true,
|
|
755
|
+
internalType: "address"
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
name: "pendingOwner",
|
|
759
|
+
type: "address",
|
|
760
|
+
indexed: true,
|
|
761
|
+
internalType: "address"
|
|
762
|
+
}
|
|
763
|
+
],
|
|
764
|
+
anonymous: false
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
type: "event",
|
|
768
|
+
name: "OwnershipTransferred",
|
|
769
|
+
inputs: [
|
|
770
|
+
{
|
|
771
|
+
name: "oldOwner",
|
|
772
|
+
type: "address",
|
|
773
|
+
indexed: true,
|
|
774
|
+
internalType: "address"
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
name: "newOwner",
|
|
778
|
+
type: "address",
|
|
779
|
+
indexed: true,
|
|
780
|
+
internalType: "address"
|
|
781
|
+
}
|
|
782
|
+
],
|
|
783
|
+
anonymous: false
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
type: "event",
|
|
787
|
+
name: "PlatformTreasurySet",
|
|
788
|
+
inputs: [
|
|
789
|
+
{
|
|
790
|
+
name: "treasury",
|
|
791
|
+
type: "address",
|
|
792
|
+
indexed: true,
|
|
793
|
+
internalType: "address"
|
|
794
|
+
}
|
|
795
|
+
],
|
|
796
|
+
anonymous: false
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
type: "event",
|
|
800
|
+
name: "PositionLocked",
|
|
801
|
+
inputs: [
|
|
802
|
+
{
|
|
803
|
+
name: "tokenId",
|
|
804
|
+
type: "uint256",
|
|
805
|
+
indexed: true,
|
|
806
|
+
internalType: "uint256"
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
name: "creator",
|
|
810
|
+
type: "address",
|
|
811
|
+
indexed: true,
|
|
812
|
+
internalType: "address"
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
name: "platformFeeBps",
|
|
816
|
+
type: "uint16",
|
|
817
|
+
indexed: false,
|
|
818
|
+
internalType: "uint16"
|
|
819
|
+
}
|
|
820
|
+
],
|
|
821
|
+
anonymous: false
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
type: "event",
|
|
825
|
+
name: "RewardsClaimed",
|
|
826
|
+
inputs: [
|
|
827
|
+
{
|
|
828
|
+
name: "account",
|
|
829
|
+
type: "address",
|
|
830
|
+
indexed: true,
|
|
831
|
+
internalType: "address"
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
name: "asset",
|
|
835
|
+
type: "address",
|
|
836
|
+
indexed: true,
|
|
837
|
+
internalType: "address"
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
name: "recipient",
|
|
841
|
+
type: "address",
|
|
842
|
+
indexed: false,
|
|
843
|
+
internalType: "address"
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
name: "amount",
|
|
847
|
+
type: "uint256",
|
|
848
|
+
indexed: false,
|
|
849
|
+
internalType: "uint256"
|
|
850
|
+
}
|
|
851
|
+
],
|
|
852
|
+
anonymous: false
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
type: "error",
|
|
856
|
+
name: "InvalidConfig",
|
|
857
|
+
inputs: []
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
type: "error",
|
|
861
|
+
name: "NothingToClaim",
|
|
862
|
+
inputs: []
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
type: "error",
|
|
866
|
+
name: "PositionAlreadyRegistered",
|
|
867
|
+
inputs: []
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
type: "error",
|
|
871
|
+
name: "TransferFailed",
|
|
872
|
+
inputs: []
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
type: "error",
|
|
876
|
+
name: "Unauthorized",
|
|
877
|
+
inputs: []
|
|
878
|
+
}
|
|
879
|
+
];
|
|
880
|
+
|
|
881
|
+
// src/abi/generated/portal.ts
|
|
882
|
+
var portalAbi = [
|
|
883
|
+
{
|
|
884
|
+
type: "constructor",
|
|
885
|
+
inputs: [
|
|
886
|
+
{
|
|
887
|
+
name: "owner_",
|
|
888
|
+
type: "address",
|
|
889
|
+
internalType: "address"
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
name: "factory_",
|
|
893
|
+
type: "address",
|
|
894
|
+
internalType: "contract TokenFactory"
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
name: "quoteToken_",
|
|
898
|
+
type: "address",
|
|
899
|
+
internalType: "address"
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
name: "lpRecipient_",
|
|
903
|
+
type: "address",
|
|
904
|
+
internalType: "address"
|
|
905
|
+
}
|
|
906
|
+
],
|
|
907
|
+
stateMutability: "nonpayable"
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
type: "function",
|
|
911
|
+
name: "BPS",
|
|
912
|
+
inputs: [],
|
|
913
|
+
outputs: [
|
|
914
|
+
{
|
|
915
|
+
name: "",
|
|
916
|
+
type: "uint256",
|
|
917
|
+
internalType: "uint256"
|
|
918
|
+
}
|
|
919
|
+
],
|
|
920
|
+
stateMutability: "view"
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
type: "function",
|
|
924
|
+
name: "CURVE_K",
|
|
925
|
+
inputs: [],
|
|
926
|
+
outputs: [
|
|
927
|
+
{
|
|
928
|
+
name: "",
|
|
929
|
+
type: "uint256",
|
|
930
|
+
internalType: "uint256"
|
|
931
|
+
}
|
|
932
|
+
],
|
|
933
|
+
stateMutability: "view"
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
type: "function",
|
|
937
|
+
name: "DEFAULT_CURVE_ID",
|
|
938
|
+
inputs: [],
|
|
939
|
+
outputs: [
|
|
940
|
+
{
|
|
941
|
+
name: "",
|
|
942
|
+
type: "uint16",
|
|
943
|
+
internalType: "uint16"
|
|
944
|
+
}
|
|
945
|
+
],
|
|
946
|
+
stateMutability: "view"
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
type: "function",
|
|
950
|
+
name: "DEFAULT_MIGRATOR_ID",
|
|
951
|
+
inputs: [],
|
|
952
|
+
outputs: [
|
|
953
|
+
{
|
|
954
|
+
name: "",
|
|
955
|
+
type: "uint16",
|
|
956
|
+
internalType: "uint16"
|
|
957
|
+
}
|
|
958
|
+
],
|
|
959
|
+
stateMutability: "view"
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
type: "function",
|
|
963
|
+
name: "DEFAULT_PROTECTION_BLOCKS",
|
|
964
|
+
inputs: [],
|
|
965
|
+
outputs: [
|
|
966
|
+
{
|
|
967
|
+
name: "",
|
|
968
|
+
type: "uint8",
|
|
969
|
+
internalType: "uint8"
|
|
970
|
+
}
|
|
971
|
+
],
|
|
972
|
+
stateMutability: "view"
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
type: "function",
|
|
976
|
+
name: "DEX_SUPPLY_THRESHOLD",
|
|
977
|
+
inputs: [],
|
|
978
|
+
outputs: [
|
|
979
|
+
{
|
|
980
|
+
name: "",
|
|
981
|
+
type: "uint256",
|
|
982
|
+
internalType: "uint256"
|
|
983
|
+
}
|
|
984
|
+
],
|
|
985
|
+
stateMutability: "view"
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
type: "function",
|
|
989
|
+
name: "MAX_PROTECTION_BLOCKS",
|
|
990
|
+
inputs: [],
|
|
991
|
+
outputs: [
|
|
992
|
+
{
|
|
993
|
+
name: "",
|
|
994
|
+
type: "uint8",
|
|
995
|
+
internalType: "uint8"
|
|
996
|
+
}
|
|
997
|
+
],
|
|
998
|
+
stateMutability: "view"
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
type: "function",
|
|
1002
|
+
name: "PLATFORM_LP_FEE_BPS",
|
|
1003
|
+
inputs: [],
|
|
1004
|
+
outputs: [
|
|
1005
|
+
{
|
|
1006
|
+
name: "",
|
|
1007
|
+
type: "uint16",
|
|
1008
|
+
internalType: "uint16"
|
|
1009
|
+
}
|
|
1010
|
+
],
|
|
1011
|
+
stateMutability: "view"
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
type: "function",
|
|
1015
|
+
name: "TOTAL_SUPPLY",
|
|
1016
|
+
inputs: [],
|
|
1017
|
+
outputs: [
|
|
1018
|
+
{
|
|
1019
|
+
name: "",
|
|
1020
|
+
type: "uint256",
|
|
1021
|
+
internalType: "uint256"
|
|
1022
|
+
}
|
|
1023
|
+
],
|
|
1024
|
+
stateMutability: "view"
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
type: "function",
|
|
1028
|
+
name: "TRADE_FEE_BPS",
|
|
1029
|
+
inputs: [],
|
|
1030
|
+
outputs: [
|
|
1031
|
+
{
|
|
1032
|
+
name: "",
|
|
1033
|
+
type: "uint16",
|
|
1034
|
+
internalType: "uint16"
|
|
1035
|
+
}
|
|
1036
|
+
],
|
|
1037
|
+
stateMutability: "view"
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
type: "function",
|
|
1041
|
+
name: "VIRTUAL_QUOTE_RESERVE",
|
|
1042
|
+
inputs: [],
|
|
1043
|
+
outputs: [
|
|
1044
|
+
{
|
|
1045
|
+
name: "",
|
|
1046
|
+
type: "uint256",
|
|
1047
|
+
internalType: "uint256"
|
|
1048
|
+
}
|
|
1049
|
+
],
|
|
1050
|
+
stateMutability: "view"
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
type: "function",
|
|
1054
|
+
name: "VIRTUAL_TOKEN_RESERVE",
|
|
1055
|
+
inputs: [],
|
|
1056
|
+
outputs: [
|
|
1057
|
+
{
|
|
1058
|
+
name: "",
|
|
1059
|
+
type: "uint256",
|
|
1060
|
+
internalType: "uint256"
|
|
1061
|
+
}
|
|
1062
|
+
],
|
|
1063
|
+
stateMutability: "view"
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
type: "function",
|
|
1067
|
+
name: "acceptOwnership",
|
|
1068
|
+
inputs: [],
|
|
1069
|
+
outputs: [],
|
|
1070
|
+
stateMutability: "nonpayable"
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
type: "function",
|
|
1074
|
+
name: "buy",
|
|
1075
|
+
inputs: [
|
|
1076
|
+
{
|
|
1077
|
+
name: "token",
|
|
1078
|
+
type: "address",
|
|
1079
|
+
internalType: "address"
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
name: "quoteIn",
|
|
1083
|
+
type: "uint256",
|
|
1084
|
+
internalType: "uint256"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
name: "minTokenOut",
|
|
1088
|
+
type: "uint256",
|
|
1089
|
+
internalType: "uint256"
|
|
1090
|
+
},
|
|
1091
|
+
{
|
|
1092
|
+
name: "deadline",
|
|
1093
|
+
type: "uint256",
|
|
1094
|
+
internalType: "uint256"
|
|
1095
|
+
}
|
|
1096
|
+
],
|
|
1097
|
+
outputs: [
|
|
1098
|
+
{
|
|
1099
|
+
name: "tokenOut",
|
|
1100
|
+
type: "uint256",
|
|
1101
|
+
internalType: "uint256"
|
|
1102
|
+
},
|
|
1103
|
+
{
|
|
1104
|
+
name: "quoteSpent",
|
|
1105
|
+
type: "uint256",
|
|
1106
|
+
internalType: "uint256"
|
|
1107
|
+
}
|
|
1108
|
+
],
|
|
1109
|
+
stateMutability: "nonpayable"
|
|
1110
|
+
},
|
|
1111
|
+
{
|
|
1112
|
+
type: "function",
|
|
1113
|
+
name: "createToken",
|
|
1114
|
+
inputs: [
|
|
1115
|
+
{
|
|
1116
|
+
name: "params",
|
|
1117
|
+
type: "tuple",
|
|
1118
|
+
internalType: "struct Portal.CreateParams",
|
|
1119
|
+
components: [
|
|
1120
|
+
{
|
|
1121
|
+
name: "name",
|
|
1122
|
+
type: "string",
|
|
1123
|
+
internalType: "string"
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
name: "symbol",
|
|
1127
|
+
type: "string",
|
|
1128
|
+
internalType: "string"
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
name: "metadata",
|
|
1132
|
+
type: "string",
|
|
1133
|
+
internalType: "string"
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
name: "userSalt",
|
|
1137
|
+
type: "bytes32",
|
|
1138
|
+
internalType: "bytes32"
|
|
1139
|
+
}
|
|
1140
|
+
]
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
name: "initialQuoteIn",
|
|
1144
|
+
type: "uint256",
|
|
1145
|
+
internalType: "uint256"
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
name: "minInitialTokenOut",
|
|
1149
|
+
type: "uint256",
|
|
1150
|
+
internalType: "uint256"
|
|
1151
|
+
},
|
|
1152
|
+
{
|
|
1153
|
+
name: "deadline",
|
|
1154
|
+
type: "uint256",
|
|
1155
|
+
internalType: "uint256"
|
|
1156
|
+
}
|
|
1157
|
+
],
|
|
1158
|
+
outputs: [
|
|
1159
|
+
{
|
|
1160
|
+
name: "token",
|
|
1161
|
+
type: "address",
|
|
1162
|
+
internalType: "address"
|
|
1163
|
+
}
|
|
1164
|
+
],
|
|
1165
|
+
stateMutability: "nonpayable"
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
type: "function",
|
|
1169
|
+
name: "createTokenV2",
|
|
1170
|
+
inputs: [
|
|
1171
|
+
{
|
|
1172
|
+
name: "params",
|
|
1173
|
+
type: "tuple",
|
|
1174
|
+
internalType: "struct Portal.CreateParams",
|
|
1175
|
+
components: [
|
|
1176
|
+
{
|
|
1177
|
+
name: "name",
|
|
1178
|
+
type: "string",
|
|
1179
|
+
internalType: "string"
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
name: "symbol",
|
|
1183
|
+
type: "string",
|
|
1184
|
+
internalType: "string"
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
name: "metadata",
|
|
1188
|
+
type: "string",
|
|
1189
|
+
internalType: "string"
|
|
1190
|
+
},
|
|
1191
|
+
{
|
|
1192
|
+
name: "userSalt",
|
|
1193
|
+
type: "bytes32",
|
|
1194
|
+
internalType: "bytes32"
|
|
1195
|
+
}
|
|
1196
|
+
]
|
|
1197
|
+
},
|
|
1198
|
+
{
|
|
1199
|
+
name: "initialQuoteIn",
|
|
1200
|
+
type: "uint256",
|
|
1201
|
+
internalType: "uint256"
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
name: "minInitialTokenOut",
|
|
1205
|
+
type: "uint256",
|
|
1206
|
+
internalType: "uint256"
|
|
1207
|
+
},
|
|
1208
|
+
{
|
|
1209
|
+
name: "deadline",
|
|
1210
|
+
type: "uint256",
|
|
1211
|
+
internalType: "uint256"
|
|
1212
|
+
},
|
|
1213
|
+
{
|
|
1214
|
+
name: "protectionBlocks",
|
|
1215
|
+
type: "uint8",
|
|
1216
|
+
internalType: "uint8"
|
|
1217
|
+
}
|
|
1218
|
+
],
|
|
1219
|
+
outputs: [
|
|
1220
|
+
{
|
|
1221
|
+
name: "token",
|
|
1222
|
+
type: "address",
|
|
1223
|
+
internalType: "address"
|
|
1224
|
+
}
|
|
1225
|
+
],
|
|
1226
|
+
stateMutability: "nonpayable"
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
type: "function",
|
|
1230
|
+
name: "creatorNonces",
|
|
1231
|
+
inputs: [
|
|
1232
|
+
{
|
|
1233
|
+
name: "",
|
|
1234
|
+
type: "address",
|
|
1235
|
+
internalType: "address"
|
|
1236
|
+
}
|
|
1237
|
+
],
|
|
1238
|
+
outputs: [
|
|
1239
|
+
{
|
|
1240
|
+
name: "",
|
|
1241
|
+
type: "uint256",
|
|
1242
|
+
internalType: "uint256"
|
|
1243
|
+
}
|
|
1244
|
+
],
|
|
1245
|
+
stateMutability: "view"
|
|
1246
|
+
},
|
|
1247
|
+
{
|
|
1248
|
+
type: "function",
|
|
1249
|
+
name: "curves",
|
|
1250
|
+
inputs: [
|
|
1251
|
+
{
|
|
1252
|
+
name: "",
|
|
1253
|
+
type: "uint16",
|
|
1254
|
+
internalType: "uint16"
|
|
1255
|
+
}
|
|
1256
|
+
],
|
|
1257
|
+
outputs: [
|
|
1258
|
+
{
|
|
1259
|
+
name: "",
|
|
1260
|
+
type: "address",
|
|
1261
|
+
internalType: "address"
|
|
1262
|
+
}
|
|
1263
|
+
],
|
|
1264
|
+
stateMutability: "view"
|
|
1265
|
+
},
|
|
1266
|
+
{
|
|
1267
|
+
type: "function",
|
|
1268
|
+
name: "getTokenState",
|
|
1269
|
+
inputs: [
|
|
1270
|
+
{
|
|
1271
|
+
name: "token",
|
|
1272
|
+
type: "address",
|
|
1273
|
+
internalType: "address"
|
|
1274
|
+
}
|
|
1275
|
+
],
|
|
1276
|
+
outputs: [
|
|
1277
|
+
{
|
|
1278
|
+
name: "",
|
|
1279
|
+
type: "tuple",
|
|
1280
|
+
internalType: "struct Portal.TokenState",
|
|
1281
|
+
components: [
|
|
1282
|
+
{
|
|
1283
|
+
name: "status",
|
|
1284
|
+
type: "uint8",
|
|
1285
|
+
internalType: "enum Portal.Status"
|
|
1286
|
+
},
|
|
1287
|
+
{
|
|
1288
|
+
name: "tokenVersion",
|
|
1289
|
+
type: "uint16",
|
|
1290
|
+
internalType: "uint16"
|
|
1291
|
+
},
|
|
1292
|
+
{
|
|
1293
|
+
name: "curveId",
|
|
1294
|
+
type: "uint16",
|
|
1295
|
+
internalType: "uint16"
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
name: "migratorId",
|
|
1299
|
+
type: "uint16",
|
|
1300
|
+
internalType: "uint16"
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
name: "quoteReserve",
|
|
1304
|
+
type: "uint128",
|
|
1305
|
+
internalType: "uint128"
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
name: "circulatingSupply",
|
|
1309
|
+
type: "uint128",
|
|
1310
|
+
internalType: "uint128"
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
name: "creator",
|
|
1314
|
+
type: "address",
|
|
1315
|
+
internalType: "address"
|
|
1316
|
+
},
|
|
1317
|
+
{
|
|
1318
|
+
name: "dexPool",
|
|
1319
|
+
type: "address",
|
|
1320
|
+
internalType: "address"
|
|
1321
|
+
},
|
|
1322
|
+
{
|
|
1323
|
+
name: "launchBlock",
|
|
1324
|
+
type: "uint64",
|
|
1325
|
+
internalType: "uint64"
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
name: "protectionBlocks",
|
|
1329
|
+
type: "uint8",
|
|
1330
|
+
internalType: "uint8"
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
name: "pauseMode",
|
|
1334
|
+
type: "uint8",
|
|
1335
|
+
internalType: "uint8"
|
|
1336
|
+
}
|
|
1337
|
+
]
|
|
1338
|
+
}
|
|
1339
|
+
],
|
|
1340
|
+
stateMutability: "view"
|
|
1341
|
+
},
|
|
1342
|
+
{
|
|
1343
|
+
type: "function",
|
|
1344
|
+
name: "lpRecipient",
|
|
1345
|
+
inputs: [],
|
|
1346
|
+
outputs: [
|
|
1347
|
+
{
|
|
1348
|
+
name: "",
|
|
1349
|
+
type: "address",
|
|
1350
|
+
internalType: "address"
|
|
1351
|
+
}
|
|
1352
|
+
],
|
|
1353
|
+
stateMutability: "view"
|
|
1354
|
+
},
|
|
1355
|
+
{
|
|
1356
|
+
type: "function",
|
|
1357
|
+
name: "metadata",
|
|
1358
|
+
inputs: [
|
|
1359
|
+
{
|
|
1360
|
+
name: "",
|
|
1361
|
+
type: "address",
|
|
1362
|
+
internalType: "address"
|
|
1363
|
+
}
|
|
1364
|
+
],
|
|
1365
|
+
outputs: [
|
|
1366
|
+
{
|
|
1367
|
+
name: "",
|
|
1368
|
+
type: "string",
|
|
1369
|
+
internalType: "string"
|
|
1370
|
+
}
|
|
1371
|
+
],
|
|
1372
|
+
stateMutability: "view"
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
type: "function",
|
|
1376
|
+
name: "migrate",
|
|
1377
|
+
inputs: [
|
|
1378
|
+
{
|
|
1379
|
+
name: "token",
|
|
1380
|
+
type: "address",
|
|
1381
|
+
internalType: "address"
|
|
1382
|
+
}
|
|
1383
|
+
],
|
|
1384
|
+
outputs: [
|
|
1385
|
+
{
|
|
1386
|
+
name: "pool",
|
|
1387
|
+
type: "address",
|
|
1388
|
+
internalType: "address"
|
|
1389
|
+
}
|
|
1390
|
+
],
|
|
1391
|
+
stateMutability: "nonpayable"
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
type: "function",
|
|
1395
|
+
name: "migrators",
|
|
1396
|
+
inputs: [
|
|
1397
|
+
{
|
|
1398
|
+
name: "",
|
|
1399
|
+
type: "uint16",
|
|
1400
|
+
internalType: "uint16"
|
|
1401
|
+
}
|
|
1402
|
+
],
|
|
1403
|
+
outputs: [
|
|
1404
|
+
{
|
|
1405
|
+
name: "",
|
|
1406
|
+
type: "address",
|
|
1407
|
+
internalType: "address"
|
|
1408
|
+
}
|
|
1409
|
+
],
|
|
1410
|
+
stateMutability: "view"
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
type: "function",
|
|
1414
|
+
name: "owner",
|
|
1415
|
+
inputs: [],
|
|
1416
|
+
outputs: [
|
|
1417
|
+
{
|
|
1418
|
+
name: "",
|
|
1419
|
+
type: "address",
|
|
1420
|
+
internalType: "address"
|
|
1421
|
+
}
|
|
1422
|
+
],
|
|
1423
|
+
stateMutability: "view"
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
type: "function",
|
|
1427
|
+
name: "paused",
|
|
1428
|
+
inputs: [],
|
|
1429
|
+
outputs: [
|
|
1430
|
+
{
|
|
1431
|
+
name: "",
|
|
1432
|
+
type: "bool",
|
|
1433
|
+
internalType: "bool"
|
|
1434
|
+
}
|
|
1435
|
+
],
|
|
1436
|
+
stateMutability: "view"
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
type: "function",
|
|
1440
|
+
name: "pendingOwner",
|
|
1441
|
+
inputs: [],
|
|
1442
|
+
outputs: [
|
|
1443
|
+
{
|
|
1444
|
+
name: "",
|
|
1445
|
+
type: "address",
|
|
1446
|
+
internalType: "address"
|
|
1447
|
+
}
|
|
1448
|
+
],
|
|
1449
|
+
stateMutability: "view"
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
type: "function",
|
|
1453
|
+
name: "priceWad",
|
|
1454
|
+
inputs: [
|
|
1455
|
+
{
|
|
1456
|
+
name: "token",
|
|
1457
|
+
type: "address",
|
|
1458
|
+
internalType: "address"
|
|
1459
|
+
}
|
|
1460
|
+
],
|
|
1461
|
+
outputs: [
|
|
1462
|
+
{
|
|
1463
|
+
name: "",
|
|
1464
|
+
type: "uint256",
|
|
1465
|
+
internalType: "uint256"
|
|
1466
|
+
}
|
|
1467
|
+
],
|
|
1468
|
+
stateMutability: "view"
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
type: "function",
|
|
1472
|
+
name: "protocolFees",
|
|
1473
|
+
inputs: [],
|
|
1474
|
+
outputs: [
|
|
1475
|
+
{
|
|
1476
|
+
name: "",
|
|
1477
|
+
type: "uint256",
|
|
1478
|
+
internalType: "uint256"
|
|
1479
|
+
}
|
|
1480
|
+
],
|
|
1481
|
+
stateMutability: "view"
|
|
1482
|
+
},
|
|
1483
|
+
{
|
|
1484
|
+
type: "function",
|
|
1485
|
+
name: "quoteBuy",
|
|
1486
|
+
inputs: [
|
|
1487
|
+
{
|
|
1488
|
+
name: "token",
|
|
1489
|
+
type: "address",
|
|
1490
|
+
internalType: "address"
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
name: "quoteIn",
|
|
1494
|
+
type: "uint256",
|
|
1495
|
+
internalType: "uint256"
|
|
1496
|
+
}
|
|
1497
|
+
],
|
|
1498
|
+
outputs: [
|
|
1499
|
+
{
|
|
1500
|
+
name: "tokenOut",
|
|
1501
|
+
type: "uint256",
|
|
1502
|
+
internalType: "uint256"
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
name: "quoteSpent",
|
|
1506
|
+
type: "uint256",
|
|
1507
|
+
internalType: "uint256"
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
name: "fee",
|
|
1511
|
+
type: "uint256",
|
|
1512
|
+
internalType: "uint256"
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
name: "reachesThreshold",
|
|
1516
|
+
type: "bool",
|
|
1517
|
+
internalType: "bool"
|
|
1518
|
+
}
|
|
1519
|
+
],
|
|
1520
|
+
stateMutability: "view"
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
type: "function",
|
|
1524
|
+
name: "quoteSell",
|
|
1525
|
+
inputs: [
|
|
1526
|
+
{
|
|
1527
|
+
name: "token",
|
|
1528
|
+
type: "address",
|
|
1529
|
+
internalType: "address"
|
|
1530
|
+
},
|
|
1531
|
+
{
|
|
1532
|
+
name: "tokenIn",
|
|
1533
|
+
type: "uint256",
|
|
1534
|
+
internalType: "uint256"
|
|
1535
|
+
}
|
|
1536
|
+
],
|
|
1537
|
+
outputs: [
|
|
1538
|
+
{
|
|
1539
|
+
name: "quoteOut",
|
|
1540
|
+
type: "uint256",
|
|
1541
|
+
internalType: "uint256"
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
name: "fee",
|
|
1545
|
+
type: "uint256",
|
|
1546
|
+
internalType: "uint256"
|
|
1547
|
+
}
|
|
1548
|
+
],
|
|
1549
|
+
stateMutability: "view"
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
type: "function",
|
|
1553
|
+
name: "quoteToken",
|
|
1554
|
+
inputs: [],
|
|
1555
|
+
outputs: [
|
|
1556
|
+
{
|
|
1557
|
+
name: "",
|
|
1558
|
+
type: "address",
|
|
1559
|
+
internalType: "address"
|
|
1560
|
+
}
|
|
1561
|
+
],
|
|
1562
|
+
stateMutability: "view"
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
type: "function",
|
|
1566
|
+
name: "registerCurve",
|
|
1567
|
+
inputs: [
|
|
1568
|
+
{
|
|
1569
|
+
name: "id",
|
|
1570
|
+
type: "uint16",
|
|
1571
|
+
internalType: "uint16"
|
|
1572
|
+
},
|
|
1573
|
+
{
|
|
1574
|
+
name: "curve",
|
|
1575
|
+
type: "address",
|
|
1576
|
+
internalType: "address"
|
|
1577
|
+
}
|
|
1578
|
+
],
|
|
1579
|
+
outputs: [],
|
|
1580
|
+
stateMutability: "nonpayable"
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
type: "function",
|
|
1584
|
+
name: "registerMigrator",
|
|
1585
|
+
inputs: [
|
|
1586
|
+
{
|
|
1587
|
+
name: "id",
|
|
1588
|
+
type: "uint16",
|
|
1589
|
+
internalType: "uint16"
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
name: "migrator",
|
|
1593
|
+
type: "address",
|
|
1594
|
+
internalType: "address"
|
|
1595
|
+
}
|
|
1596
|
+
],
|
|
1597
|
+
outputs: [],
|
|
1598
|
+
stateMutability: "nonpayable"
|
|
1599
|
+
},
|
|
1600
|
+
{
|
|
1601
|
+
type: "function",
|
|
1602
|
+
name: "sell",
|
|
1603
|
+
inputs: [
|
|
1604
|
+
{
|
|
1605
|
+
name: "token",
|
|
1606
|
+
type: "address",
|
|
1607
|
+
internalType: "address"
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
name: "tokenIn",
|
|
1611
|
+
type: "uint256",
|
|
1612
|
+
internalType: "uint256"
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
name: "minQuoteOut",
|
|
1616
|
+
type: "uint256",
|
|
1617
|
+
internalType: "uint256"
|
|
1618
|
+
},
|
|
1619
|
+
{
|
|
1620
|
+
name: "deadline",
|
|
1621
|
+
type: "uint256",
|
|
1622
|
+
internalType: "uint256"
|
|
1623
|
+
}
|
|
1624
|
+
],
|
|
1625
|
+
outputs: [
|
|
1626
|
+
{
|
|
1627
|
+
name: "quoteOut",
|
|
1628
|
+
type: "uint256",
|
|
1629
|
+
internalType: "uint256"
|
|
1630
|
+
}
|
|
1631
|
+
],
|
|
1632
|
+
stateMutability: "nonpayable"
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
type: "function",
|
|
1636
|
+
name: "setPaused",
|
|
1637
|
+
inputs: [
|
|
1638
|
+
{
|
|
1639
|
+
name: "paused_",
|
|
1640
|
+
type: "bool",
|
|
1641
|
+
internalType: "bool"
|
|
1642
|
+
}
|
|
1643
|
+
],
|
|
1644
|
+
outputs: [],
|
|
1645
|
+
stateMutability: "nonpayable"
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
type: "function",
|
|
1649
|
+
name: "setTokenPause",
|
|
1650
|
+
inputs: [
|
|
1651
|
+
{
|
|
1652
|
+
name: "token",
|
|
1653
|
+
type: "address",
|
|
1654
|
+
internalType: "address"
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
name: "mode",
|
|
1658
|
+
type: "uint8",
|
|
1659
|
+
internalType: "uint8"
|
|
1660
|
+
}
|
|
1661
|
+
],
|
|
1662
|
+
outputs: [],
|
|
1663
|
+
stateMutability: "nonpayable"
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
type: "function",
|
|
1667
|
+
name: "tokenFactory",
|
|
1668
|
+
inputs: [],
|
|
1669
|
+
outputs: [
|
|
1670
|
+
{
|
|
1671
|
+
name: "",
|
|
1672
|
+
type: "address",
|
|
1673
|
+
internalType: "contract TokenFactory"
|
|
1674
|
+
}
|
|
1675
|
+
],
|
|
1676
|
+
stateMutability: "view"
|
|
1677
|
+
},
|
|
1678
|
+
{
|
|
1679
|
+
type: "function",
|
|
1680
|
+
name: "transferOwnership",
|
|
1681
|
+
inputs: [
|
|
1682
|
+
{
|
|
1683
|
+
name: "newOwner",
|
|
1684
|
+
type: "address",
|
|
1685
|
+
internalType: "address"
|
|
1686
|
+
}
|
|
1687
|
+
],
|
|
1688
|
+
outputs: [],
|
|
1689
|
+
stateMutability: "nonpayable"
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
type: "function",
|
|
1693
|
+
name: "withdrawProtocolFees",
|
|
1694
|
+
inputs: [
|
|
1695
|
+
{
|
|
1696
|
+
name: "recipient",
|
|
1697
|
+
type: "address",
|
|
1698
|
+
internalType: "address"
|
|
1699
|
+
},
|
|
1700
|
+
{
|
|
1701
|
+
name: "amount",
|
|
1702
|
+
type: "uint256",
|
|
1703
|
+
internalType: "uint256"
|
|
1704
|
+
}
|
|
1705
|
+
],
|
|
1706
|
+
outputs: [],
|
|
1707
|
+
stateMutability: "nonpayable"
|
|
1708
|
+
},
|
|
1709
|
+
{
|
|
1710
|
+
type: "event",
|
|
1711
|
+
name: "CurveRegistered",
|
|
1712
|
+
inputs: [
|
|
1713
|
+
{
|
|
1714
|
+
name: "id",
|
|
1715
|
+
type: "uint16",
|
|
1716
|
+
indexed: true,
|
|
1717
|
+
internalType: "uint16"
|
|
1718
|
+
},
|
|
1719
|
+
{
|
|
1720
|
+
name: "curve",
|
|
1721
|
+
type: "address",
|
|
1722
|
+
indexed: true,
|
|
1723
|
+
internalType: "address"
|
|
1724
|
+
}
|
|
1725
|
+
],
|
|
1726
|
+
anonymous: false
|
|
1727
|
+
},
|
|
1728
|
+
{
|
|
1729
|
+
type: "event",
|
|
1730
|
+
name: "MigrationCompleted",
|
|
1731
|
+
inputs: [
|
|
1732
|
+
{
|
|
1733
|
+
name: "token",
|
|
1734
|
+
type: "address",
|
|
1735
|
+
indexed: true,
|
|
1736
|
+
internalType: "address"
|
|
1737
|
+
},
|
|
1738
|
+
{
|
|
1739
|
+
name: "pool",
|
|
1740
|
+
type: "address",
|
|
1741
|
+
indexed: true,
|
|
1742
|
+
internalType: "address"
|
|
1743
|
+
},
|
|
1744
|
+
{
|
|
1745
|
+
name: "liquidity",
|
|
1746
|
+
type: "uint256",
|
|
1747
|
+
indexed: false,
|
|
1748
|
+
internalType: "uint256"
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
name: "lpRecipient",
|
|
1752
|
+
type: "address",
|
|
1753
|
+
indexed: false,
|
|
1754
|
+
internalType: "address"
|
|
1755
|
+
}
|
|
1756
|
+
],
|
|
1757
|
+
anonymous: false
|
|
1758
|
+
},
|
|
1759
|
+
{
|
|
1760
|
+
type: "event",
|
|
1761
|
+
name: "MigrationStarted",
|
|
1762
|
+
inputs: [
|
|
1763
|
+
{
|
|
1764
|
+
name: "token",
|
|
1765
|
+
type: "address",
|
|
1766
|
+
indexed: true,
|
|
1767
|
+
internalType: "address"
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
name: "tokenAmount",
|
|
1771
|
+
type: "uint256",
|
|
1772
|
+
indexed: false,
|
|
1773
|
+
internalType: "uint256"
|
|
1774
|
+
},
|
|
1775
|
+
{
|
|
1776
|
+
name: "quoteAmount",
|
|
1777
|
+
type: "uint256",
|
|
1778
|
+
indexed: false,
|
|
1779
|
+
internalType: "uint256"
|
|
1780
|
+
}
|
|
1781
|
+
],
|
|
1782
|
+
anonymous: false
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
type: "event",
|
|
1786
|
+
name: "MigratorRegistered",
|
|
1787
|
+
inputs: [
|
|
1788
|
+
{
|
|
1789
|
+
name: "id",
|
|
1790
|
+
type: "uint16",
|
|
1791
|
+
indexed: true,
|
|
1792
|
+
internalType: "uint16"
|
|
1793
|
+
},
|
|
1794
|
+
{
|
|
1795
|
+
name: "migrator",
|
|
1796
|
+
type: "address",
|
|
1797
|
+
indexed: true,
|
|
1798
|
+
internalType: "address"
|
|
1799
|
+
}
|
|
1800
|
+
],
|
|
1801
|
+
anonymous: false
|
|
1802
|
+
},
|
|
1803
|
+
{
|
|
1804
|
+
type: "event",
|
|
1805
|
+
name: "OwnershipTransferStarted",
|
|
1806
|
+
inputs: [
|
|
1807
|
+
{
|
|
1808
|
+
name: "currentOwner",
|
|
1809
|
+
type: "address",
|
|
1810
|
+
indexed: true,
|
|
1811
|
+
internalType: "address"
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
name: "pendingOwner",
|
|
1815
|
+
type: "address",
|
|
1816
|
+
indexed: true,
|
|
1817
|
+
internalType: "address"
|
|
1818
|
+
}
|
|
1819
|
+
],
|
|
1820
|
+
anonymous: false
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
type: "event",
|
|
1824
|
+
name: "OwnershipTransferred",
|
|
1825
|
+
inputs: [
|
|
1826
|
+
{
|
|
1827
|
+
name: "previousOwner",
|
|
1828
|
+
type: "address",
|
|
1829
|
+
indexed: true,
|
|
1830
|
+
internalType: "address"
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
name: "newOwner",
|
|
1834
|
+
type: "address",
|
|
1835
|
+
indexed: true,
|
|
1836
|
+
internalType: "address"
|
|
1837
|
+
}
|
|
1838
|
+
],
|
|
1839
|
+
anonymous: false
|
|
1840
|
+
},
|
|
1841
|
+
{
|
|
1842
|
+
type: "event",
|
|
1843
|
+
name: "Paused",
|
|
1844
|
+
inputs: [
|
|
1845
|
+
{
|
|
1846
|
+
name: "paused",
|
|
1847
|
+
type: "bool",
|
|
1848
|
+
indexed: false,
|
|
1849
|
+
internalType: "bool"
|
|
1850
|
+
}
|
|
1851
|
+
],
|
|
1852
|
+
anonymous: false
|
|
1853
|
+
},
|
|
1854
|
+
{
|
|
1855
|
+
type: "event",
|
|
1856
|
+
name: "ProtocolFeesWithdrawn",
|
|
1857
|
+
inputs: [
|
|
1858
|
+
{
|
|
1859
|
+
name: "recipient",
|
|
1860
|
+
type: "address",
|
|
1861
|
+
indexed: true,
|
|
1862
|
+
internalType: "address"
|
|
1863
|
+
},
|
|
1864
|
+
{
|
|
1865
|
+
name: "amount",
|
|
1866
|
+
type: "uint256",
|
|
1867
|
+
indexed: false,
|
|
1868
|
+
internalType: "uint256"
|
|
1869
|
+
}
|
|
1870
|
+
],
|
|
1871
|
+
anonymous: false
|
|
1872
|
+
},
|
|
1873
|
+
{
|
|
1874
|
+
type: "event",
|
|
1875
|
+
name: "TokenCreated",
|
|
1876
|
+
inputs: [
|
|
1877
|
+
{
|
|
1878
|
+
name: "token",
|
|
1879
|
+
type: "address",
|
|
1880
|
+
indexed: true,
|
|
1881
|
+
internalType: "address"
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
name: "creator",
|
|
1885
|
+
type: "address",
|
|
1886
|
+
indexed: true,
|
|
1887
|
+
internalType: "address"
|
|
1888
|
+
},
|
|
1889
|
+
{
|
|
1890
|
+
name: "name",
|
|
1891
|
+
type: "string",
|
|
1892
|
+
indexed: false,
|
|
1893
|
+
internalType: "string"
|
|
1894
|
+
},
|
|
1895
|
+
{
|
|
1896
|
+
name: "symbol",
|
|
1897
|
+
type: "string",
|
|
1898
|
+
indexed: false,
|
|
1899
|
+
internalType: "string"
|
|
1900
|
+
},
|
|
1901
|
+
{
|
|
1902
|
+
name: "metadata",
|
|
1903
|
+
type: "string",
|
|
1904
|
+
indexed: false,
|
|
1905
|
+
internalType: "string"
|
|
1906
|
+
},
|
|
1907
|
+
{
|
|
1908
|
+
name: "curveId",
|
|
1909
|
+
type: "uint16",
|
|
1910
|
+
indexed: false,
|
|
1911
|
+
internalType: "uint16"
|
|
1912
|
+
},
|
|
1913
|
+
{
|
|
1914
|
+
name: "migratorId",
|
|
1915
|
+
type: "uint16",
|
|
1916
|
+
indexed: false,
|
|
1917
|
+
internalType: "uint16"
|
|
1918
|
+
}
|
|
1919
|
+
],
|
|
1920
|
+
anonymous: false
|
|
1921
|
+
},
|
|
1922
|
+
{
|
|
1923
|
+
type: "event",
|
|
1924
|
+
name: "TokenPauseSet",
|
|
1925
|
+
inputs: [
|
|
1926
|
+
{
|
|
1927
|
+
name: "token",
|
|
1928
|
+
type: "address",
|
|
1929
|
+
indexed: true,
|
|
1930
|
+
internalType: "address"
|
|
1931
|
+
},
|
|
1932
|
+
{
|
|
1933
|
+
name: "mode",
|
|
1934
|
+
type: "uint8",
|
|
1935
|
+
indexed: false,
|
|
1936
|
+
internalType: "uint8"
|
|
1937
|
+
}
|
|
1938
|
+
],
|
|
1939
|
+
anonymous: false
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
type: "event",
|
|
1943
|
+
name: "Trade",
|
|
1944
|
+
inputs: [
|
|
1945
|
+
{
|
|
1946
|
+
name: "token",
|
|
1947
|
+
type: "address",
|
|
1948
|
+
indexed: true,
|
|
1949
|
+
internalType: "address"
|
|
1950
|
+
},
|
|
1951
|
+
{
|
|
1952
|
+
name: "trader",
|
|
1953
|
+
type: "address",
|
|
1954
|
+
indexed: true,
|
|
1955
|
+
internalType: "address"
|
|
1956
|
+
},
|
|
1957
|
+
{
|
|
1958
|
+
name: "isBuy",
|
|
1959
|
+
type: "bool",
|
|
1960
|
+
indexed: true,
|
|
1961
|
+
internalType: "bool"
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
name: "tokenAmount",
|
|
1965
|
+
type: "uint256",
|
|
1966
|
+
indexed: false,
|
|
1967
|
+
internalType: "uint256"
|
|
1968
|
+
},
|
|
1969
|
+
{
|
|
1970
|
+
name: "quoteAmount",
|
|
1971
|
+
type: "uint256",
|
|
1972
|
+
indexed: false,
|
|
1973
|
+
internalType: "uint256"
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
name: "fee",
|
|
1977
|
+
type: "uint256",
|
|
1978
|
+
indexed: false,
|
|
1979
|
+
internalType: "uint256"
|
|
1980
|
+
}
|
|
1981
|
+
],
|
|
1982
|
+
anonymous: false
|
|
1983
|
+
},
|
|
1984
|
+
{
|
|
1985
|
+
type: "error",
|
|
1986
|
+
name: "AccountingOverflow",
|
|
1987
|
+
inputs: []
|
|
1988
|
+
},
|
|
1989
|
+
{
|
|
1990
|
+
type: "error",
|
|
1991
|
+
name: "DeadlineExpired",
|
|
1992
|
+
inputs: []
|
|
1993
|
+
},
|
|
1994
|
+
{
|
|
1995
|
+
type: "error",
|
|
1996
|
+
name: "InvalidAmount",
|
|
1997
|
+
inputs: []
|
|
1998
|
+
},
|
|
1999
|
+
{
|
|
2000
|
+
type: "error",
|
|
2001
|
+
name: "InvalidConfig",
|
|
2002
|
+
inputs: []
|
|
2003
|
+
},
|
|
2004
|
+
{
|
|
2005
|
+
type: "error",
|
|
2006
|
+
name: "InvalidStatus",
|
|
2007
|
+
inputs: []
|
|
2008
|
+
},
|
|
2009
|
+
{
|
|
2010
|
+
type: "error",
|
|
2011
|
+
name: "LaunchBlockTradingDisabled",
|
|
2012
|
+
inputs: []
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
type: "error",
|
|
2016
|
+
name: "ProtocolPaused",
|
|
2017
|
+
inputs: []
|
|
2018
|
+
},
|
|
2019
|
+
{
|
|
2020
|
+
type: "error",
|
|
2021
|
+
name: "Reentrancy",
|
|
2022
|
+
inputs: []
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
type: "error",
|
|
2026
|
+
name: "SlippageExceeded",
|
|
2027
|
+
inputs: []
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
type: "error",
|
|
2031
|
+
name: "TransferFailed",
|
|
2032
|
+
inputs: []
|
|
2033
|
+
},
|
|
2034
|
+
{
|
|
2035
|
+
type: "error",
|
|
2036
|
+
name: "Unauthorized",
|
|
2037
|
+
inputs: []
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
type: "error",
|
|
2041
|
+
name: "UnknownModule",
|
|
2042
|
+
inputs: []
|
|
2043
|
+
}
|
|
2044
|
+
];
|
|
2045
|
+
|
|
2046
|
+
// src/abi/generated/token-factory.ts
|
|
2047
|
+
var tokenFactoryAbi = [
|
|
2048
|
+
{
|
|
2049
|
+
type: "constructor",
|
|
2050
|
+
inputs: [
|
|
2051
|
+
{
|
|
2052
|
+
name: "owner_",
|
|
2053
|
+
type: "address",
|
|
2054
|
+
internalType: "address"
|
|
2055
|
+
}
|
|
2056
|
+
],
|
|
2057
|
+
stateMutability: "nonpayable"
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
type: "function",
|
|
2061
|
+
name: "create",
|
|
2062
|
+
inputs: [
|
|
2063
|
+
{
|
|
2064
|
+
name: "name",
|
|
2065
|
+
type: "string",
|
|
2066
|
+
internalType: "string"
|
|
2067
|
+
},
|
|
2068
|
+
{
|
|
2069
|
+
name: "symbol",
|
|
2070
|
+
type: "string",
|
|
2071
|
+
internalType: "string"
|
|
2072
|
+
},
|
|
2073
|
+
{
|
|
2074
|
+
name: "supply",
|
|
2075
|
+
type: "uint256",
|
|
2076
|
+
internalType: "uint256"
|
|
2077
|
+
},
|
|
2078
|
+
{
|
|
2079
|
+
name: "salt",
|
|
2080
|
+
type: "bytes32",
|
|
2081
|
+
internalType: "bytes32"
|
|
2082
|
+
}
|
|
2083
|
+
],
|
|
2084
|
+
outputs: [
|
|
2085
|
+
{
|
|
2086
|
+
name: "token",
|
|
2087
|
+
type: "address",
|
|
2088
|
+
internalType: "address"
|
|
2089
|
+
}
|
|
2090
|
+
],
|
|
2091
|
+
stateMutability: "nonpayable"
|
|
2092
|
+
},
|
|
2093
|
+
{
|
|
2094
|
+
type: "function",
|
|
2095
|
+
name: "owner",
|
|
2096
|
+
inputs: [],
|
|
2097
|
+
outputs: [
|
|
2098
|
+
{
|
|
2099
|
+
name: "",
|
|
2100
|
+
type: "address",
|
|
2101
|
+
internalType: "address"
|
|
2102
|
+
}
|
|
2103
|
+
],
|
|
2104
|
+
stateMutability: "view"
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
type: "function",
|
|
2108
|
+
name: "portal",
|
|
2109
|
+
inputs: [],
|
|
2110
|
+
outputs: [
|
|
2111
|
+
{
|
|
2112
|
+
name: "",
|
|
2113
|
+
type: "address",
|
|
2114
|
+
internalType: "address"
|
|
2115
|
+
}
|
|
2116
|
+
],
|
|
2117
|
+
stateMutability: "view"
|
|
2118
|
+
},
|
|
2119
|
+
{
|
|
2120
|
+
type: "function",
|
|
2121
|
+
name: "predictAddress",
|
|
2122
|
+
inputs: [
|
|
2123
|
+
{
|
|
2124
|
+
name: "name",
|
|
2125
|
+
type: "string",
|
|
2126
|
+
internalType: "string"
|
|
2127
|
+
},
|
|
2128
|
+
{
|
|
2129
|
+
name: "symbol",
|
|
2130
|
+
type: "string",
|
|
2131
|
+
internalType: "string"
|
|
2132
|
+
},
|
|
2133
|
+
{
|
|
2134
|
+
name: "supply",
|
|
2135
|
+
type: "uint256",
|
|
2136
|
+
internalType: "uint256"
|
|
2137
|
+
},
|
|
2138
|
+
{
|
|
2139
|
+
name: "salt",
|
|
2140
|
+
type: "bytes32",
|
|
2141
|
+
internalType: "bytes32"
|
|
2142
|
+
}
|
|
2143
|
+
],
|
|
2144
|
+
outputs: [
|
|
2145
|
+
{
|
|
2146
|
+
name: "predicted",
|
|
2147
|
+
type: "address",
|
|
2148
|
+
internalType: "address"
|
|
2149
|
+
}
|
|
2150
|
+
],
|
|
2151
|
+
stateMutability: "view"
|
|
2152
|
+
},
|
|
2153
|
+
{
|
|
2154
|
+
type: "function",
|
|
2155
|
+
name: "setPortal",
|
|
2156
|
+
inputs: [
|
|
2157
|
+
{
|
|
2158
|
+
name: "portal_",
|
|
2159
|
+
type: "address",
|
|
2160
|
+
internalType: "address"
|
|
2161
|
+
}
|
|
2162
|
+
],
|
|
2163
|
+
outputs: [],
|
|
2164
|
+
stateMutability: "nonpayable"
|
|
2165
|
+
},
|
|
2166
|
+
{
|
|
2167
|
+
type: "error",
|
|
2168
|
+
name: "PortalAlreadySet",
|
|
2169
|
+
inputs: []
|
|
2170
|
+
},
|
|
2171
|
+
{
|
|
2172
|
+
type: "error",
|
|
2173
|
+
name: "Unauthorized",
|
|
2174
|
+
inputs: []
|
|
2175
|
+
},
|
|
2176
|
+
{
|
|
2177
|
+
type: "error",
|
|
2178
|
+
name: "ZeroAddress",
|
|
2179
|
+
inputs: []
|
|
2180
|
+
}
|
|
2181
|
+
];
|
|
2182
|
+
|
|
2183
|
+
// src/abi/generated/v3-migrator.ts
|
|
2184
|
+
var v3MigratorAbi = [
|
|
2185
|
+
{
|
|
2186
|
+
type: "constructor",
|
|
2187
|
+
inputs: [
|
|
2188
|
+
{
|
|
2189
|
+
name: "portal_",
|
|
2190
|
+
type: "address",
|
|
2191
|
+
internalType: "address"
|
|
2192
|
+
},
|
|
2193
|
+
{
|
|
2194
|
+
name: "factory_",
|
|
2195
|
+
type: "address",
|
|
2196
|
+
internalType: "address"
|
|
2197
|
+
},
|
|
2198
|
+
{
|
|
2199
|
+
name: "positionManager_",
|
|
2200
|
+
type: "address",
|
|
2201
|
+
internalType: "address"
|
|
2202
|
+
},
|
|
2203
|
+
{
|
|
2204
|
+
name: "fee_",
|
|
2205
|
+
type: "uint24",
|
|
2206
|
+
internalType: "uint24"
|
|
2207
|
+
},
|
|
2208
|
+
{
|
|
2209
|
+
name: "locker_",
|
|
2210
|
+
type: "address",
|
|
2211
|
+
internalType: "address"
|
|
2212
|
+
}
|
|
2213
|
+
],
|
|
2214
|
+
stateMutability: "nonpayable"
|
|
2215
|
+
},
|
|
2216
|
+
{
|
|
2217
|
+
type: "function",
|
|
2218
|
+
name: "SQRT_RATIO_TOKEN0_LOWER_X96",
|
|
2219
|
+
inputs: [],
|
|
2220
|
+
outputs: [
|
|
2221
|
+
{
|
|
2222
|
+
name: "",
|
|
2223
|
+
type: "uint160",
|
|
2224
|
+
internalType: "uint160"
|
|
2225
|
+
}
|
|
2226
|
+
],
|
|
2227
|
+
stateMutability: "view"
|
|
2228
|
+
},
|
|
2229
|
+
{
|
|
2230
|
+
type: "function",
|
|
2231
|
+
name: "SQRT_RATIO_TOKEN0_UPPER_X96",
|
|
2232
|
+
inputs: [],
|
|
2233
|
+
outputs: [
|
|
2234
|
+
{
|
|
2235
|
+
name: "",
|
|
2236
|
+
type: "uint160",
|
|
2237
|
+
internalType: "uint160"
|
|
2238
|
+
}
|
|
2239
|
+
],
|
|
2240
|
+
stateMutability: "view"
|
|
2241
|
+
},
|
|
2242
|
+
{
|
|
2243
|
+
type: "function",
|
|
2244
|
+
name: "TOKEN0_TICK_LOWER",
|
|
2245
|
+
inputs: [],
|
|
2246
|
+
outputs: [
|
|
2247
|
+
{
|
|
2248
|
+
name: "",
|
|
2249
|
+
type: "int24",
|
|
2250
|
+
internalType: "int24"
|
|
2251
|
+
}
|
|
2252
|
+
],
|
|
2253
|
+
stateMutability: "view"
|
|
2254
|
+
},
|
|
2255
|
+
{
|
|
2256
|
+
type: "function",
|
|
2257
|
+
name: "TOKEN0_TICK_UPPER",
|
|
2258
|
+
inputs: [],
|
|
2259
|
+
outputs: [
|
|
2260
|
+
{
|
|
2261
|
+
name: "",
|
|
2262
|
+
type: "int24",
|
|
2263
|
+
internalType: "int24"
|
|
2264
|
+
}
|
|
2265
|
+
],
|
|
2266
|
+
stateMutability: "view"
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
type: "function",
|
|
2270
|
+
name: "encodeSqrtRatioX96",
|
|
2271
|
+
inputs: [
|
|
2272
|
+
{
|
|
2273
|
+
name: "amount1",
|
|
2274
|
+
type: "uint256",
|
|
2275
|
+
internalType: "uint256"
|
|
2276
|
+
},
|
|
2277
|
+
{
|
|
2278
|
+
name: "amount0",
|
|
2279
|
+
type: "uint256",
|
|
2280
|
+
internalType: "uint256"
|
|
2281
|
+
}
|
|
2282
|
+
],
|
|
2283
|
+
outputs: [
|
|
2284
|
+
{
|
|
2285
|
+
name: "",
|
|
2286
|
+
type: "uint160",
|
|
2287
|
+
internalType: "uint160"
|
|
2288
|
+
}
|
|
2289
|
+
],
|
|
2290
|
+
stateMutability: "pure"
|
|
2291
|
+
},
|
|
2292
|
+
{
|
|
2293
|
+
type: "function",
|
|
2294
|
+
name: "factory",
|
|
2295
|
+
inputs: [],
|
|
2296
|
+
outputs: [
|
|
2297
|
+
{
|
|
2298
|
+
name: "",
|
|
2299
|
+
type: "address",
|
|
2300
|
+
internalType: "address"
|
|
2301
|
+
}
|
|
2302
|
+
],
|
|
2303
|
+
stateMutability: "view"
|
|
2304
|
+
},
|
|
2305
|
+
{
|
|
2306
|
+
type: "function",
|
|
2307
|
+
name: "fee",
|
|
2308
|
+
inputs: [],
|
|
2309
|
+
outputs: [
|
|
2310
|
+
{
|
|
2311
|
+
name: "",
|
|
2312
|
+
type: "uint24",
|
|
2313
|
+
internalType: "uint24"
|
|
2314
|
+
}
|
|
2315
|
+
],
|
|
2316
|
+
stateMutability: "view"
|
|
2317
|
+
},
|
|
2318
|
+
{
|
|
2319
|
+
type: "function",
|
|
2320
|
+
name: "locker",
|
|
2321
|
+
inputs: [],
|
|
2322
|
+
outputs: [
|
|
2323
|
+
{
|
|
2324
|
+
name: "",
|
|
2325
|
+
type: "address",
|
|
2326
|
+
internalType: "address"
|
|
2327
|
+
}
|
|
2328
|
+
],
|
|
2329
|
+
stateMutability: "view"
|
|
2330
|
+
},
|
|
2331
|
+
{
|
|
2332
|
+
type: "function",
|
|
2333
|
+
name: "migrate",
|
|
2334
|
+
inputs: [
|
|
2335
|
+
{
|
|
2336
|
+
name: "token",
|
|
2337
|
+
type: "address",
|
|
2338
|
+
internalType: "address"
|
|
2339
|
+
},
|
|
2340
|
+
{
|
|
2341
|
+
name: "quoteToken",
|
|
2342
|
+
type: "address",
|
|
2343
|
+
internalType: "address"
|
|
2344
|
+
},
|
|
2345
|
+
{
|
|
2346
|
+
name: "tokenAmount",
|
|
2347
|
+
type: "uint256",
|
|
2348
|
+
internalType: "uint256"
|
|
2349
|
+
},
|
|
2350
|
+
{
|
|
2351
|
+
name: "quoteAmount",
|
|
2352
|
+
type: "uint256",
|
|
2353
|
+
internalType: "uint256"
|
|
2354
|
+
},
|
|
2355
|
+
{
|
|
2356
|
+
name: "lpRecipient",
|
|
2357
|
+
type: "address",
|
|
2358
|
+
internalType: "address"
|
|
2359
|
+
},
|
|
2360
|
+
{
|
|
2361
|
+
name: "data",
|
|
2362
|
+
type: "bytes",
|
|
2363
|
+
internalType: "bytes"
|
|
2364
|
+
}
|
|
2365
|
+
],
|
|
2366
|
+
outputs: [
|
|
2367
|
+
{
|
|
2368
|
+
name: "pool",
|
|
2369
|
+
type: "address",
|
|
2370
|
+
internalType: "address"
|
|
2371
|
+
},
|
|
2372
|
+
{
|
|
2373
|
+
name: "liquidityOut",
|
|
2374
|
+
type: "uint256",
|
|
2375
|
+
internalType: "uint256"
|
|
2376
|
+
}
|
|
2377
|
+
],
|
|
2378
|
+
stateMutability: "nonpayable"
|
|
2379
|
+
},
|
|
2380
|
+
{
|
|
2381
|
+
type: "function",
|
|
2382
|
+
name: "portal",
|
|
2383
|
+
inputs: [],
|
|
2384
|
+
outputs: [
|
|
2385
|
+
{
|
|
2386
|
+
name: "",
|
|
2387
|
+
type: "address",
|
|
2388
|
+
internalType: "address"
|
|
2389
|
+
}
|
|
2390
|
+
],
|
|
2391
|
+
stateMutability: "view"
|
|
2392
|
+
},
|
|
2393
|
+
{
|
|
2394
|
+
type: "function",
|
|
2395
|
+
name: "positionManager",
|
|
2396
|
+
inputs: [],
|
|
2397
|
+
outputs: [
|
|
2398
|
+
{
|
|
2399
|
+
name: "",
|
|
2400
|
+
type: "address",
|
|
2401
|
+
internalType: "address"
|
|
2402
|
+
}
|
|
2403
|
+
],
|
|
2404
|
+
stateMutability: "view"
|
|
2405
|
+
},
|
|
2406
|
+
{
|
|
2407
|
+
type: "function",
|
|
2408
|
+
name: "preparePool",
|
|
2409
|
+
inputs: [
|
|
2410
|
+
{
|
|
2411
|
+
name: "token",
|
|
2412
|
+
type: "address",
|
|
2413
|
+
internalType: "address"
|
|
2414
|
+
},
|
|
2415
|
+
{
|
|
2416
|
+
name: "quoteToken",
|
|
2417
|
+
type: "address",
|
|
2418
|
+
internalType: "address"
|
|
2419
|
+
},
|
|
2420
|
+
{
|
|
2421
|
+
name: "graduationPriceWad",
|
|
2422
|
+
type: "uint256",
|
|
2423
|
+
internalType: "uint256"
|
|
2424
|
+
}
|
|
2425
|
+
],
|
|
2426
|
+
outputs: [
|
|
2427
|
+
{
|
|
2428
|
+
name: "pool",
|
|
2429
|
+
type: "address",
|
|
2430
|
+
internalType: "address"
|
|
2431
|
+
}
|
|
2432
|
+
],
|
|
2433
|
+
stateMutability: "nonpayable"
|
|
2434
|
+
},
|
|
2435
|
+
{
|
|
2436
|
+
type: "event",
|
|
2437
|
+
name: "MigrationDust",
|
|
2438
|
+
inputs: [
|
|
2439
|
+
{
|
|
2440
|
+
name: "asset",
|
|
2441
|
+
type: "address",
|
|
2442
|
+
indexed: true,
|
|
2443
|
+
internalType: "address"
|
|
2444
|
+
},
|
|
2445
|
+
{
|
|
2446
|
+
name: "recipient",
|
|
2447
|
+
type: "address",
|
|
2448
|
+
indexed: true,
|
|
2449
|
+
internalType: "address"
|
|
2450
|
+
},
|
|
2451
|
+
{
|
|
2452
|
+
name: "amount",
|
|
2453
|
+
type: "uint256",
|
|
2454
|
+
indexed: false,
|
|
2455
|
+
internalType: "uint256"
|
|
2456
|
+
}
|
|
2457
|
+
],
|
|
2458
|
+
anonymous: false
|
|
2459
|
+
},
|
|
2460
|
+
{
|
|
2461
|
+
type: "event",
|
|
2462
|
+
name: "PositionMinted",
|
|
2463
|
+
inputs: [
|
|
2464
|
+
{
|
|
2465
|
+
name: "pool",
|
|
2466
|
+
type: "address",
|
|
2467
|
+
indexed: true,
|
|
2468
|
+
internalType: "address"
|
|
2469
|
+
},
|
|
2470
|
+
{
|
|
2471
|
+
name: "tokenId",
|
|
2472
|
+
type: "uint256",
|
|
2473
|
+
indexed: true,
|
|
2474
|
+
internalType: "uint256"
|
|
2475
|
+
},
|
|
2476
|
+
{
|
|
2477
|
+
name: "liquidity",
|
|
2478
|
+
type: "uint128",
|
|
2479
|
+
indexed: false,
|
|
2480
|
+
internalType: "uint128"
|
|
2481
|
+
},
|
|
2482
|
+
{
|
|
2483
|
+
name: "amount0",
|
|
2484
|
+
type: "uint256",
|
|
2485
|
+
indexed: false,
|
|
2486
|
+
internalType: "uint256"
|
|
2487
|
+
},
|
|
2488
|
+
{
|
|
2489
|
+
name: "amount1",
|
|
2490
|
+
type: "uint256",
|
|
2491
|
+
indexed: false,
|
|
2492
|
+
internalType: "uint256"
|
|
2493
|
+
}
|
|
2494
|
+
],
|
|
2495
|
+
anonymous: false
|
|
2496
|
+
},
|
|
2497
|
+
{
|
|
2498
|
+
type: "error",
|
|
2499
|
+
name: "InvalidAmount",
|
|
2500
|
+
inputs: []
|
|
2501
|
+
},
|
|
2502
|
+
{
|
|
2503
|
+
type: "error",
|
|
2504
|
+
name: "InvalidConfig",
|
|
2505
|
+
inputs: []
|
|
2506
|
+
},
|
|
2507
|
+
{
|
|
2508
|
+
type: "error",
|
|
2509
|
+
name: "PoolAlreadyInitialized",
|
|
2510
|
+
inputs: []
|
|
2511
|
+
},
|
|
2512
|
+
{
|
|
2513
|
+
type: "error",
|
|
2514
|
+
name: "PoolNotPrepared",
|
|
2515
|
+
inputs: []
|
|
2516
|
+
},
|
|
2517
|
+
{
|
|
2518
|
+
type: "error",
|
|
2519
|
+
name: "TransferFailed",
|
|
2520
|
+
inputs: []
|
|
2521
|
+
},
|
|
2522
|
+
{
|
|
2523
|
+
type: "error",
|
|
2524
|
+
name: "Unauthorized",
|
|
2525
|
+
inputs: []
|
|
2526
|
+
}
|
|
2527
|
+
];
|
|
2528
|
+
|
|
2529
|
+
// src/converters/state.ts
|
|
2530
|
+
var import_viem = require("viem");
|
|
2531
|
+
var InvalidLaunchpadStateError = class extends Error {
|
|
2532
|
+
field;
|
|
2533
|
+
constructor(field, message) {
|
|
2534
|
+
super(message);
|
|
2535
|
+
this.name = "InvalidLaunchpadStateError";
|
|
2536
|
+
this.field = field;
|
|
2537
|
+
}
|
|
2538
|
+
};
|
|
2539
|
+
var phasesByStatus = ["invalid", "bonding", "migrating", "graduated"];
|
|
2540
|
+
var pauseModes = ["active", "buyPaused", "tradingPaused"];
|
|
2541
|
+
function toLaunchpadPhase(status) {
|
|
2542
|
+
const phase = phasesByStatus[status];
|
|
2543
|
+
if (phase === void 0) {
|
|
2544
|
+
throw new InvalidLaunchpadStateError("status", `Unknown Portal token status: ${status}.`);
|
|
2545
|
+
}
|
|
2546
|
+
return phase;
|
|
2547
|
+
}
|
|
2548
|
+
function toLaunchpadPauseMode(pauseMode) {
|
|
2549
|
+
const mode = pauseModes[pauseMode];
|
|
2550
|
+
if (mode === void 0) {
|
|
2551
|
+
throw new InvalidLaunchpadStateError("pauseMode", `Unknown Portal pause mode: ${pauseMode}.`);
|
|
2552
|
+
}
|
|
2553
|
+
return mode;
|
|
2554
|
+
}
|
|
2555
|
+
function toLaunchpadTokenState(id, raw) {
|
|
2556
|
+
const phase = toLaunchpadPhase(raw.status);
|
|
2557
|
+
const hasPool = phase !== "invalid" && !(0, import_viem.isAddressEqual)(raw.dexPool, import_viem.zeroAddress);
|
|
2558
|
+
return Object.freeze({
|
|
2559
|
+
id,
|
|
2560
|
+
phase,
|
|
2561
|
+
tokenVersion: raw.tokenVersion,
|
|
2562
|
+
curveId: raw.curveId,
|
|
2563
|
+
migratorId: raw.migratorId,
|
|
2564
|
+
quoteReserve: raw.quoteReserve,
|
|
2565
|
+
circulatingSupply: raw.circulatingSupply,
|
|
2566
|
+
creator: (0, import_viem.getAddress)(raw.creator),
|
|
2567
|
+
...hasPool ? { dexPool: (0, import_viem.getAddress)(raw.dexPool) } : {},
|
|
2568
|
+
launchBlock: raw.launchBlock,
|
|
2569
|
+
protectionBlocks: raw.protectionBlocks,
|
|
2570
|
+
pauseMode: toLaunchpadPauseMode(raw.pauseMode)
|
|
2571
|
+
});
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
// src/math/protection.ts
|
|
2575
|
+
var TRADE_FEE_BPS = 100;
|
|
2576
|
+
var BPS = 1e4;
|
|
2577
|
+
var MAX_PROTECTION_BLOCKS = 6;
|
|
2578
|
+
var protectionFeeLadder = [BPS, 5e3, 2500, 1500, 1e3, 500];
|
|
2579
|
+
function tradeFeeBpsAt(launchBlock, protectionBlocks, blockNumber) {
|
|
2580
|
+
if (blockNumber < launchBlock) {
|
|
2581
|
+
throw new RangeError("blockNumber must not precede the token's launch block.");
|
|
2582
|
+
}
|
|
2583
|
+
const blockDelta = blockNumber - launchBlock;
|
|
2584
|
+
if (blockDelta >= BigInt(protectionBlocks)) return TRADE_FEE_BPS;
|
|
2585
|
+
return protectionFeeLadder[Number(blockDelta)] ?? TRADE_FEE_BPS;
|
|
2586
|
+
}
|
|
2587
|
+
function isLaunchBlockTradingDisabled(launchBlock, protectionBlocks, blockNumber) {
|
|
2588
|
+
return tradeFeeBpsAt(launchBlock, protectionBlocks, blockNumber) === BPS;
|
|
2589
|
+
}
|
|
2590
|
+
function firstTradableBlock(launchBlock, protectionBlocks) {
|
|
2591
|
+
return protectionBlocks === 0 ? launchBlock : launchBlock + 1n;
|
|
2592
|
+
}
|
|
2593
|
+
function toLaunchpadTradeAvailability(state, blockNumber, protocolPaused) {
|
|
2594
|
+
const feeBps = state.phase === "bonding" ? tradeFeeBpsAt(state.launchBlock, state.protectionBlocks, blockNumber) : TRADE_FEE_BPS;
|
|
2595
|
+
const launchBlocked = state.phase === "bonding" && feeBps === BPS;
|
|
2596
|
+
const blockedReason = (() => {
|
|
2597
|
+
if (state.phase === "invalid") return "invalidToken";
|
|
2598
|
+
if (state.phase === "migrating") return "migrating";
|
|
2599
|
+
if (state.phase === "graduated") return "graduated";
|
|
2600
|
+
if (protocolPaused) return "protocolPaused";
|
|
2601
|
+
if (state.pauseMode === "tradingPaused") return "tradingPaused";
|
|
2602
|
+
if (launchBlocked) return "launchBlock";
|
|
2603
|
+
if (state.pauseMode === "buyPaused") return "buyPaused";
|
|
2604
|
+
return void 0;
|
|
2605
|
+
})();
|
|
2606
|
+
const tradable = state.phase === "bonding" && !protocolPaused && !launchBlocked;
|
|
2607
|
+
return Object.freeze({
|
|
2608
|
+
phase: state.phase,
|
|
2609
|
+
protocolPaused,
|
|
2610
|
+
pauseMode: state.pauseMode,
|
|
2611
|
+
// `_buy` rejects any non-zero pauseMode; `sell` only rejects mode 2.
|
|
2612
|
+
canBuy: tradable && state.pauseMode === "active",
|
|
2613
|
+
canSell: tradable && state.pauseMode !== "tradingPaused",
|
|
2614
|
+
feeBps,
|
|
2615
|
+
blockNumber,
|
|
2616
|
+
...launchBlocked ? { nextTradableBlock: firstTradableBlock(state.launchBlock, state.protectionBlocks) } : {},
|
|
2617
|
+
...blockedReason ? { blockedReason } : {}
|
|
2618
|
+
});
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
// src/actions/read.ts
|
|
2622
|
+
var InvalidLaunchpadReadInputError = class extends Error {
|
|
2623
|
+
field;
|
|
2624
|
+
constructor(field, message) {
|
|
2625
|
+
super(message);
|
|
2626
|
+
this.name = "InvalidLaunchpadReadInputError";
|
|
2627
|
+
this.field = field;
|
|
2628
|
+
}
|
|
2629
|
+
};
|
|
2630
|
+
function blockSelector(options = {}) {
|
|
2631
|
+
if (options.blockNumber !== void 0) return { blockNumber: options.blockNumber };
|
|
2632
|
+
if (options.blockTag !== void 0) return { blockTag: options.blockTag };
|
|
2633
|
+
return {};
|
|
2634
|
+
}
|
|
2635
|
+
var UnpinnableBlockTagError = class extends Error {
|
|
2636
|
+
blockTag;
|
|
2637
|
+
constructor(blockTag) {
|
|
2638
|
+
super(
|
|
2639
|
+
`Block tag "${blockTag}" has no stable height, so a same-block read cannot be pinned to it. Pass an explicit blockNumber, or use "latest", "safe", or "finalized".`
|
|
2640
|
+
);
|
|
2641
|
+
this.name = "UnpinnableBlockTagError";
|
|
2642
|
+
this.blockTag = blockTag;
|
|
2643
|
+
}
|
|
2644
|
+
};
|
|
2645
|
+
async function resolvePinnedBlockNumber(context, options) {
|
|
2646
|
+
if (options?.blockNumber !== void 0) return options.blockNumber;
|
|
2647
|
+
if (options?.blockTag === void 0 || options.blockTag === "latest") {
|
|
2648
|
+
return context.publicClient.getBlockNumber();
|
|
2649
|
+
}
|
|
2650
|
+
if (options.blockTag === "pending") throw new UnpinnableBlockTagError(options.blockTag);
|
|
2651
|
+
const block = await context.publicClient.getBlock({ blockTag: options.blockTag });
|
|
2652
|
+
if (block.number === null || block.number === void 0) {
|
|
2653
|
+
throw new UnpinnableBlockTagError(options.blockTag);
|
|
2654
|
+
}
|
|
2655
|
+
return block.number;
|
|
2656
|
+
}
|
|
2657
|
+
function assertPositiveAmount(field, value) {
|
|
2658
|
+
if (value <= 0n) {
|
|
2659
|
+
throw new InvalidLaunchpadReadInputError(field, `${field} must be a positive bigint.`);
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
async function getLaunchpadTokenState(context, token, options) {
|
|
2663
|
+
const raw = await context.publicClient.readContract({
|
|
2664
|
+
address: context.deployment.contracts.portal,
|
|
2665
|
+
abi: portalAbi,
|
|
2666
|
+
functionName: "getTokenState",
|
|
2667
|
+
args: [token],
|
|
2668
|
+
...blockSelector(options)
|
|
2669
|
+
});
|
|
2670
|
+
return toLaunchpadTokenState(
|
|
2671
|
+
{ chainId: context.deployment.chainId, address: (0, import_viem2.getAddress)(token) },
|
|
2672
|
+
raw
|
|
2673
|
+
);
|
|
2674
|
+
}
|
|
2675
|
+
function getLaunchpadTokenMetadata(context, token, options) {
|
|
2676
|
+
return context.publicClient.readContract({
|
|
2677
|
+
address: context.deployment.contracts.portal,
|
|
2678
|
+
abi: portalAbi,
|
|
2679
|
+
functionName: "metadata",
|
|
2680
|
+
args: [token],
|
|
2681
|
+
...blockSelector(options)
|
|
2682
|
+
});
|
|
2683
|
+
}
|
|
2684
|
+
async function getLaunchpadPrice(context, token, options) {
|
|
2685
|
+
const blockNumber = await resolvePinnedBlockNumber(context, options);
|
|
2686
|
+
const [valueWad, state] = await Promise.all([
|
|
2687
|
+
context.publicClient.readContract({
|
|
2688
|
+
address: context.deployment.contracts.portal,
|
|
2689
|
+
abi: portalAbi,
|
|
2690
|
+
functionName: "priceWad",
|
|
2691
|
+
args: [token],
|
|
2692
|
+
blockNumber
|
|
2693
|
+
}),
|
|
2694
|
+
getLaunchpadTokenState(context, token, { blockNumber })
|
|
2695
|
+
]);
|
|
2696
|
+
return Object.freeze({ valueWad, source: "bondingCurveReference", phase: state.phase });
|
|
2697
|
+
}
|
|
2698
|
+
async function quoteLaunchpadBuy(context, token, quoteIn, options) {
|
|
2699
|
+
assertPositiveAmount("quoteIn", quoteIn);
|
|
2700
|
+
const [tokenOut, quoteSpent, fee, reachesThreshold] = await context.publicClient.readContract({
|
|
2701
|
+
address: context.deployment.contracts.portal,
|
|
2702
|
+
abi: portalAbi,
|
|
2703
|
+
functionName: "quoteBuy",
|
|
2704
|
+
args: [token, quoteIn],
|
|
2705
|
+
...blockSelector(options)
|
|
2706
|
+
});
|
|
2707
|
+
return Object.freeze({ tokenOut, quoteSpent, fee, reachesGraduation: reachesThreshold });
|
|
2708
|
+
}
|
|
2709
|
+
async function quoteLaunchpadSell(context, token, tokenIn, options) {
|
|
2710
|
+
assertPositiveAmount("tokenIn", tokenIn);
|
|
2711
|
+
const [quoteOut, fee] = await context.publicClient.readContract({
|
|
2712
|
+
address: context.deployment.contracts.portal,
|
|
2713
|
+
abi: portalAbi,
|
|
2714
|
+
functionName: "quoteSell",
|
|
2715
|
+
args: [token, tokenIn],
|
|
2716
|
+
...blockSelector(options)
|
|
2717
|
+
});
|
|
2718
|
+
return Object.freeze({ quoteOut, fee });
|
|
2719
|
+
}
|
|
2720
|
+
async function getLaunchpadTradeAvailability(context, token, options) {
|
|
2721
|
+
const blockNumber = await resolvePinnedBlockNumber(context, options);
|
|
2722
|
+
const [state, protocolPaused] = await Promise.all([
|
|
2723
|
+
getLaunchpadTokenState(context, token, { blockNumber }),
|
|
2724
|
+
context.publicClient.readContract({
|
|
2725
|
+
address: context.deployment.contracts.portal,
|
|
2726
|
+
abi: portalAbi,
|
|
2727
|
+
functionName: "paused",
|
|
2728
|
+
blockNumber
|
|
2729
|
+
})
|
|
2730
|
+
]);
|
|
2731
|
+
return toLaunchpadTradeAvailability(state, blockNumber, protocolPaused);
|
|
2732
|
+
}
|
|
2733
|
+
function getErc20Balance(context, asset, account, options) {
|
|
2734
|
+
return context.publicClient.readContract({
|
|
2735
|
+
address: asset,
|
|
2736
|
+
abi: import_viem2.erc20Abi,
|
|
2737
|
+
functionName: "balanceOf",
|
|
2738
|
+
args: [account],
|
|
2739
|
+
...blockSelector(options)
|
|
2740
|
+
});
|
|
2741
|
+
}
|
|
2742
|
+
async function getErc20Metadata(context, asset, options) {
|
|
2743
|
+
const selector = blockSelector(options);
|
|
2744
|
+
const [name, symbol, decimals] = await Promise.all([
|
|
2745
|
+
context.publicClient.readContract({
|
|
2746
|
+
address: asset,
|
|
2747
|
+
abi: import_viem2.erc20Abi,
|
|
2748
|
+
functionName: "name",
|
|
2749
|
+
...selector
|
|
2750
|
+
}),
|
|
2751
|
+
context.publicClient.readContract({
|
|
2752
|
+
address: asset,
|
|
2753
|
+
abi: import_viem2.erc20Abi,
|
|
2754
|
+
functionName: "symbol",
|
|
2755
|
+
...selector
|
|
2756
|
+
}),
|
|
2757
|
+
context.publicClient.readContract({
|
|
2758
|
+
address: asset,
|
|
2759
|
+
abi: import_viem2.erc20Abi,
|
|
2760
|
+
functionName: "decimals",
|
|
2761
|
+
...selector
|
|
2762
|
+
})
|
|
2763
|
+
]);
|
|
2764
|
+
return Object.freeze({ address: asset, name, symbol, decimals });
|
|
2765
|
+
}
|
|
2766
|
+
function getErc20Allowance(context, asset, owner, spender, options) {
|
|
2767
|
+
return context.publicClient.readContract({
|
|
2768
|
+
address: asset,
|
|
2769
|
+
abi: import_viem2.erc20Abi,
|
|
2770
|
+
functionName: "allowance",
|
|
2771
|
+
args: [owner, spender],
|
|
2772
|
+
...blockSelector(options)
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
2775
|
+
function getClaimableLaunchpadReward(context, account, asset, options) {
|
|
2776
|
+
return context.publicClient.readContract({
|
|
2777
|
+
address: context.deployment.contracts.liquidityLocker,
|
|
2778
|
+
abi: liquidityLockerAbi,
|
|
2779
|
+
functionName: "pendingRewards",
|
|
2780
|
+
args: [account, asset],
|
|
2781
|
+
...blockSelector(options)
|
|
2782
|
+
});
|
|
2783
|
+
}
|
|
2784
|
+
async function getLockedLaunchpadPosition(context, tokenId, options) {
|
|
2785
|
+
if (tokenId < 0n) throw new RangeError("tokenId must not be negative.");
|
|
2786
|
+
const [token0, token1, creator, platformFeeBps] = await context.publicClient.readContract({
|
|
2787
|
+
address: context.deployment.contracts.liquidityLocker,
|
|
2788
|
+
abi: liquidityLockerAbi,
|
|
2789
|
+
functionName: "positions",
|
|
2790
|
+
args: [tokenId],
|
|
2791
|
+
...blockSelector(options)
|
|
2792
|
+
});
|
|
2793
|
+
if ((0, import_viem2.isAddressEqual)(creator, import_viem2.zeroAddress)) return void 0;
|
|
2794
|
+
return Object.freeze({ tokenId, token0, token1, creator, platformFeeBps });
|
|
2795
|
+
}
|
|
2796
|
+
async function predictLaunchpadTokenAddress(context, input, options) {
|
|
2797
|
+
if (input.name.length === 0 || input.symbol.length === 0) {
|
|
2798
|
+
throw new InvalidLaunchpadReadInputError(
|
|
2799
|
+
"name",
|
|
2800
|
+
"Token name and symbol must not be empty; the prediction depends on both."
|
|
2801
|
+
);
|
|
2802
|
+
}
|
|
2803
|
+
const selector = blockSelector(options);
|
|
2804
|
+
const [creatorNonce, totalSupply] = await Promise.all([
|
|
2805
|
+
context.publicClient.readContract({
|
|
2806
|
+
address: context.deployment.contracts.portal,
|
|
2807
|
+
abi: portalAbi,
|
|
2808
|
+
functionName: "creatorNonces",
|
|
2809
|
+
args: [input.creator],
|
|
2810
|
+
...selector
|
|
2811
|
+
}),
|
|
2812
|
+
context.publicClient.readContract({
|
|
2813
|
+
address: context.deployment.contracts.portal,
|
|
2814
|
+
abi: portalAbi,
|
|
2815
|
+
functionName: "TOTAL_SUPPLY",
|
|
2816
|
+
...selector
|
|
2817
|
+
})
|
|
2818
|
+
]);
|
|
2819
|
+
const salt = (0, import_viem2.keccak256)(
|
|
2820
|
+
(0, import_viem2.encodeAbiParameters)(
|
|
2821
|
+
[{ type: "address" }, { type: "uint256" }, { type: "bytes32" }],
|
|
2822
|
+
[input.creator, creatorNonce, input.userSalt]
|
|
2823
|
+
)
|
|
2824
|
+
);
|
|
2825
|
+
const address = await context.publicClient.readContract({
|
|
2826
|
+
address: context.deployment.contracts.tokenFactory,
|
|
2827
|
+
abi: tokenFactoryAbi,
|
|
2828
|
+
functionName: "predictAddress",
|
|
2829
|
+
args: [input.name, input.symbol, totalSupply, salt],
|
|
2830
|
+
...selector
|
|
2831
|
+
});
|
|
2832
|
+
return Object.freeze({
|
|
2833
|
+
address,
|
|
2834
|
+
creator: input.creator,
|
|
2835
|
+
creatorNonce,
|
|
2836
|
+
userSalt: input.userSalt,
|
|
2837
|
+
salt
|
|
2838
|
+
});
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
// src/actions/approval.ts
|
|
2842
|
+
async function getLaunchpadApprovalStatus(context, input, options) {
|
|
2843
|
+
if (input.requiredAmount < 0n) {
|
|
2844
|
+
throw new RangeError("requiredAmount must not be negative.");
|
|
2845
|
+
}
|
|
2846
|
+
const spender = input.spender ?? context.deployment.contracts.portal;
|
|
2847
|
+
const allowance = await getErc20Allowance(context, input.asset, input.owner, spender, options);
|
|
2848
|
+
const sufficient = allowance >= input.requiredAmount;
|
|
2849
|
+
return Object.freeze({
|
|
2850
|
+
asset: input.asset,
|
|
2851
|
+
owner: input.owner,
|
|
2852
|
+
spender,
|
|
2853
|
+
allowance,
|
|
2854
|
+
requiredAmount: input.requiredAmount,
|
|
2855
|
+
sufficient,
|
|
2856
|
+
missingAmount: sufficient ? 0n : input.requiredAmount - allowance
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
// src/math/slippage.ts
|
|
2861
|
+
var MAX_SLIPPAGE_BPS = 1e3;
|
|
2862
|
+
var DEFAULT_DEADLINE_SECONDS = 600n;
|
|
2863
|
+
var InvalidSlippageError = class extends Error {
|
|
2864
|
+
bps;
|
|
2865
|
+
constructor(bps, message) {
|
|
2866
|
+
super(message);
|
|
2867
|
+
this.name = "InvalidSlippageError";
|
|
2868
|
+
this.bps = bps;
|
|
2869
|
+
}
|
|
2870
|
+
};
|
|
2871
|
+
var InvalidDeadlineError = class extends Error {
|
|
2872
|
+
constructor(message) {
|
|
2873
|
+
super(message);
|
|
2874
|
+
this.name = "InvalidDeadlineError";
|
|
2875
|
+
}
|
|
2876
|
+
};
|
|
2877
|
+
function assertSlippage(slippage) {
|
|
2878
|
+
const { bps } = slippage;
|
|
2879
|
+
if (!Number.isSafeInteger(bps)) {
|
|
2880
|
+
throw new InvalidSlippageError(bps, "Slippage bps must be an integer.");
|
|
2881
|
+
}
|
|
2882
|
+
if (bps < 0) {
|
|
2883
|
+
throw new InvalidSlippageError(bps, "Slippage bps must not be negative.");
|
|
2884
|
+
}
|
|
2885
|
+
if (bps > MAX_SLIPPAGE_BPS) {
|
|
2886
|
+
throw new InvalidSlippageError(
|
|
2887
|
+
bps,
|
|
2888
|
+
`Slippage bps must not exceed ${MAX_SLIPPAGE_BPS} (${MAX_SLIPPAGE_BPS / 100}%).`
|
|
2889
|
+
);
|
|
2890
|
+
}
|
|
2891
|
+
return bps;
|
|
2892
|
+
}
|
|
2893
|
+
function applySlippageToMinimumOut(expectedOut, slippage) {
|
|
2894
|
+
const bps = assertSlippage(slippage);
|
|
2895
|
+
if (expectedOut <= 0n) {
|
|
2896
|
+
throw new InvalidSlippageError(
|
|
2897
|
+
bps,
|
|
2898
|
+
"Cannot derive a minimum output from a zero or negative quote."
|
|
2899
|
+
);
|
|
2900
|
+
}
|
|
2901
|
+
const minimumOut = expectedOut * BigInt(BPS - bps) / BigInt(BPS);
|
|
2902
|
+
if (minimumOut <= 0n) {
|
|
2903
|
+
throw new InvalidSlippageError(
|
|
2904
|
+
bps,
|
|
2905
|
+
"Slippage tolerance reduces the minimum output to zero; lower the tolerance or raise the amount."
|
|
2906
|
+
);
|
|
2907
|
+
}
|
|
2908
|
+
return minimumOut;
|
|
2909
|
+
}
|
|
2910
|
+
function toDeadline(referenceTimestamp, seconds = DEFAULT_DEADLINE_SECONDS) {
|
|
2911
|
+
if (referenceTimestamp <= 0n) {
|
|
2912
|
+
throw new InvalidDeadlineError("Reference timestamp must be a positive bigint.");
|
|
2913
|
+
}
|
|
2914
|
+
if (seconds <= 0n) {
|
|
2915
|
+
throw new InvalidDeadlineError("Deadline horizon must be a positive number of seconds.");
|
|
2916
|
+
}
|
|
2917
|
+
return referenceTimestamp + seconds;
|
|
2918
|
+
}
|
|
2919
|
+
function mulDivUp(x, y, denominator) {
|
|
2920
|
+
if (denominator <= 0n) {
|
|
2921
|
+
throw new RangeError("mulDivUp denominator must be positive.");
|
|
2922
|
+
}
|
|
2923
|
+
const product = x * y;
|
|
2924
|
+
const result = product / denominator;
|
|
2925
|
+
return product % denominator === 0n ? result : result + 1n;
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
// src/math/curve.ts
|
|
2929
|
+
function initialCurveState(constants) {
|
|
2930
|
+
return Object.freeze({
|
|
2931
|
+
totalSupply: constants.totalSupply,
|
|
2932
|
+
circulatingSupply: 0n,
|
|
2933
|
+
quoteReserve: 0n,
|
|
2934
|
+
virtualTokenReserve: constants.virtualTokenReserve,
|
|
2935
|
+
virtualQuoteReserve: constants.virtualQuoteReserve,
|
|
2936
|
+
k: constants.curveK
|
|
2937
|
+
});
|
|
2938
|
+
}
|
|
2939
|
+
function creatorFirstBuyFee(quoteIn) {
|
|
2940
|
+
return quoteIn * BigInt(TRADE_FEE_BPS) / BigInt(BPS);
|
|
2941
|
+
}
|
|
2942
|
+
function toCreatorFirstBuyQuote(constants, quoteIn, tokenOutFromCurve, netRequiredForThreshold) {
|
|
2943
|
+
if (quoteIn <= 0n) {
|
|
2944
|
+
throw new RangeError("Creator first buy requires a positive quoteIn.");
|
|
2945
|
+
}
|
|
2946
|
+
const fee = creatorFirstBuyFee(quoteIn);
|
|
2947
|
+
const remaining = constants.dexSupplyThreshold;
|
|
2948
|
+
if (tokenOutFromCurve < remaining) {
|
|
2949
|
+
return Object.freeze({
|
|
2950
|
+
tokenOut: tokenOutFromCurve,
|
|
2951
|
+
quoteSpent: quoteIn,
|
|
2952
|
+
fee,
|
|
2953
|
+
reachesGraduation: false
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2956
|
+
if (netRequiredForThreshold === void 0) {
|
|
2957
|
+
throw new RangeError(
|
|
2958
|
+
"The first buy reaches graduation; quoteBuyExactOut for the threshold is required."
|
|
2959
|
+
);
|
|
2960
|
+
}
|
|
2961
|
+
const quoteSpent = mulDivUp(netRequiredForThreshold, BigInt(BPS), BigInt(BPS - TRADE_FEE_BPS));
|
|
2962
|
+
return Object.freeze({
|
|
2963
|
+
tokenOut: remaining,
|
|
2964
|
+
quoteSpent,
|
|
2965
|
+
fee: quoteSpent * BigInt(TRADE_FEE_BPS) / BigInt(BPS),
|
|
2966
|
+
reachesGraduation: true
|
|
2967
|
+
});
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2970
|
+
// src/math/price.ts
|
|
2971
|
+
var PRICE_WAD_SCALE = 10n ** 30n;
|
|
2972
|
+
function priceImpactBps(spotPriceWad, quoteAmount, tokenAmount) {
|
|
2973
|
+
if (spotPriceWad <= 0n) throw new RangeError("spotPriceWad must be positive.");
|
|
2974
|
+
if (tokenAmount <= 0n) throw new RangeError("tokenAmount must be positive.");
|
|
2975
|
+
if (quoteAmount < 0n) throw new RangeError("quoteAmount must not be negative.");
|
|
2976
|
+
const executionWad = quoteAmount * PRICE_WAD_SCALE / tokenAmount;
|
|
2977
|
+
return Number((executionWad - spotPriceWad) * BigInt(BPS) / spotPriceWad);
|
|
2978
|
+
}
|
|
2979
|
+
function buyPriceImpactBps(spotPriceWad, quote) {
|
|
2980
|
+
return priceImpactBps(spotPriceWad, quote.quoteSpent - quote.fee, quote.tokenOut);
|
|
2981
|
+
}
|
|
2982
|
+
function sellPriceImpactBps(spotPriceWad, quote, tokenIn) {
|
|
2983
|
+
return priceImpactBps(spotPriceWad, quote.quoteOut + quote.fee, tokenIn);
|
|
2984
|
+
}
|
|
2985
|
+
function priceWadPerWholeToken(priceWad, quoteDecimals, tokenDecimals = 18) {
|
|
2986
|
+
if (quoteDecimals < 0 || tokenDecimals < 0) {
|
|
2987
|
+
throw new RangeError("Decimals must not be negative.");
|
|
2988
|
+
}
|
|
2989
|
+
return priceWad * 10n ** BigInt(tokenDecimals) * 10n ** 18n / (PRICE_WAD_SCALE * 10n ** BigInt(quoteDecimals));
|
|
2990
|
+
}
|
|
2991
|
+
function marketCapQuote(priceWad, totalSupply) {
|
|
2992
|
+
return priceWad * totalSupply / PRICE_WAD_SCALE;
|
|
2993
|
+
}
|
|
2994
|
+
function curvePriceWadAt(circulatingSupply, constants) {
|
|
2995
|
+
if (circulatingSupply < 0n || circulatingSupply > constants.totalSupply) {
|
|
2996
|
+
throw new RangeError("circulatingSupply must be between zero and the total supply.");
|
|
2997
|
+
}
|
|
2998
|
+
const effectiveBase = constants.totalSupply - circulatingSupply + constants.virtualTokenReserve;
|
|
2999
|
+
return constants.curveK * PRICE_WAD_SCALE / (effectiveBase * effectiveBase);
|
|
3000
|
+
}
|
|
3001
|
+
function graduationMarketCapQuote(constants) {
|
|
3002
|
+
return marketCapQuote(
|
|
3003
|
+
curvePriceWadAt(constants.dexSupplyThreshold, constants),
|
|
3004
|
+
constants.totalSupply
|
|
3005
|
+
);
|
|
3006
|
+
}
|
|
3007
|
+
function graduationProgress(circulatingSupply, constants) {
|
|
3008
|
+
const threshold = constants.dexSupplyThreshold;
|
|
3009
|
+
if (threshold <= 0n) throw new RangeError("dexSupplyThreshold must be positive.");
|
|
3010
|
+
if (circulatingSupply >= threshold) {
|
|
3011
|
+
return Object.freeze({ tokensRemaining: 0n, progressBps: BPS, reachedThreshold: true });
|
|
3012
|
+
}
|
|
3013
|
+
return Object.freeze({
|
|
3014
|
+
tokensRemaining: threshold - circulatingSupply,
|
|
3015
|
+
progressBps: Number(circulatingSupply * BigInt(BPS) / threshold),
|
|
3016
|
+
reachedThreshold: false
|
|
3017
|
+
});
|
|
3018
|
+
}
|
|
3019
|
+
function tradeFee(quoteAmount) {
|
|
3020
|
+
return quoteAmount * BigInt(TRADE_FEE_BPS) / BigInt(BPS);
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
// src/actions/curve.ts
|
|
3024
|
+
function blockSelector2(options = {}) {
|
|
3025
|
+
if (options.blockNumber !== void 0) return { blockNumber: options.blockNumber };
|
|
3026
|
+
if (options.blockTag !== void 0) return { blockTag: options.blockTag };
|
|
3027
|
+
return {};
|
|
3028
|
+
}
|
|
3029
|
+
async function getLaunchpadCurveConstants(context, options) {
|
|
3030
|
+
const selector = blockSelector2(options);
|
|
3031
|
+
const read = (functionName) => context.publicClient.readContract({
|
|
3032
|
+
address: context.deployment.contracts.portal,
|
|
3033
|
+
abi: portalAbi,
|
|
3034
|
+
functionName,
|
|
3035
|
+
...selector
|
|
3036
|
+
});
|
|
3037
|
+
const [totalSupply, dexSupplyThreshold, virtualTokenReserve, virtualQuoteReserve, curveK] = await Promise.all([
|
|
3038
|
+
read("TOTAL_SUPPLY"),
|
|
3039
|
+
read("DEX_SUPPLY_THRESHOLD"),
|
|
3040
|
+
read("VIRTUAL_TOKEN_RESERVE"),
|
|
3041
|
+
read("VIRTUAL_QUOTE_RESERVE"),
|
|
3042
|
+
read("CURVE_K")
|
|
3043
|
+
]);
|
|
3044
|
+
return Object.freeze({
|
|
3045
|
+
totalSupply,
|
|
3046
|
+
dexSupplyThreshold,
|
|
3047
|
+
virtualTokenReserve,
|
|
3048
|
+
virtualQuoteReserve,
|
|
3049
|
+
curveK
|
|
3050
|
+
});
|
|
3051
|
+
}
|
|
3052
|
+
async function quoteCreatorFirstBuy(context, quoteIn, options) {
|
|
3053
|
+
if (quoteIn <= 0n) {
|
|
3054
|
+
throw new InvalidLaunchpadReadInputError("quoteIn", "quoteIn must be a positive bigint.");
|
|
3055
|
+
}
|
|
3056
|
+
const constants = options?.constants ?? await getLaunchpadCurveConstants(context, options);
|
|
3057
|
+
const fee = creatorFirstBuyFee(quoteIn);
|
|
3058
|
+
const netQuoteIn = quoteIn - fee;
|
|
3059
|
+
if (netQuoteIn <= 0n) {
|
|
3060
|
+
throw new InvalidLaunchpadReadInputError(
|
|
3061
|
+
"quoteIn",
|
|
3062
|
+
"quoteIn is too small to buy anything once the 1% creator fee is deducted."
|
|
3063
|
+
);
|
|
3064
|
+
}
|
|
3065
|
+
const state = initialCurveState(constants);
|
|
3066
|
+
const curve = context.deployment.contracts.curve;
|
|
3067
|
+
const selector = blockSelector2(options);
|
|
3068
|
+
const tokenOutFromCurve = await context.publicClient.readContract({
|
|
3069
|
+
address: curve,
|
|
3070
|
+
abi: constantProductCurveAbi,
|
|
3071
|
+
functionName: "quoteBuy",
|
|
3072
|
+
args: [state, netQuoteIn],
|
|
3073
|
+
...selector
|
|
3074
|
+
});
|
|
3075
|
+
if (tokenOutFromCurve < constants.dexSupplyThreshold) {
|
|
3076
|
+
return toCreatorFirstBuyQuote(constants, quoteIn, tokenOutFromCurve);
|
|
3077
|
+
}
|
|
3078
|
+
const netRequiredForThreshold = await context.publicClient.readContract({
|
|
3079
|
+
address: curve,
|
|
3080
|
+
abi: constantProductCurveAbi,
|
|
3081
|
+
functionName: "quoteBuyExactOut",
|
|
3082
|
+
args: [state, constants.dexSupplyThreshold],
|
|
3083
|
+
...selector
|
|
3084
|
+
});
|
|
3085
|
+
return toCreatorFirstBuyQuote(constants, quoteIn, tokenOutFromCurve, netRequiredForThreshold);
|
|
3086
|
+
}
|
|
3087
|
+
async function getLaunchpadCurveProgress(context, token, options) {
|
|
3088
|
+
const blockNumber = await resolvePinnedBlockNumber(context, options);
|
|
3089
|
+
const [state, priceWad, constants] = await Promise.all([
|
|
3090
|
+
getLaunchpadTokenState(context, token, { blockNumber }),
|
|
3091
|
+
context.publicClient.readContract({
|
|
3092
|
+
address: context.deployment.contracts.portal,
|
|
3093
|
+
abi: portalAbi,
|
|
3094
|
+
functionName: "priceWad",
|
|
3095
|
+
args: [token],
|
|
3096
|
+
blockNumber
|
|
3097
|
+
}),
|
|
3098
|
+
options?.constants ? Promise.resolve(options.constants) : getLaunchpadCurveConstants(context, { blockNumber })
|
|
3099
|
+
]);
|
|
3100
|
+
const progress = state.phase === "graduated" || state.phase === "migrating" ? { tokensRemaining: 0n, progressBps: 1e4, reachedThreshold: true } : graduationProgress(state.circulatingSupply, constants);
|
|
3101
|
+
return Object.freeze({
|
|
3102
|
+
...progress,
|
|
3103
|
+
blockNumber,
|
|
3104
|
+
phase: state.phase,
|
|
3105
|
+
circulatingSupply: state.circulatingSupply,
|
|
3106
|
+
quoteReserve: state.quoteReserve,
|
|
3107
|
+
priceWad,
|
|
3108
|
+
marketCapQuote: marketCapQuote(priceWad, constants.totalSupply),
|
|
3109
|
+
graduationMarketCapQuote: graduationMarketCapQuote(constants)
|
|
3110
|
+
});
|
|
3111
|
+
}
|
|
3112
|
+
|
|
3113
|
+
// ../core/src/errors.ts
|
|
3114
|
+
var import_viem3 = require("viem");
|
|
3115
|
+
var PEACH_SDK_ERROR_BRAND = /* @__PURE__ */ Symbol.for("masterpeach.sdk-core.PeachSdkError");
|
|
3116
|
+
var PeachSdkError = class extends Error {
|
|
3117
|
+
code;
|
|
3118
|
+
metadata;
|
|
3119
|
+
constructor(code, message, options = {}) {
|
|
3120
|
+
super(message, { cause: options.cause });
|
|
3121
|
+
this.name = "PeachSdkError";
|
|
3122
|
+
this.code = code;
|
|
3123
|
+
this.metadata = options.metadata ?? {};
|
|
3124
|
+
Object.defineProperty(this, PEACH_SDK_ERROR_BRAND, { value: true });
|
|
3125
|
+
}
|
|
3126
|
+
};
|
|
3127
|
+
var UnsupportedChainError = class extends PeachSdkError {
|
|
3128
|
+
constructor(chainId) {
|
|
3129
|
+
super("UNSUPPORTED_CHAIN", `Unsupported chain: ${chainId}`, {
|
|
3130
|
+
metadata: { chainId }
|
|
3131
|
+
});
|
|
3132
|
+
this.name = "UnsupportedChainError";
|
|
3133
|
+
}
|
|
3134
|
+
};
|
|
3135
|
+
var MissingChainError = class extends PeachSdkError {
|
|
3136
|
+
constructor() {
|
|
3137
|
+
super("MISSING_CHAIN", "A chain ID is required for this operation.");
|
|
3138
|
+
this.name = "MissingChainError";
|
|
3139
|
+
}
|
|
3140
|
+
};
|
|
3141
|
+
var MissingAccountError = class extends PeachSdkError {
|
|
3142
|
+
constructor() {
|
|
3143
|
+
super("MISSING_ACCOUNT", "A wallet account is required for this operation.");
|
|
3144
|
+
this.name = "MissingAccountError";
|
|
3145
|
+
}
|
|
3146
|
+
};
|
|
3147
|
+
function isPeachSdkError(value, code) {
|
|
3148
|
+
if (typeof value !== "object" || value === null) {
|
|
3149
|
+
return false;
|
|
3150
|
+
}
|
|
3151
|
+
if (value[PEACH_SDK_ERROR_BRAND] !== true) {
|
|
3152
|
+
return false;
|
|
3153
|
+
}
|
|
3154
|
+
return code === void 0 || value.code === code;
|
|
3155
|
+
}
|
|
3156
|
+
function toPeachSdkError(error) {
|
|
3157
|
+
if (isPeachSdkError(error)) {
|
|
3158
|
+
return error;
|
|
3159
|
+
}
|
|
3160
|
+
if (error instanceof import_viem3.UserRejectedRequestError) {
|
|
3161
|
+
return new PeachSdkError("USER_REJECTED", "The wallet request was rejected.", {
|
|
3162
|
+
cause: error
|
|
3163
|
+
});
|
|
3164
|
+
}
|
|
3165
|
+
return new PeachSdkError("UNKNOWN_ERROR", "An unknown SDK error occurred.", {
|
|
3166
|
+
cause: error
|
|
3167
|
+
});
|
|
3168
|
+
}
|
|
3169
|
+
|
|
3170
|
+
// ../core/src/chain.ts
|
|
3171
|
+
function resolveChainValue(registry, chainId) {
|
|
3172
|
+
const value = registry[chainId];
|
|
3173
|
+
if (value === void 0) {
|
|
3174
|
+
throw new UnsupportedChainError(chainId);
|
|
3175
|
+
}
|
|
3176
|
+
return value;
|
|
3177
|
+
}
|
|
3178
|
+
function requireWalletClient(walletClient) {
|
|
3179
|
+
if (!walletClient?.account) {
|
|
3180
|
+
throw new MissingAccountError();
|
|
3181
|
+
}
|
|
3182
|
+
return walletClient;
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
// ../core/src/transaction.ts
|
|
3186
|
+
function transactionResultFromReceipt(receipt) {
|
|
3187
|
+
return {
|
|
3188
|
+
hash: receipt.transactionHash,
|
|
3189
|
+
status: receipt.status === "success" ? "confirmed" : "reverted",
|
|
3190
|
+
receipt
|
|
3191
|
+
};
|
|
3192
|
+
}
|
|
3193
|
+
|
|
3194
|
+
// src/events.ts
|
|
3195
|
+
var import_viem4 = require("viem");
|
|
3196
|
+
function decodeFrom(abi, log) {
|
|
3197
|
+
try {
|
|
3198
|
+
return (0, import_viem4.decodeEventLog)({ abi, data: log.data, topics: log.topics });
|
|
3199
|
+
} catch {
|
|
3200
|
+
return void 0;
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
function toTradeEvent(args) {
|
|
3204
|
+
const isBuy = args.isBuy;
|
|
3205
|
+
const quoteAmountRaw = args.quoteAmount;
|
|
3206
|
+
const fee = args.fee;
|
|
3207
|
+
return Object.freeze({
|
|
3208
|
+
token: args.token,
|
|
3209
|
+
trader: args.trader,
|
|
3210
|
+
side: isBuy ? "buy" : "sell",
|
|
3211
|
+
tokenAmount: args.tokenAmount,
|
|
3212
|
+
quoteAmountRaw,
|
|
3213
|
+
fee,
|
|
3214
|
+
// Buy emits netQuote, so the trader actually paid net + fee.
|
|
3215
|
+
// Sell emits grossQuote, so the trader actually received gross - fee.
|
|
3216
|
+
traderQuoteDelta: isBuy ? -(quoteAmountRaw + fee) : quoteAmountRaw - fee,
|
|
3217
|
+
reserveQuoteDelta: isBuy ? quoteAmountRaw : -quoteAmountRaw
|
|
3218
|
+
});
|
|
3219
|
+
}
|
|
3220
|
+
function parseLaunchpadReceiptEvents(deployment, receipt) {
|
|
3221
|
+
const tokenCreated = [];
|
|
3222
|
+
const trades = [];
|
|
3223
|
+
const migrationStarted = [];
|
|
3224
|
+
const migrationCompleted = [];
|
|
3225
|
+
const rewardsClaimed = [];
|
|
3226
|
+
for (const log of receipt.logs) {
|
|
3227
|
+
if ((0, import_viem4.isAddressEqual)(log.address, deployment.contracts.portal)) {
|
|
3228
|
+
const decoded = decodeFrom(portalAbi, log);
|
|
3229
|
+
if (!decoded) continue;
|
|
3230
|
+
const args = decoded.args;
|
|
3231
|
+
switch (decoded.eventName) {
|
|
3232
|
+
case "TokenCreated":
|
|
3233
|
+
tokenCreated.push(
|
|
3234
|
+
Object.freeze({
|
|
3235
|
+
token: args.token,
|
|
3236
|
+
creator: args.creator,
|
|
3237
|
+
name: args.name,
|
|
3238
|
+
symbol: args.symbol,
|
|
3239
|
+
metadata: args.metadata,
|
|
3240
|
+
curveId: args.curveId,
|
|
3241
|
+
migratorId: args.migratorId
|
|
3242
|
+
})
|
|
3243
|
+
);
|
|
3244
|
+
break;
|
|
3245
|
+
case "Trade":
|
|
3246
|
+
trades.push(toTradeEvent(args));
|
|
3247
|
+
break;
|
|
3248
|
+
case "MigrationStarted":
|
|
3249
|
+
migrationStarted.push(
|
|
3250
|
+
Object.freeze({
|
|
3251
|
+
token: args.token,
|
|
3252
|
+
tokenAmount: args.tokenAmount,
|
|
3253
|
+
quoteAmount: args.quoteAmount
|
|
3254
|
+
})
|
|
3255
|
+
);
|
|
3256
|
+
break;
|
|
3257
|
+
case "MigrationCompleted":
|
|
3258
|
+
migrationCompleted.push(
|
|
3259
|
+
Object.freeze({
|
|
3260
|
+
token: args.token,
|
|
3261
|
+
pool: args.pool,
|
|
3262
|
+
liquidity: args.liquidity,
|
|
3263
|
+
lpRecipient: args.lpRecipient
|
|
3264
|
+
})
|
|
3265
|
+
);
|
|
3266
|
+
break;
|
|
3267
|
+
default:
|
|
3268
|
+
break;
|
|
3269
|
+
}
|
|
3270
|
+
continue;
|
|
3271
|
+
}
|
|
3272
|
+
if ((0, import_viem4.isAddressEqual)(log.address, deployment.contracts.liquidityLocker)) {
|
|
3273
|
+
const decoded = decodeFrom(liquidityLockerAbi, log);
|
|
3274
|
+
if (decoded?.eventName === "RewardsClaimed") {
|
|
3275
|
+
rewardsClaimed.push(
|
|
3276
|
+
Object.freeze({
|
|
3277
|
+
account: decoded.args.account,
|
|
3278
|
+
asset: decoded.args.asset,
|
|
3279
|
+
recipient: decoded.args.recipient,
|
|
3280
|
+
amount: decoded.args.amount
|
|
3281
|
+
})
|
|
3282
|
+
);
|
|
3283
|
+
}
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
return Object.freeze({
|
|
3287
|
+
tokenCreated: Object.freeze(tokenCreated),
|
|
3288
|
+
trades: Object.freeze(trades),
|
|
3289
|
+
migrationStarted: Object.freeze(migrationStarted),
|
|
3290
|
+
migrationCompleted: Object.freeze(migrationCompleted),
|
|
3291
|
+
rewardsClaimed: Object.freeze(rewardsClaimed)
|
|
3292
|
+
});
|
|
3293
|
+
}
|
|
3294
|
+
function createdTokenAddress(deployment, receipt) {
|
|
3295
|
+
return parseLaunchpadReceiptEvents(deployment, receipt).tokenCreated[0]?.token;
|
|
3296
|
+
}
|
|
3297
|
+
|
|
3298
|
+
// src/actions/transaction.ts
|
|
3299
|
+
async function waitForLaunchpadTransaction(context, hash, options = {}) {
|
|
3300
|
+
const receipt = await context.publicClient.waitForTransactionReceipt({
|
|
3301
|
+
hash,
|
|
3302
|
+
...options.confirmations === void 0 ? {} : { confirmations: options.confirmations }
|
|
3303
|
+
});
|
|
3304
|
+
return Object.freeze({
|
|
3305
|
+
...transactionResultFromReceipt(receipt),
|
|
3306
|
+
events: parseLaunchpadReceiptEvents(context.deployment, receipt)
|
|
3307
|
+
});
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
|
+
// src/actions/write.ts
|
|
3311
|
+
var import_viem6 = require("viem");
|
|
3312
|
+
var import_accounts = require("viem/accounts");
|
|
3313
|
+
|
|
3314
|
+
// src/errors.ts
|
|
3315
|
+
var import_viem5 = require("viem");
|
|
3316
|
+
var LaunchpadError = class extends Error {
|
|
3317
|
+
constructor(message, options) {
|
|
3318
|
+
super(message, options);
|
|
3319
|
+
this.name = "LaunchpadError";
|
|
3320
|
+
}
|
|
3321
|
+
};
|
|
3322
|
+
var LaunchpadPhaseUnavailableError = class extends LaunchpadError {
|
|
3323
|
+
phase;
|
|
3324
|
+
constructor(phase, options) {
|
|
3325
|
+
super(
|
|
3326
|
+
phase ? `The Launchpad token is in the ${phase} phase and cannot service this operation.` : "The Launchpad token is not in a phase that permits this operation.",
|
|
3327
|
+
options
|
|
3328
|
+
);
|
|
3329
|
+
this.name = "LaunchpadPhaseUnavailableError";
|
|
3330
|
+
this.phase = phase;
|
|
3331
|
+
}
|
|
3332
|
+
};
|
|
3333
|
+
var LaunchpadTradingPausedError = class extends LaunchpadError {
|
|
3334
|
+
scope;
|
|
3335
|
+
mode;
|
|
3336
|
+
constructor(scope, mode, options) {
|
|
3337
|
+
super(`Launchpad trading is paused (${scope}).`, options);
|
|
3338
|
+
this.name = "LaunchpadTradingPausedError";
|
|
3339
|
+
this.scope = scope;
|
|
3340
|
+
this.mode = mode;
|
|
3341
|
+
}
|
|
3342
|
+
};
|
|
3343
|
+
var LaunchpadProtectionError = class extends LaunchpadError {
|
|
3344
|
+
nextEligibleBlock;
|
|
3345
|
+
constructor(nextEligibleBlock, options) {
|
|
3346
|
+
super("Trading is disabled during the token's launch block.", options);
|
|
3347
|
+
this.name = "LaunchpadProtectionError";
|
|
3348
|
+
this.nextEligibleBlock = nextEligibleBlock;
|
|
3349
|
+
}
|
|
3350
|
+
};
|
|
3351
|
+
var LaunchpadSlippageError = class extends LaunchpadError {
|
|
3352
|
+
constructor(options) {
|
|
3353
|
+
super("The trade would exceed the requested slippage tolerance; refresh the quote.", options);
|
|
3354
|
+
this.name = "LaunchpadSlippageError";
|
|
3355
|
+
}
|
|
3356
|
+
};
|
|
3357
|
+
var LaunchpadDeadlineExpiredError = class extends LaunchpadError {
|
|
3358
|
+
constructor(options) {
|
|
3359
|
+
super(
|
|
3360
|
+
"The transaction deadline expired; rebuild the transaction with a new deadline.",
|
|
3361
|
+
options
|
|
3362
|
+
);
|
|
3363
|
+
this.name = "LaunchpadDeadlineExpiredError";
|
|
3364
|
+
}
|
|
3365
|
+
};
|
|
3366
|
+
var LaunchpadApprovalRequiredError = class extends LaunchpadError {
|
|
3367
|
+
asset;
|
|
3368
|
+
spender;
|
|
3369
|
+
requiredAmount;
|
|
3370
|
+
constructor(asset, spender, requiredAmount) {
|
|
3371
|
+
super(`Approve at least ${requiredAmount} of ${asset} for ${spender} before continuing.`);
|
|
3372
|
+
this.name = "LaunchpadApprovalRequiredError";
|
|
3373
|
+
this.asset = asset;
|
|
3374
|
+
this.spender = spender;
|
|
3375
|
+
this.requiredAmount = requiredAmount;
|
|
3376
|
+
}
|
|
3377
|
+
};
|
|
3378
|
+
var LaunchpadInsufficientBalanceError = class extends LaunchpadError {
|
|
3379
|
+
asset;
|
|
3380
|
+
account;
|
|
3381
|
+
requiredAmount;
|
|
3382
|
+
balance;
|
|
3383
|
+
constructor(asset, account, requiredAmount, balance) {
|
|
3384
|
+
super(
|
|
3385
|
+
`Account ${account} holds ${balance} of ${asset} but needs ${requiredAmount} for this transaction.`
|
|
3386
|
+
);
|
|
3387
|
+
this.name = "LaunchpadInsufficientBalanceError";
|
|
3388
|
+
this.asset = asset;
|
|
3389
|
+
this.account = account;
|
|
3390
|
+
this.requiredAmount = requiredAmount;
|
|
3391
|
+
this.balance = balance;
|
|
3392
|
+
}
|
|
3393
|
+
};
|
|
3394
|
+
var PreparedAccountMismatchError = class extends LaunchpadError {
|
|
3395
|
+
expectedAccount;
|
|
3396
|
+
actualAccount;
|
|
3397
|
+
constructor(expectedAccount, actualAccount) {
|
|
3398
|
+
super(
|
|
3399
|
+
`This transaction was prepared for account ${expectedAccount} but the wallet is now using ${actualAccount}. Prepare it again.`
|
|
3400
|
+
);
|
|
3401
|
+
this.name = "PreparedAccountMismatchError";
|
|
3402
|
+
this.expectedAccount = expectedAccount;
|
|
3403
|
+
this.actualAccount = actualAccount;
|
|
3404
|
+
}
|
|
3405
|
+
};
|
|
3406
|
+
var ForgedPreparedTransactionError = class extends LaunchpadError {
|
|
3407
|
+
constructor(message) {
|
|
3408
|
+
super(message);
|
|
3409
|
+
this.name = "ForgedPreparedTransactionError";
|
|
3410
|
+
}
|
|
3411
|
+
};
|
|
3412
|
+
var MissingWalletClientError = class extends LaunchpadError {
|
|
3413
|
+
constructor() {
|
|
3414
|
+
super("A Wallet Client is required for Launchpad write operations.");
|
|
3415
|
+
this.name = "MissingWalletClientError";
|
|
3416
|
+
}
|
|
3417
|
+
};
|
|
3418
|
+
var LaunchpadNothingToClaimError = class extends LaunchpadError {
|
|
3419
|
+
asset;
|
|
3420
|
+
account;
|
|
3421
|
+
constructor(asset, account) {
|
|
3422
|
+
super(`No claimable ${asset} rewards are available for ${account}.`);
|
|
3423
|
+
this.name = "LaunchpadNothingToClaimError";
|
|
3424
|
+
this.asset = asset;
|
|
3425
|
+
this.account = account;
|
|
3426
|
+
}
|
|
3427
|
+
};
|
|
3428
|
+
var LaunchpadUnknownPositionError = class extends LaunchpadError {
|
|
3429
|
+
tokenId;
|
|
3430
|
+
constructor(tokenId) {
|
|
3431
|
+
super(`No locked liquidity position is registered for LP NFT id ${tokenId}.`);
|
|
3432
|
+
this.name = "LaunchpadUnknownPositionError";
|
|
3433
|
+
this.tokenId = tokenId;
|
|
3434
|
+
}
|
|
3435
|
+
};
|
|
3436
|
+
var LaunchpadOfficialPoolLockedError = class extends LaunchpadError {
|
|
3437
|
+
constructor(options = {}) {
|
|
3438
|
+
super("The official V3 pool is locked until this token graduates.", options);
|
|
3439
|
+
this.name = "LaunchpadOfficialPoolLockedError";
|
|
3440
|
+
}
|
|
3441
|
+
};
|
|
3442
|
+
var WrongWalletChainError = class extends LaunchpadError {
|
|
3443
|
+
expectedChainId;
|
|
3444
|
+
actualChainId;
|
|
3445
|
+
constructor(expectedChainId, actualChainId) {
|
|
3446
|
+
super(
|
|
3447
|
+
`The wallet is on chain ${actualChainId ?? "unknown"} but this operation requires chain ${expectedChainId}.`
|
|
3448
|
+
);
|
|
3449
|
+
this.name = "WrongWalletChainError";
|
|
3450
|
+
this.expectedChainId = expectedChainId;
|
|
3451
|
+
this.actualChainId = actualChainId;
|
|
3452
|
+
}
|
|
3453
|
+
};
|
|
3454
|
+
var revertNameToError = {
|
|
3455
|
+
InvalidStatus: (cause) => new LaunchpadPhaseUnavailableError(void 0, { cause }),
|
|
3456
|
+
ProtocolPaused: (cause) => new LaunchpadTradingPausedError("protocol", void 0, { cause }),
|
|
3457
|
+
LaunchBlockTradingDisabled: (cause) => new LaunchpadProtectionError(void 0, { cause }),
|
|
3458
|
+
SlippageExceeded: (cause) => new LaunchpadSlippageError({ cause }),
|
|
3459
|
+
DeadlineExpired: (cause) => new LaunchpadDeadlineExpiredError({ cause }),
|
|
3460
|
+
OfficialPoolLocked: (cause) => new LaunchpadOfficialPoolLockedError({ cause })
|
|
3461
|
+
};
|
|
3462
|
+
function revertErrorName(error) {
|
|
3463
|
+
if (!(error instanceof import_viem5.BaseError)) return void 0;
|
|
3464
|
+
const reverted = error.walk((cause) => cause instanceof import_viem5.ContractFunctionRevertedError);
|
|
3465
|
+
return reverted instanceof import_viem5.ContractFunctionRevertedError ? reverted.data?.errorName : void 0;
|
|
3466
|
+
}
|
|
3467
|
+
function toLaunchpadError(error) {
|
|
3468
|
+
if (error instanceof LaunchpadError) return error;
|
|
3469
|
+
const name = revertErrorName(error);
|
|
3470
|
+
const mapped = name ? revertNameToError[name]?.(error) : void 0;
|
|
3471
|
+
return mapped ?? toPeachSdkError(error);
|
|
3472
|
+
}
|
|
3473
|
+
|
|
3474
|
+
// src/actions/write.ts
|
|
3475
|
+
var canonicalPreparedRequests = /* @__PURE__ */ new WeakMap();
|
|
3476
|
+
function immutableClone(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
3477
|
+
if (value === null || typeof value !== "object") return value;
|
|
3478
|
+
const source = value;
|
|
3479
|
+
const existing = seen.get(source);
|
|
3480
|
+
if (existing !== void 0) return existing;
|
|
3481
|
+
const clone = Array.isArray(value) ? [] : Object.create(Object.getPrototypeOf(source));
|
|
3482
|
+
seen.set(source, clone);
|
|
3483
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
3484
|
+
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
|
3485
|
+
if (!descriptor) continue;
|
|
3486
|
+
if ("value" in descriptor) {
|
|
3487
|
+
descriptor.value = immutableClone(descriptor.value, seen);
|
|
3488
|
+
descriptor.writable = false;
|
|
3489
|
+
}
|
|
3490
|
+
descriptor.configurable = false;
|
|
3491
|
+
Object.defineProperty(clone, key, descriptor);
|
|
3492
|
+
}
|
|
3493
|
+
return Object.freeze(clone);
|
|
3494
|
+
}
|
|
3495
|
+
function toPrepared(request, preview, context) {
|
|
3496
|
+
const canonicalRequest = immutableClone(request);
|
|
3497
|
+
const prepared = Object.freeze({
|
|
3498
|
+
request: immutableClone(request),
|
|
3499
|
+
preview,
|
|
3500
|
+
context
|
|
3501
|
+
});
|
|
3502
|
+
canonicalPreparedRequests.set(prepared, canonicalRequest);
|
|
3503
|
+
return prepared;
|
|
3504
|
+
}
|
|
3505
|
+
function preparedContext(context, account) {
|
|
3506
|
+
return Object.freeze({
|
|
3507
|
+
chainId: context.deployment.chainId,
|
|
3508
|
+
account: account.address,
|
|
3509
|
+
portal: context.deployment.contracts.portal
|
|
3510
|
+
});
|
|
3511
|
+
}
|
|
3512
|
+
async function requireWriteAccount(context) {
|
|
3513
|
+
const walletClient = requireWalletClient(context.walletClient);
|
|
3514
|
+
const chainId = await walletClient.getChainId();
|
|
3515
|
+
if (chainId !== context.deployment.chainId) {
|
|
3516
|
+
throw new WrongWalletChainError(context.deployment.chainId, chainId);
|
|
3517
|
+
}
|
|
3518
|
+
const [liveAddress] = await walletClient.getAddresses();
|
|
3519
|
+
if (!liveAddress) throw new MissingAccountError();
|
|
3520
|
+
const configuredAccount = walletClient.account;
|
|
3521
|
+
if (!configuredAccount) throw new MissingAccountError();
|
|
3522
|
+
return (0, import_viem6.isAddressEqual)(configuredAccount.address, liveAddress) ? configuredAccount : (0, import_accounts.parseAccount)(liveAddress);
|
|
3523
|
+
}
|
|
3524
|
+
async function simulate(context, parameters) {
|
|
3525
|
+
try {
|
|
3526
|
+
const { request, result } = await context.publicClient.simulateContract(parameters);
|
|
3527
|
+
return { request, result };
|
|
3528
|
+
} catch (error) {
|
|
3529
|
+
throw toLaunchpadError(error);
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
async function assertCanSpend(context, input) {
|
|
3533
|
+
const [balance, approval] = await Promise.all([
|
|
3534
|
+
getErc20Balance(context, input.asset, input.owner),
|
|
3535
|
+
getLaunchpadApprovalStatus(context, {
|
|
3536
|
+
asset: input.asset,
|
|
3537
|
+
owner: input.owner,
|
|
3538
|
+
requiredAmount: input.requiredAmount
|
|
3539
|
+
})
|
|
3540
|
+
]);
|
|
3541
|
+
if (balance < input.requiredAmount) {
|
|
3542
|
+
throw new LaunchpadInsufficientBalanceError(
|
|
3543
|
+
input.asset,
|
|
3544
|
+
input.owner,
|
|
3545
|
+
input.requiredAmount,
|
|
3546
|
+
balance
|
|
3547
|
+
);
|
|
3548
|
+
}
|
|
3549
|
+
if (!approval.sufficient) {
|
|
3550
|
+
throw new LaunchpadApprovalRequiredError(
|
|
3551
|
+
approval.asset,
|
|
3552
|
+
approval.spender,
|
|
3553
|
+
approval.requiredAmount
|
|
3554
|
+
);
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
async function prepareApproveErc20(context, input) {
|
|
3558
|
+
const account = await requireWriteAccount(context);
|
|
3559
|
+
const spender = input.spender ?? context.deployment.contracts.portal;
|
|
3560
|
+
if (input.amount < 0n) throw new RangeError("Approval amount must not be negative.");
|
|
3561
|
+
const { request } = await simulate(context, {
|
|
3562
|
+
account,
|
|
3563
|
+
address: input.asset,
|
|
3564
|
+
abi: import_viem6.erc20Abi,
|
|
3565
|
+
functionName: "approve",
|
|
3566
|
+
args: [spender, input.amount]
|
|
3567
|
+
});
|
|
3568
|
+
return toPrepared(
|
|
3569
|
+
request,
|
|
3570
|
+
{ asset: input.asset, spender, amount: input.amount },
|
|
3571
|
+
preparedContext(context, account)
|
|
3572
|
+
);
|
|
3573
|
+
}
|
|
3574
|
+
async function prepareLaunchpadBuy(context, input) {
|
|
3575
|
+
const account = await requireWriteAccount(context);
|
|
3576
|
+
const quote = await quoteLaunchpadBuy(context, input.token, input.quoteIn);
|
|
3577
|
+
const minTokenOut = applySlippageToMinimumOut(quote.tokenOut, input.slippage);
|
|
3578
|
+
await assertCanSpend(context, {
|
|
3579
|
+
asset: context.deployment.contracts.quoteToken,
|
|
3580
|
+
owner: account.address,
|
|
3581
|
+
requiredAmount: quote.quoteSpent
|
|
3582
|
+
});
|
|
3583
|
+
const { request } = await simulate(context, {
|
|
3584
|
+
account,
|
|
3585
|
+
address: context.deployment.contracts.portal,
|
|
3586
|
+
abi: portalAbi,
|
|
3587
|
+
functionName: "buy",
|
|
3588
|
+
args: [input.token, input.quoteIn, minTokenOut, input.deadline]
|
|
3589
|
+
});
|
|
3590
|
+
return toPrepared(request, quote, preparedContext(context, account));
|
|
3591
|
+
}
|
|
3592
|
+
async function prepareLaunchpadSell(context, input) {
|
|
3593
|
+
const account = await requireWriteAccount(context);
|
|
3594
|
+
const quote = await quoteLaunchpadSell(context, input.token, input.tokenIn);
|
|
3595
|
+
const minQuoteOut = applySlippageToMinimumOut(quote.quoteOut, input.slippage);
|
|
3596
|
+
await assertCanSpend(context, {
|
|
3597
|
+
asset: input.token,
|
|
3598
|
+
owner: account.address,
|
|
3599
|
+
requiredAmount: input.tokenIn
|
|
3600
|
+
});
|
|
3601
|
+
const { request } = await simulate(context, {
|
|
3602
|
+
account,
|
|
3603
|
+
address: context.deployment.contracts.portal,
|
|
3604
|
+
abi: portalAbi,
|
|
3605
|
+
functionName: "sell",
|
|
3606
|
+
args: [input.token, input.tokenIn, minQuoteOut, input.deadline]
|
|
3607
|
+
});
|
|
3608
|
+
return toPrepared(request, quote, preparedContext(context, account));
|
|
3609
|
+
}
|
|
3610
|
+
async function prepareCreateToken(context, input) {
|
|
3611
|
+
const account = await requireWriteAccount(context);
|
|
3612
|
+
if (input.name.length === 0 || input.symbol.length === 0) {
|
|
3613
|
+
throw new RangeError("Token name and symbol must not be empty.");
|
|
3614
|
+
}
|
|
3615
|
+
if (!Number.isSafeInteger(input.protectionBlocks) || input.protectionBlocks < 0 || input.protectionBlocks > MAX_PROTECTION_BLOCKS) {
|
|
3616
|
+
throw new RangeError(
|
|
3617
|
+
`protectionBlocks must be an integer between 0 and ${MAX_PROTECTION_BLOCKS}.`
|
|
3618
|
+
);
|
|
3619
|
+
}
|
|
3620
|
+
if (input.initialQuoteIn < 0n) {
|
|
3621
|
+
throw new RangeError("initialQuoteIn must not be negative.");
|
|
3622
|
+
}
|
|
3623
|
+
let firstBuy;
|
|
3624
|
+
let minInitialTokenOut = 0n;
|
|
3625
|
+
if (input.initialQuoteIn === 0n) {
|
|
3626
|
+
if (input.minInitialTokenOut !== void 0 && input.minInitialTokenOut !== 0n) {
|
|
3627
|
+
throw new RangeError("minInitialTokenOut must be zero when no initial buy is made.");
|
|
3628
|
+
}
|
|
3629
|
+
if (input.slippage !== void 0) {
|
|
3630
|
+
throw new RangeError("slippage is meaningless when no initial buy is made.");
|
|
3631
|
+
}
|
|
3632
|
+
} else {
|
|
3633
|
+
if (input.slippage === void 0 && input.minInitialTokenOut === void 0) {
|
|
3634
|
+
throw new RangeError(
|
|
3635
|
+
"A creator first buy requires either slippage (recommended) or an explicit minInitialTokenOut."
|
|
3636
|
+
);
|
|
3637
|
+
}
|
|
3638
|
+
firstBuy = await quoteCreatorFirstBuy(context, input.initialQuoteIn);
|
|
3639
|
+
if (input.minInitialTokenOut === void 0) {
|
|
3640
|
+
minInitialTokenOut = applySlippageToMinimumOut(firstBuy.tokenOut, input.slippage);
|
|
3641
|
+
} else {
|
|
3642
|
+
if (input.minInitialTokenOut <= 0n) {
|
|
3643
|
+
throw new RangeError(
|
|
3644
|
+
"A creator first buy requires a positive minInitialTokenOut; pass slippage to derive one."
|
|
3645
|
+
);
|
|
3646
|
+
}
|
|
3647
|
+
if (input.minInitialTokenOut > firstBuy.tokenOut) {
|
|
3648
|
+
throw new RangeError(
|
|
3649
|
+
`minInitialTokenOut ${input.minInitialTokenOut} exceeds the quoted first-buy output ${firstBuy.tokenOut} and would revert.`
|
|
3650
|
+
);
|
|
3651
|
+
}
|
|
3652
|
+
minInitialTokenOut = input.minInitialTokenOut;
|
|
3653
|
+
}
|
|
3654
|
+
await assertCanSpend(context, {
|
|
3655
|
+
asset: context.deployment.contracts.quoteToken,
|
|
3656
|
+
owner: account.address,
|
|
3657
|
+
requiredAmount: firstBuy.quoteSpent
|
|
3658
|
+
});
|
|
3659
|
+
}
|
|
3660
|
+
const { request } = await simulate(context, {
|
|
3661
|
+
account,
|
|
3662
|
+
address: context.deployment.contracts.portal,
|
|
3663
|
+
abi: portalAbi,
|
|
3664
|
+
functionName: "createTokenV2",
|
|
3665
|
+
args: [
|
|
3666
|
+
{
|
|
3667
|
+
name: input.name,
|
|
3668
|
+
symbol: input.symbol,
|
|
3669
|
+
metadata: input.metadata,
|
|
3670
|
+
userSalt: input.userSalt
|
|
3671
|
+
},
|
|
3672
|
+
// Raw input, not quoteSpent: the Portal truncates a graduating buy itself.
|
|
3673
|
+
input.initialQuoteIn,
|
|
3674
|
+
minInitialTokenOut,
|
|
3675
|
+
input.deadline,
|
|
3676
|
+
input.protectionBlocks
|
|
3677
|
+
]
|
|
3678
|
+
});
|
|
3679
|
+
return toPrepared(
|
|
3680
|
+
request,
|
|
3681
|
+
{
|
|
3682
|
+
...firstBuy ? { firstBuy } : {},
|
|
3683
|
+
initialQuoteIn: input.initialQuoteIn,
|
|
3684
|
+
minInitialTokenOut,
|
|
3685
|
+
protectionBlocks: input.protectionBlocks,
|
|
3686
|
+
deadline: input.deadline
|
|
3687
|
+
},
|
|
3688
|
+
preparedContext(context, account)
|
|
3689
|
+
);
|
|
3690
|
+
}
|
|
3691
|
+
async function prepareLaunchpadMigration(context, token) {
|
|
3692
|
+
const account = await requireWriteAccount(context);
|
|
3693
|
+
const state = await getLaunchpadTokenState(context, token);
|
|
3694
|
+
if (state.phase !== "migrating") {
|
|
3695
|
+
throw new LaunchpadPhaseUnavailableError(state.phase);
|
|
3696
|
+
}
|
|
3697
|
+
const { request } = await simulate(context, {
|
|
3698
|
+
account,
|
|
3699
|
+
address: context.deployment.contracts.portal,
|
|
3700
|
+
abi: portalAbi,
|
|
3701
|
+
functionName: "migrate",
|
|
3702
|
+
args: [token]
|
|
3703
|
+
});
|
|
3704
|
+
return toPrepared(request, { token }, preparedContext(context, account));
|
|
3705
|
+
}
|
|
3706
|
+
async function prepareCollectLaunchpadFees(context, tokenId) {
|
|
3707
|
+
const account = await requireWriteAccount(context);
|
|
3708
|
+
const position = await getLockedLaunchpadPosition(context, tokenId);
|
|
3709
|
+
if (!position) {
|
|
3710
|
+
throw new LaunchpadUnknownPositionError(tokenId);
|
|
3711
|
+
}
|
|
3712
|
+
const { request, result } = await simulate(context, {
|
|
3713
|
+
account,
|
|
3714
|
+
address: context.deployment.contracts.liquidityLocker,
|
|
3715
|
+
abi: liquidityLockerAbi,
|
|
3716
|
+
functionName: "collectFees",
|
|
3717
|
+
args: [tokenId]
|
|
3718
|
+
});
|
|
3719
|
+
const [amount0, amount1] = result;
|
|
3720
|
+
return toPrepared(
|
|
3721
|
+
request,
|
|
3722
|
+
{
|
|
3723
|
+
tokenId,
|
|
3724
|
+
token0: position.token0,
|
|
3725
|
+
token1: position.token1,
|
|
3726
|
+
creator: position.creator,
|
|
3727
|
+
platformFeeBps: position.platformFeeBps,
|
|
3728
|
+
amount0,
|
|
3729
|
+
amount1
|
|
3730
|
+
},
|
|
3731
|
+
preparedContext(context, account)
|
|
3732
|
+
);
|
|
3733
|
+
}
|
|
3734
|
+
async function prepareClaimLaunchpadReward(context, input) {
|
|
3735
|
+
const account = await requireWriteAccount(context);
|
|
3736
|
+
const recipient = input.recipient ?? account.address;
|
|
3737
|
+
const amount = await getClaimableLaunchpadReward(context, account.address, input.asset);
|
|
3738
|
+
if (amount <= 0n) {
|
|
3739
|
+
throw new LaunchpadNothingToClaimError(input.asset, account.address);
|
|
3740
|
+
}
|
|
3741
|
+
const { request } = await simulate(context, {
|
|
3742
|
+
account,
|
|
3743
|
+
address: context.deployment.contracts.liquidityLocker,
|
|
3744
|
+
abi: liquidityLockerAbi,
|
|
3745
|
+
functionName: "claim",
|
|
3746
|
+
args: [input.asset, recipient]
|
|
3747
|
+
});
|
|
3748
|
+
return toPrepared(
|
|
3749
|
+
request,
|
|
3750
|
+
{ asset: input.asset, recipient, amount },
|
|
3751
|
+
preparedContext(context, account)
|
|
3752
|
+
);
|
|
3753
|
+
}
|
|
3754
|
+
async function assertPreparedStillValid(context, prepared) {
|
|
3755
|
+
if (prepared === null || typeof prepared !== "object" || typeof prepared.request !== "object" || prepared.request === null || typeof prepared.context !== "object" || prepared.context === null) {
|
|
3756
|
+
throw new ForgedPreparedTransactionError(
|
|
3757
|
+
"The prepared transaction is malformed; obtain it from a prepare* call."
|
|
3758
|
+
);
|
|
3759
|
+
}
|
|
3760
|
+
if (!canonicalPreparedRequests.has(prepared)) {
|
|
3761
|
+
throw new ForgedPreparedTransactionError(
|
|
3762
|
+
"The prepared transaction did not originate from this SDK process; obtain it from a prepare* call."
|
|
3763
|
+
);
|
|
3764
|
+
}
|
|
3765
|
+
if (prepared.context.chainId !== context.deployment.chainId) {
|
|
3766
|
+
throw new ForgedPreparedTransactionError(
|
|
3767
|
+
`The prepared transaction targets chain ${prepared.context.chainId} but this client is bound to chain ${context.deployment.chainId}.`
|
|
3768
|
+
);
|
|
3769
|
+
}
|
|
3770
|
+
if (!(0, import_viem6.isAddressEqual)(prepared.context.portal, context.deployment.contracts.portal)) {
|
|
3771
|
+
throw new ForgedPreparedTransactionError(
|
|
3772
|
+
`The prepared transaction targets Portal ${prepared.context.portal} but this client is bound to ${context.deployment.contracts.portal}.`
|
|
3773
|
+
);
|
|
3774
|
+
}
|
|
3775
|
+
const account = await requireWriteAccount(context);
|
|
3776
|
+
if (!(0, import_viem6.isAddressEqual)(account.address, prepared.context.account)) {
|
|
3777
|
+
throw new PreparedAccountMismatchError(prepared.context.account, account.address);
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
async function sendPreparedLaunchpadTransaction(context, prepared) {
|
|
3781
|
+
await assertPreparedStillValid(context, prepared);
|
|
3782
|
+
const walletClient = requireWalletClient(context.walletClient);
|
|
3783
|
+
const canonicalRequest = canonicalPreparedRequests.get(prepared);
|
|
3784
|
+
if (!canonicalRequest) {
|
|
3785
|
+
throw new ForgedPreparedTransactionError(
|
|
3786
|
+
"The prepared transaction has no canonical simulated request; prepare it again."
|
|
3787
|
+
);
|
|
3788
|
+
}
|
|
3789
|
+
try {
|
|
3790
|
+
return await walletClient.writeContract(canonicalRequest);
|
|
3791
|
+
} catch (error) {
|
|
3792
|
+
throw toLaunchpadError(error);
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3796
|
+
// src/chains.ts
|
|
3797
|
+
var import_viem8 = require("viem");
|
|
3798
|
+
|
|
3799
|
+
// src/deployment.ts
|
|
3800
|
+
var import_viem7 = require("viem");
|
|
3801
|
+
var gitCommitPattern = /^[0-9a-f]{40}$/;
|
|
3802
|
+
var runtimeCodeHashPattern = /^0x[0-9a-f]{64}$/;
|
|
3803
|
+
var requiredContractFields = [
|
|
3804
|
+
"portal",
|
|
3805
|
+
"tokenFactory",
|
|
3806
|
+
"curve",
|
|
3807
|
+
"migrator",
|
|
3808
|
+
"liquidityLocker",
|
|
3809
|
+
"quoteToken"
|
|
3810
|
+
];
|
|
3811
|
+
var optionalContractFields = [
|
|
3812
|
+
"v3Factory",
|
|
3813
|
+
"positionManager",
|
|
3814
|
+
"dexRouter"
|
|
3815
|
+
];
|
|
3816
|
+
var InvalidLaunchpadDeploymentError = class extends Error {
|
|
3817
|
+
field;
|
|
3818
|
+
constructor(field, message) {
|
|
3819
|
+
super(message);
|
|
3820
|
+
this.name = "InvalidLaunchpadDeploymentError";
|
|
3821
|
+
this.field = field;
|
|
3822
|
+
}
|
|
3823
|
+
};
|
|
3824
|
+
function invalid(field, message) {
|
|
3825
|
+
throw new InvalidLaunchpadDeploymentError(field, message);
|
|
3826
|
+
}
|
|
3827
|
+
function normalizeAddress(field, address) {
|
|
3828
|
+
if (typeof address !== "string" || !(0, import_viem7.isAddress)(address) || (0, import_viem7.isAddressEqual)(address, import_viem7.zeroAddress)) {
|
|
3829
|
+
return invalid(field, `${field} must be a non-zero EVM address.`);
|
|
3830
|
+
}
|
|
3831
|
+
return (0, import_viem7.getAddress)(address);
|
|
3832
|
+
}
|
|
3833
|
+
function normalizeContracts(input) {
|
|
3834
|
+
const normalized = {};
|
|
3835
|
+
for (const field of requiredContractFields) {
|
|
3836
|
+
normalized[field] = normalizeAddress(`contracts.${field}`, input[field]);
|
|
3837
|
+
}
|
|
3838
|
+
for (const field of optionalContractFields) {
|
|
3839
|
+
const value = input[field];
|
|
3840
|
+
if (value !== void 0) {
|
|
3841
|
+
normalized[field] = normalizeAddress(`contracts.${field}`, value);
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3844
|
+
return Object.freeze(normalized);
|
|
3845
|
+
}
|
|
3846
|
+
function defineLaunchpadDeployment(input) {
|
|
3847
|
+
if (!Number.isSafeInteger(input.chainId) || input.chainId <= 0) {
|
|
3848
|
+
invalid("chainId", "chainId must be a positive safe integer.");
|
|
3849
|
+
}
|
|
3850
|
+
if (input.contractVersion.trim().length === 0) {
|
|
3851
|
+
invalid("contractVersion", "contractVersion must not be empty.");
|
|
3852
|
+
}
|
|
3853
|
+
if (typeof input.deploymentBlock !== "bigint" || input.deploymentBlock <= 0n) {
|
|
3854
|
+
invalid("deploymentBlock", "deploymentBlock must be a positive bigint.");
|
|
3855
|
+
}
|
|
3856
|
+
if (!gitCommitPattern.test(input.artifactCommit)) {
|
|
3857
|
+
invalid("artifactCommit", "artifactCommit must be a lowercase 40-character Git commit.");
|
|
3858
|
+
}
|
|
3859
|
+
if (!gitCommitPattern.test(input.sourceCommit)) {
|
|
3860
|
+
invalid("sourceCommit", "sourceCommit must be a lowercase 40-character Git commit.");
|
|
3861
|
+
}
|
|
3862
|
+
if (!runtimeCodeHashPattern.test(input.portalRuntimeCodeHash)) {
|
|
3863
|
+
invalid(
|
|
3864
|
+
"portalRuntimeCodeHash",
|
|
3865
|
+
"portalRuntimeCodeHash must be a lowercase 32-byte hex hash (0x + 64 hex chars)."
|
|
3866
|
+
);
|
|
3867
|
+
}
|
|
3868
|
+
return Object.freeze({
|
|
3869
|
+
chainId: input.chainId,
|
|
3870
|
+
contractVersion: input.contractVersion,
|
|
3871
|
+
contracts: normalizeContracts(input.contracts),
|
|
3872
|
+
deploymentBlock: input.deploymentBlock,
|
|
3873
|
+
artifactCommit: input.artifactCommit,
|
|
3874
|
+
sourceCommit: input.sourceCommit,
|
|
3875
|
+
portalRuntimeCodeHash: input.portalRuntimeCodeHash
|
|
3876
|
+
});
|
|
3877
|
+
}
|
|
3878
|
+
function defineLaunchpadDeploymentRegistry(input) {
|
|
3879
|
+
const entries = Object.entries(input).map(([key, deployment]) => {
|
|
3880
|
+
const defined = defineLaunchpadDeployment(deployment);
|
|
3881
|
+
if (Number(key) !== defined.chainId) {
|
|
3882
|
+
invalid(
|
|
3883
|
+
`registry[${key}]`,
|
|
3884
|
+
`Registry key ${key} does not match deployment chainId ${defined.chainId}.`
|
|
3885
|
+
);
|
|
3886
|
+
}
|
|
3887
|
+
return [defined.chainId, defined];
|
|
3888
|
+
});
|
|
3889
|
+
return Object.freeze(Object.fromEntries(entries));
|
|
3890
|
+
}
|
|
3891
|
+
var launchpadDeploymentRegistry = defineLaunchpadDeploymentRegistry({});
|
|
3892
|
+
function resolveLaunchpadDeployment(registry, chainId) {
|
|
3893
|
+
const deployment = registry[chainId];
|
|
3894
|
+
if (deployment === void 0) throw new UnsupportedChainError(chainId);
|
|
3895
|
+
return deployment;
|
|
3896
|
+
}
|
|
3897
|
+
|
|
3898
|
+
// src/chains.ts
|
|
3899
|
+
var InvalidLaunchpadChainConfigError = class extends Error {
|
|
3900
|
+
field;
|
|
3901
|
+
constructor(field, message) {
|
|
3902
|
+
super(message);
|
|
3903
|
+
this.name = "InvalidLaunchpadChainConfigError";
|
|
3904
|
+
this.field = field;
|
|
3905
|
+
}
|
|
3906
|
+
};
|
|
3907
|
+
function invalid2(field, message) {
|
|
3908
|
+
throw new InvalidLaunchpadChainConfigError(field, message);
|
|
3909
|
+
}
|
|
3910
|
+
function normalizeAddress2(field, address) {
|
|
3911
|
+
if (!(0, import_viem8.isAddress)(address) || (0, import_viem8.isAddressEqual)(address, import_viem8.zeroAddress)) {
|
|
3912
|
+
return invalid2(field, `${field} must be a non-zero EVM address.`);
|
|
3913
|
+
}
|
|
3914
|
+
return (0, import_viem8.getAddress)(address);
|
|
3915
|
+
}
|
|
3916
|
+
function normalizeUrl(field, value) {
|
|
3917
|
+
try {
|
|
3918
|
+
const url = new URL(value);
|
|
3919
|
+
if (url.protocol !== "https:" && url.protocol !== "wss:") {
|
|
3920
|
+
return invalid2(field, `${field} must use HTTPS or WSS.`);
|
|
3921
|
+
}
|
|
3922
|
+
return url.toString().replace(/\/$/, "");
|
|
3923
|
+
} catch {
|
|
3924
|
+
return invalid2(field, `${field} must be an absolute URL.`);
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
function normalizeQuoteToken(input, index) {
|
|
3928
|
+
const field = `quoteTokens[${index}]`;
|
|
3929
|
+
if (!Number.isSafeInteger(input.decimals) || input.decimals < 0 || input.decimals > 255) {
|
|
3930
|
+
invalid2(`${field}.decimals`, "Quote token decimals must be an integer between 0 and 255.");
|
|
3931
|
+
}
|
|
3932
|
+
if (input.symbol.trim().length === 0) {
|
|
3933
|
+
invalid2(`${field}.symbol`, "Quote token symbol must not be empty.");
|
|
3934
|
+
}
|
|
3935
|
+
return Object.freeze({ ...input, address: normalizeAddress2(`${field}.address`, input.address) });
|
|
3936
|
+
}
|
|
3937
|
+
var capabilities = [
|
|
3938
|
+
"create",
|
|
3939
|
+
"bondingTrade",
|
|
3940
|
+
"graduatedTrade",
|
|
3941
|
+
"antiFarmer",
|
|
3942
|
+
"earlySellTax",
|
|
3943
|
+
"rewards",
|
|
3944
|
+
"referral"
|
|
3945
|
+
];
|
|
3946
|
+
function defineLaunchpadChain(input) {
|
|
3947
|
+
if (!Number.isSafeInteger(input.chainId) || input.chainId <= 0) {
|
|
3948
|
+
invalid2("chainId", "chainId must be a positive safe integer.");
|
|
3949
|
+
}
|
|
3950
|
+
if (!/^[a-z0-9-]+$/.test(input.slug)) {
|
|
3951
|
+
invalid2("slug", "slug must be lowercase and contain only letters, numbers, and hyphens.");
|
|
3952
|
+
}
|
|
3953
|
+
if (input.deployment.chainId !== input.chainId) {
|
|
3954
|
+
invalid2(
|
|
3955
|
+
"deployment.chainId",
|
|
3956
|
+
`deployment.chainId (${input.deployment.chainId}) must match the chain's chainId (${input.chainId}).`
|
|
3957
|
+
);
|
|
3958
|
+
}
|
|
3959
|
+
if (!Number.isSafeInteger(input.nativeCurrency.decimals) || input.nativeCurrency.decimals < 0) {
|
|
3960
|
+
invalid2("nativeCurrency.decimals", "Native currency decimals must be a non-negative integer.");
|
|
3961
|
+
}
|
|
3962
|
+
if (input.nativeCurrency.symbol.trim().length === 0) {
|
|
3963
|
+
invalid2("nativeCurrency.symbol", "Native currency symbol must not be empty.");
|
|
3964
|
+
}
|
|
3965
|
+
if (input.rpcUrls.length === 0) {
|
|
3966
|
+
invalid2("rpcUrls", "At least one RPC URL is required.");
|
|
3967
|
+
}
|
|
3968
|
+
if (!Number.isSafeInteger(input.confirmations) || input.confirmations < 0) {
|
|
3969
|
+
invalid2("confirmations", "confirmations must be a non-negative safe integer.");
|
|
3970
|
+
}
|
|
3971
|
+
const quoteTokens = input.quoteTokens.map(normalizeQuoteToken);
|
|
3972
|
+
const quoteAddresses = new Set(quoteTokens.map((token) => token.address.toLowerCase()));
|
|
3973
|
+
if (quoteAddresses.size !== quoteTokens.length) {
|
|
3974
|
+
invalid2("quoteTokens", "Quote token addresses must be unique for a chain.");
|
|
3975
|
+
}
|
|
3976
|
+
for (const capability of capabilities) {
|
|
3977
|
+
if (typeof input.capabilities[capability] !== "boolean") {
|
|
3978
|
+
invalid2(
|
|
3979
|
+
`capabilities.${capability}`,
|
|
3980
|
+
"Every Launchpad capability must be declared as a boolean."
|
|
3981
|
+
);
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
return Object.freeze({
|
|
3985
|
+
...input,
|
|
3986
|
+
apiBaseUrl: normalizeUrl("apiBaseUrl", input.apiBaseUrl),
|
|
3987
|
+
capabilities: Object.freeze({ ...input.capabilities }),
|
|
3988
|
+
// Validation and freezing are delegated to the deployment's own definer rather than
|
|
3989
|
+
// duplicated here, so a chain config can never carry an under-validated deployment.
|
|
3990
|
+
deployment: defineLaunchpadDeployment(input.deployment),
|
|
3991
|
+
explorerUrl: normalizeUrl("explorerUrl", input.explorerUrl),
|
|
3992
|
+
nativeCurrency: Object.freeze({ ...input.nativeCurrency }),
|
|
3993
|
+
quoteTokens: Object.freeze(quoteTokens),
|
|
3994
|
+
realtimeUrl: normalizeUrl("realtimeUrl", input.realtimeUrl),
|
|
3995
|
+
rpcUrls: Object.freeze(
|
|
3996
|
+
input.rpcUrls.map((url, index) => normalizeUrl(`rpcUrls[${index}]`, url))
|
|
3997
|
+
)
|
|
3998
|
+
});
|
|
3999
|
+
}
|
|
4000
|
+
function defineLaunchpadTokenId(input) {
|
|
4001
|
+
if (!Number.isSafeInteger(input.chainId) || input.chainId <= 0) {
|
|
4002
|
+
invalid2("chainId", "chainId must be a positive safe integer.");
|
|
4003
|
+
}
|
|
4004
|
+
return Object.freeze({
|
|
4005
|
+
chainId: input.chainId,
|
|
4006
|
+
address: normalizeAddress2("address", input.address)
|
|
4007
|
+
});
|
|
4008
|
+
}
|
|
4009
|
+
|
|
4010
|
+
// src/client.ts
|
|
4011
|
+
function createLaunchpadClient(config) {
|
|
4012
|
+
const chains = Object.freeze(
|
|
4013
|
+
Object.fromEntries(
|
|
4014
|
+
Object.entries(config.chains).map(([chainId, chain]) => [
|
|
4015
|
+
chainId,
|
|
4016
|
+
defineLaunchpadChain(chain)
|
|
4017
|
+
])
|
|
4018
|
+
)
|
|
4019
|
+
);
|
|
4020
|
+
const resolveChain = (chainId) => {
|
|
4021
|
+
const resolvedChainId = chainId ?? config.publicClient.chain?.id;
|
|
4022
|
+
if (resolvedChainId === void 0) throw new MissingChainError();
|
|
4023
|
+
const chain = resolveChainValue(chains, resolvedChainId);
|
|
4024
|
+
if (chain.chainId !== resolvedChainId) {
|
|
4025
|
+
throw new TypeError(
|
|
4026
|
+
`Launchpad chain ${chain.chainId} does not match registry chain ${resolvedChainId}.`
|
|
4027
|
+
);
|
|
4028
|
+
}
|
|
4029
|
+
return chain;
|
|
4030
|
+
};
|
|
4031
|
+
const resolveAdapter = (chainId) => {
|
|
4032
|
+
const chain = resolveChain(chainId);
|
|
4033
|
+
return resolveChainValue(config.adapters ?? {}, chain.chainId);
|
|
4034
|
+
};
|
|
4035
|
+
return Object.freeze({
|
|
4036
|
+
publicClient: config.publicClient,
|
|
4037
|
+
walletClient: config.walletClient,
|
|
4038
|
+
getChain: resolveChain,
|
|
4039
|
+
getAdapter: resolveAdapter,
|
|
4040
|
+
read: (request, chainId) => {
|
|
4041
|
+
const chain = resolveChain(chainId);
|
|
4042
|
+
return resolveAdapter(chain.chainId).read(
|
|
4043
|
+
{ chain, publicClient: config.publicClient },
|
|
4044
|
+
request
|
|
4045
|
+
);
|
|
4046
|
+
},
|
|
4047
|
+
write: (request, chainId) => {
|
|
4048
|
+
const chain = resolveChain(chainId);
|
|
4049
|
+
if (!chain.capabilities[request.requiredCapability]) {
|
|
4050
|
+
throw new UnsupportedLaunchpadCapabilityError(chain.chainId, request.requiredCapability);
|
|
4051
|
+
}
|
|
4052
|
+
return resolveAdapter(chain.chainId).write(
|
|
4053
|
+
{
|
|
4054
|
+
chain,
|
|
4055
|
+
publicClient: config.publicClient,
|
|
4056
|
+
walletClient: requireWalletClient(config.walletClient)
|
|
4057
|
+
},
|
|
4058
|
+
request
|
|
4059
|
+
);
|
|
4060
|
+
}
|
|
4061
|
+
});
|
|
4062
|
+
}
|
|
4063
|
+
var UnsupportedLaunchpadCapabilityError = class extends Error {
|
|
4064
|
+
chainId;
|
|
4065
|
+
capability;
|
|
4066
|
+
constructor(chainId, capability) {
|
|
4067
|
+
super(`Launchpad capability ${capability} is not supported on chain ${chainId}.`);
|
|
4068
|
+
this.name = "UnsupportedLaunchpadCapabilityError";
|
|
4069
|
+
this.chainId = chainId;
|
|
4070
|
+
this.capability = capability;
|
|
4071
|
+
}
|
|
4072
|
+
};
|
|
4073
|
+
|
|
4074
|
+
// src/deployments/arc-testnet.ts
|
|
4075
|
+
var arcTestnetChainId = 5042002;
|
|
4076
|
+
var arcTestnetLaunchpadDeployment = defineLaunchpadDeployment({
|
|
4077
|
+
chainId: arcTestnetChainId,
|
|
4078
|
+
contractVersion: "v2",
|
|
4079
|
+
contracts: {
|
|
4080
|
+
portal: "0x068E0fD38cb2D91264A8590a922A7f30F32A52FC",
|
|
4081
|
+
tokenFactory: "0x86C0617e718082949C613AB3a31B5d89c7632C38",
|
|
4082
|
+
curve: "0xC56485723B3015c9020De94A3D81C5071c791132",
|
|
4083
|
+
migrator: "0x27079FB023F051AB18AD5D441D0AFd5bE0F83E95",
|
|
4084
|
+
liquidityLocker: "0xfC285E5FD969381798C9Eb1b6bFF8ddaBB7ee243",
|
|
4085
|
+
quoteToken: "0xa93A87359D6c824b2Dad1184d523Da8DCcaaBcD7",
|
|
4086
|
+
v3Factory: "0xf2134DBAF02aB5Da16bfF6BddE87d79ad6A41753",
|
|
4087
|
+
positionManager: "0xb09CD98B83cC46e5da2CB9CEF7988DBA8238c803"
|
|
4088
|
+
// dexRouter is intentionally unset: no audited graduated-execution router adapter exists.
|
|
4089
|
+
},
|
|
4090
|
+
deploymentBlock: 56732456n,
|
|
4091
|
+
artifactCommit: "33dd9f1cd51304ebe84375774dcbee3b1181f3bb",
|
|
4092
|
+
sourceCommit: "33dd9f1cd51304ebe84375774dcbee3b1181f3bb",
|
|
4093
|
+
portalRuntimeCodeHash: "0x4a9960f8e62928be2a163cc78ec14f1609ad72bb910c997c0135e14812cfc50d"
|
|
4094
|
+
});
|
|
4095
|
+
|
|
4096
|
+
// src/metadata.ts
|
|
4097
|
+
var knownStringFields = ["description", "image", "website"];
|
|
4098
|
+
function readStringField(source, key) {
|
|
4099
|
+
const value = source[key];
|
|
4100
|
+
return typeof value === "string" ? value : void 0;
|
|
4101
|
+
}
|
|
4102
|
+
function parseLaunchpadMetadata(raw) {
|
|
4103
|
+
let parsed;
|
|
4104
|
+
try {
|
|
4105
|
+
parsed = JSON.parse(raw);
|
|
4106
|
+
} catch {
|
|
4107
|
+
return Object.freeze({ raw, valid: false, extra: Object.freeze({}) });
|
|
4108
|
+
}
|
|
4109
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
4110
|
+
return Object.freeze({ raw, valid: false, extra: Object.freeze({}) });
|
|
4111
|
+
}
|
|
4112
|
+
const source = parsed;
|
|
4113
|
+
const extra = Object.fromEntries(
|
|
4114
|
+
Object.entries(source).filter(
|
|
4115
|
+
([key]) => !knownStringFields.includes(key)
|
|
4116
|
+
)
|
|
4117
|
+
);
|
|
4118
|
+
const fields = Object.fromEntries(
|
|
4119
|
+
knownStringFields.map((key) => [key, readStringField(source, key)]).filter(([, value]) => value !== void 0)
|
|
4120
|
+
);
|
|
4121
|
+
return Object.freeze({
|
|
4122
|
+
raw,
|
|
4123
|
+
valid: true,
|
|
4124
|
+
...fields,
|
|
4125
|
+
extra: Object.freeze(extra)
|
|
4126
|
+
});
|
|
4127
|
+
}
|
|
4128
|
+
|
|
4129
|
+
// src/portal-client.ts
|
|
4130
|
+
function createLaunchpadPortalClient(config) {
|
|
4131
|
+
const chain = defineLaunchpadChain(config.chain);
|
|
4132
|
+
const deployment = chain.deployment;
|
|
4133
|
+
const readContext = {
|
|
4134
|
+
publicClient: config.publicClient,
|
|
4135
|
+
deployment
|
|
4136
|
+
};
|
|
4137
|
+
const minted = /* @__PURE__ */ new WeakSet();
|
|
4138
|
+
const mint = (prepared) => {
|
|
4139
|
+
minted.add(prepared);
|
|
4140
|
+
return prepared;
|
|
4141
|
+
};
|
|
4142
|
+
const writeContext = () => {
|
|
4143
|
+
if (!config.walletClient) throw new MissingWalletClientError();
|
|
4144
|
+
return { ...readContext, walletClient: config.walletClient };
|
|
4145
|
+
};
|
|
4146
|
+
const requireCapability = (capability) => {
|
|
4147
|
+
if (!chain.capabilities[capability]) {
|
|
4148
|
+
throw new UnsupportedLaunchpadCapabilityError(chain.chainId, capability);
|
|
4149
|
+
}
|
|
4150
|
+
};
|
|
4151
|
+
const client = {
|
|
4152
|
+
chain,
|
|
4153
|
+
deployment,
|
|
4154
|
+
publicClient: config.publicClient,
|
|
4155
|
+
walletClient: config.walletClient,
|
|
4156
|
+
getTokenState: (token, options) => getLaunchpadTokenState(readContext, token, options),
|
|
4157
|
+
getTokenMetadata: (token, options) => getLaunchpadTokenMetadata(readContext, token, options),
|
|
4158
|
+
getPrice: (token, options) => getLaunchpadPrice(readContext, token, options),
|
|
4159
|
+
quoteBuy: (token, quoteIn, options) => quoteLaunchpadBuy(readContext, token, quoteIn, options),
|
|
4160
|
+
quoteSell: (token, tokenIn, options) => quoteLaunchpadSell(readContext, token, tokenIn, options),
|
|
4161
|
+
getCurveConstants: (options) => getLaunchpadCurveConstants(readContext, options),
|
|
4162
|
+
getErc20Metadata: (asset, options) => getErc20Metadata(readContext, asset, options),
|
|
4163
|
+
getLockedPosition: (tokenId, options) => getLockedLaunchpadPosition(readContext, tokenId, options),
|
|
4164
|
+
getCurveProgress: (token, options) => getLaunchpadCurveProgress(readContext, token, options),
|
|
4165
|
+
predictTokenAddress: (input, options) => predictLaunchpadTokenAddress(readContext, input, options),
|
|
4166
|
+
quoteCreatorFirstBuy: (quoteIn, options) => quoteCreatorFirstBuy(readContext, quoteIn, options),
|
|
4167
|
+
getTradeAvailability: (token, options) => getLaunchpadTradeAvailability(readContext, token, options),
|
|
4168
|
+
getBalance: (asset, account, options) => getErc20Balance(readContext, asset, account, options),
|
|
4169
|
+
getAllowance: (asset, owner, spender, options) => getErc20Allowance(readContext, asset, owner, spender, options),
|
|
4170
|
+
getApprovalStatus: (input, options) => getLaunchpadApprovalStatus(readContext, input, options),
|
|
4171
|
+
getClaimableReward: (account, asset, options) => getClaimableLaunchpadReward(readContext, account, asset, options),
|
|
4172
|
+
// `async` so a missing Wallet Client or a disabled capability surfaces as a rejected promise
|
|
4173
|
+
// rather than a synchronous throw, keeping every write path uniformly awaitable.
|
|
4174
|
+
prepareApprove: async (input) => mint(await prepareApproveErc20(writeContext(), input)),
|
|
4175
|
+
prepareCreateToken: async (input) => {
|
|
4176
|
+
requireCapability("create");
|
|
4177
|
+
return mint(await prepareCreateToken(writeContext(), input));
|
|
4178
|
+
},
|
|
4179
|
+
prepareBuy: async (input) => {
|
|
4180
|
+
requireCapability("bondingTrade");
|
|
4181
|
+
return mint(await prepareLaunchpadBuy(writeContext(), input));
|
|
4182
|
+
},
|
|
4183
|
+
prepareSell: async (input) => {
|
|
4184
|
+
requireCapability("bondingTrade");
|
|
4185
|
+
return mint(await prepareLaunchpadSell(writeContext(), input));
|
|
4186
|
+
},
|
|
4187
|
+
prepareMigration: async (token) => mint(await prepareLaunchpadMigration(writeContext(), token)),
|
|
4188
|
+
prepareCollectFees: async (tokenId) => mint(await prepareCollectLaunchpadFees(writeContext(), tokenId)),
|
|
4189
|
+
prepareClaimReward: async (input) => {
|
|
4190
|
+
requireCapability("rewards");
|
|
4191
|
+
return mint(await prepareClaimLaunchpadReward(writeContext(), input));
|
|
4192
|
+
},
|
|
4193
|
+
send: async (prepared) => {
|
|
4194
|
+
if (!minted.has(prepared)) {
|
|
4195
|
+
throw new ForgedPreparedTransactionError(
|
|
4196
|
+
"This prepared transaction was not created by this client. Prepare it again through the client you are sending from."
|
|
4197
|
+
);
|
|
4198
|
+
}
|
|
4199
|
+
return sendPreparedLaunchpadTransaction(writeContext(), prepared);
|
|
4200
|
+
},
|
|
4201
|
+
wait: (hash, options) => waitForLaunchpadTransaction(readContext, hash, options)
|
|
4202
|
+
};
|
|
4203
|
+
return Object.freeze(client);
|
|
4204
|
+
}
|
|
4205
|
+
|
|
4206
|
+
// src/verify.ts
|
|
4207
|
+
var import_viem9 = require("viem");
|
|
4208
|
+
var DEFAULT_CURVE_ID = 1;
|
|
4209
|
+
var DEFAULT_MIGRATOR_ID = 1;
|
|
4210
|
+
var LaunchpadDeploymentVerificationError = class extends Error {
|
|
4211
|
+
field;
|
|
4212
|
+
expected;
|
|
4213
|
+
actual;
|
|
4214
|
+
constructor(field, expected, actual) {
|
|
4215
|
+
super(
|
|
4216
|
+
`Launchpad deployment verification failed for ${field}: expected ${expected}, got ${actual}.`
|
|
4217
|
+
);
|
|
4218
|
+
this.name = "LaunchpadDeploymentVerificationError";
|
|
4219
|
+
this.field = field;
|
|
4220
|
+
this.expected = expected;
|
|
4221
|
+
this.actual = actual;
|
|
4222
|
+
}
|
|
4223
|
+
};
|
|
4224
|
+
function assertAddress(field, expected, actual) {
|
|
4225
|
+
if (!(0, import_viem9.isAddressEqual)(expected, actual)) {
|
|
4226
|
+
throw new LaunchpadDeploymentVerificationError(field, expected, actual);
|
|
4227
|
+
}
|
|
4228
|
+
}
|
|
4229
|
+
async function verifyLaunchpadDeployment(publicClient, deployment) {
|
|
4230
|
+
const contracts = deployment.contracts;
|
|
4231
|
+
const chainId = await publicClient.getChainId();
|
|
4232
|
+
if (chainId !== deployment.chainId) {
|
|
4233
|
+
throw new LaunchpadDeploymentVerificationError(
|
|
4234
|
+
"chainId",
|
|
4235
|
+
String(deployment.chainId),
|
|
4236
|
+
String(chainId)
|
|
4237
|
+
);
|
|
4238
|
+
}
|
|
4239
|
+
const code = await publicClient.getCode({ address: contracts.portal });
|
|
4240
|
+
if (!code || code === "0x") {
|
|
4241
|
+
throw new LaunchpadDeploymentVerificationError(
|
|
4242
|
+
"portalRuntimeCode",
|
|
4243
|
+
deployment.portalRuntimeCodeHash,
|
|
4244
|
+
"0x"
|
|
4245
|
+
);
|
|
4246
|
+
}
|
|
4247
|
+
const runtimeCodeHash = (0, import_viem9.keccak256)(code).toLowerCase();
|
|
4248
|
+
if (runtimeCodeHash !== deployment.portalRuntimeCodeHash.toLowerCase()) {
|
|
4249
|
+
throw new LaunchpadDeploymentVerificationError(
|
|
4250
|
+
"portalRuntimeCodeHash",
|
|
4251
|
+
deployment.portalRuntimeCodeHash,
|
|
4252
|
+
runtimeCodeHash
|
|
4253
|
+
);
|
|
4254
|
+
}
|
|
4255
|
+
const readPortal = (functionName) => publicClient.readContract({
|
|
4256
|
+
address: contracts.portal,
|
|
4257
|
+
abi: portalAbi,
|
|
4258
|
+
functionName
|
|
4259
|
+
});
|
|
4260
|
+
const [portalFactory, portalQuoteToken, portalLpRecipient, portalCurve, portalMigrator] = await Promise.all([
|
|
4261
|
+
readPortal("tokenFactory"),
|
|
4262
|
+
readPortal("quoteToken"),
|
|
4263
|
+
readPortal("lpRecipient"),
|
|
4264
|
+
publicClient.readContract({
|
|
4265
|
+
address: contracts.portal,
|
|
4266
|
+
abi: portalAbi,
|
|
4267
|
+
functionName: "curves",
|
|
4268
|
+
args: [DEFAULT_CURVE_ID]
|
|
4269
|
+
}),
|
|
4270
|
+
publicClient.readContract({
|
|
4271
|
+
address: contracts.portal,
|
|
4272
|
+
abi: portalAbi,
|
|
4273
|
+
functionName: "migrators",
|
|
4274
|
+
args: [DEFAULT_MIGRATOR_ID]
|
|
4275
|
+
})
|
|
4276
|
+
]);
|
|
4277
|
+
assertAddress("portal.tokenFactory", contracts.tokenFactory, portalFactory);
|
|
4278
|
+
assertAddress("portal.quoteToken", contracts.quoteToken, portalQuoteToken);
|
|
4279
|
+
assertAddress("portal.lpRecipient", contracts.liquidityLocker, portalLpRecipient);
|
|
4280
|
+
assertAddress("portal.curves(1)", contracts.curve, portalCurve);
|
|
4281
|
+
assertAddress("portal.migrators(1)", contracts.migrator, portalMigrator);
|
|
4282
|
+
const readMigrator = (functionName) => publicClient.readContract({
|
|
4283
|
+
address: contracts.migrator,
|
|
4284
|
+
abi: v3MigratorAbi,
|
|
4285
|
+
functionName
|
|
4286
|
+
});
|
|
4287
|
+
const [migratorPortal, migratorLocker] = await Promise.all([
|
|
4288
|
+
readMigrator("portal"),
|
|
4289
|
+
readMigrator("locker")
|
|
4290
|
+
]);
|
|
4291
|
+
assertAddress("migrator.portal", contracts.portal, migratorPortal);
|
|
4292
|
+
assertAddress("migrator.locker", contracts.liquidityLocker, migratorLocker);
|
|
4293
|
+
if (contracts.v3Factory !== void 0) {
|
|
4294
|
+
assertAddress("migrator.factory", contracts.v3Factory, await readMigrator("factory"));
|
|
4295
|
+
}
|
|
4296
|
+
if (contracts.positionManager !== void 0) {
|
|
4297
|
+
const [migratorPositionManager, lockerPositionManager] = await Promise.all([
|
|
4298
|
+
readMigrator("positionManager"),
|
|
4299
|
+
publicClient.readContract({
|
|
4300
|
+
address: contracts.liquidityLocker,
|
|
4301
|
+
abi: liquidityLockerAbi,
|
|
4302
|
+
functionName: "positionManager"
|
|
4303
|
+
})
|
|
4304
|
+
]);
|
|
4305
|
+
assertAddress("migrator.positionManager", contracts.positionManager, migratorPositionManager);
|
|
4306
|
+
assertAddress("locker.positionManager", contracts.positionManager, lockerPositionManager);
|
|
4307
|
+
}
|
|
4308
|
+
const lockerAllowsMigrator = await publicClient.readContract({
|
|
4309
|
+
address: contracts.liquidityLocker,
|
|
4310
|
+
abi: liquidityLockerAbi,
|
|
4311
|
+
functionName: "migrators",
|
|
4312
|
+
args: [contracts.migrator]
|
|
4313
|
+
});
|
|
4314
|
+
if (lockerAllowsMigrator !== true) {
|
|
4315
|
+
throw new LaunchpadDeploymentVerificationError(
|
|
4316
|
+
"locker.migrators(migrator)",
|
|
4317
|
+
"true",
|
|
4318
|
+
String(lockerAllowsMigrator)
|
|
4319
|
+
);
|
|
4320
|
+
}
|
|
4321
|
+
}
|
|
4322
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4323
|
+
0 && (module.exports = {
|
|
4324
|
+
BPS,
|
|
4325
|
+
DEFAULT_DEADLINE_SECONDS,
|
|
4326
|
+
ForgedPreparedTransactionError,
|
|
4327
|
+
InvalidDeadlineError,
|
|
4328
|
+
InvalidLaunchpadChainConfigError,
|
|
4329
|
+
InvalidLaunchpadDeploymentError,
|
|
4330
|
+
InvalidLaunchpadReadInputError,
|
|
4331
|
+
InvalidLaunchpadStateError,
|
|
4332
|
+
InvalidSlippageError,
|
|
4333
|
+
LaunchpadApprovalRequiredError,
|
|
4334
|
+
LaunchpadDeadlineExpiredError,
|
|
4335
|
+
LaunchpadDeploymentVerificationError,
|
|
4336
|
+
LaunchpadError,
|
|
4337
|
+
LaunchpadInsufficientBalanceError,
|
|
4338
|
+
LaunchpadNothingToClaimError,
|
|
4339
|
+
LaunchpadOfficialPoolLockedError,
|
|
4340
|
+
LaunchpadPhaseUnavailableError,
|
|
4341
|
+
LaunchpadProtectionError,
|
|
4342
|
+
LaunchpadSlippageError,
|
|
4343
|
+
LaunchpadTradingPausedError,
|
|
4344
|
+
LaunchpadUnknownPositionError,
|
|
4345
|
+
MAX_PROTECTION_BLOCKS,
|
|
4346
|
+
MAX_SLIPPAGE_BPS,
|
|
4347
|
+
MissingWalletClientError,
|
|
4348
|
+
PRICE_WAD_SCALE,
|
|
4349
|
+
PreparedAccountMismatchError,
|
|
4350
|
+
TRADE_FEE_BPS,
|
|
4351
|
+
UnpinnableBlockTagError,
|
|
4352
|
+
UnsupportedLaunchpadCapabilityError,
|
|
4353
|
+
WrongWalletChainError,
|
|
4354
|
+
applySlippageToMinimumOut,
|
|
4355
|
+
arcTestnetChainId,
|
|
4356
|
+
arcTestnetLaunchpadDeployment,
|
|
4357
|
+
assertSlippage,
|
|
4358
|
+
buyPriceImpactBps,
|
|
4359
|
+
createLaunchpadClient,
|
|
4360
|
+
createLaunchpadPortalClient,
|
|
4361
|
+
createdTokenAddress,
|
|
4362
|
+
creatorFirstBuyFee,
|
|
4363
|
+
curvePriceWadAt,
|
|
4364
|
+
defineLaunchpadChain,
|
|
4365
|
+
defineLaunchpadDeployment,
|
|
4366
|
+
defineLaunchpadDeploymentRegistry,
|
|
4367
|
+
defineLaunchpadTokenId,
|
|
4368
|
+
firstTradableBlock,
|
|
4369
|
+
getClaimableLaunchpadReward,
|
|
4370
|
+
getErc20Allowance,
|
|
4371
|
+
getErc20Balance,
|
|
4372
|
+
getErc20Metadata,
|
|
4373
|
+
getLaunchpadApprovalStatus,
|
|
4374
|
+
getLaunchpadCurveConstants,
|
|
4375
|
+
getLaunchpadCurveProgress,
|
|
4376
|
+
getLaunchpadPrice,
|
|
4377
|
+
getLaunchpadTokenMetadata,
|
|
4378
|
+
getLaunchpadTokenState,
|
|
4379
|
+
getLaunchpadTradeAvailability,
|
|
4380
|
+
getLockedLaunchpadPosition,
|
|
4381
|
+
graduationMarketCapQuote,
|
|
4382
|
+
graduationProgress,
|
|
4383
|
+
initialCurveState,
|
|
4384
|
+
isLaunchBlockTradingDisabled,
|
|
4385
|
+
launchpadDeploymentRegistry,
|
|
4386
|
+
marketCapQuote,
|
|
4387
|
+
mulDivUp,
|
|
4388
|
+
parseLaunchpadMetadata,
|
|
4389
|
+
parseLaunchpadReceiptEvents,
|
|
4390
|
+
predictLaunchpadTokenAddress,
|
|
4391
|
+
prepareApproveErc20,
|
|
4392
|
+
prepareClaimLaunchpadReward,
|
|
4393
|
+
prepareCollectLaunchpadFees,
|
|
4394
|
+
prepareCreateToken,
|
|
4395
|
+
prepareLaunchpadBuy,
|
|
4396
|
+
prepareLaunchpadMigration,
|
|
4397
|
+
prepareLaunchpadSell,
|
|
4398
|
+
priceImpactBps,
|
|
4399
|
+
priceWadPerWholeToken,
|
|
4400
|
+
quoteCreatorFirstBuy,
|
|
4401
|
+
quoteLaunchpadBuy,
|
|
4402
|
+
quoteLaunchpadSell,
|
|
4403
|
+
resolveLaunchpadDeployment,
|
|
4404
|
+
resolvePinnedBlockNumber,
|
|
4405
|
+
revertErrorName,
|
|
4406
|
+
sellPriceImpactBps,
|
|
4407
|
+
sendPreparedLaunchpadTransaction,
|
|
4408
|
+
toCreatorFirstBuyQuote,
|
|
4409
|
+
toDeadline,
|
|
4410
|
+
toLaunchpadError,
|
|
4411
|
+
toLaunchpadPauseMode,
|
|
4412
|
+
toLaunchpadPhase,
|
|
4413
|
+
toLaunchpadTokenState,
|
|
4414
|
+
toLaunchpadTradeAvailability,
|
|
4415
|
+
tradeFee,
|
|
4416
|
+
tradeFeeBpsAt,
|
|
4417
|
+
verifyLaunchpadDeployment,
|
|
4418
|
+
waitForLaunchpadTransaction
|
|
4419
|
+
});
|
|
4420
|
+
//# sourceMappingURL=index.cjs.map
|