Declaration Error overriding transferFrom() ERC20.sol

Hello :slight_smile:

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!

Hey @monkii
I think there is an issue with the npm package and Remix

If you use
import "" should work

1 Like

Thank you so much @FreezyEx ! :smiley:

For my specific use case, I had to exchange all import statements for the GitHub ones, but it works now as intended.

All the best

1 Like