/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
contract BigbomContributorWhiteList is Ownable {
mapping(address=>uint) public addressMinCap;
mapping(address=>uint) public addressMaxCap;
function BigbomContributorWhiteList() public {}
event ListAddress( address _user, uint _mincap, uint _maxcap, uint _time );
// Owner can delist by setting cap = 0.
// Onwer can also change it at any time
function listAddress( address _user, uint _mincap, uint _maxcap ) public onlyOwner {
require(_mincap <= _maxcap);
require(_user != address(0x0));
addressMinCap[_user] = _mincap;
addressMaxCap[_user] = _maxcap;
ListAddress( _user, _mincap, _maxcap, now );
}
// an optimization in case of network congestion
function listAddresses( address[] _users, uint[] _mincap, uint[] _maxcap ) public onlyOwner {
require(_users.length == _mincap.length );
require(_users.length == _maxcap.length );
for( uint i = 0 ; i < _users.length ; i++ ) {
listAddress( _users[i], _mincap[i], _maxcap[i] );
}
}
function getMinCap( address _user ) public constant returns(uint) {
return addressMinCap[_user];
}
function getMaxCap( address _user ) public constant returns(uint) {
return addressMaxCap[_user];
}
}
{
"compilationTarget": {
"BigbomContributorWhiteList.sol": "BigbomContributorWhiteList"
},
"libraries": {},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"constant":true,"inputs":[{"name":"_user","type":"address"}],"name":"getMinCap","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_user","type":"address"},{"name":"_mincap","type":"uint256"},{"name":"_maxcap","type":"uint256"}],"name":"listAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"addressMinCap","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_user","type":"address"}],"name":"getMaxCap","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"addressMaxCap","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_users","type":"address[]"},{"name":"_mincap","type":"uint256[]"},{"name":"_maxcap","type":"uint256[]"}],"name":"listAddresses","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_user","type":"address"},{"indexed":false,"name":"_mincap","type":"uint256"},{"indexed":false,"name":"_maxcap","type":"uint256"},{"indexed":false,"name":"_time","type":"uint256"}],"name":"ListAddress","type":"event"}]