Fujicracy / fuji-v2

Cross-chain money market aggregator
https://fuji-v2-frontend.vercel.app
15 stars 10 forks source link

CS - Swapper - slippage too high protection #217

Closed 0xdcota closed 1 year ago

0xdcota commented 1 year ago

Where: https://github.com/Fujicracy/fuji-v2/blob/bffa427797ad8d6df63671868ee8823574e044ca/packages/protocol/src/swappers/UniswapV2Swapper.sol#L81-L83

Description: Assumptions behind this mechanism is to protect users from overpaying for token swaps. The minSweepOut parameter is a minimum required amount that users expect to get back from the initial amountIn, in order for the swap to succeed.

For example:

There are two issues with this mechanism:

Recommendation: