contract BASEDOracle is Ownable, ExampleOracleSimple, IOracle {

    uint256 constant SCALE = 10 ** 18;
    address based;
    address constant uniFactory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;

    constructor(address based_, address susd_) public ExampleOracleSimple(uniFactory, based_, susd_) {
        PERIOD = 23 hours; // ensure that rebase can always call update
        based = based_;
    }

    // this must be called 24h before first rebase to get proper price
    function updateBeforeRebase() public onlyOwner {
        update();
    }

    function getData() override external returns (uint256, bool) {
        require(msg.sender == UFragmentsI(based).monetaryPolicy());
        update();
        uint256 price = consult(based, SCALE); // will return 1 BASED in sUSD

        if (price == 0) {
            return (0, false);
        }

        return (price, true);
    }
}
function updateBeforeRebase() public onlyOwner {
    update();
}

// this must be called 24h before first rebase to get proper price