Add rebalancing slippage protection#44
Conversation
64fc0d7 to
0d21a52
Compare
0d21a52 to
24cc381
Compare
|
The proposed implementation essentially checks price impact not slippage and enforces a specific number on all users. We still need the price impact protection for the rebalance function. |
|
@holyfuchs Can you be more specific about the changes you're suggesting?
The Yearn ERC4626 Router operates on vault instances satisfying IYearn4626. As I understand it, that interface adds additional functions to the vault which allow the user to specify Here's the issue description #5:
Below I'm using the term "slippage" to mean the difference between the oracle price and the price we actually realize in a swap. My interpretation of the desired behaviour here:
|
I would suggest using an implementation that doesn't require changing the core contract, unless there is a specific benefit in doing so. For example this one:
Yes, we still need this functionality for rebalancing. |
|
Got it, so from what I can see the ERC4626-Alliance ERC4626Router is the best fit for our situation then. The initial ticket mentioned the possibility of using I think we can split this into two separate PRs then:
|
24cc381 to
4692ca7
Compare
Work towards #5.
Adds slippage protection to vault rebalancing only — deposit/redeem slippage is the caller's, via the ERC4626 router (#53). The lever/delever swaps set
amountOutMinimumto the oracle-expected output lessmaxSlippageBps(1e4-scaled), tunable by the admin viasetMaxSlippageBps.