Velvet-Capital / Velvet-v4

V4 (thena+venus) on top of v3
Other
0 stars 0 forks source link

Slippage protection when swapping to reinvest #9

Closed langnavina97 closed 1 month ago

langnavina97 commented 3 months ago

When a user increases or decreases liquidity the tokens (fees earned) must be swapped into the correct ratio to reinvest them without having any big dust.

The user will pass the swap amount and the ratio is being verified to make sure the amount can't be manipulated to benefit the user.

The amountOut defines how many tokens out are expected, the parameter will be passed by the user. The user in this case is not a trusted actor of the system, we need to add a verification using a price oracle or similar.