0

I am wondering on how does the burning mechanism work, as far as i know, that who ever called the contract msg.sender will be his ethereum address. But the twist is when i saw the burn function, it has the intended account that anyone can burn from:

function burn(address owner, uint256 value) public returns(bool){
        balances[owner] = balances[owner].sub(value);
        totalSupply = totalSupply.sub(value);
        emit Transfer(owner,address(0),value);
        return true;
    }

this is my edit, so that the caller is restricted to burn from his own address.

function burn(uint256 value) public returns(bool){
        balances[msg.sender] = balances[msg.sender].sub(value);
        totalSupply = totalSupply.sub(value);
        emit Transfer(msg.sender,address(0),value);
        return true;
    }

Any reflections on my edit? is everywhere has the access to them? And how would be possible that the first example will allow an unauthorized burning if it is public?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.