We have been running tokens to prepare for a larger project and we have been getting sniped/botted the instant liquidity is added. This results in this sniper dumping 20 minutes later and killing any momentum and destroying the chart. We are looking for a way to blacklist these bots so they cannot sell. I've been able to get the function to appear but inputting an address does nothing - the address can still buy and sell.

We have tried a variety of code from other contracts with no luck, for example:

    // Address that are identified as botters with holding of more than 5%.
mapping(address => bool) private _includeToBlackList;

 * @dev Exclude an address from blackList.
 * Can only be called by the current operator.
function setExcludeFromBlackList(address _account) public onlyOwner {
    _includeToBlackList[_account] = false;

 * @dev Include an address to blackList.
 * Can only be called by the current operator.
function setIncludeToBlackList(address _account) public onlyOwner {
    _includeToBlackList[_account] = true;

Our contract is 0.6.12

1 Answer 1


How about adding the following in the _transfer function? It would revert if the blacklisted address send or receives the token.

require(!_includeToBlackList[sender] && !_includetoBlackList[recipient], "This address is blacklisted"); 

On a side-note, I would personally never ever buy a token where the owner can unilaterally blacklist an address like that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.