forked from poanetwork/poa-popa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EthereumClaimsRegistry.sol
41 lines (32 loc) · 1.25 KB
/
EthereumClaimsRegistry.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
pragma solidity 0.4.19;
contract EthereumClaimsRegistry {
mapping(address => mapping(address => mapping(bytes32 => bytes32))) public registry;
event ClaimSet(
address indexed issuer,
address indexed subject,
bytes32 indexed key,
bytes32 value,
uint updatedAt);
event ClaimRemoved(
address indexed issuer,
address indexed subject,
bytes32 indexed key,
uint removedAt);
// create or update claims
function setClaim(address subject, bytes32 key, bytes32 value) external {
registry[msg.sender][subject][key] = value;
ClaimSet(msg.sender, subject, key, value, now);
}
function setSelfClaim(bytes32 key, bytes32 value) external {
registry[msg.sender][msg.sender][key] = value;
ClaimSet(msg.sender, msg.sender, key, value, now);
}
function removeClaim(address issuer, address subject, bytes32 key) external {
require(msg.sender == issuer || msg.sender == subject);
delete registry[issuer][subject][key];
ClaimRemoved(msg.sender, subject, key, now);
}
function getClaim(address issuer, address subject, bytes32 key) external view returns(bytes32) {
return registry[issuer][subject][key];
}
}