ERC20BurnableLib
Title: ERC20BurnableLib
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Burnable.sol)
Library implementing ERC-20 burn extensions. Adds no own storage.
Ports OpenZeppelin v5.6.1 ERC20Burnable. Differences from OpenZeppelin:
- Known limitation (IMP-1): OZ marks
_spendAllowanceasvirtualto allow downstream extensions (e.g., Permit-based overrides) to intercept allowance consumption. Solidity libraries cannot declarevirtualfunctions, soburnFromis hardwired toERC20Lib._spendAllowance. If permit-based allowance overriding is required in the future, an_innerdelegate pattern or a hook inERC20Libwill be needed to restore the override chain. - Burns call
ERC20Lib._burndirectly, so the ERC20Pausable and ERC20Votes overrides oftransfer/transferFromnever see them: a burn goes through while paused and does not move votes (decision D25 on #234). - The caller is
msg.sender, not_msgSender(). - Registers IERC20Burnable for ERC-165 in its init; OpenZeppelin's extension has no ERC-165.
Functions
__ERC20Burnable_init
Registers the IERC20Burnable interface for ERC-165 discovery.
Must be called inside a pre/postInitializer block. No own storage to initialize.
function __ERC20Burnable_init() internal;registerInterface
Registers support for the IERC20Burnable interface via ERC-165.
function registerInterface() internal;burn
Destroys value tokens from the caller's balance.
function burn(uint256 value) internal;Parameters
| Name | Type | Description |
|---|---|---|
| value | uint256 |
burnFrom
Destroys value tokens from account, using the caller's allowance.
function burnFrom(address account, uint256 value) internal;Parameters
| Name | Type | Description |
|---|---|---|
| account | address | |
| value | uint256 |