You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This function is called during rebalance, iterateRebalance, ripcord and disengage.
717
+
// Assert currentLeverageRatio is 0 as the set should be engaged before this function is called.
718
+
require(currentLeverageRatio.absUint256() >0, "Current leverage ratio must NOT be 0");
719
+
719
720
returnLeverageInfo({
720
721
action: actionInfo,
721
722
currentLeverageRatio: currentLeverageRatio,
@@ -973,6 +974,7 @@ contract PerpV2LeverageStrategyExtension is BaseExtension {
973
974
* Calculate total notional rebalance quantity and chunked rebalance quantity in base asset units for engaging the SetToken. Used in engage().
974
975
* Leverage ratio (for the base asset) is zero before engage. We open a new base asset position with size equals to (collateralBalance * targetLeverageRatio / baseAssetPrice)
975
976
* to gain (targetLeverageRatio * collateralBalance) worth of exposure to the base asset.
977
+
* Note: We can't use `_calculateChunkRebalanceNotional` function because CLR is 0 during engage and it would lead to a divison by zero error.
976
978
*
977
979
* return int256 Chunked rebalance notional in base asset units
978
980
* return int256 Total rebalance notional in base asset units
0 commit comments