Skip to content

ERC20Burnable Not Required #2127

Answered by EngrPips
mgroovyank asked this question in Q&A
Jul 28, 2024 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

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:

    contract DecentralizedStablecoin is **ERC20**, Ownable {
    error DecentralizedStablecoin__BalanceMustBeMoreThanZero();
    error DecentralizedStablecoin__BurnAmountExceedsBalance();

    constructor(
        address owner
    ) ERC20("DecentralizedStablecoin", "DSC") Ownable(owner) {}

    function burn(uint256 amount) public onlyOwner {
        uint256 balance = balanceOf(msg.sender);
  …

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@FrankezeCode
Comment options

@EngrPips
Comment options

@FrankezeCode
Comment options

Comment options

You must be logged in to vote
2 replies
@mgroovyank
Comment options

@EngrPips
Comment options

Answer selected by mgroovyank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants