-
Notifications
You must be signed in to change notification settings - Fork 199
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
feat: show ARB token on all Orbit chains #1475
Open
fionnachan
wants to merge
72
commits into
master
Choose a base branch
from
fix-arb-on-orbit
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+121
−65
Open
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
a145526
feat: always show ARB on Orbit pair
fionnachan 2600e99
fix weird case when switching destination chain
fionnachan 399a118
remove usecallback
fionnachan cd414cc
lowercase lol
fionnachan 4dda7fb
remove console.log
fionnachan 33064f4
remove unneeded code
fionnachan c842199
remove comment
fionnachan c0fd50e
clean up
fionnachan c034918
unneeded imports
fionnachan a909ee2
cypress didn't like the @ paths it doesn't know about
fionnachan 8d91da6
fix path
fionnachan 1bb8ee0
move file
fionnachan 7e57735
nits
fionnachan d2b114f
nit
fionnachan ed95f46
more renaming
fionnachan b7f7ab6
Merge branch 'master' into fix-arb-on-orbit
fionnachan 7439928
Merge branch 'master' into fix-arb-on-orbit
fionnachan 8d24a23
Merge branch 'master' into fix-arb-on-orbit
fionnachan a5dfdc1
Merge branch 'master' into fix-arb-on-orbit
chrstph-dvx 1992fa8
Merge branch 'master' into fix-arb-on-orbit
fionnachan b16d5a2
Merge branch 'master' into fix-arb-on-orbit
fionnachan 1749754
Merge branch 'master' into fix-arb-on-orbit
fionnachan 0ecce9e
Merge branch 'master' into fix-arb-on-orbit
fionnachan 66cff86
Merge branch 'master' into fix-arb-on-orbit
fionnachan 04d8380
Merge branch 'master' into fix-arb-on-orbit
fionnachan 2e872f5
Merge branch 'master' into fix-arb-on-orbit
fionnachan b5c7a7d
Merge branch 'master' into fix-arb-on-orbit
fionnachan e67e5fc
Merge branch 'master' into fix-arb-on-orbit
fionnachan 925bb23
Merge branch 'master' into fix-arb-on-orbit
fionnachan a13787b
Merge branch 'master' into fix-arb-on-orbit
fionnachan 0144380
Merge branch 'master' into fix-arb-on-orbit
fionnachan 4515d29
Merge branch 'master' into fix-arb-on-orbit
fionnachan a42a878
Merge remote-tracking branch 'origin/master' into fix-arb-on-orbit
fionnachan 385b6dc
Merge branch 'master' into fix-arb-on-orbit
fionnachan 2162617
Merge branch 'master' into fix-arb-on-orbit
fionnachan 4d43c17
Merge remote-tracking branch 'origin/master' into fix-arb-on-orbit
fionnachan 7d7ea3a
Merge branch 'master' into fix-arb-on-orbit
fionnachan fb7d1b2
Merge branch 'master' into fix-arb-on-orbit
fionnachan 4b4c27e
Merge branch 'master' into fix-arb-on-orbit
fionnachan 0ab3d47
Merge branch 'master' into fix-arb-on-orbit
fionnachan bbdbe3b
Merge branch 'master' into fix-arb-on-orbit
fionnachan d1d8bc2
Merge branch 'master' into fix-arb-on-orbit
fionnachan aa22245
Merge branch 'master' into fix-arb-on-orbit
fionnachan 327f59d
Merge branch 'master' into fix-arb-on-orbit
fionnachan 6bed30a
Merge branch 'master' into fix-arb-on-orbit
fionnachan 46cc99e
Merge branch 'master' into fix-arb-on-orbit
fionnachan 85d3f09
Merge remote-tracking branch 'origin/master' into fix-arb-on-orbit
fionnachan 763ed06
Merge branch 'master' into fix-arb-on-orbit
fionnachan fbe590d
Merge branch 'master' into fix-arb-on-orbit
fionnachan e281aab
Merge remote-tracking branch 'origin/master' into fix-arb-on-orbit
fionnachan f82407f
clean up
fionnachan 834f875
clean up
fionnachan 0a5d807
Merge branch 'master' into fix-arb-on-orbit
fionnachan 1b8bb4e
Merge branch 'master' into fix-arb-on-orbit
fionnachan 3642076
Merge remote-tracking branch 'origin/master' into fix-arb-on-orbit
fionnachan 6c5b341
Merge remote-tracking branch 'origin/master' into fix-arb-on-orbit
fionnachan ba84a9c
Merge branch 'master' into fix-arb-on-orbit
fionnachan 2fcee98
Merge branch 'master' into fix-arb-on-orbit
fionnachan 81d8159
Merge branch 'master' into fix-arb-on-orbit
fionnachan f3d3516
Merge branch 'master' into fix-arb-on-orbit
fionnachan d442ca2
Merge branch 'master' into fix-arb-on-orbit
fionnachan 6749488
Merge branch 'master' into fix-arb-on-orbit
fionnachan c77b94a
Merge branch 'master' into fix-arb-on-orbit
fionnachan a08a994
Merge branch 'master' into fix-arb-on-orbit
fionnachan 6b421fb
Merge branch 'master' into fix-arb-on-orbit
fionnachan 2bd9c55
Merge branch 'master' into fix-arb-on-orbit
fionnachan 27389c9
Merge branch 'master' into fix-arb-on-orbit
fionnachan 53ca4c3
Merge branch 'master' into fix-arb-on-orbit
fionnachan bf52145
Merge remote-tracking branch 'origin/master' into fix-arb-on-orbit
fionnachan 90da13d
Merge remote-tracking branch 'origin/master' into fix-arb-on-orbit
fionnachan e7379fa
Merge branch 'master' into fix-arb-on-orbit
fionnachan fca8881
Merge branch 'master' into fix-arb-on-orbit
fionnachan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,7 @@ import { Chain } from 'wagmi' | |
|
||
import { Loader } from '../common/atoms/Loader' | ||
import { useAppState } from '../../state' | ||
import { | ||
listIdsToNames, | ||
SPECIAL_ARBITRUM_TOKEN_TOKEN_LIST_ID | ||
} from '../../util/TokenListUtils' | ||
import { listIdsToNames } from '../../util/TokenListUtils' | ||
import { formatAmount } from '../../util/NumberUtils' | ||
import { shortenAddress } from '../../util/CommonUtils' | ||
import { | ||
|
@@ -20,6 +17,7 @@ import { | |
sanitizeTokenName, | ||
sanitizeTokenSymbol | ||
} from '../../util/TokenUtils' | ||
import { isArbitrumToken as isArbitrumTokenCheck } from '../../util/ArbTokenUtils' | ||
import { SafeImage } from '../common/SafeImage' | ||
import { getExplorerUrl, getNetworkName } from '../../util/networks' | ||
import { Tooltip } from '../common/Tooltip' | ||
|
@@ -178,22 +176,16 @@ function useTokenInfo(token: ERC20BridgeToken | null) { | |
|
||
const balance = useBalanceOnSourceChain(token) | ||
|
||
const isArbitrumToken = useMemo(() => { | ||
if (!token) { | ||
return false | ||
} | ||
|
||
return token.listIds.has(SPECIAL_ARBITRUM_TOKEN_TOKEN_LIST_ID) | ||
}, [token]) | ||
const isArbitrumToken = isArbitrumTokenCheck(token) | ||
|
||
const isPotentialFakeArbitrumToken = useMemo(() => { | ||
if (!token || isArbitrumToken) { | ||
return false | ||
} | ||
|
||
return ( | ||
token.name.toLowerCase().startsWith('arb') || | ||
token.symbol.toLowerCase().startsWith('arb') | ||
token.name.toLowerCase().startsWith('arbitrum') || | ||
token.symbol.toLowerCase() === 'arb' | ||
) | ||
}, [token, isArbitrumToken]) | ||
|
||
|
@@ -249,6 +241,8 @@ function TokenBalance({ token }: { token: ERC20BridgeToken | null }) { | |
isTokenArbitrumOneNativeUSDC(token?.address) || | ||
isTokenArbitrumSepoliaNativeUSDC(token?.address) | ||
|
||
const isArbitrumToken = isArbitrumTokenCheck(token) | ||
|
||
const tokenIsAddedToTheBridge = useMemo(() => { | ||
// Can happen when switching networks. | ||
if (typeof bridgeTokens === 'undefined') { | ||
|
@@ -263,8 +257,12 @@ function TokenBalance({ token }: { token: ERC20BridgeToken | null }) { | |
return true | ||
} | ||
|
||
return typeof bridgeTokens[token.address] !== 'undefined' | ||
}, [bridgeTokens, isArbitrumNativeUSDC, token]) | ||
if (isArbitrumToken) { | ||
return true | ||
} | ||
Comment on lines
+260
to
+262
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. never show the "Import" text for Arb token |
||
|
||
return typeof bridgeTokens[token.address.toLowerCase()] !== 'undefined' | ||
}, [bridgeTokens, isArbitrumNativeUSDC, isArbitrumToken, token]) | ||
|
||
if (!tokenIsAddedToTheBridge) { | ||
return <span className="arb-hover text-sm">Import</span> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { useEffect } from 'react' | ||
import { useAccount } from 'wagmi' | ||
import { useNetworks } from '../../hooks/useNetworks' | ||
import { useNetworksRelationship } from '../../hooks/useNetworksRelationship' | ||
|
||
|
@@ -15,19 +14,14 @@ const TokenListSyncer = (): JSX.Element => { | |
const { | ||
app: { arbTokenBridge, arbTokenBridgeLoaded } | ||
} = useAppState() | ||
const { address: walletAddress } = useAccount() | ||
const [networks] = useNetworks() | ||
const { childChain } = useNetworksRelationship(networks) | ||
const { childChain, parentChain } = useNetworksRelationship(networks) | ||
|
||
useEffect(() => { | ||
if (!arbTokenBridgeLoaded) { | ||
return | ||
} | ||
|
||
if (!walletAddress) { | ||
return | ||
} | ||
Comment on lines
-27
to
-29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. didn't use it at all |
||
|
||
const tokenListsToSet = BRIDGE_TOKEN_LISTS.filter(bridgeTokenList => { | ||
// Always load the Arbitrum Token token list | ||
if (bridgeTokenList.isArbitrumTokenTokenList) { | ||
|
@@ -41,9 +35,14 @@ const TokenListSyncer = (): JSX.Element => { | |
}) | ||
|
||
tokenListsToSet.forEach(bridgeTokenList => { | ||
addBridgeTokenListToBridge(bridgeTokenList, arbTokenBridge) | ||
addBridgeTokenListToBridge({ | ||
bridgeTokenList, | ||
arbTokenBridge, | ||
parentChainId: parentChain.id, | ||
childChainId: childChain.id | ||
}) | ||
}) | ||
}, [walletAddress, childChain.id, arbTokenBridgeLoaded]) | ||
}, [childChain.id, arbTokenBridgeLoaded, parentChain.id]) | ||
|
||
return <></> | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FS-327