Skip to content

Commit f004ac0

Browse files
committed
fix: handle direct aggregators in price oracle indexing
1 parent 223ad66 commit f004ac0

File tree

1 file changed

+8
-9
lines changed
  • src/mapping/proxy-price-provider

1 file changed

+8
-9
lines changed

src/mapping/proxy-price-provider/v3.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,18 @@ export function priceFeedUpdated(
143143

144144
// Type simple means that the source is chainlink source
145145
if (priceOracleAsset.type == PRICE_ORACLE_ASSET_TYPE_SIMPLE) {
146+
let aggregatorAddress = assetOracleAddress;
147+
146148
// get underlying aggregator from proxy (assetOracleAddress) address
147149
let chainlinkProxyInstance = EACAggregatorProxy.bind(assetOracleAddress);
148150
let aggregatorAddressCall = chainlinkProxyInstance.try_aggregator();
149-
// If we can't get the aggregator, it means that the source address is not a chainlink proxy
150-
// so it has been registered badly.
151-
if (aggregatorAddressCall.reverted) {
152-
log.error(
153-
`PROXY: Simple Type must be a chainlink proxy. || asset: {} | assetOracleAddress: {}`,
154-
[sAssetAddress, assetOracleAddress.toHexString()]
155-
);
156-
return;
151+
152+
// If aggregator() call succeeds, it's a proxy - use the underlying aggregator
153+
// If it fails, the source address itself is the direct aggregator (e.g., PT tokens)
154+
if (!aggregatorAddressCall.reverted) {
155+
aggregatorAddress = aggregatorAddressCall.value;
157156
}
158-
let aggregatorAddress = aggregatorAddressCall.value;
157+
159158
priceOracleAsset.priceSource = aggregatorAddress;
160159
// create ChainLink aggregator template entity
161160
ChainlinkAggregatorContract.create(aggregatorAddress);

0 commit comments

Comments
 (0)