/// price-feed.sol - ds-value like that also pokes a medianizer // Copyright (C) 2017, 2018 DappHub, LLC // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see . pragma solidity 0.5.7; import "./thing.sol"; interface Medianizer { function poke() external; } contract PriceFeed is DSThing { uint128 val; uint32 public zzz; function peek() external view returns (bytes32,bool) { return (bytes32(uint256(val)), now < zzz); } function read() external view returns (bytes32) { require(now < zzz); return bytes32(uint256(val)); } function poke(uint128 val_, uint32 zzz_) external note auth { val = val_; zzz = zzz_; } function post(uint128 val_, uint32 zzz_, Medianizer med_) external note auth { val = val_; zzz = zzz_; med_.poke(); } function void() external note auth { zzz = 0; } }