Created
September 6, 2018 22:46
-
-
Save asselstine/e6abd9c192228fab30f2e45b790f78f0 to your computer and use it in GitHub Desktop.
Some snippets showing the case challenging code for arbitration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract ChallengeManager is Ownable, Initializable { | |
using RegistryLookup for Registry; | |
Registry registry; | |
event ChallengeDoctorSet(address indexed _case, address indexed _patient, address indexed _challengingDoctor, bytes doctorEncryptedKey); | |
event ChallengingDoctorCleared(address indexed _case, address indexed _patient, address indexed _diagnosingDoctor); | |
event CaseChallenged(address indexed _case, address indexed _patient, address indexed _challengingDoctor); | |
event ChallengedCaseClosed(address indexed _case, address indexed _patient, address indexed _diagnosingDoctor, address _challengingDoctor); | |
event CaseDiagnosesDiffer(address indexed _case, address indexed _patient, address indexed _challengingDoctor); | |
event CaseDiagnosisConfirmed(address indexed _case, address indexed _patient, address indexed _challengingDoctor); | |
function challengeWithDoctor(address _caseAddress, address _doctor, bytes _doctorEncryptedKey) | |
external | |
onlyCaseLifecycleManager | |
{ | |
Case _case = Case(_caseAddress); | |
_case.setStatus(Case.CaseStatus.Challenging); | |
setChallengingDoctor(_case, _doctor, _doctorEncryptedKey); | |
registry.caseScheduleManager().touchUpdatedAt(_caseAddress); | |
emit CaseChallenged(_caseAddress, _case.patient(), _doctor); | |
} | |
function setChallengingDoctor(Case _case, address _doctor, bytes _doctorEncryptedKey) internal { | |
_case.setChallengingDoctor(_doctor); | |
_case.setDoctorEncryptedCaseKeys(_doctor, _doctorEncryptedKey); | |
registry.caseManager().addDoctorToDoctorCases(_doctor, _case); | |
registry.caseStatusManager().addOpenCase(_doctor, _case); | |
emit ChallengeDoctorSet(_case, _case.patient(), _doctor, _doctorEncryptedKey); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment