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

feat: Add crosschain tokenlists #1530

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

chrstph-dvx
Copy link
Contributor

@chrstph-dvx chrstph-dvx commented Feb 13, 2024

Objective

The idea is to:

  • Add the new crosschain token lists to the bridge
  • Refactor how tokens are handled in the bridge

Paired with network query param refactor, we can store and access tokens by a tuple (chainId, address) and have information about their bridged chains, regardless of current chain.

Architecture changes

Adding

  • Add zustand store for tokenLists with custom hooks:
    • useTokens custom hook: returns tokens map for source and destination chains with defaults, so we don't need to check for the existence of the object
    • useSelectedToken custom hook: Return currently selected token for source chain and destination chain

Deprecating

  • Remove bridgeTokens from useArbTokenBridge
  • Remove selectedToken from the global state
  • Remove tokenListSyncer. The tokenLists now include information about multiple chains, so we don't need to sync anymore.

Proposed plan

  • Add zustand store and custom hooks
  • Extract bridgeTokens from useArbTokenBridge
  • Replace token lists utils with zustand store
  • Replace bridgeTokens with new tokens hook

@chrstph-dvx chrstph-dvx self-assigned this Feb 13, 2024
@cla-bot cla-bot bot added the cla-signed label Feb 13, 2024
Copy link

vercel bot commented Feb 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
arbitrum-token-bridge ❌ Failed (Inspect) Feb 22, 2024 2:49pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant