Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions contracts/misc/UiPoolDataProviderV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 {
IEACAggregatorProxy public immutable marketReferenceCurrencyPriceInUsdProxyAggregator;
uint256 public constant ETH_CURRENCY_UNIT = 1 ether;
address public constant MKR_ADDRESS = 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2;
uint256 private constant MAX_REASONABLE_PRICE = 1e15;

constructor(
IEACAggregatorProxy _networkBaseTokenPriceInUsdProxyAggregator,
Expand Down Expand Up @@ -81,6 +82,17 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 {
reserveData.underlyingAsset
);
reserveData.priceOracle = oracle.getSourceOfAsset(reserveData.underlyingAsset);

// Validate oracle address
if (reserveData.priceOracle == address(0)) {
// Use fallback pricing or mark as invalid
reserveData.priceInMarketReferenceCurrency = 0;
}

// Validate price bounds (prevent extreme values like 1.539e+35)
if (reserveData.priceInMarketReferenceCurrency > MAX_REASONABLE_PRICE) {
reserveData.priceInMarketReferenceCurrency = 0; // Mark as invalid
}
reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf(
reserveData.aTokenAddress
);
Expand Down