From ee431a1d5d0343eaee40215ae111a91d773c92c6 Mon Sep 17 00:00:00 2001 From: Arjun Rao <2940142+arjun-io@users.noreply.github.com> Date: Thu, 16 Nov 2023 12:51:03 -0500 Subject: [PATCH] Fix vault when position at target --- .../contracts/single-balanced/SingleBalancedVault.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/perennial-vaults/contracts/single-balanced/SingleBalancedVault.sol b/packages/perennial-vaults/contracts/single-balanced/SingleBalancedVault.sol index c4296d8c..22e8bf03 100644 --- a/packages/perennial-vaults/contracts/single-balanced/SingleBalancedVault.sol +++ b/packages/perennial-vaults/contracts/single-balanced/SingleBalancedVault.sol @@ -439,8 +439,10 @@ contract SingleBalancedVault is ISingleBalancedVault, UInitializable { if (targetPosition.lt(currentPosition)) product.closeMake(currentPosition.sub(targetPosition)); - if (targetPosition.gte(currentPosition)) + if (targetPosition.gt(currentPosition)) product.openMake(targetPosition.sub(currentPosition).min(makerAvailable)); + if (targetPosition.eq(currentPosition)) + product.closeMake(UFixed18Lib.ZERO); emit PositionUpdated(product, targetPosition); }