I'm writing a token contract that accepts and and issues varying ether/token amounts via conditional statements like so:
function getAirdrop() public payable {
if (msg.value < 0.005 ether) {
balances[msg.sender] += 4000;
} else if ( (msg.value >= 0.005 ether) && (msg.value < 0.008 ether)) {
balances[msg.sender] += 9000;
} else if ( (msg.value >= 0.008 ether) && (msg.value < 0.016 ether)) {
balances[msg.sender] += 13000;
} else balances[msg.sender] += 25000;
}
How do I implement a blacklist in the first conditional to limit access like so:
mapping (address => bool) public blacklist;
// TODO: function to clear blacklist -----
if (msg.value < 0.005 ether) {
require(firstPurchaceTierAllowed);
// TODO: Check if msg.sender is not blacklisted
balances[msg.sender] += 4000;
// TODO: Add msg.sender to blacklist
}