Uncertainty regarding the implementation of the liquidity fee

Of course you do - since you have the Uniswap Router contract address at hand, you can easily view the entire source code of this contract on etherscan.

But instead of looking into those functions, you may as well just search where the error-message TRANSFER_FROM_FAILED appears in that code.

And if you do, then you'll see that it only appears in one place:

function safeTransferFrom(address token, address from, address to, uint value) internal {
    // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
    require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}

Which means that whatever function on the Uniswap Router contract you called, this function has ended up reverting when it attempted to call function transferFrom on the designated token contract, which is... YOUR token contract.

So what you need to do is to investigate the related code on YOUR contract.

Function transferFrom is implemented in the ERC20 contract which your contract inherits from.

It calls function _transfer, which is also implemented in the ERC20 contract which your contract inherits from, but since you have overridden that function in your contract, function transferFrom ends up calling function _transfer on YOUR contract.

You haven't provided the exact code of that function, so I'm having to rely on several different versions of it which you have posted throughout this thread.

And this is where things go... a little weird...

Inside function _transfer, you seem to be calling function addLiquidity in YOUR contract.

Again, you haven't provided the code of that function, but by name, I am inclined to guess that this function calls function addLiquidity on the Uniswap Router contract...?

If so, then what you get here is a kind of a recursive loop, starting as you add liquidity via the Uniswap web interface:

  • Which calls function addLiquidity on the Uniswap Router contract
  • Which calls function transferFrom on your contract
  • Which calls function _transfer on your contract
  • Which calls function addLiquidity on your contract
  • Which calls function addLiquidity on the Uniswap Router contract