mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
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 b54c6f8a24
.
This commit is contained in:
parent
50f60a3666
commit
0b109da9c6
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user