0
votes

I'm new to Solidity.I've got an error from compiling the above code.

browser/EHRs.sol:18:9 :Error:Undeclared identifier.require(msg.sender = dotor);

Hopefully someone can give some guidance

pragma solidity ^0.4.0;

contract postRecord {

bytes32 public patientRecords;

address public doctor;

function Person() private{

    doctor = msg.sender;

}

struct patient {

    address client;

    bool consent;

    bytes32 name;

}

function setPatientRecords(bytes32 _patientRecords) public {

    patientRecords = _patientRecords;

}

event Post(bytes32 patientRecords, address doctor);

modifier rightPerson {

    require (msg.sender = doctor);

    _;

}

function getRecords()public payable{

    Post(patientRecords, doctor);

}}   
2

2 Answers

0
votes

Have a look at this solution

modifier rightPerson {

require (doctor == msg.sender);

_;

}

0
votes

Firstly use == to compare values, and secondly pass exception message as second parameter in require (you can pass empty string)

modifier rightPerson {

    require (msg.sender == doctor, "");

    _;
}

require()