Our tokens features an anti-bot.
Is based on Max transaction size, but notice that can only be set higher, never lower. That prevents us from blocking sells, a common rugpull technique.
/**
* @dev Sets the maxTransactionSize
*
* This prevents users to buy and transfer before the dev allows it.
* Can also prevent masive buys from bots.
* The maxTransactionSize can only increase, so the dev can't block transaction.
*
* Requirements
*
* - `msg.sender` must be the token owner
* - `maxTransactionSize` value must be higher than current value
* - `msg.sender` must be the maxTransactionSizeOwner
*/
function setMaxTransactionSize(uint256 _maxTransactionSize) public {
require(msg.sender == maxTransactionSizeOwner);
require(_maxTransactionSize > maxTransactionSize, "New maxTransactionSize value must be higher than current value");
maxTransactionSize = _maxTransactionSize;
}
/**
* @dev renounces the maxTransactionSizeOwner
*
* This sends the ownership of the maxTransactionSizeOwner to the zero address
*
* Requirements
*
* - `msg.sender` must be maxTransactionSizeOwner
*/
function renounceMaxTransactionSizeOwner() public {
require (msg.sender == maxTransactionSizeOwner);
maxTransactionSizeOwner = address(0);
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - `amount` must be lower than maxTransactionSize
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
require(amount <= maxTransactionSize || sender == owner(), "BEP20: transfer amount over maxTransactionSize");
_balances[sender] = _balances[sender].sub(
amount,
"BEP20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
The function has an owner, we did it this way to avoid conflicts with transferring ownership to masterchef.