Git Product home page Git Product logo

arbitrum-token-bridge's Introduction

The canonical token-bridge of Arbitrum

Are you a developer looking to explore the Arbitrum token bridge and its underlying technology? Then you've come to the right place! We'll walk you through the steps to run the Arbitrum token bridge website locally on your machine.


Offchain Labs โค๏ธ Open-source

Interested in contributing to this repo? We welcome your contribution. Check out the contribution guidelines and instructions here.




Prerequisites for running the code

  • Install Node.js for your platform

  • Install Node Version Manager (nvm) to setup the correct Node version for the project.

  • Install VS Code for your platform

  • Install Yarn (version 1) - Package manager

  • Within VS Code, we use a some tools to automate things (e.g. code formatting), maintain consistency and reduce noise for code reviews. For the optimal development experience, install the following tools:

    • Prettier - Automatic code formatting
      • Find Prettier integration for your code editor here
    • EditorConfig - Automatic file formatting
      • Find EditorConfig integration for your code editor here
    • ESLint - Static analysis for JavaScript
      • Find ESLint integration for your code editor here



Steps to run the code locally

  1. Clone the Arbitrum token bridge repository from Github onto your local machine

    $ git clone https://github.com/OffchainLabs/arb-token-bridge
  2. Use the Node version as per project settings to avoid any errors before project installation.

    $ nvm use
  3. Install dependencies in all packages using yarn.

    $ yarn
  4. Set env vars:

    1. Copy the existing env.local.sample file present.

      $ cp ./packages/arb-token-bridge-ui/.env.local.sample  ./packages/arb-token-bridge-ui/.env
    2. In .env created, add NEXT_PUBLIC_INFURA_KEY=my-infura-key

    3. Set NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID to your WalletConnect project ID. You can create a new project on the WalletConnect dashboard.

    4. For custom urls, set optional vars:

    • NEXT_PUBLIC_ETHEREUM_RPC_URL=my-eth-node
    • NEXT_PUBLIC_SEPOLIA_RPC_URL=my-sepolia-node (see .env.sample) If no custom URL is provided, Infura will be used by default.
  5. Build the project and internal packages

    $ yarn build
  6. Finally, running the project

    1. (back in root dir:)

      $ yarn dev
    2. Visit http://localhost:3000/




Testing changes

It is important for any code change to pass both unit and end-to-end tests. This is generally done before raising the PR to ensure it doesn't break any existing feature.


Run Unit Tests

  1. Run the token bridge UI locally on http://localhost:3000/
  2. Run the tests
    $ yarn test:ci

Run End-to-End (E2E) Tests

  1. Set up the Nitro test node

    1. First, make sure you have a Nitro test node running. Follow the instructions here.

    2. When the Nitro test-node is up and running you should see logs like sequencer_1 and staker-unsafe_1 in the terminal. This can take up to 10 minutes.

  2. At the root of the token bridge UI:

    1. Run:
    $ cp ./packages/arb-token-bridge-ui/.e2e.env.sample ./packages/arb-token-bridge-ui/.e2e.env
    1. In the newly created file, .e2e.env, update your NEXT_PUBLIC_INFURA_KEY
  3. Run the token bridge UI locally on http://localhost:3000/ with:

    $ yarn dev
  4. Run e2e tests

    $ yarn test:e2e

Read more about the test setup here.




arbitrum-token-bridge's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arbitrum-token-bridge's Issues

Add old UI's warnings/disclaimers/ etc.

3 things at least from the old UI should also be in the new one:

  • Terms of service page
  • "NOTICE: You're connected to mainnet, still in beta phase. BE CAREFUL!" warning (for both Ethereum L1 and Arbitrum 1)
  • Pop up (or some sort of notification) before depositing and withdrawing alerting user of timing

"In transit" assets for withdrawal UI

  • Show amount "in transit" with ETA
  • Show corresponding amounts / ETAs for multiple simultaneous "in transit" transactions

Should probably come up with different terms for "withdrawal" (rollup chain to contract vs. lockbox to account)

token list search box: mainnet should filter vs rinkeby should allow add token

For mainnet, before we open up permissionless token registration, in light of #69, we have all of the available tokens displayed, so there's no need to allow a user to add a new token. The search box could instead be a filter (filters down the currently displayed tokens).

For rinkeby, we should continue supporting adding tokens. (maybe for rinkeby, it funcitions as both?)

Display cost of claiming in the L1 when withdrawing

We already have an alert warning users it takes 7 days, we should also warn users about the cost of executing the tx in the L1 after the 7 day confirmation period.

There is the cost of proving against the outputs merkle root which is usually constant.
For the actual token bridge execution costs (ie sending the tokens to the user), we can still run a eth_estimateGas

Should we display at current gas prices or maybe a couple preset values? ie 30gwei, 60gwei, 90gwei

fix pendingtransactionupdater polling

the pendingTransactions derived state caching seems off - triggers many updates, so the setInterval continuously gets reset and ends up never running its body

L1 token list

Currently we query all tokens for their name and symbol.

I believe we should use a token list to load these variables instead. We can have a different L1 token list, or just map the L2 token list https://bridge.arbitrum.io/token-list-42161.json so that we have the l1Address as a key for direct lookups.

If there is no info in the token list, we can then query for their name() and symbol() on-chain.

Add button to set max token amount

I'm a user and want to send all my eth or tokens over.
We could add a button to set this automatically.

tricky part with eth is that we need to send over user balance - tx gas cost - msg.value

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.