合约发布在bsc测试链,在https://test-swap.pinksale.finance/#/pool发布流动性, 使用uniswap卖代币的时候报错TransferHelper: TRANSFER_FROM_FAILED,这个问题怎么解决? 卖token的代码:
function _swapTokensForBnb(uint256 tokenAmount) public {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}