openzeppelin-contracts: ERC20 _update customization is not practical.
You can’t actually modify behavior due to the variables being private.
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
Let’s say I want to customize the burn to increment the balance of the 0 adresss and decrement the total supply, It’s not currently possible.
💻 Environment
OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
📝 Details
🔢 Code to reproduce bug
About this issue
- Original URL
- State: closed
- Created 3 months ago
- Comments: 17 (5 by maintainers)
Commits related to this issue
- See https://github.com/OpenZeppelin/openzeppelin-contracts/issues/4967 — committed to BillSchumacher/openzeppelin-contracts by BillSchumacher 3 months ago
Indeed, thanks again.
Ran 1 test for test/HelloWorld.t.sol:OverCapTest [PASS] testHelloOverCap() (gas: 19073) Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 920.50µs (139.40µs CPU time)
Ran 1 test for test/WorldHello.t.sol:OverCapAfterTest [PASS] testWorldOverCap() (gas: 19065) Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 807.10µs (117.40µs CPU time)