TVL Extractors

TVL extractors are the functions that calculate the balances of assets locked in a protocol.

Structure

The structure of the TVL extractor is inspired by Defillama and Defipluse TVL adapters. The additional thing Spock is providing is the ability to archive syncing the TVL from the day of the protocol launch.

Currently, Spock has two categories for TVL.

  1. TVL => Assets locked by users in a protocol.

  2. Staking => Protocol native tokens locked in the staking contract.

type TvlExtractor = {
  category: TVL_Category;
  extractor: (chain: Chain, block: number, timestamp: number, cache?: LogsCache) => Promise<Record<string, string>>;
  startBlock: number;
};

Property
Type
Description

category

required

Category in which the TVL is classified

extractor

required

A function that calculates and returns balances of assets locked in a protocol

startBlock

required

Block number from which the syncing of the TVL wll start

Last updated