Guest User

Untitled

a guest
Oct 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. pragma solidity ^0.4.24;
  2. import "github.com/Arachnid/solidity-stringutils/strings.sol";
  3.  
  4. contract registry {
  5. using strings for *;
  6. struct Certificate {
  7. //mapping(address => bool) attested;
  8. mapping(address => string) ipfsRootHash;
  9. }
  10.  
  11. mapping(string => Certificate) certificates;
  12.  
  13. function attest(string _hash, string _ipfsRootHash) public {
  14. Certificate storage currentCertificate = certificates[_hash];
  15. if (_ipfsRootHash.toSlice().len() > 0) {
  16. currentCertificate.ipfsRootHash[msg.sender] = _ipfsRootHash;
  17. } else {
  18. currentCertificate.ipfsRootHash[msg.sender] = "default";
  19. }
  20.  
  21. }
  22.  
  23. function verify(string _hash) public view returns (string) {
  24. return certificates[_hash].ipfsRootHash[msg.sender];
  25. }
  26. }
Add Comment
Please, Sign In to add comment