Burnable token

Good day can someone please help me i imported my code from openzepelin contract after i deployed to testnet i tested the functions several times but it is giving a wrong out put. i deployed 5000 token but when I tried to burn 3000 from it, my total supply turn to 4,999.999999 while 0.0000003 was only send to dead wallet.

this is the code

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
   
    
import"https://github.com/abcoathup/openzeppelin-contracts/blob/release-v3.1.0/contracts/token/ERC20/ERC20.sol";
import"https://github.com/abcoathup/openzeppelin-contracts/blob/release-v3.1.0/contracts/token/ERC20/ERC20Burnable.sol";
import"https://github.com/abcoathup/openzeppelin-contracts/blob/release-v3.1.0/contracts/math/SafeMath.sol";
import"https://github.com/abcoathup/openzeppelin-contracts/blob/release-v3.1.0/contracts/access/Ownable.sol";


contract MyToken is ERC20,ERC20Burnable,Ownable{
    constructor () public ERC20("Solace Token", "SLT") {
        _mint(msg.sender, 5000 * (10 ** uint256(decimals())));
    }
   
}

To burn 3000, you have to look at the number of digits in the token. If you have 18 digits, to burn 3000, you must burn 3000000000000000000000000000000000.

1 Like