Function destroys tokens: "DeclarationError: Undeclared identifier" error in remix

Viewed 125

I'm trying to create a function that destroys tokens in an address.

The remix has the error

DeclarationError: Undeclared identifier

mostly for totalSupply.

Can anyone check what the error is in the syntax and how to solve it?

Is this the best function, or is it better to remove the tokens and send them to the dead address, or to the contract itself, or even to leave it in the wallet of the holder and block their movement in the wallet forever? I would like advice (and mainly how to solve this code).

/**
    @dev removes tokens from an account and decreases the token supply
    can only be called by the contract owner

     _from       account to remove the amount from
     _amount     amount to decrease the supply by
*/
function removeTokens(address _from, uint256 _amount) public onlyOwner
{
    balanceOf[_from] = sub(balanceOf[_from], _amount);
    totalSupply = sub(totalSupply, _amount);

    Transfer(_from, this, _amount);
    Destruction(_amount);
}

Sub is the subtraction function of values (SafeMath)

0 Answers
Related