Skip to content

Commit

Permalink
fix: approval address check (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdev3 authored Jul 23, 2024
1 parent 2c27ab7 commit 6af77c4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
export const uint256MaxValue =
"115792089237316195423570985008687907853269984665640564039457584007913129639935";

export const nativeTokenConstant = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
export const NATIVE_EVM_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
export const NATIVE_EVM_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee".toLowerCase();
export const MULTICALL_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";
export const multicallAbi = [
{
Expand Down
8 changes: 6 additions & 2 deletions src/handlers/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import {
WalletV6,
} from "../../types";

import { CHAINS_WITHOUT_MULTICALL, nativeTokenConstant, uint256MaxValue } from "../../constants";
import {
CHAINS_WITHOUT_MULTICALL,
NATIVE_EVM_TOKEN_ADDRESS,
uint256MaxValue,
} from "../../constants";
import { Utils } from "./utils";
import { TokensChains } from "../../utils/TokensChains";

Expand Down Expand Up @@ -318,7 +322,7 @@ export class EvmHandler extends Utils {

const fromProvider = ethersAdapter.rpcProvider(_fromChain.rpc);

const fromIsNative = _fromToken.address === nativeTokenConstant;
const fromIsNative = _fromToken.address.toLowerCase() === NATIVE_EVM_TOKEN_ADDRESS;
let fromTokenContract;

if (!fromIsNative) {
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/evm/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class Utils {
tokens.map(async t => {
let balance: TokenBalance | null;
try {
if (t.address === NATIVE_EVM_TOKEN_ADDRESS) {
if (t.address.toLowerCase() === NATIVE_EVM_TOKEN_ADDRESS.toLowerCase()) {
balance = await this.fetchBalance({
token: t,
userAddress,
Expand Down

0 comments on commit 6af77c4

Please sign in to comment.