How to use IERC20 safeTransferFrom?

I wouldike to have a function for my users for migrate old token to the new token :

address public oldToken = "XXXXXXXXXXXX";
address public newToken = "XXXXXXXXXXX";

 function migrateToNewToken(uint256 _inputAmt) public {

        //require(block.number < endOldToken, "too late :(");
        IERC20(oldToken).safeTransferFrom(
            address(msg.sender),
            burnAddress,
            _inputAmt
        );

        Token(newToken).mint(msg.sender, _inputAmt);
        emit MigrateToV2(msg.sender,_inputAmt);
    }

After deployed and minted some token for oldToken. I run the function migrateNewToken but I have always the same error :

transact to MasterChefV2.migrateToNewToken errored: VM error: revert. revert The transaction has been reverted to the initial state. Reason provided by the contract: "ERC20: transfer amount exceeds allowance"

So has the msg.sender called approve correctly? I think the right way should be:

  • Alice calls oldToken.approve(migrateToNewToken_contract_address, amount)
  • Alice calls migrateToNewToken(amount)