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:
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.
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.
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.
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.
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:
This is what the screen looks like when I added Arbitrum to my wallet:
Now you need to get L2 tokens: at least two types because liquidity pools always work in pairs.
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 is a simple, low fee bridge for moving between or among L1s and L2.
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.
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.
Once you have chosen your token pair and network, it’s time to head over to Uniswap.
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:
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:
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.
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.
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?)
Providing liquidity on L2 Uniswap has quite a few steps, but they’re all relatively simple.
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