---
description: >-
  TVL extractors are the functions that calculate the balances of assets locked
  in a protocol.
---

# TVL Extractors

### 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.

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

<table><thead><tr><th width="146">Property</th><th width="125">Type</th><th>Description</th></tr></thead><tbody><tr><td>category</td><td>required</td><td>Category in which the TVL is classified</td></tr><tr><td>extractor</td><td>required</td><td>A function that calculates and returns balances of assets locked in a protocol</td></tr><tr><td>startBlock</td><td>required</td><td>Block number from which the syncing of the TVL wll start</td></tr></tbody></table>
