Created
October 15, 2018 09:34
-
-
Save alaahd/b4cdb956fb0546b4a4cf08a5c3e3f4a3 to your computer and use it in GitHub Desktop.
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
pragma solidity ^0.4.24; | |
contract registry{ | |
struct Certificate { | |
mapping(address => bool) attested; | |
mapping(address => string) ipfsRootHash; | |
} | |
mapping(string => Certificate) certificates; | |
function attest(string _hash, string _ipfsRootHash) public { | |
Certificate storage currentCertificate = certificates[_hash]; | |
currentCertificate.attested[msg.sender] = true; | |
currentCertificate.ipfsRootHash[msg.sender] = _ipfsRootHash; | |
} | |
function verify(string _hash) public view returns (bool) { | |
return certificates[_hash].attested[msg.sender]; | |
} | |
function getMetaData(string _hash) public view returns (string) { | |
require(certificates[_hash].attested[msg.sender]); | |
return certificates[_hash].ipfsRootHash[msg.sender]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment