Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fillMissingTokenAddress function doesn't work as expected #422

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bridge-ui/src/hooks/useTokenFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,28 @@ const useTokenFetch = () => {
return;
}

// Since we don't if a token is native or bridged for a chain we try all the combinations
// Since we don't know if a token is native or bridged for a chain we try all the combinations
// possible to find its counterpart on the other chain
if (!token.L1 && token.L2) {
token.L1 = (await fetchNativeToken(fromChain, token.L2)) || null;
if (!token.L1 || token.L1 !== zeroAddress) return;
if (token.L1 && token.L1 !== zeroAddress) return;

token.L1 = (await fetchNativeToken(toChain, token.L2)) || null;
if (!token.L1 || token.L1 !== zeroAddress) return;
if (token.L1 && token.L1 !== zeroAddress) return;

token.L1 = (await fetchBridgedToken(fromChain, toChain, token.L2)) || null;
if (!token.L1 || token.L1 !== zeroAddress) return;
if (token.L1 && token.L1 !== zeroAddress) return;

token.L1 = (await fetchBridgedToken(toChain, fromChain, token.L2)) || null;
} else if (token.L1) {
token.L2 = (await fetchNativeToken(fromChain, token.L1)) || null;
if (!token.L2 || token.L2 !== zeroAddress) return;
if (token.L2 && token.L2 !== zeroAddress) return;

token.L2 = (await fetchNativeToken(toChain, token.L1)) || null;
if (!token.L2 || token.L2 !== zeroAddress) return;
if (token.L2 && token.L2 !== zeroAddress) return;

token.L2 = (await fetchBridgedToken(fromChain, toChain, token.L1)) || null;
if (!token.L2 || token.L2 !== zeroAddress) return;
if (token.L2 && token.L2 !== zeroAddress) return;

token.L2 = (await fetchBridgedToken(toChain, fromChain, token.L1)) || null;
}
Expand Down