How can I change the last line in the following code to make it work?
contract University {
address public owner;
address public student;
bytes32 fName;
bytes32 lName;
bytes32 Studies;
bytes32 private caCertificate;
bytes32 ipfs_hash;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() { if (msg.sender == owner) _; }
modifier onlyOwnerOrStudent() {
if (msg.sender == owner || msg.sender == student) _;
.....
}
I get the error message:
Operator == not compatible with types address and bytes32
Best Answer
you are comparing data types of
address
andbytes32
for equality. Since they are two data types operator is not allowed. you need make eitherstudent
tobytes32
orfName
toaddress
depending on your use-case.