17
TransferHelper: TRANSFER_FROM_FAILED
source link: https://learnblockchain.cn/question/2900
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
TransferHelper: TRANSFER_FROM_FAILED
TransferHelper: TRANSFER_FROM_FAILED
合约发布在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
);
}
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK