Liquidity Pool (LP) Transaction Flows: How-To for Accountants and Auditors

Introduction

As the digital asset space matures more and more institutions are entering the space and it is critical for accountants and auditors to understand how these transaction flows work. Many Decentralized Finance (DeFi) transactions sound easy enough when you first encounter them: “Uniswap is just like a buy and sell on the New York Stock Exchange right?” However, when we start looking at the transactions on the blockchain they are often much more complex than people expect.

This article is the first in a series where we’ll break down these transactions at a very basic level to help users understand their logic and how they should be accounted for.

We’ll start out by looking at Liquidity Pools (LP), using Uniswap Version 2 as an example.

Liquidity Pools

A liquidity pool is a pool of digital assets locked in a smart contract that is used to facilitate trades between assets on a decentralized exchange (DEX). Instead of traditional markets of buyers and sellers, matching buys to sells, many decentralized finance (DeFi) platforms use automated market makers (AMMs), which allow digital assets to be traded in an automatic and permissionless manner through the use of liquidity pools.

All this really means is that when you are trading on a DEX you are actually selling your tokens into a pool of two assets and receiving the token you bought out of that same pool of assets. This is all facilitated through a smart contract and makes the process very smooth and seamless.

When dealing with liquidity pools you can either be a liquidity provider (“LP”), where you are adding the assets to the pool and share in rewards and fees or a user, where you are buying and selling assets using the pool.

For our first example we will look at adding LP to a pool and the transactions associated with that process.

Adding Liquidity

In our example we are going to assume we are adding liquidity to the DAI (stable coin)/Ethereum LP pool. The first transaction which will take place when a user interacts with with the pool is the transfer of the assets being added to the pool. In this example DAI and ETH will be added in a 50/50 value ratio to the pool. In our example let’s say this is $100 worth of ETH and $100 worth of DAI being added to the pool.


When the ETH and DAI is sent to the smart contract it will return LP tokens. These tokens take different formats and can even be NFT’s, but at its core these tokens are just a representation of your tokens that have been locked up in the pool, similar to an IOU allowing the holder to claim the assets associated with them.

Earning Rewards

Once the assets are locked in the specific pool, the LP provider will start earning reward tokens in the native token of that protocol. In this example this will be UNI tokens. The tokens accrue to the user in the smart contract, but will only flow to the LP providers wallet when they are claimed. This is the first completeness risk to be aware off. If tokens are not claimed they will not show up in the wallet and viewing wallet transactions on Etherscan will not show rewards earned in smart contracts.


This is why its very important to use data providers who can support these types of rewards and provide complete transactions to account.  

Impermanent Loss

While the tokens are locked up in the pool the price of these tokens may fluctuate as the relative price of tokens changes against each other. Each protocol has its own pricing mechanism and Uniswap uses the formula “x * y=k” to determine this price which can be represented as follows:

In Uniswap V3 the concept of concentrated liquidity was also introduced, you can read more about that here: https://uniswap.org/whitepaper-v3.pdf

The main take away for auditors and accountants is that there will be “impermanent loss”, probably better know to you as “unrealized gains and losses” on the assets that have been locked up in the pool. To take a simple example, if the price of ETH decreases 20% against DAI the ‘value’ of the assets will change to DAI ($120): ETH ($80), while the ration of the number of DAI and ETH will remain at 50:50.

This topic can be an article on its own and we won’t go into further details here. The main thing to take out of this is that the value of the LP provided may change while locked in the pool.


Closing the Position

The final step in the LP pool process is to close the position. This occurs when the LP Tokens representing your share in the pool are deposited back into the smart contract. Two transactions will result from this process.

Firstly the assets deposited into the contract (DAI/ETH) will be returned to your wallet and secondly a percentage of the fees from the pool will be paid into your wallet. These fees are the reward for providing liquidity and locking up assets.


The main points for auditors to consider here are that when you close a position you will receive tokens back in the ratio based on the price at that point in time. In our example above the DAI:ETH ration will still be at 50:50, however this will be at the price when the position was closed. Therefore, you will not receive the same amount of DAI and ETH as when you first added liquidity to the pool and may have a realized gain or loss on this position.

It should also be noted that fees are only paid when the LP tokens are redeemed. This is not the case for all protocols and may vary given different versions and circumstances in protocols. You should however ensure that you account for these rewards correctly and take them into account when LP tokens have not yet been redeemed.

Conclusion

This is a very high-level overview of the LP process and has been simplified for ease of explanation. To ensure you are accounting for these types of investments correctly you have to use data providers who can display all the intricacies of DeFi in an easy to understand format.

At Hash Data this is our mission. To help grow DeFi by making it easy for any company to integrate the data into their financial systems.