Agnostic Documentation
  • 👋Welcome to Agnostic
  • Overview
    • 💡Introducing Agnostic
    • ✨Our Features
  • API
    • Execution Layer
      • Blocks
    • Smart-contracts
      • EVM Events
      • EVM Calls
    • DeFi
      • Trades
      • Liquidity Events
      • Liquidity Snapshots
    • Token
      • Balances
      • Total Supplies
  • Tutorials
    • 🦄Uniswap V3
      • Definition
      • Explore
      • Apify
    • 🤑Portfolio tracker
  • Fundamentals
    • 📈Data visualization
      • 👨‍🔬Create your first chart
    • 👷Building API
    • 💻HTTP Interface
      • Authentication
    • 🔑Authentication details
      • PostgreSQL
      • HTTP
    • 📎Understanding Projects
    • 🛠️Collaborate with your team
      • 📝Setting permissions
      • 🧑Inviting Members
Powered by GitBook
On this page
  • Availability
  • Methodology
  • Table Schema
  • Usage
  1. API
  2. DeFi

Liquidity Events

Availability

This collection is available for the Ethereum, Polygon, Arbitrum, and Base.

Points-of-Presence
Tables

eu-west-1

defi_liquidity_events_ethereum_mainnet_v1 defi_liquidity_events_polygon_mainnet_v1 defi_liquidity_events_arbitrum_mainnet_v1 defi_liquidity_events_base_mainnet_v1

Methodology

The table is built by extracting data from DEXes activity and then normalizing it to fit a unified data model.

We currently support the following DEXes:

  • Uniswap V2

  • Uniswap V3

  • Curve

We extract data from any contract compatible with one of the above DEXes ABI.

It means that any DEXes that forked or tried to be compatible at the ABI level with these contracts will be indexed automatically.

Table Schema

Column Name
Column Type
Description

chain_name

string

Name of the chain (ethereum, arbitrum, polygon, ...).

chain_network_name

string

name of the network (mainnet).

block_hash

string

Block hash encoded as binary string

block_number

uint64

Block height

transaction_index

uint64

The index of the transaction in the block

timestamp

datetime

UNIX timestamp for when the block was collated

decoder_name

string

The internal name of the decoder used to decode this trade (uniswap_v2_liquidity_event, curve_liquidity_event)

type

string

Either mint or burn

factory

string

The address of the DEX factory contract (if any)

contract

string

The address of the DEX pair/pool

provider

string

The address of the account that provided or withdraw the liquidity

raw_amounts

map(string, uint256)

A map of token amounts provided or withdrawn

amounts

map(string, float64)

A map of token amounts provided or withdrawn. The amount of tokens are divided by pow(10, decimals) where decimals is the number of decimals declared by the token (USDT has 6 decimals)

Usage

The query below makes use of the defi_liquidity_events_ethereum_mainnet_v1 to chart the daily delta of liquidity for each token of the famous Curve 3Pool (0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7).

select 
    date_trunc('day', timestamp) as date,
    sum(if(type = 'mint', amounts['0x6b175474e89094c44da98b954eedeac495271d0f'], -amounts['0x6b175474e89094c44da98b954eedeac495271d0f'])) as delta_dai,
    sum(if(type = 'mint', amounts['0xdac17f958d2ee523a2206206994597c13d831ec7'], -amounts['0xdac17f958d2ee523a2206206994597c13d831ec7'])) as delta_usdt,
    sum(if(type = 'mint', amounts['0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'], -amounts['0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'])) as delta_usdc
from defi_liquidity_events_ethereum_mainnet_v1
where contract = '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7'
and timestamp >= now() - interval 30 day 
group by date

PreviousTradesNextLiquidity Snapshots

Last updated 1 year ago