Lucene search

K
code423n4Code4renaCODE423N4:2022-01-DEV-TEST-REPO-FINDINGS-ISSUES-252
HistoryDec 12, 2023 - 12:00 a.m.

Fee-on-transfer/rebasing tokens will have problems when swapping

2023-12-1200:00:00
Code4rena
github.com
4
uniswap v3
fee-on-transfer tokens
rebasing tokens
uniswap v2
smart contracts

7.1 High

AI Score

Confidence

Low

Lines of code


110

Vulnerability details


Uniswap v3 does not support rebasing or fee-on-transfer tokens so using these tokens with it will result funds getting stuck. With fee-on-transfer tokens, if the balance isnโ€™t checked, the wrong amount may be transferred out. With rebasing tokens, the contract may have some remaining residual balance after the fixed amount is transferred out. Uniswap v2 does support them but only with the โ€œSupportingFeeOnTransferโ€ swap variants.

File: contracts/Swapper/CurveSwapper.sol

110              yieldBox
111          );
112  
113          // Retrieve tokens from sender or from YieldBox
114          amountIn = _extractTokens(
115              swapData.yieldBoxData,
116              yieldBox,
117              tokenIn,
118              swapData.tokensData.tokenInId,
119              amountIn,
120              swapData.amountData.shareIn
121          );
122  
123          // Swap & compute output
124          amountOut = _swapTokensForTokens(
125              int128(int256(tokenIndexes[0])),
126              int128(int256(tokenIndexes[1])),
127              amountIn,
128              amountOutMin
129          );
130          if (swapData.yieldBoxData.depositToYb) {
131              _safeApprove(tokenOut, address(yieldBox), amountOut);
132              (, shareOut) = yieldBox.depositAsset(
133                  swapData.tokensData.tokenOutId,
134                  address(this),
135                  to,
136                  amountOut,
137                  0
138              );
139          } else {
140              IERC20(tokenOut).safeTransfer(to, amountOut);
141          }
142:     }

Assessed type


other


The text was updated successfully, but these errors were encountered:

All reactions

7.1 High

AI Score

Confidence

Low