Skip to content

Instantly share code, notes, and snippets.

@oed
Last active December 4, 2017 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oed/3cc42367649b626d0fe110a0cd2f16ef to your computer and use it in GitHub Desktop.
Save oed/3cc42367649b626d0fe110a0cd2f16ef to your computer and use it in GitHub Desktop.
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