ERC20Burnable Not Required #2127
Replies: 2 comments 5 replies
-
Hello @mgroovyank, The |
Beta Was this translation helpful? Give feedback.
-
So I look more into the difference between ERC20 BURN /**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
} You will need to instead override the ERC20Burnable BURN /**
* @dev Destroys a `value` amount of tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 value) public virtual {
_burn(_msgSender(), value);
} So I think it is just a flexibility difference between the two contracts. |
Beta Was this translation helpful? Give feedback.
-
While creating DecentralizedStablecoin.sol, Patrick implements ERC20Burnable contract. Is that really required? He could have just implemented ERC20 contract directly. There is also no need to override burn function of ERC20Burnable contract as well that way.
Here is how, I think it could've been:
What do you think about this approach? Am I missing anything?
Beta Was this translation helpful? Give feedback.
All reactions