I tried to make a token burn function, which would burn tokens from sender and show that amount of total supply are decreasing.
function burn2(uint256 _value) public {
_burn2(msg.sender, _value);
}
function _burn2(address _who, uint256 _value) internal {
require(_value <= _rOwned[_who]);
_rOwned[_who] = _rOwned[_who].sub(_value);
_tTotal = _tTotal.sub(_value);
emit Transfer(_who, address(0), _value);
}
This code works, but actually it burns tokens NOT only from sender wallet. It burns tokens from all wallets (holders) in percentage ratio like if I burn 1M of tokens while holding 70% of them it will take away only 70% tokens from me and also take 30% from other holders eventually.
I’m trying to make it burn only from sender wallet, rather from all wallets, but doing something wrong.
I understand that I substract values from total supply which may lead to decreasing all amount of tokens in each wallet, but i can’t figure out how to show bscscan that amount of tokens are decreasing everytime I burn tokens.
Thanks in advance.