Closed sherlock-admin closed 2 years ago
The minimum sent to the YieldSpace pool will generally be in terms of the return expected.
In this case, because we are sending shares, the return expected will be in assets, hence the minimum is in terms of assets.
HonorLt
medium
Wrong default slippage
Summary
When withdrawing and selling the principal token it incorrectly calculates the default slippage.
Vulnerability Detail
When withdrawing in ERC5095 it sells
shares
but calculates slippage ona
underlying:One more issue regarding slippage: function yield reverts when
received = m
:It should be okay if you received the exact minimum amount, so the condition has to be
<
here.Impact
This may lead to unpredicted slippage control when the amount of underlying and shares differs much.
Code Snippet
https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/tokens/ERC5095.sol#L216-L224
https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/Lender.sol#L951-L954
Tool used
Manual Review
Recommendation
Based on my understanding, the slippage should be: