Have deployed and verified a few contracts (with inheritance from OpenZeppelin's ERC20.sol and ERC20Burnable.sol) but can't interact via Web3 with any functions regarding _burn, burn (both with ERC20 and ERC20Burnable) . have tried remix, etherscan, and mew. I'm assuming I can just write the code for _burn in the abi section of mew.? will have to test further.
The code looks right but my interacting with contracts is limited so I could be missing something obvious. Perhaps I need to create a tx first to another address?
Perhaps not all functions with Web3 show up and have to be manually entered?
have checked a few of the older topics which seem to warn of deflationary tokens? but would just like to test the burn functions.
Thanks again!
Environment
OpenZeppelin 4.1 inheritances. 0.8.0 Compiler. Deployed and Verified contracts.
Have tried on both Chrome and Brave browsers.
Code to reproduce
ERC20 code from verified contract
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");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
ERC20Burnable code from verified contract
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 amount) public virtual {
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
}