Revert error when calling TransferFrom inside contract

:computer: Environment

I’ using truffle v5.3.3

:memo:Details
There was error when i try to call transferErc20 function, it gives me the revert error. I increased allovance for tokenFactory, but it isnt help.

Uncaught Error: Returned error: VM Exception while processing transaction: revert
    at evalmachine.<anonymous>:0:7
    at sigintHandlersWrap (node:vm:271:12)
    at Script.runInContext (node:vm:139:14)
    at runScript (/usr/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:270:1)
    at Console.interpret (/usr/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:285:1)
    at bound (node:domain:416:15)
    at REPLServer.runBound [as eval] (node:domain:427:12)
    at REPLServer.onLine (node:repl:836:10)
    at REPLServer.emit (node:events:378:20)
    at REPLServer.EventEmitter.emit (node:domain:470:12)
    at REPLServer.Interface._onLine (node:readline:418:10)
    at REPLServer.Interface._line (node:readline:763:8)
    at REPLServer.Interface._ttyWrite (node:readline:1108:14)
    at REPLServer.self._ttyWrite (node:repl:928:9)
    at ReadStream.onkeypress (node:readline:259:10)
    at ReadStream.emit (node:events:378:20)
    at ReadStream.EventEmitter.emit (node:domain:470:12)
    at emitKeys (node:internal/readline/utils:358:14)
    at emitKeys.next (<anonymous>)
    at ReadStream.onData (node:readline:1242:36) {
  data: {
    '0x9b378676f2489c21cb38c44fbd99cf6d3667d790d6b800e6e8be931cc7091e01': { error: 'revert', program_counter: 666, return: '0x' },
    stack: 'RuntimeError: VM Exception while processing transaction: revert\n' +
      '    at Function.RuntimeError.fromResults (/usr/lib/node_modules/truffle/build/webpack:/node_modules/ganache-core/lib/utils/runtimeerror.js:94:1)\n' +
      '    at BlockchainDouble.processBlock (/usr/lib/node_modules/truffle/build/webpack:/node_modules/ganache-core/lib/blockchain_double.js:627:1)\n' +
      '    at runMicrotasks (<anonymous>)\n' +
      '    at processTicksAndRejections (node:internal/process/task_queues:94:5)',
    name: 'RuntimeError'
  },
  hijackedStack: 'Error: Returned error: VM Exception while processing transaction: revert\n' +
    '    at Object.ErrorResponse (/usr/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-helpers/lib/errors.js:28:1)\n' +
    '    at /usr/lib/node_modules/truffle/build/webpack:/node_modules/web3/node_modules/web3-core-requestmanager/lib/index.js:303:1\n' +
    '    at /usr/lib/node_modules/truffle/build/webpack:/packages/provider/wrapper.js:107:1\n' +
    '    at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/webpack:/node_modules/web3/node_modules/web3-providers-http/lib/index.js:98:1)\n' +
    '    at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:1)\n' +
    '    at XMLHttpRequest.exports.modules.996763.XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:208:1)\n' +
    '    at XMLHttpRequest.exports.modules.996763.XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:318:1)\n' +
    '    at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:289:47)\n' +
    '    at IncomingMessage.emit (node:events:390:22)\n' +
    '    at IncomingMessage.EventEmitter.emit (node:domain:532:15)\n' +
    '    at endReadableNT (node:internal/streams/readable:1307:12)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:81:21)'
}

:1234: Code to reproduce

pragma solidity ^0.5.0;

import "./myERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";


contract tokenFactory {

    address[] tokenAddress;
    IERC20 token20;  //обьявляем структуру токена erc20

   constructor(IERC20 token1)  public {

    IERC20 token20; 
    token20 = token1;

   }

    function transferErc20() public payable { //переправляем токены 

      token20.transferFrom(msg.sender, address(this), 1);

    }
    function deploy721Contract(string calldata name,string calldata symbol,string calldata baseUrl) external returns (myERC721 cardAddress) {
     
        myERC721 newCards = new myERC721(name, symbol, baseUrl);

        tokenAddress.push(address(newCards)); 
        return newCards;
    }

}
token20.transferFrom(msg.sender, address(this), 1);

Where is transferFrom’s defined?
If you just inherit them from the interface then nothing will happen or be done.
These functions need to have code within them.

Hello @Volandemort
Before calling transfer from, did the message sender approved the token transfer in the first place?

You’re right. For this issue i have just delete

IERC20 token20;

from constructor and it works