From 0b109da9c6c81306d6a6033576b6d8746bf97111 Mon Sep 17 00:00:00 2001 From: David Racero Date: Thu, 27 May 2021 11:40:28 +0200 Subject: [PATCH] Revert "feat: Remove WETH mention from AaveOracle. Add QUOTE_CURRENCY and QUOTE_CURRENCY_UNIT to determine the quote currency of the price sources" This reverts commit b54c6f8a2459f0a16b0c5844fe0c58d7eb347f88. --- contracts/misc/AaveOracle.sol | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/contracts/misc/AaveOracle.sol b/contracts/misc/AaveOracle.sol index 11a2e332..0cb8e180 100644 --- a/contracts/misc/AaveOracle.sol +++ b/contracts/misc/AaveOracle.sol @@ -18,14 +18,13 @@ import {SafeERC20} from '../dependencies/openzeppelin/contracts/SafeERC20.sol'; contract AaveOracle is IPriceOracleGetter, Ownable { using SafeERC20 for IERC20; - event QuoteCurrencySet(address indexed quoteCurrency, uint256 quoteUnit); + event WethSet(address indexed weth); event AssetSourceUpdated(address indexed asset, address indexed source); event FallbackOracleUpdated(address indexed fallbackOracle); mapping(address => IChainlinkAggregator) private assetsSources; IPriceOracleGetter private _fallbackOracle; - address public immutable QUOTE_CURRENCY; - uint256 public immutable QUOTE_CURRENCY_UNIT; + address public immutable WETH; /// @notice Constructor /// @param assets The addresses of the assets @@ -36,14 +35,12 @@ contract AaveOracle is IPriceOracleGetter, Ownable { address[] memory assets, address[] memory sources, address fallbackOracle, - address quoteCurrency, - uint256 quoteCurrencyUnits + address weth ) public { _setFallbackOracle(fallbackOracle); _setAssetsSources(assets, sources); - QUOTE_CURRENCY = quoteCurrency; - QUOTE_CURRENCY_UNIT = quoteCurrencyUnits; - emit QuoteCurrencySet(quoteCurrency, quoteCurrencyUnits); + WETH = weth; + emit WethSet(weth); } /// @notice External function called by the Aave governance to set or replace sources of assets @@ -86,8 +83,8 @@ contract AaveOracle is IPriceOracleGetter, Ownable { function getAssetPrice(address asset) public view override returns (uint256) { IChainlinkAggregator source = assetsSources[asset]; - if (asset == QUOTE_CURRENCY) { - return QUOTE_CURRENCY_UNIT; + if (asset == WETH) { + return 1 ether; } else if (address(source) == address(0)) { return _fallbackOracle.getAssetPrice(asset); } else {