Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.4.24;
- import "github.com/Arachnid/solidity-stringutils/strings.sol";
- contract registry {
- using strings for *;
- 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];
- if (_ipfsRootHash.toSlice().len() > 0) {
- currentCertificate.ipfsRootHash[msg.sender] = _ipfsRootHash;
- } else {
- currentCertificate.ipfsRootHash[msg.sender] = "default";
- }
- }
- function verify(string _hash) public view returns (string) {
- return certificates[_hash].ipfsRootHash[msg.sender];
- }
- }
Add Comment
Please, Sign In to add comment