Skip to content

Instantly share code, notes, and snippets.

@asselstine
Last active September 12, 2018 17:13
Show Gist options
  • Save asselstine/6f0474e1fe0dda0539f5119022c10657 to your computer and use it in GitHub Desktop.
Save asselstine/6f0474e1fe0dda0539f5119022c10657 to your computer and use it in GitHub Desktop.
An example of a contract that uses the DoctorRegistry
import 'medcredits-solidity/DoctorRegistry.sol';
contract CaseFactory {
uint8 constant DERMATOLOGY_CODE = 0x00001a83;
Case[] cases;
mapping (uint256 => address) public caseIndices;
DoctorRegistry doctorRegistry;
function CaseFactory(DoctorRegistry _doctorRegistry) {
doctorRegistry = _doctorRegistry;
}
modifier isQualified(address _doctor) {
return doctorRegistry.isQualified(_doctor, DERMATOLOGY_CODE, 'doctor is not qualified');
_;
}
function createCase(address _patient, address _doctor) external isQualified(_doctor) returns (Case) {
Case case = new Case(_patient, _doctor);
uint256 index = cases.length;
cases.push(case);
caseIndices[index] = case;
return case;
}
}
@chuckbergeron
Copy link

Needs returns(Case)
function createCase(address _doctor) external isQualified(_doctor) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment