Docs

ERC20Burnable

import "@thirdweb-dev/contracts/extension/interface/IBurnableERC20.sol";

Support burning tokens by implementing the IBurnableERC20 interface.


View on GitHub

Usage

This is an example smart contract demonstrating how to inherit from this extension and override the functions to add (optional) custom functionality.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@thirdweb-dev/contracts/openzeppelin-presets/token/ERC20/ERC20.sol";
import "@thirdweb-dev/contracts/extension/interface/IBurnableERC20.sol";

contract Contract is ERC20, IBurnableERC20 {
    constructor(
        string memory _name,
        string memory _symbol
    )
        ERC20(
            _name,
            _symbol
        )
    {}

    function burn(uint256 amount) external override {
        // Your custom implementation here
    }

    function burnFrom(address account, uint256 amount) external override {
        // Your custom implementation here
    }

}

Base Contracts Implementing This Extension

No base contracts implement this functionality by default.