From 5b59bb46cf3bf2cee7e9e0648c35f8db1ca42789 Mon Sep 17 00:00:00 2001 From: pietro-maximoff Date: Thu, 28 Nov 2024 19:42:56 +0100 Subject: [PATCH 1/3] SOV-4609: fix ambient liq balance --- .../AmbientMarketMaking/hooks/useGetAmbientPositions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/frontend/src/app/5_pages/MarketMakingPage/components/AmbientMarketMaking/hooks/useGetAmbientPositions.ts b/apps/frontend/src/app/5_pages/MarketMakingPage/components/AmbientMarketMaking/hooks/useGetAmbientPositions.ts index 121616bb8..5636abebe 100644 --- a/apps/frontend/src/app/5_pages/MarketMakingPage/components/AmbientMarketMaking/hooks/useGetAmbientPositions.ts +++ b/apps/frontend/src/app/5_pages/MarketMakingPage/components/AmbientMarketMaking/hooks/useGetAmbientPositions.ts @@ -60,7 +60,8 @@ export const useGetAmbientPositions = (pool: AmbientLiquidityPool) => { if (ambientIndex !== -1) { const ambientPosition = positions[ambientIndex]; - ambientPosition.ambientLiq = liqBalance; + ambientPosition.ambientLiq = + ambientPosition.ambientLiq || liqBalance; // Update the ambient position with the latest balance } else if (parseFloat(liqBalance) > 0) { positions.push({ ambientLiq: liqBalance, From 2668d3a0ce51af68d4a0bd5843b8ef7533b520b1 Mon Sep 17 00:00:00 2001 From: Pietro <74987028+pietro-maximoff@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:45:16 +0100 Subject: [PATCH 2/3] Create wild-donkeys-unite.md --- .changeset/wild-donkeys-unite.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/wild-donkeys-unite.md diff --git a/.changeset/wild-donkeys-unite.md b/.changeset/wild-donkeys-unite.md new file mode 100644 index 000000000..a1a414d2e --- /dev/null +++ b/.changeset/wild-donkeys-unite.md @@ -0,0 +1,5 @@ +--- +"frontend": patch +--- + +SOV-4609: fix display ambient liq balance From 637de2d634702a37c4e5b86c565365b05bc60fff Mon Sep 17 00:00:00 2001 From: pietro-maximoff Date: Fri, 29 Nov 2024 08:21:41 +0100 Subject: [PATCH 3/3] chore: update ambient balance --- .../AmbientMarketMaking/hooks/useGetAmbientPositions.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/frontend/src/app/5_pages/MarketMakingPage/components/AmbientMarketMaking/hooks/useGetAmbientPositions.ts b/apps/frontend/src/app/5_pages/MarketMakingPage/components/AmbientMarketMaking/hooks/useGetAmbientPositions.ts index 5636abebe..015e33814 100644 --- a/apps/frontend/src/app/5_pages/MarketMakingPage/components/AmbientMarketMaking/hooks/useGetAmbientPositions.ts +++ b/apps/frontend/src/app/5_pages/MarketMakingPage/components/AmbientMarketMaking/hooks/useGetAmbientPositions.ts @@ -59,9 +59,10 @@ export const useGetAmbientPositions = (pool: AmbientLiquidityPool) => { const liqBalance = wallet.gt(0) ? wallet.toString() : lpTokenBalance; if (ambientIndex !== -1) { - const ambientPosition = positions[ambientIndex]; - ambientPosition.ambientLiq = - ambientPosition.ambientLiq || liqBalance; // Update the ambient position with the latest balance + if (parseFloat(liqBalance) > 0) { + const ambientPosition = positions[ambientIndex]; + ambientPosition.ambientLiq = liqBalance; + } } else if (parseFloat(liqBalance) > 0) { positions.push({ ambientLiq: liqBalance,