Etherscan Uniswap Flashbots UniswapV2 – How to Make Sense of a Simple Uniswap V2 Transaction

etherscanflashbotsuniswapuniswapv2

https://etherscan.io/tx/0x006a041ade99b4715e6578ac968932f47fa9f1be1a676ad66678260ca0fbb6d1

This appears like a vanilla UniswapV2Router02 swap, sending the well-known method swapExactTokensForETHSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) to the well-known router address 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D.

The amountIn is 0x728e54491c400 which is 2,015,290.0 OC tokens in decimal notation (OC has 9 decimals). OC charges a 1% fee/tax, so the first swap sends 20,152.9 tokens right back to the OC contract, and swaps the remainder, 1,995,137.1 OC, for 0.186567242655743455 Ether. So far, everything as expected.

What throws me for a loop is that immediately after, everything seems to be happening a second time!

The event logs ( https://etherscan.io/tx/0x006a041ade99b4715e6578ac968932f47fa9f1be1a676ad66678260ca0fbb6d1#eventlog ) show that the sender asks for another, identical swap of 2,015,290.0 OC tokens, again split into 20,152.9 (1%) tax and the remainder, 1,995,137.1 OC, swapped for 0.176161447034409986 Ether.

Question 1: Why am I seeing double double? What's going on here?

Does it have to do with the fact that the miner is Flashbots (see https://etherscan.io/tx/0x006a041ade99b4715e6578ac968932f47fa9f1be1a676ad66678260ca0fbb6d1#statechange )? Is there some setting in Flashbots to execute transactions twice or trice? Where is this setting (number of repeats) visible on Etherscan?

One would assume that everything on the blockchain is public, so where does it say on Etherscan "This swapExactTokensForETHSupportingFeeOnTransferTokens() call is supposed to be executed twice in a row, with identical inputs"?

Question 2: In the end, how many OC tokens were "consumed" in the swap (left the transaction signer's wallet), and how much Ether was received by him in exchange? It appears that the answer is:

2,015,290 + 2,015,290 = 4,030,580 tokens left the signer's wallet.

0.186567242655743455 + 0.176161447034409986 = 0.3627286897 Ether was received back.

All this even though only one swap was defined as call argument?

Best Answer

Ok so I think I figured it out, studying the token's source code, this is a common scheme to "cash out" taxes/fees charged on every token trade or transfer.

What are taxes/fees? Taxes/fees are a percentage of the transaction value of every transaction back to the token contract. They are paid in tokens, not in ETH.

So when you buy 1,000,000 shitcoins, and tax is currently 10%, it means you get only 900,000 shitcoins and 100,000 shitcoins are sent right back to the token contract which acts as a wallet holding the accumulated taxes.

Token devs justify taxes/fees with "ongoing marketing expenses" for growing the project (whatever...). Taxes are also used as a device to artificially prop up a token's price, by taxing token sales higher during the first hours or days of a launch. You'll think twice before dumping that shitcoin minutes after you bought it, when you stand to lose half or more of your investment to "taxes".

Accumulating all these tokens poses a problem for the token dev, in that he needs to frequently "cash out" his "tax tokens" that accumulate over time.

Why not piggyback on your token holder's transactions and make THEM pay the gas for swapping the dev's accumulated tokens, and also front-run their sells so that you get a slightly higher ETH value for the tokens?

That's exactly what is happening here; as soon as a minimum amount of tax/fee tokens have accumulated, the smart contract swaps the loot into ETH and sends it to the token dev, and it does so BEFORE whatever swap was requested by the token holder, dinging the liquidity pool, causing a slightly lower sale price for the original investor.

In short: It's a system to cash out tax/fee tokens once they have reached a threshold, and make unsuspecting token holders pay the gas for the transaaction, AND also effectively doubling the tax by front-running one's own token holders sell txns.

No judgement though... it's all in the open so buyer beware.

Related Topic