Skip to content

Commit

Permalink
fix: suggested-fees min amounts (#1196)
Browse files Browse the repository at this point in the history
* chore: test with logs

Signed-off-by: james-a-morris <[email protected]>

* fix: make isAmountTooLow context aware of limits

Signed-off-by: james-a-morris <[email protected]>

* improve: rearrange amount too low

Signed-off-by: james-a-morris <[email protected]>

* nit: test

Signed-off-by: james-a-morris <[email protected]>

* chore: remove logs

Signed-off-by: james-a-morris <[email protected]>

* chore: remove logs

Signed-off-by: james-a-morris <[email protected]>

---------

Signed-off-by: james-a-morris <[email protected]>
  • Loading branch information
james-a-morris authored Sep 6, 2024
1 parent 4036abd commit 7ec25d9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions api/suggested-fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,14 @@ const handler = async (
gasPrice
);

const skipAmountLimitEnabled = skipAmountLimit === "true";
const isAmountTooLow =
relayerFeeDetails.isAmountTooLow ||
BigNumber.from(amountInput).lt(limits.minDeposit);

if (!skipAmountLimitEnabled && relayerFeeDetails.isAmountTooLow)
const skipAmountLimitEnabled = skipAmountLimit === "true";
if (!skipAmountLimitEnabled && isAmountTooLow) {
throw new InputError("Sent amount is too low relative to fees");
}

// Across V3's new `deposit` function requires now a total fee that includes the LP fee
const totalRelayFee = BigNumber.from(relayerFeeDetails.relayFeeTotal).add(
Expand Down Expand Up @@ -312,7 +316,7 @@ const handler = async (
timestamp: isNaN(parsedTimestamp)
? quoteTimestamp.toString()
: parsedTimestamp.toString(),
isAmountTooLow: relayerFeeDetails.isAmountTooLow,
isAmountTooLow,
quoteBlock: quoteBlockNumber.toString(),
exclusiveRelayer,
exclusivityDeadline,
Expand Down

0 comments on commit 7ec25d9

Please sign in to comment.