-
Notifications
You must be signed in to change notification settings - Fork 4
/
SimpleLinkRegistry.sol
63 lines (58 loc) · 1.46 KB
/
SimpleLinkRegistry.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title Simple Link Registry - A repository storing links issued about any other Ethereum address
*/
contract SimpleLinkRegistry is Ownable {
/*----------- Variables -----------*/
mapping(
address => mapping(
bytes32 => string
)
) public registry;
event LinkSet(
address from,
address indexed subject,
bytes32 indexed key,
string value,
uint updatedAt
);
/**
* @dev Create or update a link
* @param subject - The address the link is being issued to
* @param key - The key used to identify the link
* @param value - The data associated with the link
*/
function setLink(
address subject,
bytes32 key,
string value
)
external
onlyOwner
{
registry[subject][key] = value;
emit LinkSet(
msg.sender,
subject,
key,
value,
block.timestamp // solhint-disable-line not-rely-on-time
);
}
/**
* @dev Allows a user to retrieve a link
* @param subject - The address to which the link was issued to
* @param key - The key used to identify the link
*/
function getLink(
address subject,
bytes32 key
)
external
view
returns(string)
{
return registry[subject][key];
}
}