I created a BEP20 Smart contract using
There are 10 billion tokens and there is a limit of 300 million tokens per address. This is the line of code I added in the _transfer() function to set the limit. (300 million + 18 zeros for 18 decimal places)
require(_balances[recipient] + amount <= 300000000000000000000000000, "ERC20: transfer
amount exceeds address limit"); // to limit number of tokens on address
The problem is, I am trying to put 9.7 billion tokens in the PanCakeSwap liquidity pool but it doesn’t let me. I presume this is because of the limit I have set per address. It lets me add 300 million tokens to the liquidity pool but nothing more than that.
Environment
solidity v0.8.0
Details
I am using the Remix IDE. Is there a function I can call to increase/remove the limit for the pancakeswap address? Will the allowance function help me here?
Code to reproduce
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
require(_balances[recipient] + amount <= 300000000000000000000000000, "ERC20: transfer amount exceeds address limit"); // to limit number of tokens on address
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
I would really appreciate your help here. Thank you!