Closed banteg closed 3 years ago
yHegic strategies are also doing that same fix: https://github.com/Macarse/yhegic/blob/master/contracts/strategies/StrategyHegic.sol#L102-L103
A better fix suggested by Sam https://github.com/banteg/strategy-uni-lp-pickle/commit/08f849a5639086b34c9dca248662ac4330a8bedb
It is intended that the implementer be aware of the amount freed, and that it should exceed neither the amount needed nor the amount the strategy currently has available to it locally. It is only intended to use this function in withdraw
but we can discuss further of how it could be used in other functions to reduce duplicated code in strategies.
If
liquidatePosition(uint256 _amountNeeded)(uint256 _amountFreed)
frees more than expected, it causes underflow down the line. This should be handled at BaseStrategy level and not cause an error.Use this Strategy fix for now https://github.com/banteg/strategy-uni-lp-pickle/commit/fc8da9e0133b59dc19e26f5df79f6e2d836a7f78