August 2019
Intermediate to advanced
486 pages
13h 52m
English
When you need to allow users to burn their tokens, you should use the ERC20Burnable.sol contract. This contract provides two functions: burn() and burnFrom().
The OpenZeppelin contract present at Chapter09/openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol is defined as follows:
import "./ERC20.sol";contract ERC20Burnable is ERC20 { function burn(uint256 value) public { _burn(msg.sender, value); } function burnFrom(address from, uint256 value) public { _burnFrom(from, value); }}
Let's review the preceding code in more detail. The contract contains the following functions: