Skip to content

Commit

Permalink
fix decimals to the max supported for evm chains if the decimals are …
Browse files Browse the repository at this point in the history
…higher
  • Loading branch information
sebastianscatularo committed Aug 14, 2023
1 parent 8a1b7e7 commit 1ca6879
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hooks/useMinimumAmountGuard.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { RootState } from "../store";
import { useMemo } from "react";
import { useSelector } from "react-redux";
import { ChainId, isEVMChain } from "@certusone/wormhole-sdk";

function checkIfIsBelowMinimum(amount: string, decimals: number) {
Expand All @@ -15,13 +13,15 @@ function checkIfIsBelowMinimum(amount: string, decimals: number) {
}
}

const EIGHT_DECIMALS = 8;

function getAdjustedDecimals(
chainId: ChainId,
isNativeAsset: boolean,
decimals: number
) {
return isEVMChain(chainId) && !isNativeAsset && decimals > 8
? decimals - 8
return isEVMChain(chainId) && !isNativeAsset && decimals > EIGHT_DECIMALS
? EIGHT_DECIMALS // max decimals supported on evm chains
: decimals;
}

Expand Down

0 comments on commit 1ca6879

Please sign in to comment.