Total Value Locked
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.
- 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.
- 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
Where do we get the data from?
The balances of locked tokens are taken directly from the PostgreSQL database connected to the Radix ledger.
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.
Here is some details on how we do the calculation in the Postgres DB.
- 1.Get the
state_historyfor each validator entity id
- 2.Get the latest XRD balance of the vault from
- 1.Take all components and pools from the
entitiestable, i.e. all entities with addresses starting with
- 2.Check latest resource balance in
owner_entity_idis 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.
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.