BakerDAO Subgraph

The BakerDAO subgraph indexes all activity relating to BREAD. It tracks loans, collateral, liquidations, and user incentive weights. If you need to query loan data, calculate user rewards, or analyze protocol metrics, this is your go-to data source.

https://api.goldsky.com/api/public/project_clpx84oel0al201r78jsl0r3i/subgraphs/bakerdao-subgraph/1.0.9/gn

Key Concepts

User Weights & Incentives

The protocol calculates user weights based on a simple formula: your borrowed amount multiplied by the square root of days remaining on your loan. This rewards longer-term positions more heavily than short-term ones.

userWeight = borrowedTimesSqrtDays / totalBorrowedTimesSqrtDays

Only loans created after block 5623025 are eligible for incentives.

Snapshot System

The subgraph creates automatic snapshots to preserve historical data:

  • User snapshots: Created every hour for all active users

  • Global snapshots: Created every 4 hours for protocol-wide metrics

  • Real-time data: Query main entities directly for current state

These snapshots are essential for reward calculations and historical analysis.

Core Entities

User

Tracks individual user data and loan history.

Loan

Individual loan positions with time-based calculations.

UserLoanSnapshot

Hourly snapshots of user loan data for historical analysis.

GlobalStats

Protocol-wide statistics (single entity with ID "global_v2").

ActiveUser

Tracks which users currently have active loans.

Common Queries

Get Current User Weights and Positions

Get Protocol Statistics

Get Active Loans

Historical User Weight Analysis

Last updated