Skip to content

Instantly share code, notes, and snippets.

@michielmulders
Created February 17, 2018 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michielmulders/75da31bbfb7583828ac6f0cfd6fb9ac2 to your computer and use it in GitHub Desktop.
Save michielmulders/75da31bbfb7583828ac6f0cfd6fb9ac2 to your computer and use it in GitHub Desktop.
ERC777 Burn implementation interface Ethereum
/// @notice Burns `_amount` tokens from `_tokenHolder`
/// Sample burn function to showcase the use of the `Burned` event.
/// @param _tokenHolder The address that will lose the tokens
/// @param _amount The quantity of tokens to burn
function burn(address _tokenHolder, uint256 _amount, bytes _userData, bytes _operatorData) public onlyOwner {
requireMultiple(_amount);
require(balanceOf(_tokenHolder) >= _amount);
mBalances[_tokenHolder] = mBalances[_tokenHolder].sub(_amount);
mTotalSupply = mTotalSupply.sub(_amount);
Burned(msg.sender, _tokenHolder, _amount, _userData, _operatorData);
if (mErc20compatible) { Transfer(_tokenHolder, 0x0, _amount); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment