Introduction to LUVI and Midgard APR Calculation Update

THORChain Author
6 min readJul 7, 2022

--

Introduction

Within DeFi, measuring a liquidity pool performance is a difficult task due to many contributing factors. How “APR” or “APY” is calculated within Defi is not standardised and are often opaque and obscure. A consistent and standardised approach has been developed to measure pool health and performance in order to better inform network users via THORChain’s Midgard API.

Midgard serves as THORChain’s data API and provides aggregated stats such as price, swap volumes and pool depths. Within Midgard a new metric called Liquidity Unit Value Index ( LUVI) has been added. The APR calculation has been updated to be based off this new LUVI metric.

While this has been updated within THORChain, it is up to interfaces to adopt these changes. LUVI and the updated APR calculations do not change the rewards or accounting for liquidity providers.

Time to shine a light on THORChain yield calculations and improvements.

How were pool yields calculated in Midgard?

Previously in Midgard, yields for liquidity pools on THORChain were calculated as the amount of fees and rewards accruing to the liquidity pool over a 7 day period reflected as an annualised percentage gain of the total pool depth. It included emission of block rewards (thus the inflation of RUNE) and income from swap transaction fees. These components served to provide an indicator of a pool’s health and performance, versus each of these factors. However, this APR calculation still has its share of limitations, such as the fluctuation of APR within subsequent 7-day time periods attributable to asset price changes and volume spikes, which impacts THORChain’s efforts to attract long-term liquidity providers. In addition, the introduction of THORChain synths adds another dimension to yield calculation that was not incorporated in the previous version of APR.

To address this, THORChain has implemented an improved method to calculate the yield of a pool, called LUVI.

Introducing LUVI

At the core, Pool Units are the underlying accounting unit used in THORChain pools. When a Liquidity Provider adds assets to a pool, their position is summarised as a balance of Liquidity Units, i.e. a unit representing a share of the underlying assets within the Liquidity Pool. Similarly, when Synths are minted, the Synths position is summarised as a balance of Synth Units within the pool. Together:

Liquidity Units + Synths Units = Pool Units.

By measuring the value of each pool over time using Pool Units, the performance of the pool can be annualised to provide a clearer picture of pool performance for Liquidity Providers.

Liquidity Unit Value Index (LUVI) Formula

Definitions:

  • Asset Depth: The amount of non-RUNE assets in the liquidity pool (eg. Number of BTC)
  • Rune Depth: The amount of RUNE in the liquidity pool
  • Pool Units: Liquidity Units + Synth Units
  • Liquidity Units: A unit representing a share of the underlying assets composing a Liquidity Pool (RUNE and ASSET)
  • Synth Units: The total number of liquidity units that are needed to redeem all of the corresponding Synthetic Asset to the pool

Understanding Synth Units:

  • A pool’s Synth Units decrease when the total value of the minted synthetic assets goes up in terms of Liquidity Units (i.e. when RUNE outperforms ASSET)
  • A pool’s Synth Units increase when the total value of the minted synthetic assets goes down in terms of Liquidity Units (i.e. when ASSET outperforms RUNE)
  • A pool’s Synth Units change when synths are minted and redeemed for the underlying asset

The Asset Depth, Rune Depth, Liquidity Units, Synth Units, calculated LUVI and APR can be found in the Midgard endpoints below:

The /pools query can also be appended with a `period` parameter to calculate the yield with a longer LUVI sample interval, default is 30 days. For example, the APR based on a rolling 100 days of pool LUVI data can be viewed here. Since THORChain encourages long-term liquidity provision, it is recommended that long-term liquidity providers use longer periods for a more accurate picture of pool performance over the long term such as 100 days as that matches the full Impermanent Loss Protection (ILP) period.

Update: ILP has been removed as per ADR 005 Amendment 1 for all liquidity providers. ILP is not offered within THORChain.

The introduction of LUVI as a metric has had a resounding impact in helping developers discover areas of improvement within the protocol codebase — leading to several PRs to fix edge cases in the internal accounting of THORChain.

LUVI Analysis Related PRs:

Why is LUVI useful?

  • Provides a fair and comparable value for end-users to see a pool’s performance
  • Provides a measure of increases and decreases in Liquidity Unit value
  • Provides a summary of the increase and decrease in value for a single Liquidity Unit.,
LUVI Example

How would yield calculations change with LUVI?

  • Longer default averaged period: With the recent Midgard update, the displayed yield will now represent the: change in LUVI over the last N days (30 day default), reflected as an annualised percentage return, APR.
  • Compounding to non-compounding rate: The change to an APR (from APY) would reflect a non-compounding gain from the principal.
  • No changes to actual rewards earned This does not change the actual rewards accrued by LPs. It only reflects the change in value of the holdings of the pool itself over a 1-year period so users have a clearer understanding of pool performance.

What actions affect LUVI?

  • LP deposits and withdrawals have no net change to LUVI
  • Slippage fees, block rewards, and donations increase LUVI
  • Synthetic assets (Synths) can affect LUVI

The Impact of Synthetic Assets on LUVI

  • Synthetic Assets (Synths) are minted by depositing RUNE into the pools
  • Synths contribute to pool depth and are backed 50:50 by RUNE:ASSET
  • Synth holders give up their yield to other LPs in exchange for perpetual 1:1 redemption to the underlying asset
  • This creates a leveraged effect for LPs where LUVI may decrease when RUNE price goes down, but increase returns for LPs when RUNE price goes up
  • Synthetic Assets have a cap of the max pool depth because of this — controlled by the nodes (mimir: ‘MAXSYNTHPERASSETDEPTH’)
  • The maximum synthetic asset depth is currently set to 15% of the total pool depth, with a hard cap of 33% allowed for economic security

What does this mean for Liquidity Providers?

  • There is no change to the rewards of Liquidity Pools or Liquidity Providers, only the metric which tracks the performance of the pools (APR).
  • Individual Liquidity Providers enter and exit pools at different times, so they may and likely will have different yields than the pool itself.

Example LUVI and APR calculations

RUNE: BTC Pool — 100 Day Period

2022–01–01

  • assetDepth 501.94
  • runeDepth 3,840,897.91
  • PoolUnits 2,719,990.88
  • luvi 0.01614 = sqrt(501.94 * 3,840,897.91) / 2,719,990.88

2022–04–10

  • assetDepth 1,164.77
  • runeDepth 5,429,485.74
  • PoolUnits 4,696,197.85
  • Luvi 0.0167 = sqrt(5,429,485.74 * 4,696,197.85) / 4,696,197.85
  • Change in LUVI (0.0167 / 0.01614) — 1 = 3.4%

Annualised: 3.4% * 365 / 100 days = 12.41%

Summary

LUVI is a summary value to represent the value of a Liquidity Unit on THORChain. It is more accurate to reflect the yield of the pool as the change in LUVI over a period of time — noting that since the asset ratios in the liquidity pools over the 100 day window impact this calculation, it differs slightly from the methods used by most AMMs. The yield of the pool as displayed in Midgard: The change in LUVI over the last 30 days, expressed as an annualised yield (APR). This does not change the reward accrual or accounting for individual liquidity providers. It is up to interfaces to adopt these changes.

THORChain Community

To keep up to date with the project, please monitor community channels, particularly Telegram, Discord and Twitter:

--

--