From b8b98cb01edb54e1d8c4a1d19a41f88341e7b504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Pr=C3=A9vost?= <998369+prevostc@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:43:13 +0100 Subject: [PATCH] Fix initial position value --- src/vault-interaction.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vault-interaction.ts b/src/vault-interaction.ts index 1294623..8b66625 100644 --- a/src/vault-interaction.ts +++ b/src/vault-interaction.ts @@ -209,10 +209,10 @@ function updateUserPosition( const positionValueUSDDelta = position.positionValueUSD.minus(previousPositionValueUSD) if (isNewPosition) { position.initialUnderlyingBalance0 = position.underlyingBalance0 - position.initialUnderlyingBalance1 = position.underlyingBalance0 - position.initialUnderlyingBalance0USD = position.underlyingBalance0 - position.initialUnderlyingBalance1USD = position.underlyingBalance0 - position.initialPositionValueUSD = position.underlyingBalance0 + position.initialUnderlyingBalance1 = position.underlyingBalance1 + position.initialUnderlyingBalance0USD = position.underlyingBalance0USD + position.initialUnderlyingBalance1USD = position.underlyingBalance1USD + position.initialPositionValueUSD = position.positionValueUSD } else { // apply the share balance percent change to the initial position value const mult = shareBalancePercentChange.plus(ONE_BD)