proceed fees from contract, can anyone please help?
When the function is called inside the _transfer() function to proceed the accumulated fees, transaction fails and contract is broken (users cant buy or sell). But when the SAME function is called externally to manually swap the fees, transaction succeeds. Why this behavior is observed in the same functionallity?
Any help is appreciated!
function swapTokensForBNB() private swaping {
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance < 1 ) {
return;
}
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = pancakeSwapV2Router.WETH();
_approve(address(this), address(pancakeSwapV2Router), contractTokenBalance);
pancakeSwapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
contractTokenBalance,
0,
path,
address(this),
block.timestamp
);
}
Use swap:make-dir,path.
Обсуждают сегодня