This repository has been archived by the owner on Dec 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathKYC.sol
90 lines (73 loc) · 3.2 KB
/
KYC.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
Copyright 2018 CoinAlpha, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.21;
import "./zeppelin/Ownable.sol";
contract IKYC {
function isWhitelistedHolder (address) public view returns (bool) {}
}
/// @title KYCWhitelist -- Whitelist contract to limit participants to KYCed individuals, to ensure legal compliance
/// @author CoinAlpha, Inc. <[email protected]>
contract KYC is Ownable {
// public variables
address public admin;
// Modifiers
modifier onlyOwnerOrAdmin {
require(msg.sender == admin || msg.sender == owner); // Check: "Only the owner or permissied admin can call this function"
_;
}
// Mappings
mapping(address => bool) public whitelistedHolders;
// Events
event LogWhitelistHolder(address indexed whitelistedHolder);
event LogUnwhitelistHolder(address indexed unwhitelistedHolder);
event LogSetAdmin(address indexed oldAdmin, address indexed newAdmin);
/// @dev KYC constructor
function KYC(address _admin) public {
owner = msg.sender;
admin = _admin;
}
/// @dev Check if address is a whitelisted holder
/// @param _holder holder address
/// @return isWhitelisted is whitelisted
function isWhitelistedHolder(address _holder) public view returns (bool) {
return whitelistedHolders[_holder];
}
/// @dev Whitelist an address to become a holder
/// @param _addressToWhitelist address to be whitelisted
/// @return success Operation successful
function whitelistHolder(address _addressToWhitelist) public onlyOwnerOrAdmin returns (bool) {
whitelistedHolders[_addressToWhitelist] = true;
emit LogWhitelistHolder(_addressToWhitelist);
return true;
}
/// @dev Remove an address from whitelisted holders
/// @param _addressToUnwhitelist address to remove from whitelist
/// @return success Operation successful
function unWhitelistHolder(address _addressToUnwhitelist) public onlyOwnerOrAdmin returns (bool) {
whitelistedHolders[_addressToUnwhitelist] = false;
emit LogUnwhitelistHolder(_addressToUnwhitelist);
return true;
}
/// @dev Set the permission admin to another address
/// @param _newAdmin new admin address
/// @return success Operation successful
function setAdmin(address _newAdmin) public onlyOwner returns (bool) {
address oldAdmin = admin;
admin = _newAdmin;
emit LogSetAdmin(oldAdmin, _newAdmin);
return true;
}
/// @dev Fallback to reject any ether sent to contract
// Check: "KYC does not accept ETH transfers"
function () public payable { revert(); }
}