📈Subgraph Queries
🌐 Subgraph Endpoint
📊 Entity Schema
Loan Entity
type Loan @entity {
id: ID!
lender: Bytes!
borrower: Bytes
tokenAddress: Bytes!
amount: BigInt!
interestRate: BigInt!
duration: BigInt!
collateralAddress: Bytes!
collateralAmount: BigInt!
minCollateralRatioBPS: BigInt!
liquidationThresholdBPS: BigInt!
maxPriceStaleness: BigInt!
status: LoanStatus!
startTime: BigInt
repaidAmount: BigInt!
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}User Entity
ProtocolStats Entity
🔍 Common Queries
Get All Active Loans
Get Pending Loan Offers
Get User's Loans
Get Loan Details
Get Protocol Statistics
Get User Statistics
Get Loans by Token
Get Recent Liquidations
Get Loans with Filters
📊 Advanced Queries
Get Loan History with Events
Get Top Lenders
Get Market Overview
🛠️ JavaScript Integration
Using Apollo Client
Using Fetch API
React Hook Example
📋 Query Parameters
Filtering
Sorting
Pagination
Example with All Parameters
🔄 Real-time Updates
Subscriptions (if supported)
Polling Strategy
🎯 Best Practices
Performance Optimization
Error Handling
Caching Strategy
Last updated
