How to Provide Liquidity on Uniswap Optimism/Arbitrum
RabbitHole
0xF719
jfuji
0xF5Ae
May 30th, 2022

In this tutorial, we’ll cover how to become a L2 liquidity provider using Uniswap on two popular L2 networks: Optimism and Arbitrum.

Main steps include:

  1. Adding the networks to your wallet
  2. Depositing funds to your network of choice
  3. Using Uniswap v3 to provide liquidity

Before we Start

What is an L2?

L2 is short for Ethereum Layer 2. The main Ethereum network is called Layer 1.

An L2 network is built on top of Layer 1, as the name implies. The main goal of an L2 network is to reduce transaction costs. If it costs $10 to send $5 worth of ETH, no one will want to use the network! L2’s like Optimism and Arbitrum aim to make these “gas fees” very small and manageable.

Optimism and Arbitrum are two of the most prominent L2’s. Read more about their differences here.

What is Uniswap v3?

Uniswap is an Ethereum-based decentralized exchange (DEX) that allows anyone to swap ERC20 tokens. V3 is the third major version of Uniswap.

It looks and feels like a website. When you open the “app” on the site, it brings you to an interface that connects to your crypto wallet (like MetaMask). Once Uniswap is connected to your wallet, you can start swapping, but only between tokens on the same network. You can change your wallet’s network easily, and if Uniswap supports that network, then you’re free to swap as you please.

What are liquidity pools?

When you do a swap with Uniswap, who is swapping with you? A swap is just a trade, and therefore there must be a buyer (e.g. you) and a seller (who?)

When you use Uniswap, you’re not actually trading with any single person. Rather, you’re accessing a “liquidity pool.”

These are like special banks that Uniswap’s protocol manages. Each pool represents a pair of tokens, say ETH and DAI. When you trade in ETH to get DAI, your ETH goes into the pool and out comes DAI from the pool. If the pool runs out of either, then swaps can’t happen.

So: Uniswap provides rewards for people to become liquidity providers (LP). These are users (like you!) who pool their money together to create the “bank” that is used to execute the trades (and keep it from running dry). A buyer or seller in this system doesn't have to wait for another party to appear to complete a trade, and the trade can be executed instantly at a known price if there is enough liquidity.

Why become a liquidity provider?

Whenever someone does a swap, they pay a small fee to the pool. A portion of that fee goes to all the liquidity providers. So you can earn passive income from other people trading back and forth.

You may also become an LP to help support the flow of value between projects, systems, or networks. 

The Guide

Step 1: Add the Optimism or Arbitrum Network to your Wallet

In order for Uniswap v3 to allow swapping, it needs to connect to a wallet that has the right network configuration. This is easy to do:

Login to MetaMask on your browser

Click on the Networks dropdown menu at the top. It usually says something like ‘Ethereum Mainnet,’ and is right beside the MetaMask fox logo.

From the dropdown, select ‘Add Network’

For Optimism, enter the following in the fields:

For Arbitrum, enter the following in the fields:

Click ‘Save’

This is what the screen looks like when I added Arbitrum to my wallet:

Step 2: Bridge Assets from the Ethereum Mainnet 

Now you need to get L2 tokens: at least two types because liquidity pools always work in pairs.

  • If your only goal is to provide liquidity, acquire a similar USD-value amount of each token (e.g. $200 worth of ETH, $200 worth of DAI)
  • Alternatively, you could acquire the full amount in one token, then swap about 50% of it for the other one (using the LP!), then add the amounts right back into the pool.
  • Research what pairs to provide liquidity for. Different pairs come with different risk profiles. Pairing two well-established assets is less risky than including even one lesser known token.

If you’ve never used Optimism or Arbitrum before, you’ll need to turn your L1 tokens into their L2 versions.

This is not the same as swapping (but it is still pretty easy). The process of moving tokens between entire protocols is called “bridging.” You will have to pay the Layer 1 gas fees in order to do this (but only once per bridge request!)

There are a few handy bridge protocols out there for this. They are simple to use.

Hop

Hop is a simple, low fee bridge for moving between or among L1s and L2. 

  1. Connect your wallet
  2. Stay on the “Send” menu at the top
  3. Pick the token you’re looking to bridge
  4. Pay attention to the networks. Below I’m turning Mainnet ETH into ETH on Arbitrum and Optimism
  5. Enter the amount. You’ll get an estimate for what you’ll receive, less bridge fees
  6. Once you confirm, your wallet will tell you what additional gas fees you’ll need to commit to, if they apply

When bridging L1 ETH to L2 ETH on Arbitrum, I’ll lose almost no ETH to the bridge, but…

Here are the actual gas fees, about $13 USD worth of ETH that will be deducted out of my L1 wallet. Be sure you have enough gas to pay for bridging! And keep an eye on gas trackers like Etherscan’s for periods of low gas fees.

