Skip to content

Instantly share code, notes, and snippets.

@PillarDevelopment
Created March 23, 2018 08:42
Show Gist options
  • Select an option

  • Save PillarDevelopment/06a97192f2b988b6e1970e2142ef84d3 to your computer and use it in GitHub Desktop.

Select an option

Save PillarDevelopment/06a97192f2b988b6e1970e2142ef84d3 to your computer and use it in GitHub Desktop.
Функция whitelist
pragma solidity ^0.4.21;
import "https://github.com/OpenZeppelin/zeppelin-solidity/contracts/ownership/Ownable.sol";
contract WhiteList is Ownable {
mapping (address => bool) public investorWhiteList;
mapping (address => address) public referralList;
function WhiteList() {
}
// addded new 1 address investor
function addInvestorToWhiteList(address investor) external onlyOwner {
require(investor != 0x0 && !investorWhiteList[investor]);
investorWhiteList[investor] = true;
}
// deleted 1 address in array of investors
function removeInvestorFromWhiteList(address investor) external onlyOwner {
require(investor != 0x0 && investorWhiteList[investor]);
investorWhiteList[investor] = false;
}
//when new user will contribute ICO contract will automatically send bonus to referral
function addReferralOf(address investor, address referral) external onlyOwner {
require(investor != 0x0 && referral != 0x0 && referralList[investor] == 0x0 && investor != referral);
referralList[investor] = referral;
}
//
function isAllowed(address investor) constant external returns (bool result) {
return investorWhiteList[investor];
}
function getReferralOf(address investor) constant external returns (address result) {
return referralList[investor];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment