Crypto News

What is Impermanent Loss in DeFi?

July 11, 2022
Written By


    Decentralized finance(DeFi) protocols like Uniswap and Curve have nearly $40 billion in total value locked even after the crypto crash in mid-2022. These decentralized exchanges, or DEXs, enable anyone to become a market maker and earn trading fees, replacing centralized exchanges with a more crypto-friendly alternative.

    For example, when depositing a cryptocurrency into Uniswap, the protocol will mint and send you a liquidity token, representing your contribution to the liquidity pool. Then, whenever a trade occurs, the sender pays a 0.3% fee distributed pro-rata to all liquidity providers in the pool – providing you with a source of income.

    But what happens when the cryptocurrency that you deposit changes in value? You might experience impermanent loss.

    Impermanent loss is a challenging concept, but it boils down to the opportunity cost of using liquidity pools.

    What is Impermanent Loss?

    Impermanent loss occurs when the price of the asset you deposit into a liquidity pool changes in value. These losses are commonplace in liquidity pools where you have to provide two assets in a ratio, and one of the assets is more volatile than the other. For example, a Uniswap DAI/ETH 50/50 liquidity pool, where DAI is worth a constant US$1.00, may create an opportunity for impermanent loss given ETH’s volatility.

    Liquidity pools that contain less volatile assets – such as stablecoins or like-kind coins – have less risk of impermanent loss. In addition to stablecoins, you can use uneven and multi-asset liquidity pools to reduce impermanent loss, as we’ll see below.

    How Impermanent Loss Happens

    Suppose you deposit 20 ETH worth US$10,000 and 10,000 DAI worth US$10,000 to a Uniswap liquidity pool. Then, the price of ETH rises to US$550 on an external exchange, like Coinbase. After doing the math, the price of ETH will be US$550 on Uniswap when there are 10,448 DAI and 19.07 ETH in the liquidity pool. So, arbitrageurs quickly buy ETH from the LP until the price of ETH equalizes with Coinbase and the broader market.

    Impermanent Loss
    Example of impermanent loss from Finematics. Source: Finematics

    After the arbitrage, you would realize a ~US$23 impermanent loss because you would have earned ~US$23 more by holding ETH rather than contributing to the liquidity pool. But, of course, you must also account for any income from trading fees received throughout the holding period that may offset some of these losses. In other words, you still make money if your fee income is higher than your impermanent loss.

    Is Impermanent Loss Permanent?

    Impermanent losses are not actual losses incurred from a liquidity provider’s position in a DeFi protocol. Rather, it’s the opportunity cost that arises when compared to buying and holding the same asset – or the risk of getting less value back when closing the position.

    It’s also worth noting that these losses aren't permanent until you withdraw your cryptocurrency from the liquidity pool. In the example above, if ETH went back to US$500, the impermanent loss would disappear. However, the loss would become permanent if you withdrew your ETH from the liquidity pool when the price of ETH was US$550.

    How to Calculate Impermanent Loss

    Liquidity pools are smart contracts that hold two or more different tokens and enable anyone to deposit or withdraw funds based on specific rules. However, impermanent losses depend on each protocol's specific rules and you’ll need to research the algorithm used by your DeFi protocol to make the most accurate calculations.

    That said, the most common rule is the constant product formula, or x * y = k, where X and Y are the reserves of two tokens. To withdraw token X, you must deposit a proportional amount of token Y to maintain the constant k before fees. However, in practice, transaction fees move into reserves, increasing the value of k over time.

    Impermanent Loss
    Example of a Uniswap transaction. Source: Uniswap

    In this example from Uniswap, the price of Token A increases from 1,200 to 1,203.03, which decreases the value of Token B to 399 to preserve the constant of 3. After the transaction, the liquidity shares are worth 3.015 after adding transaction fees.

    You can use several calculators to play around with these numbers and better understand your impermanent loss risk. For example, Whiteboard Crypto provides both simple and advanced calculators to help you compare the total value invested in a liquidity pool with the buy-and-hold value of the cryptocurrency to determine impermanent loss.

    How to Avoid Impermanent Loss

    The easiest way to avoid impermanent loss is to use stablecoins that don't change in value. For instance, Curve only contains assets that hold the same or very similar values, including stablecoins like USDC and DAI or different wrapped versions of the same underlying asset, like wBTC and sBTC. As a result, there's a very low risk of impermanent loss.

    Another common solution is adjusting the asset mix to minimize impermanent loss risk. For instance, Balancer uses arbitrary weights different from the usual 50/50 weighted model. As a result, you can maintain a higher exposure to certain assets with 80/20 pools. The higher the token's weight in the pool, the more negligible the impermanent loss risk. Other DeFi protocols use multi-asset liquidity pools to enhance diversification. 

    Finally, some DeFi protocols are exploring entirely new concepts. For example, Bancor aims to mitigate impermanent loss by adjusting weights based on external prices from price oracles. As a result, the protocol can eliminate impermanent loss in even the most volatile assets. And Tokemak uses single-sided liquidity pools where the protocol’s native token absorbs the risk of impermanent loss in exchange for swap fees and bribe rewards.

    The Bottom Line

    Impermanent loss occurs when the price of the asset you deposit into a liquidity pool changes in value. Fortunately, most liquidity pools provide enough trading fee income to offset impermanent loss, while other exchanges have ways of minimizing these losses. However, it's an essential concept to understand when using DeFi protocols.

    If you participate in liquidity pools, ZenLedger can help you calculate your taxable gain or loss. Our platform automatically aggregates transactions across wallets and exchanges, computes capital gains and losses, and pre-fills popular IRS forms to help you stay organized. It works with all kinds of transactions, including liquidity providers.

    Get started for free today!

    Get Started Now

    Simplifying DeFi, NFT, and Crypto Taxes for Investors and Tax Professionals

    FB logolinkedin logotwitter logoyoutubrmedium

    Copyright © 2022 ZenLedger
    10400 NE 4th St, Floor #5,
    Bellevue, WA 98004, USA