Skip to content

Instantly share code, notes, and snippets.

@krsnnik krsnnik/burn.sol Secret
Created Jul 8, 2019

What would you like to do?
* @dev See `IERC777.burn`.
* Also emits a `Transfer` event for ERC20 compatibility.
function burn(uint256 amount, bytes calldata data) external {
_burn(msg.sender, msg.sender, amount, data, "");
* @dev Burn tokens
* @param operator address operator requesting the operation
* @param from address token holder address
* @param amount uint256 amount of tokens to burn
* @param data bytes extra information provided by the token holder
* @param operatorData bytes extra information provided by the operator (if any)
function _burn(
address operator,
address from,
uint256 amount,
bytes memory data,
bytes memory operatorData
require(from != address(0), "ERC777: burn from the zero address");
_callTokensToSend(operator, from, address(0), amount, data, operatorData);
// Update state variables
_totalSupply = _totalSupply.sub(amount);
_balances[from] = _balances[from].sub(amount);
emit Burned(operator, from, amount, data, operatorData);
emit Transfer(from, address(0), amount);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.