Skip to main content
Dune’s lending tables provide standardized data on DeFi lending protocol activity — supply (deposit/withdraw), borrow (borrow/repay/liquidation), and flash loans — across 15+ EVM chains. All major lending protocols are aggregated into a single schema.
Maintained by: Dune · Refresh: ~20 min · Chains: 15 EVM chains

Get This Data

Access lending data via API, Datashare, or the Dune App.

Available Tables

When to Use These Tables

  • Track supply and borrow volumes across DeFi lending protocols
  • Analyze liquidation events and at-risk positions
  • Monitor flash loan activity and fees
  • Compare lending protocol market share across chains
  • Build lending analytics dashboards for protocol teams or investors

Coverage

Chains (15): Arbitrum, Avalanche C-Chain, Base, BNB Chain, Celo, Ethereum, Fantom, Gnosis, Linea, Optimism, Polygon, Scroll, Sonic, zkSync, Unichain Protocols: Aggregated from all integrated lending protocols including Aave, Compound, and others. Use SELECT DISTINCT project FROM lending.supply for the current list.

Query Performance

Partition keys:
  • lending.supply: blockchain, project, block_month
  • lending.borrow: blockchain, project, block_month
  • lending.flashloans: blockchain, project
Always include blockchain and block_month (or a block_time range) in your WHERE clause.
-- ✅ Good: filters on partition keys
SELECT * FROM lending.supply
WHERE blockchain = 'ethereum'
  AND block_month >= DATE '2025-01-01'
  AND project = 'aave'

-- ❌ Slow: no partition filters
SELECT * FROM lending.supply
WHERE symbol = 'USDC'

Methodology

Lending tables are maintained by Dune (source code). They aggregate data from protocol-specific base models (lending_base_supply, lending_base_borrow, lending_base_flashloans), which decode on-chain events from each protocol’s smart contracts. Token amounts are decimal-adjusted and joined with Dune’s price feeds (prices.minute, prices.hour, prices.day) for USD values.

Example Queries

Daily supply volume by protocol on Ethereum:
SELECT
  date_trunc('day', block_time) AS day,
  project,
  SUM(amount_usd) AS supply_volume_usd
FROM lending.supply
WHERE blockchain = 'ethereum'
  AND block_month >= DATE '2025-01-01'
  AND transaction_type = 'deposit'
GROUP BY 1, 2
ORDER BY 1 DESC, 3 DESC
Top borrowers by total USD borrowed (last 30 days):
SELECT
  borrower,
  SUM(amount_usd) AS total_borrowed_usd,
  COUNT(*) AS num_borrows
FROM lending.borrow
WHERE blockchain = 'ethereum'
  AND block_time >= NOW() - INTERVAL '30' DAY
  AND transaction_type = 'borrow'
GROUP BY 1
ORDER BY 2 DESC
LIMIT 20
Flash loan volume by chain:
SELECT
  blockchain,
  project,
  SUM(amount_usd) AS flashloan_volume_usd,
  COUNT(*) AS num_flashloans
FROM lending.flashloans
WHERE block_time >= NOW() - INTERVAL '7' DAY
GROUP BY 1, 2
ORDER BY 3 DESC
  • dex.flashloans — Flash loans from DEX protocols (Balancer, Uniswap, dYdX) as opposed to lending-native flash loans
  • prices.day / prices.hour / prices.minute — Token price feeds
  • tokens.erc20 — Token metadata (symbols, decimals)