@across-protocol/sdk 4.2.6 → 4.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +5 -13
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +5 -11
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +18 -35
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/interfaces/SpokePool.d.ts +1 -3
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +3 -3
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +24 -22
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +5 -13
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +5 -11
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +21 -38
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/interfaces/SpokePool.d.ts +1 -3
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +4 -13
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +25 -23
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +5 -11
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +1 -3
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +4 -13
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +1 -1
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +8 -16
- package/src/clients/mocks/MockSpokePoolClient.ts +36 -66
- package/src/interfaces/SpokePool.ts +1 -4
- package/src/relayFeeCalculator/relayFeeCalculator.ts +25 -22
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
BigNumber,
|
|
26
26
|
bnZero,
|
|
27
27
|
bnOne,
|
|
28
|
-
toAddress,
|
|
29
28
|
toBytes32,
|
|
30
29
|
spreadEventWithBlockNumber,
|
|
31
30
|
} from "../../utils";
|
|
@@ -85,6 +84,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
85
84
|
lastDepositId = _depositIds[i];
|
|
86
85
|
}
|
|
87
86
|
}
|
|
87
|
+
|
|
88
88
|
_getDepositIdAtBlock(blockTag: number): Promise<BigNumber> {
|
|
89
89
|
return Promise.resolve(this.depositIdAtBlock[blockTag]);
|
|
90
90
|
}
|
|
@@ -129,10 +129,6 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
129
129
|
return this._deposit("FundsDeposited", deposit);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
depositV3(deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
|
|
133
|
-
return this._deposit("V3FundsDeposited", deposit);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
132
|
protected _deposit(event: string, deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
|
|
137
133
|
const { blockNumber, txnIndex } = deposit;
|
|
138
134
|
let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
|
|
@@ -140,12 +136,11 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
140
136
|
this.numberOfDeposits = depositId.add(bnOne);
|
|
141
137
|
|
|
142
138
|
destinationChainId ??= random(1, 42161, false);
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
const exclusiveRelayer = addressModifier(deposit.exclusiveRelayer ?? ZERO_ADDRESS);
|
|
139
|
+
const depositor = toBytes32(deposit.depositor ?? randomAddress());
|
|
140
|
+
const recipient = toBytes32(deposit.recipient ?? depositor);
|
|
141
|
+
const inputToken = toBytes32(deposit.inputToken ?? randomAddress());
|
|
142
|
+
const outputToken = toBytes32(deposit.outputToken ?? inputToken);
|
|
143
|
+
const exclusiveRelayer = toBytes32(deposit.exclusiveRelayer ?? ZERO_ADDRESS);
|
|
149
144
|
|
|
150
145
|
inputAmount ??= toBNWei(random(1, 1000, false));
|
|
151
146
|
outputAmount ??= inputAmount.mul(toBN("0.95"));
|
|
@@ -180,17 +175,13 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
180
175
|
});
|
|
181
176
|
}
|
|
182
177
|
|
|
183
|
-
|
|
184
|
-
return this._fillRelay("FilledV3Relay", fill);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
fillRelay(fill: Omit<Fill, "messageHash"> & { message: string } & Partial<SortableEvent>): Log {
|
|
178
|
+
fillRelay(fill: Omit<Fill, "messageHash"> & { message?: string } & Partial<SortableEvent>): Log {
|
|
188
179
|
return this._fillRelay("FilledRelay", fill);
|
|
189
180
|
}
|
|
190
181
|
|
|
191
182
|
protected _fillRelay(
|
|
192
183
|
event: string,
|
|
193
|
-
fill: Omit<Fill, "messageHash"> & { message
|
|
184
|
+
fill: Omit<Fill, "messageHash"> & { message?: string } & Partial<SortableEvent>
|
|
194
185
|
): Log {
|
|
195
186
|
const { blockNumber, txnIndex } = fill;
|
|
196
187
|
let { originChainId, depositId, inputAmount, outputAmount, fillDeadline } = fill;
|
|
@@ -200,15 +191,14 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
200
191
|
outputAmount ??= inputAmount;
|
|
201
192
|
fillDeadline ??= getCurrentTime() + 60;
|
|
202
193
|
|
|
203
|
-
const
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
const
|
|
209
|
-
const relayer = addressModifier(fill.relayer ?? randomAddress());
|
|
194
|
+
const depositor = toBytes32(fill.depositor ?? randomAddress());
|
|
195
|
+
const recipient = toBytes32(fill.recipient ?? depositor);
|
|
196
|
+
const inputToken = toBytes32(fill.inputToken ?? randomAddress());
|
|
197
|
+
const outputToken = toBytes32(fill.outputToken ?? ZERO_ADDRESS);
|
|
198
|
+
const exclusiveRelayer = toBytes32(fill.exclusiveRelayer ?? ZERO_ADDRESS);
|
|
199
|
+
const relayer = toBytes32(fill.relayer ?? randomAddress());
|
|
210
200
|
|
|
211
|
-
const topics = [originChainId, depositId, relayer];
|
|
201
|
+
const topics = [originChainId, depositId, relayer];
|
|
212
202
|
const message = fill.message ?? EMPTY_MESSAGE;
|
|
213
203
|
const updatedMessage = fill.relayExecutionInfo?.updatedMessage ?? message;
|
|
214
204
|
|
|
@@ -239,25 +229,14 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
239
229
|
},
|
|
240
230
|
};
|
|
241
231
|
|
|
242
|
-
const args =
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
},
|
|
251
|
-
}
|
|
252
|
-
: {
|
|
253
|
-
// FilledV3Relay
|
|
254
|
-
..._args,
|
|
255
|
-
message,
|
|
256
|
-
relayExecutionInfo: {
|
|
257
|
-
...relayExecutionInfo,
|
|
258
|
-
updatedMessage,
|
|
259
|
-
},
|
|
260
|
-
};
|
|
232
|
+
const args = {
|
|
233
|
+
..._args,
|
|
234
|
+
messageHash: getMessageHash(message),
|
|
235
|
+
relayExecutionInfo: {
|
|
236
|
+
...relayExecutionInfo,
|
|
237
|
+
updatedMessageHash: getMessageHash(updatedMessage),
|
|
238
|
+
},
|
|
239
|
+
};
|
|
261
240
|
|
|
262
241
|
return this.eventManager.generateEvent({
|
|
263
242
|
event,
|
|
@@ -269,17 +248,12 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
269
248
|
});
|
|
270
249
|
}
|
|
271
250
|
|
|
272
|
-
speedUpV3Deposit(speedUp: SpeedUp): Log {
|
|
273
|
-
return this._speedUpDeposit("RequestedSpeedUpV3Deposit", speedUp);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
251
|
speedUpDeposit(speedUp: SpeedUp): Log {
|
|
277
252
|
return this._speedUpDeposit("RequestedSpeedUpDeposit", speedUp);
|
|
278
253
|
}
|
|
279
254
|
|
|
280
255
|
protected _speedUpDeposit(event: string, speedUp: SpeedUp): Log {
|
|
281
|
-
const
|
|
282
|
-
const depositor = addressModifier(speedUp.depositor);
|
|
256
|
+
const depositor = toBytes32(speedUp.depositor);
|
|
283
257
|
const topics = [speedUp.depositId, depositor];
|
|
284
258
|
const args = { ...speedUp };
|
|
285
259
|
|
|
@@ -290,7 +264,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
290
264
|
args: {
|
|
291
265
|
...args,
|
|
292
266
|
depositor,
|
|
293
|
-
updatedRecipient:
|
|
267
|
+
updatedRecipient: toBytes32(speedUp.updatedRecipient),
|
|
294
268
|
},
|
|
295
269
|
});
|
|
296
270
|
}
|
|
@@ -308,24 +282,19 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
308
282
|
});
|
|
309
283
|
}
|
|
310
284
|
|
|
311
|
-
|
|
312
|
-
return this._requestSlowFill("RequestedV3SlowFill", request);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
requestSlowFill(request: Omit<SlowFillRequest, "messageHash"> & Partial<SortableEvent>): Log {
|
|
285
|
+
requestSlowFill(request: Omit<SlowFillRequest, "destinationChainId"> & Partial<SortableEvent>): Log {
|
|
316
286
|
return this._requestSlowFill("RequestedSlowFill", request);
|
|
317
287
|
}
|
|
318
288
|
|
|
319
289
|
protected _requestSlowFill(
|
|
320
290
|
event: string,
|
|
321
|
-
request: Omit<SlowFillRequest, "
|
|
291
|
+
request: Omit<SlowFillRequest, "destinationChainId"> & Partial<SortableEvent>
|
|
322
292
|
): Log {
|
|
323
293
|
const { originChainId, depositId } = request;
|
|
324
294
|
const topics = [originChainId, depositId];
|
|
325
295
|
const args = { ...request };
|
|
326
296
|
|
|
327
|
-
const
|
|
328
|
-
const depositor = addressModifier(args.depositor ?? randomAddress());
|
|
297
|
+
const depositor = toBytes32(args.depositor ?? randomAddress());
|
|
329
298
|
|
|
330
299
|
return this.eventManager.generateEvent({
|
|
331
300
|
event,
|
|
@@ -333,20 +302,21 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
333
302
|
topics: topics.map((topic) => topic.toString()),
|
|
334
303
|
args: {
|
|
335
304
|
...args,
|
|
305
|
+
destinationChainId: this.chainId,
|
|
336
306
|
depositor,
|
|
337
|
-
recipient:
|
|
338
|
-
inputToken:
|
|
339
|
-
outputToken:
|
|
340
|
-
exclusiveRelayer:
|
|
307
|
+
recipient: toBytes32(args.recipient ?? depositor),
|
|
308
|
+
inputToken: toBytes32(args.inputToken ?? randomAddress()),
|
|
309
|
+
outputToken: toBytes32(args.outputToken ?? ZERO_ADDRESS),
|
|
310
|
+
exclusiveRelayer: toBytes32(args.exclusiveRelayer ?? ZERO_ADDRESS),
|
|
341
311
|
},
|
|
342
312
|
blockNumber: request.blockNumber,
|
|
343
313
|
transactionIndex: request.txnIndex,
|
|
344
314
|
});
|
|
345
315
|
}
|
|
346
316
|
|
|
347
|
-
// This is a simple wrapper around
|
|
317
|
+
// This is a simple wrapper around fillRelay().
|
|
348
318
|
// rootBundleId and proof are discarded here - we have no interest in verifying that.
|
|
349
|
-
|
|
319
|
+
executeSlowRelayLeaf(leaf: Omit<SlowFillLeaf, "messageHash">): Log {
|
|
350
320
|
const fill = {
|
|
351
321
|
...leaf.relayData,
|
|
352
322
|
destinationChainId: this.chainId,
|
|
@@ -361,7 +331,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
361
331
|
},
|
|
362
332
|
};
|
|
363
333
|
|
|
364
|
-
return this.
|
|
334
|
+
return this.fillRelay(fill);
|
|
365
335
|
}
|
|
366
336
|
|
|
367
337
|
executeRelayerRefundLeaf(refund: RelayerRefundExecution & Partial<SortableEvent>): Log {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { SortableEvent } from "./Common";
|
|
2
|
-
import { FilledV3RelayEvent, V3FundsDepositedEvent } from "../typechain";
|
|
3
2
|
import { SpokePoolClient } from "../clients";
|
|
4
3
|
import { BigNumber } from "../utils";
|
|
5
4
|
import { RelayerRefundLeaf } from "./HubPool";
|
|
6
5
|
|
|
7
|
-
export type { FilledV3RelayEvent, V3FundsDepositedEvent };
|
|
8
|
-
|
|
9
6
|
export interface RelayData {
|
|
10
7
|
originChainId: number;
|
|
11
8
|
depositor: string;
|
|
@@ -93,7 +90,7 @@ export interface SpeedUp {
|
|
|
93
90
|
|
|
94
91
|
export interface SpeedUpWithBlock extends SpeedUp, SortableEvent {}
|
|
95
92
|
|
|
96
|
-
export interface SlowFillRequest extends RelayData {
|
|
93
|
+
export interface SlowFillRequest extends Omit<RelayData, "message"> {
|
|
97
94
|
messageHash: string;
|
|
98
95
|
destinationChainId: number;
|
|
99
96
|
}
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
toBNWei,
|
|
23
23
|
isZeroAddress,
|
|
24
24
|
compareAddressesSimple,
|
|
25
|
+
ConvertDecimals,
|
|
25
26
|
chainIsSvm,
|
|
26
27
|
} from "../utils";
|
|
27
28
|
import { Transport } from "viem";
|
|
@@ -251,7 +252,7 @@ export class RelayFeeCalculator {
|
|
|
251
252
|
*/
|
|
252
253
|
async gasFeePercent(
|
|
253
254
|
deposit: Deposit,
|
|
254
|
-
|
|
255
|
+
outputAmount: BigNumberish,
|
|
255
256
|
simulateZeroFill = false,
|
|
256
257
|
relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
257
258
|
_tokenPrice?: number,
|
|
@@ -261,7 +262,7 @@ export class RelayFeeCalculator {
|
|
|
261
262
|
_tokenGasCost?: BigNumberish,
|
|
262
263
|
transport?: Transport
|
|
263
264
|
): Promise<BigNumber> {
|
|
264
|
-
if (toBN(
|
|
265
|
+
if (toBN(outputAmount).eq(bnZero)) return MAX_BIG_INT;
|
|
265
266
|
|
|
266
267
|
const { inputToken, destinationChainId, originChainId } = deposit;
|
|
267
268
|
// It's fine if we resolve a destination token which is not the "canonical" L1 token (e.g. USDB for DAI or USDC.e for USDC), since `getTokenInfo` will re-map
|
|
@@ -284,7 +285,7 @@ export class RelayFeeCalculator {
|
|
|
284
285
|
|
|
285
286
|
// Reduce the output amount to simulate a full fill with a lower value to estimate
|
|
286
287
|
// the fill cost accurately without risking a failure due to insufficient balance.
|
|
287
|
-
const simulatedAmount = simulateZeroFill ? safeOutputAmount : toBN(
|
|
288
|
+
const simulatedAmount = simulateZeroFill ? safeOutputAmount : toBN(outputAmount);
|
|
288
289
|
deposit = { ...deposit, outputAmount: simulatedAmount };
|
|
289
290
|
|
|
290
291
|
const getGasCosts = this.queries
|
|
@@ -314,19 +315,19 @@ export class RelayFeeCalculator {
|
|
|
314
315
|
throw error;
|
|
315
316
|
}),
|
|
316
317
|
]);
|
|
317
|
-
const gasFeesInToken = nativeToToken(tokenGasCost, tokenPrice,
|
|
318
|
-
return percent(gasFeesInToken,
|
|
318
|
+
const gasFeesInToken = nativeToToken(tokenGasCost, tokenPrice, outputTokenInfo.decimals, this.nativeTokenDecimals);
|
|
319
|
+
return percent(gasFeesInToken, outputAmount.toString());
|
|
319
320
|
}
|
|
320
321
|
|
|
321
322
|
// Note: these variables are unused now, but may be needed in future versions of this function that are more complex.
|
|
322
323
|
capitalFeePercent(
|
|
323
|
-
|
|
324
|
+
_outputAmount: BigNumberish,
|
|
324
325
|
_tokenSymbol: string,
|
|
325
326
|
_originRoute?: ChainIdAsString,
|
|
326
327
|
_destinationRoute?: ChainIdAsString
|
|
327
328
|
): BigNumber {
|
|
328
329
|
// If amount is 0, then the capital fee % should be the max 100%
|
|
329
|
-
if (toBN(
|
|
330
|
+
if (toBN(_outputAmount).eq(toBN(0))) return MAX_BIG_INT;
|
|
330
331
|
|
|
331
332
|
// V0: Ensure that there is a capital fee available for the token.
|
|
332
333
|
// If not, then we should throw an error because this is indicative
|
|
@@ -366,7 +367,7 @@ export class RelayFeeCalculator {
|
|
|
366
367
|
);
|
|
367
368
|
|
|
368
369
|
// Scale amount "y" to 18 decimals.
|
|
369
|
-
const y = toBN(
|
|
370
|
+
const y = toBN(_outputAmount).mul(toBNWei("1", 18 - config.decimals));
|
|
370
371
|
// At a minimum, the fee will be equal to lower bound fee * y
|
|
371
372
|
const minCharge = toBN(config.lowerBound).mul(y).div(fixedPointAdjustment);
|
|
372
373
|
|
|
@@ -490,7 +491,7 @@ export class RelayFeeCalculator {
|
|
|
490
491
|
*/
|
|
491
492
|
async relayerFeeDetails(
|
|
492
493
|
deposit: Deposit,
|
|
493
|
-
|
|
494
|
+
outputAmount?: BigNumberish,
|
|
494
495
|
simulateZeroFill = false,
|
|
495
496
|
relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
496
497
|
_tokenPrice?: number,
|
|
@@ -500,18 +501,19 @@ export class RelayFeeCalculator {
|
|
|
500
501
|
): Promise<RelayerFeeDetails> {
|
|
501
502
|
// If the amount to relay is not provided, then we
|
|
502
503
|
// should use the full deposit amount.
|
|
503
|
-
|
|
504
|
-
const { inputToken, originChainId } = deposit;
|
|
504
|
+
outputAmount ??= deposit.outputAmount;
|
|
505
|
+
const { inputToken, originChainId, outputToken, destinationChainId } = deposit;
|
|
505
506
|
// We can perform a simple lookup with `getTokenInfo` here without resolving the exact token to resolve since we only need to
|
|
506
507
|
// resolve the L1 token symbol and not the L2 token decimals.
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
|
|
508
|
+
const inputTokenInfo = getTokenInfo(inputToken, originChainId);
|
|
509
|
+
const outputTokenInfo = getTokenInfo(outputToken, destinationChainId);
|
|
510
|
+
if (!isDefined(inputTokenInfo) || !isDefined(outputTokenInfo)) {
|
|
511
|
+
throw new Error(`Could not find token information for ${inputToken} or ${outputToken}`);
|
|
510
512
|
}
|
|
511
513
|
|
|
512
514
|
const gasFeePercent = await this.gasFeePercent(
|
|
513
515
|
deposit,
|
|
514
|
-
|
|
516
|
+
outputAmount,
|
|
515
517
|
simulateZeroFill,
|
|
516
518
|
relayerAddress,
|
|
517
519
|
_tokenPrice,
|
|
@@ -520,14 +522,15 @@ export class RelayFeeCalculator {
|
|
|
520
522
|
gasUnits,
|
|
521
523
|
tokenGasCost
|
|
522
524
|
);
|
|
523
|
-
const
|
|
525
|
+
const outToInDecimals = ConvertDecimals(outputTokenInfo.decimals, inputTokenInfo.decimals);
|
|
526
|
+
const gasFeeTotal = gasFeePercent.mul(outToInDecimals(outputAmount.toString())).div(fixedPointAdjustment);
|
|
524
527
|
const capitalFeePercent = this.capitalFeePercent(
|
|
525
|
-
|
|
526
|
-
|
|
528
|
+
outputAmount,
|
|
529
|
+
inputTokenInfo.symbol,
|
|
527
530
|
deposit.originChainId.toString(),
|
|
528
531
|
deposit.destinationChainId.toString()
|
|
529
532
|
);
|
|
530
|
-
const capitalFeeTotal = capitalFeePercent.mul(
|
|
533
|
+
const capitalFeeTotal = capitalFeePercent.mul(outToInDecimals(outputAmount.toString())).div(fixedPointAdjustment);
|
|
531
534
|
const relayFeePercent = gasFeePercent.add(capitalFeePercent);
|
|
532
535
|
const relayFeeTotal = gasFeeTotal.add(capitalFeeTotal);
|
|
533
536
|
|
|
@@ -546,12 +549,12 @@ export class RelayFeeCalculator {
|
|
|
546
549
|
isAmountTooLow = true;
|
|
547
550
|
} else {
|
|
548
551
|
minDeposit = gasFeeTotal.mul(fixedPointAdjustment).div(maxGasFeePercent);
|
|
549
|
-
isAmountTooLow = toBN(
|
|
552
|
+
isAmountTooLow = toBN(outputAmount).lt(minDeposit);
|
|
550
553
|
}
|
|
551
554
|
|
|
552
555
|
return {
|
|
553
|
-
amountToRelay:
|
|
554
|
-
tokenSymbol:
|
|
556
|
+
amountToRelay: outputAmount.toString(),
|
|
557
|
+
tokenSymbol: inputTokenInfo.symbol,
|
|
555
558
|
gasFeePercent: gasFeePercent.toString(),
|
|
556
559
|
gasFeeTotal: gasFeeTotal.toString(),
|
|
557
560
|
gasDiscountPercent: this.gasDiscountPercent,
|