Total Value Locked (TVL) - Current Liquidity

Returns balance updates on Ethereum, where balance update address is 0x6a9c…3cb8 and currency smart contract is 0x582d…def1, sorted by balance, highest first: currency name, smart contract, currency symbol, sum of balance update amount and balance update address.

By chantha · saved 18 July 2025 · run 2 times · Bitquery API v2

What it returns

Filters

The query

query GetTVL($contract_address: String, $pool_address: String) {
  EVM(dataset: combined, network: eth) {
    # Current liquidity in the pool
    Current_liquidity: BalanceUpdates(
      where: {BalanceUpdate: {Address: {is: $pool_address}}}
      orderBy: {descendingByField: "balance"}
    ) {
      Currency {
        Name
        SmartContract
        Symbol
      }
      balance: sum(of: BalanceUpdate_Amount, selectWhere: {gt: "0"})
      BalanceUpdate {
        Address
      }
    }
    
    # Token specific liquidity
    Token_liquidity: BalanceUpdates(
      where: {
        Currency: {SmartContract: {is: $contract_address}}
        BalanceUpdate: {Address: {is: $pool_address}}
      }
    ) {
      balance: sum(of: BalanceUpdate_Amount)
      Currency {
        Name
        Symbol
      }
    }
  }
}

Variables

{
  "contract_address": "0x582d872a1b094fc48f5de31d3b73f2d9be47def1",
  "pool_address": "0x6a9c4fc2b35ee398e7a0e75d982872466ba93cb8",
  "start_date": "2024-01-01T00:00:00Z",
  "end_date": "2024-12-31T23:59:59Z"
}

Similar queries