Use Cases

The SDK guide shows you how to use individual methods. This section shows you how to combine them to build real applications.

Choose Your Path

If you're building...
Start here
You'll learn

Web dashboard, portfolio UI

Data fetching patterns, display mapping, real-time updates

Indexer, analytics, data pipeline

Historical snapshots, event indexing, state tracking

Liquidation bot

Account monitoring, health factor filtering, execution patterns

Quick Decision Guide

Need to display data to users in real-time? Start with Frontend Applications. You'll use marketRegister for cached data and compressors for fresh queries.

Need to collect and analyze historical data? Start with Backend Services. You'll index events and snapshot state at specific blocks.

Need to monitor accounts and execute on-chain actions? Start with Liquidation Bots. You'll filter accounts by health factor and use the Router for execution.

Prerequisites

Before diving into use-case guides, complete:

  1. Setup - Install the SDK and initialize GearboxSDK

  2. Reading Data - Understand marketRegister and basic queries

Common Foundation: Compressors

All use cases rely on compressors for efficient data fetching. Compressors aggregate on-chain data into single calls, reducing RPC overhead.

Compressor
Use Case

MarketCompressor

Pool state, credit manager config, token data

CreditAccountCompressor

Account queries with filtering and pagination

PriceFeedCompressor

Oracle status and update requirements

See Compressors Reference for the complete API.

The multicalls/ directory documents individual operations (add collateral, manage debt, etc.). The use-cases/ directory shows how to combine those operations with data fetching to build complete applications.

Last updated