I am trying to compile the following contract on Remix IDE.
pragma solidity ^0.5.1;
contract ProofofExistence{
event ProofCreated(
uint256 indexed id,
bytes32 documentHash);//an event can be listened by any client
address public owner;//getters are already generated for public variables
mapping (uint => bytes32) hashesById;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier noHashExistsYet(uint256 id) {
require(hashesById[id] == "");
_;
}//The modifeir can be prepended to any function
constructor() public {//constructor is executed when the contract s created
owner = msg.sender;
}
function notarizeHash(uint256 id, bytes32 documentHash) onlyOwner noHashExistsYet(id) public{
hashesById[id] = documentHash;
emit ProofCreated(id, documentHash);//Proof created event is emited to the block chain
}//The core function of this contract allows its owner
//to confirm a document id with a certain content
function doesProofExist(uint256 id, bytes32 documentHash) public view returns (bool) {
return hashesById[id] == documentHash;
}//view/constant functions are read-only and do not cost gas
}
I am getting following warning message:
Use assert(x) if you never ever want x to be false, not in any circumstance (apart from a bug in your code). Use require(x) if x can be false, due to e.g. invalid input or a failing external component.
Can somebody please guide me how to get rid of the above warning message?
Zulfi.