0x52 - AuraSpell#closePositionFarm requires users to swap all reward tokens through same router
sherlock-admin opened this issue · 2 comments
sherlock-admin commented
0x52
medium
AuraSpell#closePositionFarm requires users to swap all reward tokens through same router
Summary
AuraSpell#closePositionFarm requires users to swap all reward tokens through same router. This is problematic as it is very unlikely that a UniswapV2 router will have good liquidity sources for all tokens and will result in users experiencing forced losses to their reward token.
Vulnerability Detail
for (uint256 i = 0; i < rewardTokens.length; i++) {
uint256 rewards = _doCutRewardsFee(rewardTokens[i]);
_ensureApprove(rewardTokens[i], address(swapRouter), rewards);
swapRouter.swapExactTokensForTokens(
rewards,
0,
swapPath[i],
address(this),
type(uint256).max
);
}
All tokens are forcibly swapped through a single router.
Impact
Users will be forced to swap through a router even if it doesn't have good liquidity for all tokens
Code Snippet
Tool used
Manual Review
Recommendation
Allow users to use an aggregator like paraswap or multiple routers instead of only one single UniswapV2 router.
Gornutz commented
IAm0x52 commented
ConvexSpell needs similar fix