@ickb/sdk 1000.0.52 → 1000.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codec.d.ts +3 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +58 -0
- package/dist/codec.js.map +1 -0
- package/dist/constants.d.ts +23 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +95 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk.d.ts +51 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +242 -0
- package/dist/sdk.js.map +1 -0
- package/package.json +35 -20
- package/src/codec.ts +138 -0
- package/src/constants.ts +205 -0
- package/src/index.ts +3 -573
- package/src/sdk.ts +513 -0
- package/dist/cjs/index.d.ts +0 -190
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js +0 -341
- package/dist/cjs/index.js.map +0 -1
- package/dist/esm/index.d.ts +0 -190
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -337
- package/dist/esm/index.js.map +0 -1
package/dist/esm/index.js
DELETED
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
import { collect, epochCompare, CapacityManager, SmartTransaction, epochAdd, asyncBinarySearch, RestrictedTransaction, binarySearch, } from "@ickb/utils";
|
|
3
|
-
import { convert, ICKB_DEPOSIT_CAP, ickbExchangeRatio, IckbUdtManager, LogicManager, OwnedOwnerManager, } from "@ickb/core";
|
|
4
|
-
import { DaoManager } from "@ickb/dao";
|
|
5
|
-
import { Info, OrderManager, } from "@ickb/order";
|
|
6
|
-
/**
|
|
7
|
-
* Controller for managing iCKB operations.
|
|
8
|
-
*/
|
|
9
|
-
export class IckbController {
|
|
10
|
-
/**
|
|
11
|
-
* Creates an instance of IckbController.
|
|
12
|
-
* @param ickbUdtManager - The manager for iCKB UDT operations.
|
|
13
|
-
* @param logicManager - The logic manager for handling business logic.
|
|
14
|
-
* @param ownedOwnerManager - The manager for owned owner operations.
|
|
15
|
-
* @param orderManager - The manager for order operations.
|
|
16
|
-
* @param daoManager - The manager for DAO operations.
|
|
17
|
-
*/
|
|
18
|
-
constructor(ickbUdtManager, logicManager, ownedOwnerManager, orderManager, daoManager, bots) {
|
|
19
|
-
this.ickbUdtManager = ickbUdtManager;
|
|
20
|
-
this.logicManager = logicManager;
|
|
21
|
-
this.ownedOwnerManager = ownedOwnerManager;
|
|
22
|
-
this.orderManager = orderManager;
|
|
23
|
-
this.daoManager = daoManager;
|
|
24
|
-
this.bots = bots;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Creates an instance of IckbController from script dependencies.
|
|
28
|
-
* @param deps - The script dependencies.
|
|
29
|
-
* @param deps.udt - The script dependencies for UDT.
|
|
30
|
-
* @param deps.dao - The script dependencies for DAO.
|
|
31
|
-
* @param deps.ickbLogic - The script dependencies for iCKB logic.
|
|
32
|
-
* @param deps.ownedOwner - The script dependencies for owned owner.
|
|
33
|
-
* @param deps.order - The script dependencies for order.
|
|
34
|
-
* @returns An instance of IckbController.
|
|
35
|
-
*/
|
|
36
|
-
static fromDeps(deps, bots) {
|
|
37
|
-
const { udt: { script: { codeHash, hashType }, cellDeps, }, ickbLogic: { script: ickbLogicScript }, } = deps;
|
|
38
|
-
const daoManager = DaoManager.fromDeps(deps);
|
|
39
|
-
const udt = {
|
|
40
|
-
script: new ccc.Script(codeHash, hashType, [ickbLogicScript.hash(), "00000080"].join("")),
|
|
41
|
-
cellDeps,
|
|
42
|
-
};
|
|
43
|
-
const ickbUdtManager = IckbUdtManager.fromDeps({ udt }, daoManager);
|
|
44
|
-
return new IckbController(ickbUdtManager, LogicManager.fromDeps(deps, daoManager, ickbUdtManager), OwnedOwnerManager.fromDeps(deps, daoManager, ickbUdtManager), OrderManager.fromDeps(deps, ickbUdtManager), daoManager, bots);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Previews the conversion between CKB and UDT.
|
|
48
|
-
* @param conversion - The conversion parameters.
|
|
49
|
-
* @param conversion.isCkb2Udt - Indicates if the conversion is from CKB to UDT.
|
|
50
|
-
* @param conversion.amount - The amount to convert.
|
|
51
|
-
* @param conversion.rate - The exchange rate for conversion.
|
|
52
|
-
* @param conversion.fee - The fee for the conversion.
|
|
53
|
-
* @returns The rate and converted amount.
|
|
54
|
-
*
|
|
55
|
-
* Fee meaning examples:
|
|
56
|
-
* - 100000n => 0.001%
|
|
57
|
-
* - 10000n => 0.01%
|
|
58
|
-
* - 1000n => 0.1%
|
|
59
|
-
* - 100n => 1%
|
|
60
|
-
* - 10n => 10%
|
|
61
|
-
* - 1n => 100%
|
|
62
|
-
* - less than 1n => 0%
|
|
63
|
-
*/
|
|
64
|
-
static previewConversion(conversion) {
|
|
65
|
-
const { isCkb2Udt, amount, fee } = conversion;
|
|
66
|
-
let rate = conversion.rate;
|
|
67
|
-
rate = "dao" in rate ? ickbExchangeRatio(rate) : rate;
|
|
68
|
-
if (fee > ccc.Zero) {
|
|
69
|
-
const { ckbScale, udtScale } = rate;
|
|
70
|
-
rate = {
|
|
71
|
-
ckbScale,
|
|
72
|
-
// Worst case scenario where fee applies to the full amount
|
|
73
|
-
udtScale: udtScale + (isCkb2Udt ? 1n : -1n) * (udtScale / fee),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
const convertedAmount = amount > ccc.Zero ? convert(isCkb2Udt, amount, rate) : ccc.Zero;
|
|
77
|
-
return { rate, convertedAmount };
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Converts between CKB and UDT based on the provided options.
|
|
81
|
-
* @param options - The conversion options.
|
|
82
|
-
* @param options.conversion - The conversion parameters.
|
|
83
|
-
* @param options.conversion.isCkb2Udt - Indicates if the conversion is from CKB to UDT.
|
|
84
|
-
* @param options.conversion.amount - The amount to convert.
|
|
85
|
-
* @param options.conversion.rate - The exchange rate for conversion.
|
|
86
|
-
* @param options.conversion.ckbMinMatchLog - Minimum CKB match log (optional).
|
|
87
|
-
* @param options.conversion.ckbMinFee - Minimum CKB fee (optional).
|
|
88
|
-
* @param options.signer - The signer for the transaction.
|
|
89
|
-
* @param options.userCells - The user's cells.
|
|
90
|
-
* @param options.system - The current system state.
|
|
91
|
-
* @param options.filters - The filters for the conversion.
|
|
92
|
-
* @param options.filters.isReadyOnly - Indicates if only ready conversions should be considered.
|
|
93
|
-
* @param options.filters.isFulfilledOnly - Indicates if only fulfilled conversions should be considered.
|
|
94
|
-
* @returns A promise that resolves to the conversion result or undefined.
|
|
95
|
-
*/
|
|
96
|
-
async convert(options) {
|
|
97
|
-
// Get user lock
|
|
98
|
-
const { system, signer } = options;
|
|
99
|
-
const lock = (await signer.getRecommendedAddressObj()).script;
|
|
100
|
-
// Normalize rate
|
|
101
|
-
const { rate } = IckbController.previewConversion({
|
|
102
|
-
...options.conversion,
|
|
103
|
-
amount: ccc.Zero,
|
|
104
|
-
});
|
|
105
|
-
const { isCkb2Udt, amount, ckbMinMatchLog } = options.conversion;
|
|
106
|
-
const info = Info.create(isCkb2Udt, rate, ckbMinMatchLog);
|
|
107
|
-
// feeRate is a good approximation of the bot tx size matching the order
|
|
108
|
-
const ckbMinFee = options.conversion.ckbMinFee ?? 10n * system.feeRate;
|
|
109
|
-
const conversion = {
|
|
110
|
-
isCkb2Udt,
|
|
111
|
-
amount,
|
|
112
|
-
rate,
|
|
113
|
-
info,
|
|
114
|
-
ckbMinFee,
|
|
115
|
-
lock,
|
|
116
|
-
};
|
|
117
|
-
const N = isCkb2Udt
|
|
118
|
-
? Number(amount / system.ckbDepositCap)
|
|
119
|
-
: system.depositPool.slice(0, 30).length;
|
|
120
|
-
const cache = Array(N);
|
|
121
|
-
const cachedAttempt = (n) => {
|
|
122
|
-
n = N - n;
|
|
123
|
-
return (cache[n] = cache[n] ?? this.attempt(n, conversion, options));
|
|
124
|
-
};
|
|
125
|
-
return cachedAttempt(await asyncBinarySearch(N, async (n) => (await cachedAttempt(n)) !== undefined));
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Attempts to perform a conversion based on the provided parameters.
|
|
129
|
-
* @param n - The size of deposit to make or withdraw from.
|
|
130
|
-
* @param conversion - The conversion parameters.
|
|
131
|
-
* @param conversion.isCkb2Udt - Indicates if the conversion is from CKB to UDT.
|
|
132
|
-
* @param conversion.amount - The amount to convert.
|
|
133
|
-
* @param conversion.rate - The exchange rate for conversion.
|
|
134
|
-
* @param conversion.info - Additional information for the conversion.
|
|
135
|
-
* @param conversion.ckbMinFee - Minimum CKB fee.
|
|
136
|
-
* @param conversion.lock - The script lock for the transaction.
|
|
137
|
-
* @param options - Additional options for the conversion.
|
|
138
|
-
* @returns A promise that resolves to the conversion result or undefined.
|
|
139
|
-
*/
|
|
140
|
-
async attempt(n, conversion, options) {
|
|
141
|
-
try {
|
|
142
|
-
const { isCkb2Udt, rate, info, ckbMinFee, lock } = conversion;
|
|
143
|
-
const { signer, userCells, filters, system } = options;
|
|
144
|
-
const { feeRate, ckbDepositCap, exchangeRatio, depositPool } = system;
|
|
145
|
-
const tx = SmartTransaction.default();
|
|
146
|
-
const maturities = [[0n, 1n, 80n]]; // 3 minutes minimum
|
|
147
|
-
let ckbFee = ccc.Zero;
|
|
148
|
-
let amount = conversion.amount;
|
|
149
|
-
let udtWithdrawed = ccc.Zero;
|
|
150
|
-
// Core protocol
|
|
151
|
-
if (n > 0) {
|
|
152
|
-
if (isCkb2Udt) {
|
|
153
|
-
amount -= ckbDepositCap * BigInt(n);
|
|
154
|
-
if (amount < ccc.Zero) {
|
|
155
|
-
// Too many Deposits respectfully to the amount
|
|
156
|
-
return undefined;
|
|
157
|
-
}
|
|
158
|
-
this.logicManager.deposit(tx, n, ckbDepositCap, lock);
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
const myDeposits = depositPool.slice(0, n);
|
|
162
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
163
|
-
udtWithdrawed = myDeposits.slice(-1)[0].udtCumulative;
|
|
164
|
-
amount -= udtWithdrawed;
|
|
165
|
-
if (amount < ccc.Zero) {
|
|
166
|
-
// Too many Withdrawal Requests respectfully to the amount
|
|
167
|
-
return undefined;
|
|
168
|
-
}
|
|
169
|
-
this.ownedOwnerManager.requestWithdrawal(tx, myDeposits, lock);
|
|
170
|
-
maturities.push(...myDeposits.map((d) => d.maturity));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
// Order protocol
|
|
174
|
-
if (amount > ccc.Zero) {
|
|
175
|
-
this.orderManager.mint(tx, lock, info, {
|
|
176
|
-
ckbValue: isCkb2Udt ? amount : ccc.Zero,
|
|
177
|
-
udtValue: isCkb2Udt ? ccc.Zero : amount,
|
|
178
|
-
});
|
|
179
|
-
const convertedAmount = convert(isCkb2Udt, amount, rate);
|
|
180
|
-
ckbFee = isCkb2Udt
|
|
181
|
-
? amount - convert(false, convertedAmount, exchangeRatio)
|
|
182
|
-
: convert(true, amount, exchangeRatio) - convertedAmount;
|
|
183
|
-
maturities.push(orderMaturityEstimate(isCkb2Udt, amount, udtWithdrawed, system));
|
|
184
|
-
// Check that order provides enough fee to the bot for being matched
|
|
185
|
-
if (ckbFee < ckbMinFee) {
|
|
186
|
-
return undefined;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
const { receipts, withdrawalGroups, orders, udts, capacities } = userCells;
|
|
190
|
-
this.logicManager.completeDeposit(tx, receipts);
|
|
191
|
-
this.ownedOwnerManager.withdraw(tx, withdrawalGroups, filters);
|
|
192
|
-
this.orderManager.melt(tx, orders, filters);
|
|
193
|
-
this.ickbUdtManager.addUdts(tx, udts);
|
|
194
|
-
CapacityManager.addCapacities(tx, capacities);
|
|
195
|
-
// Throw an error if inputs do not cover for outputs
|
|
196
|
-
await new RestrictedTransaction(tx).completeFeeBy(signer, feeRate);
|
|
197
|
-
// Find the maturity most distant in the future
|
|
198
|
-
const maturity = maturities.reduce((a, b) => epochCompare(a, b) === -1 ? b : a);
|
|
199
|
-
return {
|
|
200
|
-
tx,
|
|
201
|
-
ckbFee,
|
|
202
|
-
maturity,
|
|
203
|
-
};
|
|
204
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
205
|
-
}
|
|
206
|
-
catch (_) {
|
|
207
|
-
return undefined;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Retrieves the L1 state based on the provided parameters.
|
|
212
|
-
* @param client - The client to interact with the blockchain.
|
|
213
|
-
* @param filter - The set of filters to apply.
|
|
214
|
-
* @param locks - The script locks to filter the user cells.
|
|
215
|
-
* @param options - Optional parameters for the state retrieval.
|
|
216
|
-
* @param options.minLockUp - The minimum lock-up period (optional).
|
|
217
|
-
* @param options.maxLockUp - The maximum lock-up period (optional).
|
|
218
|
-
* @returns A promise that resolves to an object containing the system state and user cells.
|
|
219
|
-
*/
|
|
220
|
-
async getL1State(client, filter, locks, options) {
|
|
221
|
-
const tip = await client.getTipHeader();
|
|
222
|
-
const onChain = true;
|
|
223
|
-
const opts = { ...options, tip, onChain };
|
|
224
|
-
const [feeRate, depositPool, capacities, udts, receipts, withdrawalGroups, orders, deposits, withdrawalRequests, botCapacities,] = await Promise.all([
|
|
225
|
-
client.getFeeRate(),
|
|
226
|
-
filter.has("depositPool")
|
|
227
|
-
? collect(this.logicManager.findDeposits(client, opts))
|
|
228
|
-
: [],
|
|
229
|
-
filter.has("capacities")
|
|
230
|
-
? collect(CapacityManager.findCapacities(client, locks, opts))
|
|
231
|
-
: [],
|
|
232
|
-
filter.has("udts")
|
|
233
|
-
? collect(this.ickbUdtManager.findUdts(client, locks, opts))
|
|
234
|
-
: [],
|
|
235
|
-
filter.has("receipts")
|
|
236
|
-
? collect(this.logicManager.findReceipts(client, locks, opts))
|
|
237
|
-
: [],
|
|
238
|
-
filter.has("withdrawalGroups")
|
|
239
|
-
? collect(this.ownedOwnerManager.findWithdrawalGroups(client, locks, opts))
|
|
240
|
-
: [],
|
|
241
|
-
filter.has("orders") ? collect(this.orderManager.findOrders(client)) : [],
|
|
242
|
-
filter.has("deposits")
|
|
243
|
-
? collect(this.daoManager.findDeposits(client, locks, opts))
|
|
244
|
-
: [],
|
|
245
|
-
filter.has("withdrawalRequests")
|
|
246
|
-
? collect(this.daoManager.findWithdrawalRequests(client, locks, opts))
|
|
247
|
-
: [],
|
|
248
|
-
filter.has("ckbBots")
|
|
249
|
-
? collect(CapacityManager.findCapacities(client, locks, opts))
|
|
250
|
-
: [],
|
|
251
|
-
]);
|
|
252
|
-
// Sort depositPool by maturity
|
|
253
|
-
depositPool.sort((a, b) => epochCompare(a.maturity, b.maturity));
|
|
254
|
-
// Calculate cumulative value of deposits in the pool
|
|
255
|
-
let udtCumulative = 0n;
|
|
256
|
-
const cumulativeDepositPool = [];
|
|
257
|
-
for (const deposit of depositPool) {
|
|
258
|
-
udtCumulative += deposit.udtValue;
|
|
259
|
-
cumulativeDepositPool.push({ ...deposit, udtCumulative });
|
|
260
|
-
}
|
|
261
|
-
const userOrders = [];
|
|
262
|
-
const nonUserOrders = [];
|
|
263
|
-
for (const group of orders) {
|
|
264
|
-
if (group.isOwner(...locks)) {
|
|
265
|
-
userOrders.push(group);
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
nonUserOrders.push(group.order);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
const exchangeRatio = ickbExchangeRatio(tip);
|
|
272
|
-
const ckbDepositCap = convert(false, ICKB_DEPOSIT_CAP, exchangeRatio);
|
|
273
|
-
// Calculate the ckb ready to match incoming transactions
|
|
274
|
-
let ckbBots = botCapacities.reduce((acc, c) => acc + c.ckbValue, ccc.Zero);
|
|
275
|
-
// Each bot keeps a reserve of CKB for operations
|
|
276
|
-
ckbBots -= ccc.numFrom(this.bots.length) * ccc.fixedPointFrom("2000");
|
|
277
|
-
ckbBots = ckbBots > ccc.Zero ? ckbBots : ccc.Zero;
|
|
278
|
-
return {
|
|
279
|
-
system: {
|
|
280
|
-
feeRate,
|
|
281
|
-
tip,
|
|
282
|
-
exchangeRatio,
|
|
283
|
-
ckbDepositCap,
|
|
284
|
-
udtDepositCap: ICKB_DEPOSIT_CAP,
|
|
285
|
-
depositPool: cumulativeDepositPool,
|
|
286
|
-
orderPool: nonUserOrders,
|
|
287
|
-
ckbBots,
|
|
288
|
-
},
|
|
289
|
-
user: {
|
|
290
|
-
capacities,
|
|
291
|
-
udts,
|
|
292
|
-
receipts,
|
|
293
|
-
withdrawalGroups,
|
|
294
|
-
orders: userOrders,
|
|
295
|
-
deposits,
|
|
296
|
-
withdrawalRequests,
|
|
297
|
-
},
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Estimates the maturity of an order based on the type of conversion and amount.
|
|
303
|
-
*
|
|
304
|
-
* @param isCkb2Udt - A boolean indicating if the order is from CKB to UDT.
|
|
305
|
-
* @param amount - The amount of CKB or UDT involved in the order.
|
|
306
|
-
* @param udtWithdrawed - The amount of UDT that has been withdrawn by the current conversion via core.
|
|
307
|
-
* @param system - The current system state, which includes the block header tip, order pool, deposit pool, CKB bots, and exchange ratio.
|
|
308
|
-
*
|
|
309
|
-
* @returns The estimated maturity epoch for the order.
|
|
310
|
-
*/
|
|
311
|
-
function orderMaturityEstimate(isCkb2Udt, amount, udtWithdrawed, system) {
|
|
312
|
-
const { tip, orderPool, depositPool, ckbBots, exchangeRatio } = system;
|
|
313
|
-
// Maturity estimate a priori, the estimation is based on:
|
|
314
|
-
// - CKB to iCKB orders at 100k CKB every minute
|
|
315
|
-
// - iCKB to CKB orders at 200 CKB every minute
|
|
316
|
-
let maturity = epochAdd(tip.epoch, [
|
|
317
|
-
0n,
|
|
318
|
-
1n + amount / ccc.fixedPointFrom(isCkb2Udt ? 100000 : 200),
|
|
319
|
-
4n * 60n,
|
|
320
|
-
]);
|
|
321
|
-
if (isCkb2Udt) {
|
|
322
|
-
return maturity;
|
|
323
|
-
}
|
|
324
|
-
if (depositPool.length > 0) {
|
|
325
|
-
const udtWaiting = orderPool
|
|
326
|
-
.filter((o) => o.isUdt2CkbMatchable())
|
|
327
|
-
.reduce((acc, o) => acc + o.udtValue, ccc.Zero);
|
|
328
|
-
const udtAvailable = convert(isCkb2Udt, ckbBots, exchangeRatio);
|
|
329
|
-
const udtToConvert = amount + udtWithdrawed + udtWaiting - udtAvailable;
|
|
330
|
-
const i = binarySearch(depositPool.length,
|
|
331
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
332
|
-
(n) => depositPool[n].udtCumulative >= udtToConvert);
|
|
333
|
-
maturity = depositPool[i]?.maturity ?? maturity;
|
|
334
|
-
}
|
|
335
|
-
return maturity;
|
|
336
|
-
}
|
|
337
|
-
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,eAAe,EACf,gBAAgB,EAIhB,QAAQ,EACR,iBAAiB,EACjB,qBAAqB,EAErB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,iBAAiB,GAIlB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAgB,MAAM,WAAW,CAAC;AACrD,OAAO,EACL,IAAI,EACJ,YAAY,GAGb,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB;;;;;;;OAOG;IACH,YACkB,cAA8B,EAC9B,YAA0B,EAC1B,iBAAoC,EACpC,YAA0B,EAC1B,UAAsB,EACtB,IAAkB;QALlB,mBAAc,G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