aave / protocol-subgraphs

The code of Aave protocol subgraphs
GNU Affero General Public License v3.0
122 stars 102 forks source link

Mainnet: ENS Oracle never registered - Price is zero and priceSource is 0x0 #79

Open vicnaum opened 2 years ago

vicnaum commented 2 years ago

Describe the bug ENS price is always zero, doesn't have price history, and ENS PriceSource was never registered - it's still 0x0.

Details & History: ENS Token was added to Aave in March 2022 with Proposal 63: https://staging.aave.com/governance/proposal/63/ And the ENS Oracle was set at block 14338029 at 07 Mar 2022: https://etherscan.io/tx/0x47c2b4fc4c0226373a0ad1a86249f4668519447bac3504ec1cb928a9c221d35a

The corresponding AssetSourceUpdated event was emitted successfully.

But the Oracle used isn't the standard ChainLink Proxy, but a custom smart contract called EnsUsdToEnsEth that calculates ENS/ETH price from ENS_USD and USD_ETH (using two ChainLink sources): https://etherscan.io/address/0xd4641b75015E6536E8102D98479568D05D7123Db#code

It has latestAnswer() method, but doesn't has other methods

Supposedly, this bug happens, because ENS Oracle isn't standard ChainLink proxy and doesn't have aggregator, thus doesn't pass the "try_aggregator()" call at: https://github.com/aave/protocol-subgraphs/blob/8cc0989ffed6817176c8190c2df5eade3e732199/src/mapping/proxy-price-provider/ethereum.ts#L82

So presumably it fails there and never gets further.

To Reproduce This query can be used in TheGraph Playground:

{
  priceOracleAsset (id: "0xc18360217d8f7ab5e7c516566761ea12ce7f9d72") {
    id
    priceSource
    priceInEth
  }
}

Expected behavior Some workaround or exception should be made for handling the ENS oracle - it should be registered as a PriceSource and provide price updates.

defispartan commented 2 years ago

Thanks for the detailed report, we'll look into this