UniswapV2 Router Flaw: Double Taxation

The UniswapV2 router exposes two distinct functions for removing liquidity with transfer-tax token pairs:

a) removeLiquidity

b) removeLiquidityETHSupportingFeeOnTransferTokens

The Standard Liquidity Removal: removeLiquidity

The removeLiquidity function is straightforward: it allows liquidity providers to withdraw their share of tokens directly from the liquidity pool to their address. Here, both assets of the liquidity pair are transferred directly to the liquidity provider’s wallet. This is the most common scenario if a user does not necessarily need native ETH but also can accept WETH.

The removal with native ETH:


Things get a bit more complex with the removeLiquidityETHSupportingFeeOnTransferTokens function. This function is designed specifically for scenarios where one of the tokens in the pair includes a transfer tax AND the user aims to receive ETH instead of WETH. It differs from the standard removeLiquidity in that it not only removes liquidity but also unwraps Wrapped Ether (WETH) to Ether (ETH), directly transferring the native ETH to the recipient's address.

The critical distinction here is in the transfer process: When invoking this function, both tokens are first transferred to the router contract itself. This intermediary step is necessary to unwrap the WETH to ETH. However, this leads to significant implications for liquidity pairs that include a transfer-tax token.

The Double Taxation Issue

The introduction of the intermediate step (transferring tokens first to the router) triggers the transfer tax twice:

1. From the Liquidity Pair to the Router: This initial transfer incurs a tax as per the token's transfer tax rules.

2. From the Router to the Recipient: When the router then forwards these tokens to the user's wallet, the transfer tax is applied again.

This double taxation can substantially reduce the amount of tokens a user receives from the transaction, effectively resulting in a higher cost to remove liquidity for pairs that include a transfer-tax token.

Given the financial impact, it's crucial for interfaces leveraging UniswapV2 to clearly communicate these nuances to users. Many investors may not be aware of the additional costs associated with removing liquidity via the removeLiquidityETHSupportingFeeOnTransferTokens function.

"I guess a few million $ have been lost to date due to this little issue."

Link to the article