Degen Code

Degen Code

Aave — Part VIII

Price Oracles

Apr 03, 2026
∙ Paid

We now have access to the complete set of Aave user positions, so we can analyze them and begin hunting.

To properly evaluate the health of a particular user, we need to know all of their collateral and debt positions. In Part V, we did this by hand using mentally mapped asset prices.

Aave — Part V

Aave — Part V

BowTiedDevil
·
December 18, 2025
Read full story

Now we want to replace that process (with its assumptions and simplifications) with one that scales across all of Aave’s assets. To do this, we need to look closely at how asset prices are determined so that we can track them in the same way.

Price Oracles

I’ve discussed price oracles before in a limited way, focusing on the price of a single asset.

Chainlink Price Feeds, Calculating Trade EV, Automatically Scaling Gas Fees

Chainlink Price Feeds, Calculating Trade EV, Automatically Scaling Gas Fees

BowTiedDevil
·
January 17, 2022
Read full story

Aave uses an oracle contract that acts as a bridge between its internal operations and the external market. The current oracle is available at the PoolAddressProvider contract via the getPriceOracle function. The oracle was set shortly after the mainnet market deployment and has not changed since, but that is not a guarantee that it will remain that way. It can be changed at any time by governance.

Asset Sources

The oracle maintains a single source for each of the registered assets. Whenever this source is updated, the oracle emits an AssetSourceUpdated event. The Aave updater in degenbot tracks these events and uses them to update the database.

Asset Prices

The oracle’s price discovery mechanism is the getAssetPrice function, which retrieves the source for a given asset, then calls source.latestAnswer():

/// @inheritdoc IPriceOracleGetter
function getAssetPrice(address asset) public view override returns (uint256) {
  AggregatorInterface source = assetsSources[asset];

  if (asset == BASE_CURRENCY) {
    return BASE_CURRENCY_UNIT;
  } else if (address(source) == address(0)) {
    return _fallbackOracle.getAssetPrice(asset);
  } else {
    int256 price = source.latestAnswer();
    if (price > 0) {
      return uint256(price);
    } else {
      return _fallbackOracle.getAssetPrice(asset);
    }
  }
}

latestAnswer() should be familiar if you’ve looked at a Chainlink contract. Note that the oracle does not have to be a Chainlink contract, but most of them are. The only requirement of the oracle is that is provides the latestAnswer interface.

So all we need is the source for each asset, and a way to observe the price when it changes.

Let’s consider Aave’s Ether/WETH asset. The oracle tells us that the price source is contract 0x5424384B256154046E9667dDFaaa5e550145215e:

And that the asset’s current price is 205429135979 ($2,054):

We can also inspect latestAnswer() directly at the source contract:

The values match, which we expected.

Chainlink SVR

It’s not obvious from reading the contract source, but this is a special kind of feed contract labeled as a Chainlink Smart Value Recapture (SVR) feed also specific to the Aave protocol.

User's avatar

Continue reading this post for free, courtesy of BowTiedDevil.

Or purchase a paid subscription.
© 2026 BowTiedDevil · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture