-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGxOwnedIterable.sol
More file actions
47 lines (36 loc) · 1.34 KB
/
GxOwnedIterable.sol
File metadata and controls
47 lines (36 loc) · 1.34 KB
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
pragma solidity ^0.4.2;
import './GxOwnedInterface.sol';
import './GxCallableByDeploymentAdmin.sol';
import './libraries.sol';
contract GxOwnedIterable is GxOwnedInterface, GxCallableByDeploymentAdmin {
using IterableAddressMapping for IterableAddressMapping.iterableAddressMap;
IterableAddressMapping.iterableAddressMap owners;
modifier callableByOwner {
if (isOwner(msg.sender)) {
_;
} else {
throw;
}
}
function isOwner(address accountAddress) public constant returns (bool) {
return owners.contains(accountAddress);
}
function addOwner(address accountAddress) public callableByDeploymentAdmin {
owners.add(accountAddress);
}
function removeOwner(address accountAddress) public callableByDeploymentAdmin {
owners.remove(accountAddress);
}
function iterateStart() public constant returns (uint keyIndex) {
return iterateNext(0);
}
function iterateValid(uint keyIndex) public constant returns (bool) {
return owners.iterateValid(keyIndex);
}
function iterateNext(uint keyIndex) public constant returns (uint r_keyIndex) {
return owners.iterateNext(keyIndex);
}
function iterateGet(uint keyIndex) public constant returns (address mappedAddress) {
return owners.iterateGet(keyIndex);
}
}