First Flight #18: T-Swap

First Flight #18
Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: medium
Valid

t-swap does not support token with fee on transfer

Summary

T-Swap does not support tokens with fee-on-transfer

Vulnerability Details

In T-swap, when we transfer tokens to our contract, we don't check the actual received token amount. This will work well in most cases except the tokens with fee on transfer.
If we transfer tokens with fee on transfer, we will get less tokens than we think. This will break our invariant.

function _addLiquidityMintAndTransfer(
uint256 wethToDeposit,
uint256 poolTokensToDeposit,
uint256 liquidityTokensToMint
) private {
_mint(msg.sender, liquidityTokensToMint);
emit LiquidityAdded(msg.sender, poolTokensToDeposit, wethToDeposit);
// Interactions
// @audit fee on transfer Token
i_wethToken.safeTransferFrom(msg.sender, address(this), wethToDeposit);
i_poolToken.safeTransferFrom(
msg.sender,
address(this),
poolTokensToDeposit
);
}

Impact

Our invariant will be broken. Our constant k will decrease when we deposit.

Tools Used

Manual

Recommendations

Refer to the uniswap v2, check the actual received amount

Updates

Appeal created

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

FoT

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.