Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
arjun-io committed Jul 25, 2023
1 parent 66670c1 commit a52f06e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/perennial-vaults/contracts/balanced/BalancedVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,10 @@ contract BalancedVault is IBalancedVault, BalancedVaultDefinition, UInitializabl
*/
function _rebalancePosition(EpochContext memory context, UFixed18 claimAmount) private {
// Compute target collateral
UFixed18 targetCollateral;
if (_totalAssetsAtEpoch(context).gte(claimAmount))
targetCollateral = _totalAssetsAtEpoch(context).sub(claimAmount)
.mul(_totalSupplyAtEpoch(context).unsafeDiv(_totalSupplyAtEpoch(context).add(_redemption)))
.add(_deposit)
.div(TWO);
UFixed18 targetCollateral = _totalAssetsAtEpoch(context).max(claimAmount).sub(claimAmount)
.mul(_totalSupplyAtEpoch(context).unsafeDiv(_totalSupplyAtEpoch(context).add(_redemption)))
.add(_deposit)
.div(TWO);

if (targetCollateral.muldiv(minWeight, totalWeight).lt(controller.minCollateral()))
targetCollateral = UFixed18Lib.ZERO;
Expand Down

0 comments on commit a52f06e

Please sign in to comment.