Hello
I'm trying to built upon the OpenZeppelin ERC20.sol. I want to override the token's public functions which works well for all functions (approve(), decreaseAllowance(), increaseAllowance(), and transfer()), but throws a declaration error (Undeclared Identifier) for the transferFrom() function. Specifically, the line including "_spendAllowance(from, spender, amount);".
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken is ERC20 {
constructor(string memory name, string memory symbol) ERC20(name, symbol) {}
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
}
I'm working with Remix.
I would highly appreciate any hint that would help me to solve this issue or directions for already discussed issues, as I can't find any solutions to this issue myself.
Thanks a lot in advance!