Skip to content

Conversation

@grkhr
Copy link

@grkhr grkhr commented Oct 19, 2025

Fix: Support Direct Chainlink Aggregators Without Proxy Wrapper

Problem

Multiple assets have priceInEth: "0" in the subgraph despite having valid on-chain oracle prices. This affects:

  • All PT tokens (PT-sUSDE, PT-USDe, etc.)
  • Major assets: WBTC, GHO, USDe, sUSDe, wstETH, cbETH, weETH, rETH, etc.

Root cause: Code assumes all price feeds use EACAggregatorProxy pattern (proxy → aggregator), but some assets use direct aggregator addresses without a proxy wrapper. When aggregator() call reverts, the handler exits early without saving priceSource.

Location: src/mapping/proxy-price-provider/v3.ts:148-160

Current Behavior

if (priceOracleAsset.type == PRICE_ORACLE_ASSET_TYPE_SIMPLE) {
  let chainlinkProxyInstance = EACAggregatorProxy.bind(assetOracleAddress);
  let aggregatorAddressCall = chainlinkProxyInstance.try_aggregator();

  if (aggregatorAddressCall.reverted) {
    log.error(...);
    return;  // ❌ Exits without saving priceSource
  }

  let aggregatorAddress = aggregatorAddressCall.value;
  priceOracleAsset.priceSource = aggregatorAddress;
}

Fix

Handle both patterns - proxy and direct aggregator:

if (priceOracleAsset.type == PRICE_ORACLE_ASSET_TYPE_SIMPLE) {
  let aggregatorAddress = assetOracleAddress;  // Default to direct address

  let chainlinkProxyInstance = EACAggregatorProxy.bind(assetOracleAddress);
  let aggregatorAddressCall = chainlinkProxyInstance.try_aggregator();

  // If it's a proxy, use underlying aggregator. Otherwise use direct address.
  if (!aggregatorAddressCall.reverted) {
    aggregatorAddress = aggregatorAddressCall.value;
  }

  priceOracleAsset.priceSource = aggregatorAddress;
  ChainlinkAggregatorContract.create(aggregatorAddress);
}

Evidence

On-chain data exists (Dune query):

SELECT asset, source FROM aave_v3_ethereum.AaveOracle_evt_AssetSourceUpdated
WHERE asset = 0x6c9f097e044506712b58EaC670c9a5fd4BCceF13  -- PT-sUSDE
-- Result: Events emitted at block 23290548

Subgraph shows missing prices:

{ reserves { symbol price { priceInEth } } }
{ "symbol": "PT-sUSDE-27MAR2025", "price": { "priceInEth": "0" } },
{ "symbol": "WBTC", "price": { "priceInEth": "0" } },
{ "symbol": "wstETH", "price": { "priceInEth": "0" } }
// ... 20+ more assets with priceInEth: "0"

Impact

  • ✅ Backwards compatible with proxy-based feeds
  • ✅ Adds support for direct aggregator pattern

Files Changed: src/mapping/proxy-price-provider/v3.ts (lines 148-165)

@grkhr grkhr marked this pull request as ready for review October 19, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant