Last active
December 4, 2017 11:46
-
-
Save oed/3cc42367649b626d0fe110a0cd2f16ef 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
contract A { | |
EthereumClaimRegistry ecr; | |
event Log1(bytes b); | |
function bbl(address reg, address iss, address sub, bytes32 key) { | |
ecr = EthereumClaimRegistry(reg); | |
bytes a = ecr.getClaim(iss, sub, key); | |
Log1(a); | |
} | |
} | |
contract EthereumClaimRegistry { | |
mapping(address => mapping(address => mapping(bytes32 => bytes))) public registry; | |
event ClaimAdded( | |
address indexed issuer, | |
address indexed subject, | |
bytes32 indexed key, | |
bytes value, | |
uint updatedAt); | |
event ClaimRemoved( | |
address indexed issuer, | |
address indexed subject, | |
bytes32 indexed key, | |
uint removedAt); | |
// create or update clams | |
function setClaim(address subject, bytes32 key, bytes value) public { | |
registry[msg.sender][subject][key] = value; | |
ClaimAdded(msg.sender, subject, key, value, now); | |
} | |
function getClaim(address issuer, address subject, bytes32 key) public constant returns(bytes) { | |
return registry[issuer][subject][key]; | |
} | |
function removeClaim(address issuer, address subject, bytes32 key) public { | |
require(msg.sender == issuer || msg.sender == subject); | |
delete registry[issuer][subject][key]; | |
ClaimRemoved(msg.sender, subject, key, now); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment