function claimCredential(address _vaccineAddress, uint8 _vaccineType, string calldata _value) public returns(bool){
require(Credential storage credential = credentials[_vaccineAddress]);
require(credentials[_vaccineAddress].id == 0);
credential.id = idCount;
credential.issuer = msg.sender;
credential.vaccineType = _vaccineType;
credential.value = _value;
credential.createDate = block.timestamp;
credential.status = true;
idCount+=1;
return true;
}
claimCredential 함수를 통해 발급자(issuer)는 접종자에게 백신 증명서를 발급할 수 있다.
👉 백신 접종 여부를 확인해야한다.
function isCredential(address _vaccineAddress) public view returns (bool){
if(credentials[_vaccineAddress].status === true) return true;
else return false;
}
백신 접종이 완료된 상태이면 true를 리턴해준다.
👉 백신의 종류를 알 수 있어야 한다.
function VaccineType(uint8 _type, string calldata _value) onlyIssuer public returns (bool) {
require(bytes(vaccineEnum[_type]).length == 0);
vaccineEnum[_type] = _value;
return true;
}
Share article