aave-protocol-v2/contracts/mocks/oracle/PriceOracle.sol

31 lines
882 B
Solidity
Raw Normal View History

// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.6.8;
2020-08-20 10:44:51 +00:00
import {IPriceOracle} from '../../interfaces/IPriceOracle.sol';
contract PriceOracle is IPriceOracle {
2020-07-13 08:54:08 +00:00
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);
}
}