mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
31 lines
882 B
Solidity
31 lines
882 B
Solidity
// SPDX-License-Identifier: agpl-3.0
|
|
pragma solidity 0.6.12;
|
|
|
|
import {IPriceOracle} from '../../interfaces/IPriceOracle.sol';
|
|
|
|
contract PriceOracle is IPriceOracle {
|
|
mapping(address => uint256) prices;
|
|
uint256 ethPriceUsd;
|
|
|
|
event AssetPriceUpdated(address _asset, uint256 _price, uint256 timestamp);
|
|
event EthPriceUpdated(uint256 _price, uint256 timestamp);
|
|
|
|
function getAssetPrice(address _asset) external override view returns (uint256) {
|
|
return prices[_asset];
|
|
}
|
|
|
|
function setAssetPrice(address _asset, uint256 _price) external override {
|
|
prices[_asset] = _price;
|
|
emit AssetPriceUpdated(_asset, _price, block.timestamp);
|
|
}
|
|
|
|
function getEthUsdPrice() external view returns (uint256) {
|
|
return ethPriceUsd;
|
|
}
|
|
|
|
function setEthUsdPrice(uint256 _price) external {
|
|
ethPriceUsd = _price;
|
|
emit EthPriceUpdated(_price, block.timestamp);
|
|
}
|
|
}
|