How to Swap Tokens on Uniswap Optimism/Arbitrum
RabbitHole
0xF719
Kairon
0x0BB6
May 30th, 2022

Layer 2 solutions are an exciting answer to the common question of “how can you participate in web3 without having to spend exorbitant fees?”. In this tutorial, we’ll go over one of the simplest steps you can take to start interacting with L2 chains: swapping tokens on Uniswap.

Main steps include: 

  1. Bridging funds to Optimism/Arbitrum 
  2. Swapping tokens in Uniswap on Optimism/Arbitrum 

What is an L2? An Introduction to Optimism and Arbitrum One 

Optimism is an EVM-compatible Optimistic Rollup chain that is designed to be a fast, simple, and secure scaling solution for Ethereum (we’ll give you the cliff’s notes version of some of those terms in a second). Essentially, Optimism is one solution to the question of “How do we get as many people into web3, without skyrocketing transaction fees?”, by using an L2 solution like Optimism, you’ll gain access to negligible gas fees, almost instant transactions, and a more accessible experience out of the box. Oh, and did we mention they’re becoming a DAO soon?

Similarly, Arbitrum One is a suite of Ethereum scaling solutions that enables low cost smart contracts while keeping the bulletproof security Ethereum is known for. They use a similar concept to Optimism in terms of how they process your transactions, with a few differences in the technicalities here and there.

Of course, this is just an oversimplification of how these platforms operate, and the value they offer to you as a user. But for now, suffice it to say they’re both efficient layer 2 solutions with Optimistic Rollups.

Woah, that was a mouthful, wasn’t it? Here are some key definitions to get you up to speed on the terminology:

  • Layer 2: Bitcoin, Ethereum and Dogecoin all have their own blockchains to process information, and while technically compatible through “wrapping”, they aren’t really built to play together. 

To solve the problem of high transaction fees, the concept of a second-layer blockchain was invented to send your transactions through in a more data (and budget) friendly way. As long as the chain you’re using is EVM compatible, you can take advantage of all the perks of Ethereum, while paying a fraction of the gas costs.

  • EVM: Or the “Ethereum Virtual Machine”, is a piece of infrastructure that processes transactions on the Ethereum Network. By being EVM compatible, Layer 2 chains like Optimism, Arbitrum and many more can process transaction hashes on Ethereum in bulk, through a process known as a Rollup.
  • Optimistic Rollup: It’s just a way to verify that all of the transactions they bundled together are, in fact, true. They’re called optimistic because they assume everything is correct unless someone externally challenges them. An alternative to this type of rollups is called the Zero-Knowledge (or ZK) Rollups, but those are a topic for another day.

What is Uniswap v3?

The top dog in Ethereum Decentralized Exchanges (and expanding into several other chains), Uniswap is a DeFi protocol allowing the entire multi-coin ecosystem to function. In it, you can swap your tokens and coins, pool liquidity to boost the engine running web3, and much much more. Basically, if you want to interact with web3 through a token like ETH, MATIC, APE, etc; there’s a very good chance you’ll go through Uniswap first.

What separates this platform from centralized exchanges such as Binance and Coinbase is that the protocol is entirely run by immutable smart contracts on Ethereum, that is, they’re completely decentralized. There’s absolutely no one in between the ETH you want to swap, and the pool willing to grant you some USDC in exchange (Liquidity Providers, or LPs for short). 

If you want to learn more about LPs, we recommend you read our quickstart guide on providing liquidity on Uniswap with Optimism/Arbitrum.

Step 1: Bridge Funds to Optimism/Arbitrum 

Arguably the biggest advantage of using Layer 2 solutions is the much lower bridging fees. While sending your tokens to other chains could cost you a pretty penny depending on the occasion, bridging your tokens from Ethereum to Optimism and Arbitrum can be much more budget friendly. So, knowing that your good old ETH will work perfectly on L2s, how about we bridge some of it over to whichever you choose? (the process is basically the same for both options)

First, go to chainlist.org, search Optimism and Arbitrum, and add them both to your Metamask wallet in order to switch chains easily.

Now enter app.hop.exchange and send some ETH over to Optimism or Arbitrum, you’ll notice the transaction fees are remarkably lower than bridging over to side chains like Polygon (Even though Hop also allows you to send funds over to MATIC for a much lower fee).

Give it a few minutes while the bridging transaction is validated, once submitted it should take no more than half an hour at most.

Done! Just switch your Network through Metamask and you’re ready to interact with the L2 you sent ETH to.

Step 2: Swap Tokens in Uniswap on Optimism/Arbitrum

Picking up right where we left off, you’ve just switched your network to Optimism/Arbitrum. You can make sure by checking the upper right  corner of the Metamask widget.

Head over to app.uniswap.org and connect your wallet if you haven't done so yet. It should automatically detect which network you’re interacting from.

Pick the token pair you’d like to swap between from the drop down menu and set the amount of ETH you’d like to exchange (make sure the swap is enabled in Uniswap’s interface, and that the token you're trading for is from a verified source).

If prompted to do so, grant Uniswap the permission to swap between your selected token pair.

After selecting your token pair, and allowing Uniswap to do the exchange, just click the swap button and confirm the transaction from your wallet

Recap and Pointers 

Congrats! You just got your feet wet in the L2 ecosystem by swapping tokens on Optimism/Arbitrum! Just add your new token to Metamask to keep track of your balances, or try your hand at providing liquidity on a pool you like.

Here’s the TL;DR version in case you want a refresher:

  • Add your preferred L2 network to your wallet
  • Bridge some funds over to L2
  • Connect to the Uniswap app (which is different from just https://uniswap.org!)
  • Make sure you’re on the right L2 network in your wallet
  • Swap between tokens through Uniswap’s interface
  • Add your newly acquired tokens to Metamask to keep track of your balances

And just like that, you’re one step closer to becoming an experienced user of web3 by experimenting with some of the most interesting solutions coming up in our ecosystem.

Subscribe to RabbitHole
Receive new entries directly to your inbox.
Collectors
View
#1
#2
#3
View collectors
This entry has been permanently stored on-chain and signed by its creator.