Total Value Locked

TVL

Total Value Locked is an aggregate of all the funds locked in a DeFi Smart Contract, often as collateral for a financial product or service offered by the smart contract.

It is often used to measure the size of the DeFi ecosystem, but it has been criticized as a misleading metric as it can count assets more than once and there is no clear definition across all ecosystems, meaning you often compare apples with pears.

Here we provide details on how our TVL for Radix is calculated.

What is included?

  • Staking: all XRD values staked to Radix Nodes (not only the active validators)

  • Smart Contracts: all Radix native tokens that are stored in a component (smart contract)

We will implement filter options for the different TVL contents soon.

What is not included?

  • Liquid staking units (LSUs) put into pools: those are already counted for the Staking and therefore should not be counted double

  • Account balances: all tokens stored in accounts are not considered as locked

  • eXRD: eXRD is the wrapped representation of XRD on Ethereum and can therefore not be considered in the TVL

Data sources

Where do we get the data from?

Balances

The balances of locked tokens are taken directly from the PostgreSQL database connected to the Radix ledger.

Prices

More DEXs will be taken as price source as soon as they make their APIs available for us to fetch the data. We will then take the average price per token across the DEXs.

Calculation logic

Here is some details on how we do the calculation in the Postgres DB.

Staking:

  1. Get the stake_xrd_vault from state_history for each validator entity id

  2. Get the latest XRD balance of the vault from entity_vault_history

Smart contracts:

  1. Take all components and pools from the entities table, i.e. all entities with addresses starting with component_ or pool_

  2. Check latest resource balance in entity_vault_history where owner_entity_id is in the list from (1)

  3. Take current XRD price for all Non-XRD resources (where a price exists)

  4. Convert all to USD values

Note: prices are not on ledger but coming from our own created table with imported prices from the above mentioned APIs.

Timing

The calculation job is running every 5 minutes, but data shown on the website is aggregated to an hourly value, taking the average value within that hour.

Last updated