CRYPTO NEWS

Chainalysis announces $170M funding round, platform now valued at $8.6 billion

This is the tenth and largest funding for the blockchain aggregation and reporting service since its inception in October 2014.

ETH: Failing to Swap Tokens in same txid when transfering from DEX

I am having troubles with the following scenario: I have written a simple token which takes buy & sell tax fees of 3%. (All Good) I want the fee to be immediately swapped for ETH in the same transactions. (Failing) No matter what I do this method swapExactTokensForETHSupportingFeeOnTransferTokens is failing and the problem is that::Listen

I am having troubles with the following scenario:

  1. I have written a simple token which takes buy & sell tax fees of 3%. (All Good)
  2. I want the fee to be immediately swapped for ETH in the same transactions. (Failing)

No matter what I do this method swapExactTokensForETHSupportingFeeOnTransferTokens is failing and the problem is that the error is without any meaning.

I have created over 23 tokens with different tests and no luck.

Transfer Function

function _transfer(address from, address to, uint256 amount) private {     require(from != address(0), "BEP20: transfer from the zero address");     require(to != address(0), "BEP20: transfer to the zero address");     require(amount > 0, "Transfer amount must be greater than zero");      if(from == _pancakeswapV2LiquidityPair || to == _pancakeswapV2LiquidityPair)      {         uint256 tFee = amount.mul(dexTaxFee).div(100);         uint256 tTransferAmount = amount.sub(tFee);          _balances[from] = _balances[from].sub(amount, "BEP20: Transfer amount exceeds balance");         _balances[to] = _balances[to].add(tTransferAmount);                  emit Transfer(from, to, tTransferAmount);          swapTokensForEthAndSend(tFee, _feesCollectingAddress);            }     else      {         _balances[from] = _balances[from].sub(amount, "BEP20: Transfer amount exceeds balance");         _balances[to] = _balances[to].add(amount);          emit Transfer(from, to, amount);     } } 

SwapTokensForEth

function swapTokensForEthAndSend(uint256 tokenAmount, address payable recipient) private {     address[] memory path = new address[](2);     path[0] = address(this);      path[1] = _pancakeswapV2Router.WETH();       _approve(address(this), address(_pancakeswapV2Router), tokenAmount);      _pancakeswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(         tokenAmount,         0,         path,         recipient,         block.timestamp.add(86400)     ); } 

Chainalysis announces $170M funding round, platform now valued at $8.6 billion

Shopping cart
There are no products in the cart!
Continue shopping
0