Newbie here - I launched a contract in Remix with a burn feature and a revoke feature. If I revoke the contract, will I still be able to initiate burns in Remix?
-
Please be more specific– Zartaj AfserCommented Aug 1, 2023 at 5:04
-
In Remix, if I press the orange button that says revoke, can I still enter a token amount next to the orange button that says burn? Many desire for the contract to be revoked, I am just not sure what impact that would have on my ability to maintain my burn schedule– user124436Commented Aug 1, 2023 at 5:11
-
Man, this totally depends on what contract are you talking about. How do we know what's written on the contract. Remix is just an IDE. Can you please paste the contract code or tell what does the contract is supposed to do.– Zartaj AfserCommented Aug 1, 2023 at 11:23
Add a comment
|
1 Answer
I guess you mean renounceOwnership()
? The function basically sets a zero address
as the owner of the contract. Considering the burn function, yes it will still work in the standard ERC20 contract.
Here's the burn function:
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
As you can see, the function doesn't have any onlyOwner
checks. All it
needs is that the caller has a token balance to burn. That's it. So yes, it will work.
-
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } Commented Aug 1, 2023 at 13:41
-
not sure why it looses the formatting after I post the comment. Commented Aug 1, 2023 at 13:42
-