contract ChainlinkOracle is Oracle {
    using SafeMath for uint;

    uint private constant SCALE_FACTOR = 10 ** 10;  // Since Chainlink has 8 dec places, and latestPrice() needs 18

    AggregatorV3Interface private aggregator;

    constructor(AggregatorV3Interface aggregator_) public
    {
        aggregator = aggregator_;
    }

    /**
     * @notice Retrieve the latest price of the price oracle.
     * @return price
     */
    function latestPrice() public virtual override view returns (uint price) {
        price = latestChainlinkPrice();
    }

    function latestChainlinkPrice() public view returns (uint price) {
        (, int rawPrice,,,) = aggregator.latestRoundData();
        price = uint(rawPrice).mul(SCALE_FACTOR); // TODO: Cast safely
    }
}
/**
 * @title ChainlinkOracle
 */
function latestPrice() public virtual override view returns (uint price) {
    price = latestChainlinkPrice();
}

/**
 * @notice Retrieve the latest price of the price oracle.
 * @return price
 */