Skip to content

Commit

Permalink
Merge pull request #158 from bnb-chain/feat/addressCheck
Browse files Browse the repository at this point in the history
fix: Check lower case address
  • Loading branch information
Halibao-Lala authored Dec 3, 2024
2 parents 5a49ccf + d3750f1 commit 64f43f5
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ export const useValidateSendToken = () => {

if (!deBridgeConfig?.tokens) return false;
const tokenInfo = deBridgeConfig.tokens[tokenAddress.toLowerCase()];
if (!!tokenInfo && tokenInfo?.address === tokenAddress && tokenInfo?.symbol === tokenSymbol) {
if (
!!tokenInfo &&
tokenInfo?.address.toLowerCase() === tokenAddress.toLowerCase() &&
tokenInfo?.symbol === tokenSymbol
) {
console.log('deBridge token info matched', tokenInfo);
return true;
}
Expand Down Expand Up @@ -208,7 +212,8 @@ export const useValidateSendToken = () => {
const chainInfo = mesonConfig.result.filter((chainInfo) => {
const tokenInfo = chainInfo.tokens.filter(
(token) =>
(token?.addr === tokenAddress && token.id === tokenSymbol.toLowerCase()) ||
(token?.addr?.toLowerCase() === tokenAddress.toLowerCase() &&
token.id === tokenSymbol.toLowerCase()) ||
(!token?.addr &&
tokenAddress === '0x0000000000000000000000000000000000000000' &&
token.id === tokenSymbol.toLowerCase()),
Expand All @@ -218,7 +223,7 @@ export const useValidateSendToken = () => {
}
return (
chainInfo.chainId === `0x${hexNum}` &&
chainInfo.address === bridgeAddress &&
chainInfo.address.toLowerCase() === bridgeAddress.toLowerCase() &&
tokenInfo?.length > 0 &&
!!tokenInfo
);
Expand Down

0 comments on commit 64f43f5

Please sign in to comment.