DocumentationOpen App

Compressors

Compressor contracts are read-only data aggregation contracts. Instead of dozens of individual calls, a single compressor call returns complete protocol state. The SDK uses compressors internally.

Discovering Compressor Addresses

Use AddressProvider to find compressor addresses:

Solidity
address compressor = addressProvider.getLatestAddressByContractType( AP_MARKET_COMPRESSOR, VERSION_RANGE_310 );
TypeScript
const [compressor] = sdk.addressProvider.mustGetLatest( AP_MARKET_COMPRESSOR, VERSION_RANGE_310 );

MarketCompressor

Aggregates complete market state including pools, credit managers, and price oracles.

View Methods

getMarkets

Returns market data for all markets matching the filter.

Solidity
function getMarkets(MarketFilter memory filter) external view returns (MarketData[] memory);
ParameterTypeDescription
filterMarketFilterFilter criteria (see below)

Returns: Array of MarketData structs.


getMarketData

Returns complete data for a single market identified by its pool address.

Solidity
function getMarketData(address pool) external view returns (MarketData memory);
ParameterTypeDescription
pooladdressPool address identifying the market

getPoolState

Returns the pool state for a given pool.

Solidity
function getPoolState(address pool) external view returns (PoolState memory);
ParameterTypeDescription
pooladdressPool address

Data Structures

MarketFilter

Solidity
struct MarketFilter { address[] configurators; // Filter by Risk Curator addresses address[] pools; // Filter by specific pool addresses address underlying; // Filter by underlying token (e.g., USDC) }

Pass empty arrays and address(0) for no filtering.

MarketData

Solidity
struct MarketData { PoolState pool; QuotaKeeperState quotaKeeper; CreditSuiteData[] creditManagers; PriceOracleState priceOracle; TokenData[] tokens; }

PoolState (key fields)

FieldTypeDescription
baseParams.addraddressPool contract address
availableLiquidityuint256Borrowable liquidity
dieselRateuint256Share price (RAY)
supplyRateuint256Lender APY (RAY)
baseInterestRateuint256Borrower APR (RAY)
totalAssetsuint256Total pool value

CreditSuiteData (key fields)

FieldTypeDescription
creditManageraddressCredit Manager address
creditFacadeaddressCredit Facade address
creditConfiguratoraddressConfigurator address
debtLimitsDebtLimitsMin/max debt per account
collateralTokensCollateralToken[]Allowed tokens + LTs

CreditAccountCompressor

Fetches credit account data with filtering and pagination.

View Methods

getCreditAccountData

Returns complete data for a single credit account. The account's Credit Manager is resolved automatically.

Solidity
function getCreditAccountData(address creditAccount) external view returns (CreditAccountData memory);
ParameterTypeDescription
creditAccountaddressAccount to query

getCreditAccounts

Returns credit accounts matching the filter with pagination support.

Solidity
function getCreditAccounts( address creditManager, CreditAccountFilter memory caFilter, uint256 offset ) external view returns (CreditAccountData[] memory data, uint256 nextOffset); function getCreditAccounts( CreditManagerFilter memory cmFilter, CreditAccountFilter memory caFilter, uint256 offset ) external view returns (CreditAccountData[] memory data, uint256 nextOffset);
ParameterTypeDescription
creditManager / cmFilteraddress / CreditManagerFilterCredit Manager(s) to query
caFilterCreditAccountFilterFilter criteria (see below)
offsetuint256Pagination offset

Returns: Matching accounts and nextOffset. A non-zero nextOffset means the call stopped near the gas limit; call again starting from it. Overloads with a trailing uint256 limit parameter cap the number of accounts processed per call.


countCreditAccounts

Returns the count of credit accounts matching the filter.

Solidity
function countCreditAccounts( address creditManager, CreditAccountFilter memory caFilter ) external view returns (uint256);

Data Structures

CreditAccountFilter

Solidity
struct CreditAccountFilter { address owner; // Filter by owner (address(0) = any) bool includeZeroDebt; // Include accounts with no debt uint256 minHealthFactor; // Minimum HF (0 = no min) uint256 maxHealthFactor; // Maximum HF (type(uint256).max = no max) bool reverting; // Only accounts whose state computation reverts }

CreditManagerFilter

Solidity
struct CreditManagerFilter { address[] configurators; // Filter by market configurators address[] creditManagers; // Filter by specific Credit Managers address[] pools; // Filter by pools address underlying; // Filter by underlying token (address(0) = any) }

CreditAccountData (key fields)

FieldTypeDescription
creditAccountaddressCredit Account address
owneraddressAccount owner
creditManageraddressParent Credit Manager
creditFacadeaddressCredit Facade address
underlyingaddressUnderlying token
debtuint256Principal, in underlying
accruedInterestuint256Accrued interest, in underlying
accruedFeesuint256Accrued fees, in underlying
totalDebtUSDuint256Total debt, USD
totalValueUSDuint256Total account value, USD
twvUSDuint256Threshold-weighted value, USD
enabledTokensMaskuint256Bitmask of enabled tokens
healthFactoruint256Current HF (10000 = 1.0; below is liquidatable)
successboolFalse if account state could not be computed
tokensTokenInfo[]Token balances and quotas

PriceFeedCompressor

Aggregates price feed state for oracle monitoring and updates.

View Methods

getUpdatablePriceFeeds

Returns all price feeds that may need updating for a given price oracle.

Solidity
function getUpdatablePriceFeeds(address priceOracle) external view returns (PriceFeedData[] memory);
ParameterTypeDescription
priceOracleaddressPriceOracle contract to query

Returns: Array of price feed data including staleness information.


loadPriceFeedTree

Returns the full price feed dependency tree for a specific token.

Solidity
function loadPriceFeedTree(address priceOracle, address token) external view returns (PriceFeedTreeNode memory);
ParameterTypeDescription
priceOracleaddressPriceOracle contract
tokenaddressToken to query

When to Use Compressors vs SDK

ScenarioApproach
General market dataSDK marketRegister
Credit account queriesSDK services
One-off account lookupDirect compressor call
Custom filtering logicDirect compressor calls
Liquidation botsDirect compressor (one call, many accounts)
Real-time monitoringDirect compressor with specific filters

Compressors are view contracts designed for off-chain eth_call reads. They are not gas-optimized, so avoid calling them from on-chain contracts.