Contract Discovery

Find any Gearbox contract address programmatically. Never hardcode addresses.

For SDK setup and discovery, see SDK Setup.

AddressProviderV3

The only address you need to hardcode. All other contracts are discoverable from here.

Basic Usage

import {IAddressProviderV3} from "@gearbox-protocol/core-v3/contracts/interfaces/IAddressProviderV3.sol";

IAddressProviderV3 ap = IAddressProviderV3(ADDRESS_PROVIDER);

// Get ContractsRegister (version 3.00)
address contractsRegister = ap.getAddressOrRevert("CONTRACTS_REGISTER", 3_00);

// Get Price Oracle (version 3.10)
address priceOracle = ap.getAddressOrRevert("PRICE_ORACLE", 3_10);

// Get WETH (no version control)
address weth = ap.getAddressOrRevert("WETH_TOKEN", 0);

Standard Keys

Key
Purpose

CONTRACTS_REGISTER

Registry of pools and credit managers

PRICE_ORACLE

Main price oracle router

PRICE_FEED_STORE

On-demand price feed storage

ACCOUNT_FACTORY

Credit account factory

BOT_LIST

Bot permissions registry

TREASURY

Protocol treasury

WETH_TOKEN

Wrapped ETH address

ACL

Access control list

Version Control

Pass version as the second parameter to getAddressOrRevert():

  • 3_00 - V3.0 contracts

  • 3_10 - V3.1 contracts

  • 0 - No version control (for static addresses like WETH)

ContractsRegister

Enumerates all pools and credit managers in the system.

Get All Pools

Get All Credit Managers

Filter by Version

Check contract version to filter V3+ contracts:

From Pool to Credit Suite

Navigate the relationship tree from a pool to its credit infrastructure.

Get Pool's Quota Keeper

Get Credit Manager's Facade

Complete Discovery Example

Find all USDC lending pools and their credit managers:

MarketCompressor Discovery

For aggregated market data, use MarketCompressor:

Next Steps

For architectural background, see Credit Suite Architecture.

Last updated