Hi i want to sent token owner wallet to any wallet but I can't
1 Answer
Apparently, the transfer function in the token is using burn funtion to deduct instead of simple math calculation.
The amount of tokens you are trying to transfer through the burn exceeds the totalSupply.
If you are the owner, either mint more tokens or decrease the transfer amount.
function _burn(address from , uint256 amount) internal {
require(from != address(0), "ERC20: burn from the zero address");
require(_tOwned[from] >= amount ,"ERC20: burn amount exceeds balance");
uint256 _tOwnedFrom = _tOwned[from];
_tOwnedFrom = _tOwnedFrom.sub(amount);
_rTotal = _rTotal.sub(amount);
emit Transfer(from, address(0), amount);
}
Look at this piece of code that I have taken from from your coin. It says, if you try to burn more tokens than you own, the transaction will revert with an error message:
ERC20: burn amount exceeds balance
And that is also the error you are getting in the wallet. So please check the total amount of GNP tokens you are holding before transfering to someone else.
Edit:
After checking the contract, I have found an error in the contract. Even though you have ample tokens to suppy, the reason you are not able to transfer because balance check is failing.
require(_tOwned[from] >= amount ,"ERC20: burn amount exceeds balance");
In that line, the contract is checking whether your address have the amount you are transfering or not.
Even though you have tokens, it is never updated in the following mapping.
mapping (address => uint256) private _tOwned;
The mapping saves amount of tokens the address are holding. But the developer never updated in the contract or constructor.
So what you can do is redeploying the contract by updating the constructor.
If you do not understand, show this answer to your developer or update the code and deploy it for yourself.
constructor () {
_tOwned[owner()] = _tTotal;
_rOwned[owner()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), owner(), _tTotal);
}
In the above constructor, I have added _tOwned mapping too. Replace the old constructor with new constructor and deploy the contract again and the transfer function works fine as gold this time.
Tell me if it helps!
-
-
In simple words, you are trying to transfer tokens more than you own. It is like, you have 100 dollars in your bank account and trying to send 1000 dollars. So lower the amount of GNP you are trying to transfer or mint(aka print) new coins.– Ad-h0cSep 30, 2022 at 7:32
-
-
I have 100.000.000.000.000.000 quadrillion and i want sent 350.000.000.000.000 but i cant– ChrisSep 30, 2022 at 7:39
-
Okay. I rechecked the contract. There is some idiotic human error the developer made. I will update my answer so please check.– Ad-h0cSep 30, 2022 at 9:09