contract DaoOracleId is IOracleId, Ownable {
  event Provided(uint256 indexed timestamp, uint256 result);

  // Opium
  IOracleAggregator public oracleAggregator;

  constructor(IOracleAggregator _oracleAggregator) public {
    oracleAggregator = _oracleAggregator;

    /*
    {
      "author": "Opium.Team",
      "description": "Opium DAO Oracle",
      "asset": "any",
      "type": "dao",
      "source": "opiumteam",
      "logic": "none",
      "path": "none"
    }
    */
    emit MetadataSet("{\"author\":\"Opium.Team\",\"description\":\"Opium DAO Oracle\",\"asset\":\"any\",\"type\":\"dao\",\"source\":\"opiumteam\",\"logic\":\"none\",\"path\":\"none\"}");
  }

  /** OPIUM */
  function fetchData(uint256 _timestamp) external payable {
    _timestamp;
    revert("N.S"); // N.S = not supported
  }

  function recursivelyFetchData(uint256 _timestamp, uint256 _period, uint256 _times) external payable {
    _timestamp;
    _period;
    _times;
    revert("N.S"); // N.S = not supported
  }

  function calculateFetchPrice() external returns (uint256) {
    return 0;
  }
  
  function _callback(uint256 _timestamp, uint256 _result) public onlyOwner {
    require(
      !oracleAggregator.hasData(address(this), _timestamp) &&
      _timestamp < now,
      "N.A" // N.A = Only when no data and after timestamp allowed
    );

    oracleAggregator.__callback(_timestamp, _result);

    emit Provided(_timestamp, _result);
  }
}
function fetchData(uint256 _timestamp) external payable {
  _timestamp;
  revert("N.S"); // N.S = not supported
}

/** OPIUM */