-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircleRegistry.sol
39 lines (34 loc) · 947 Bytes
/
circleRegistry.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
pragma solidity ^0.4.0;
contract circlesRegistry
{
mapping (address => address[]) public trusted;
mapping (address => mapping (address => Trust)) public isTrusted
struct Trust {
bool trusted;
uint index;
}
function circlesRegistry() {
}
function trust (address user){
if (isTrusted[msg.sender][user].trusted != true){
isTrusted[msg.sender][user].index = isTrusted[msg.sender].length;
isTrusted[msg.sender][user].trusted = true;
isTrusted[msg.sender].push[user];
}
}
function revokeTrust (address user) {
if (isTrusted[msg.sender][user].trusted){
isTrusted[msg.sender][user].trusted = false;
trusted[isTrusted[msg.sender][user].index] = 0x0;
}
}
function checkTrust (address[] path) returns(bool) {
for(uint i = 0; i>path.length - 1; i++){
if(isTrusted[path[i+1]][path[i].trusted != true])
{
return false;
}
}
return true;
}
}