LayerSwap

Is a little more complex, but it is good if you have L1 assets on a centralized exchange (CEX) like Coinbase, KuCoin or Kraken. It helps you save on gas fees by using an API to connect directly to your exchange account before doing the bridge. You can learn more about how that works here.

Step 3: Providing Liquidity

Once you have chosen your token pair and network, it’s time to head over to Uniswap.

  1. Go to https://app.uniswap.org/
  2. Connect your wallet if it isn’t already

Make sure you’re on your preferred L2 network. Uniswap offers you the option to switch networks in the upper righthand side, or you can do it from your wallet.

Click “Pool” at the top

Click the + New position button

If it’s your first time using a new token like DAI, you’ll need to approve it for use. This may force you to go back to the beginning of configuration, so do this first!

Configure your position in the pool (see more info below)

Hit “Preview” and check to make sure everything looks right

Sign the transaction with your wallet and pay any gas fees (L2 gas fees will be low!)

And you’re done!

Here’s what the pool screen will show now:

Configuring your Position

This is the most complicated part! Once you hit + New position, you’ll see a control panel interface appear, and it will be mostly blank—until you pick your pair from the dropdown menus. Below is an example of choosing the ETH-DAI pair.

Fee tier. The app will auto-select the fee tier with the most liquidity. In most cases, LPs will align around one fee tier for a pair.

Price range. This is one of the most powerful aspects of Uniswap v3. Setting a price range allows you to say: “I only want to participate in this pool if the price is above X and below Y” (and this can be expressed in terms of either token). Here are a few things to keep in mind about the price range configuration:

  • It helps protect you against large price swings. We know that things can sometimes get crazy in crypto. Let’s say the price crashes on one of your tokens, and you’re on vacation somewhere. People would rush to execute swaps, trading the “dying” token for the one that’s still valuable. If you didn’t have a price range set, you’d come back to find your position full of the dead tokens, with none of its pair left at all. A price range stops trading your assets at a certain limit, which limits your losses (and gains, going the other way).
  • It impacts the deposit ratio. Uniswap will automatically calculate how much of each token you need to deposit. You may find that the USD amounts are quite different than what you originally planned for so pay attention!
  • It impacts your passive income potential. You only collect fees from swappers when swaps happen inside your range, so having too narrow of a range may limit your passive income.

Removing Liquidity

Once you’ve provided liquidity, when you go to the “Pools” page on https://app.uniswap.org/ you’ll be able to see your positions (make sure to switch to the correct network!). There’s a pretty obvious “remove liquidity” button that will take you through some easy steps to transfer some or all of your assets back to your wallet.

Collecting your Earned Fees

A big incentive for providing liquidity is collecting fees from swaps that happen in your price range. But how do you claim them?

As you accrue fees, Uniswap will show them to you when you click on one of your positions. If there is something to withdraw, you’ll see a button to collect fees. This costs a bit of gas, so you should let the fees build up a bit before collecting. This 0.0002286 DAI is not really worth the gas, so I’ll let it build up.

L2 Liquidity Pool Risks

Collecting fees is nice, but there are definitely downsides to using liquidity pools, and especially L2 LPs! (That just rolls off the tongue, doesn’t it?)

  • Impermanent loss. This is something that happens when the prices and ratios of tokens in an LP change over time. If there are big changes in the relationship between the token pair, you may find that it was more profitable (or less damaging) to have simply held onto the tokens in your wallet vs. putting them in an LP. This article gets into the details.
  • L2 is in beta right now. These L2 technologies are pretty cool, but they are still quite new and still under construction. It is expected that the networks could go down temporarily, have bugs, and be exposed to exploits. Tokens inside L2 LPs carry these risks. Never invest more than you can afford to lose—especially in frontier DeFi tech like this!

Recap and Pointers

Providing liquidity on L2 Uniswap has quite a few steps, but they’re all relatively simple.

  • Add your preferred L2 network to your wallet
  • Bridge desired L1 assets over to L2 if don’t already have L2 assets
  • 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 (you may also need to add your L2 token addresses to your wallet to see them)
  • Go to the Pools section, and hit the + New position button
  • Choose your LP pair, approve tokens, configure your position (with special attention paid to the price range!)
  • Triple check everything in the preview
  • Sign the deposit transaction!

Like with all things in the DeFi space, be absolutely sure your browser’s URL is pointing to the correct app or site. Don’t click on any suspicious links, and be wary of what apps and platforms you sign permissions with. Keep your wallet keys ultra safe, and triple check when you’re copying and pasting addresses into fields.

~

Keep on questing and leveling up your skills!

🧙‍♂️ Tutorial created by: jfuji.eth • jfuji.app.bio

Add to your collection
Support this creator by becoming a collector.
Collectors
View
#1
#2
#3
View collectors
This entry has been permanently stored on-chain and signed by its creator.