From b1b9695998efd524af44f59922deed116195c547 Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Thu, 4 May 2023 20:23:52 +0300 Subject: [PATCH 1/5] fix(liquidity): rows duplicated wrong ag-grid row ID (#3614) --- libs/liquidity/src/lib/liquidity-data-provider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/liquidity/src/lib/liquidity-data-provider.ts b/libs/liquidity/src/lib/liquidity-data-provider.ts index 231822c8a..03fc94988 100644 --- a/libs/liquidity/src/lib/liquidity-data-provider.ts +++ b/libs/liquidity/src/lib/liquidity-data-provider.ts @@ -94,8 +94,8 @@ export const getId = ( > ) => isLpFragment(entry) - ? `${entry.party.id}${entry.status}${entry.createdAt}${entry.updatedAt}` - : `${entry.partyID}${entry.status}${entry.createdAt}${entry.updatedAt}`; + ? `${entry.party.id}${entry.status}${entry.createdAt}` + : `${entry.partyID}${entry.status}${entry.createdAt}`; export const marketLiquidityDataProvider = makeDataProvider< MarketLpQuery, From 7b15d2db1086f16d6d94b16a1806ba24650d27e3 Mon Sep 17 00:00:00 2001 From: dexturr Date: Thu, 4 May 2023 18:07:23 +0000 Subject: [PATCH 2/5] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 43 ++++++++++++-------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index b8b9d348d..b640add59 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -1,4 +1,15 @@ [ + { + "tranche_id": 58, + "tranche_start": "2023-05-11T00:00:00.000Z", + "tranche_end": "2023-06-11T00:00:00.000Z", + "total_added": "0", + "total_removed": "0", + "locked_amount": "0", + "deposits": [], + "withdrawals": [], + "users": [] + }, { "tranche_id": 57, "tranche_start": "2024-04-01T00:00:00.000Z", @@ -38,7 +49,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "959.3245960538025", - "locked_amount": "9937.5330975115729338", + "locked_amount": "9778.132284239970893725", "deposits": [ { "amount": "188", @@ -845,7 +856,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "5079.76864115505", - "locked_amount": "722.8069444444451328", + "locked_amount": "602.523981481480872", "deposits": [ { "amount": "111", @@ -4715,7 +4726,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "50929.7231498068801776055", + "locked_amount": "50870.7144382016204122711", "deposits": [ { "amount": "86666.297", @@ -4781,7 +4792,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "377.65663156288155", + "locked_amount": "374.242915649165575", "deposits": [ { "amount": "2500", @@ -4814,7 +4825,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14714.136096014493014714136096014493", + "locked_amount": "14693.8764341787435146938764341787435", "deposits": [ { "amount": "1.5e-14", @@ -4902,7 +4913,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11364.8616772342995", + "locked_amount": "11341.2254050925935", "deposits": [ { "amount": "12500", @@ -5169,7 +5180,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18334.268531307550125", + "locked_amount": "18282.77988796807875", "deposits": [ { "amount": "7500", @@ -5577,7 +5588,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "50883.256185656170147137", + "locked_amount": "50824.30131207547475805", "deposits": [ { "amount": "129999.45", @@ -5610,7 +5621,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49187.91691173374041346364", + "locked_amount": "49151.15194696213614364594", "deposits": [ { "amount": "54144.7663", @@ -5643,7 +5654,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "20836.950722983256762", + "locked_amount": "20794.3280948756986", "deposits": [ { "amount": "10000", @@ -5836,7 +5847,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1856.07401065448985", + "locked_amount": "1852.669647387113", "deposits": [ { "amount": "5000", @@ -6894,7 +6905,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "151438.7964147451270015398", + "locked_amount": "150117.9522311023317082554", "deposits": [ { "amount": "1852091.69", @@ -40766,7 +40777,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "257209.934903168881888467304", + "locked_amount": "255180.351788727463654323131", "deposits": [ { "amount": "1998.95815", @@ -42159,7 +42170,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "869802.17678213314859352", - "locked_amount": "6211737.5003512443867025914959180178169776", + "locked_amount": "6204540.728939124626399115372553117991349", "deposits": [ { "amount": "16249.93", @@ -48759,7 +48770,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6169862.126766503085603932", - "locked_amount": "13191.17171553312990484487088804078", + "locked_amount": "6547.158299684973084315598915349103", "deposits": [ { "amount": "129284.449", @@ -58869,7 +58880,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "40756.38446007669418433357128362", + "locked_amount": "40434.785414001751136630548756968", "deposits": [ { "amount": "3000", From 85e293f3ec785a6aad7b9222aa2543814e81b6bf Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Fri, 5 May 2023 02:23:33 +0300 Subject: [PATCH 3/5] fix(liquidity): use LP order ID as ag-grid row ID (#3615) --- .../src/lib/liquidity-data-provider.ts | 26 ++----------------- libs/liquidity/src/lib/liquidity-table.tsx | 3 +-- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/libs/liquidity/src/lib/liquidity-data-provider.ts b/libs/liquidity/src/lib/liquidity-data-provider.ts index 03fc94988..821567c42 100644 --- a/libs/liquidity/src/lib/liquidity-data-provider.ts +++ b/libs/liquidity/src/lib/liquidity-data-provider.ts @@ -22,7 +22,6 @@ import type { LiquidityProvisionsQueryVariables, LiquidityProvisionsUpdateSubscription, } from './__generated__/MarketLiquidity'; -import type { IterableElement } from 'type-fest'; export const liquidityProvisionsDataProvider = makeDataProvider< LiquidityProvisionsQuery, @@ -39,8 +38,8 @@ export const liquidityProvisionsDataProvider = makeDataProvider< ) => { return produce(data || [], (draft) => { deltas?.forEach((delta) => { - const id = getId(delta); - const index = draft.findIndex((a) => getId(a) === id); + const id = delta.id; + const index = draft.findIndex((a) => delta.id === id); if (index !== -1) { draft[index].commitmentAmount = delta.commitmentAmount; draft[index].fee = delta.fee; @@ -76,27 +75,6 @@ export const liquidityProvisionsDataProvider = makeDataProvider< }, }); -function isLpFragment( - entry: - | LiquidityProvisionFieldsFragment - | IterableElement< - LiquidityProvisionsUpdateSubscription['liquidityProvisions'] - > -): entry is LiquidityProvisionFieldsFragment { - return entry.__typename === 'LiquidityProvision'; -} - -export const getId = ( - entry: - | LiquidityProvisionFieldsFragment - | IterableElement< - LiquidityProvisionsUpdateSubscription['liquidityProvisions'] - > -) => - isLpFragment(entry) - ? `${entry.party.id}${entry.status}${entry.createdAt}` - : `${entry.partyID}${entry.status}${entry.createdAt}`; - export const marketLiquidityDataProvider = makeDataProvider< MarketLpQuery, MarketLpQuery, diff --git a/libs/liquidity/src/lib/liquidity-table.tsx b/libs/liquidity/src/lib/liquidity-table.tsx index e9b408681..47865558c 100644 --- a/libs/liquidity/src/lib/liquidity-table.tsx +++ b/libs/liquidity/src/lib/liquidity-table.tsx @@ -17,7 +17,6 @@ import type { ValueFormatterParams } from 'ag-grid-community'; import BigNumber from 'bignumber.js'; import { LiquidityProvisionStatusMapping } from '@vegaprotocol/types'; import type { LiquidityProvisionData } from './liquidity-data-provider'; -import { getId } from './liquidity-data-provider'; const percentageFormatter = ({ value }: ValueFormatterParams) => { if (!value) return '-'; @@ -56,7 +55,7 @@ export const LiquidityTable = forwardRef( getId(data)} + getRowId={({ data }) => data.id} ref={ref} tooltipShowDelay={500} defaultColDef={{ From 4f6ed1eadf37b837874f637c2dc01558b5a20a53 Mon Sep 17 00:00:00 2001 From: dexturr Date: Fri, 5 May 2023 00:14:53 +0000 Subject: [PATCH 4/5] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 66 +++++++++++++------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index b640add59..e3c0a83e5 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -48,8 +48,8 @@ "tranche_start": "2023-04-20T00:00:00.000Z", "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", - "total_removed": "959.3245960538025", - "locked_amount": "9778.132284239970893725", + "total_removed": "1214.9959502191275", + "locked_amount": "9614.44059587191292221375", "deposits": [ { "amount": "188", @@ -247,6 +247,11 @@ "amount": "422.1034736680125", "user": "0xf915Da10e5136352Ba049acB0545Deb119054256", "tx": "0x5932f574afe019060f5812fc89c7298ab9f768cddebe0a803c27e9914b45dc3d" + }, + { + "amount": "255.671354165325", + "user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756", + "tx": "0x92cd553dcee22eb58abadc7aab2dc8d4d9b2285943b41aacea8ed09eff5a0914" } ], "users": [ @@ -308,11 +313,17 @@ "user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756", "tranche_id": 56, "tx": "0x5f544a659ae728cc7b1a29dcda14740425cadf1f47aa74bae92bf2ade3c8093d" + }, + { + "amount": "255.671354165325", + "user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756", + "tranche_id": 56, + "tx": "0x92cd553dcee22eb58abadc7aab2dc8d4d9b2285943b41aacea8ed09eff5a0914" } ], "total_tokens": "1207.5", - "withdrawn_tokens": "341.3307146949", - "remaining_tokens": "866.1692853051" + "withdrawn_tokens": "597.002068860225", + "remaining_tokens": "610.497931139775" }, { "address": "0x33Ce1D9E53AFb7367E34749517C086405a651a95", @@ -856,7 +867,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "5079.76864115505", - "locked_amount": "602.523981481480872", + "locked_amount": "479.00314814814754512", "deposits": [ { "amount": "111", @@ -4726,7 +4737,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "50870.7144382016204122711", + "locked_amount": "50810.1172841919093407674", "deposits": [ { "amount": "86666.297", @@ -4792,7 +4803,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "374.242915649165575", + "locked_amount": "370.7373066748068", "deposits": [ { "amount": "2500", @@ -4825,7 +4836,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14693.8764341787435146938764341787435", + "locked_amount": "14673.0714070048305146730714070048305", "deposits": [ { "amount": "1.5e-14", @@ -4913,7 +4924,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11341.2254050925935", + "locked_amount": "11316.952873389695", "deposits": [ { "amount": "12500", @@ -5180,7 +5191,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18282.77988796807875", + "locked_amount": "18229.9052332719465", "deposits": [ { "amount": "7500", @@ -5588,7 +5599,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "50824.30131207547475805", + "locked_amount": "50763.759445344185166297", "deposits": [ { "amount": "129999.45", @@ -5621,7 +5632,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49151.15194696213614364594", + "locked_amount": "49113.39731426774597774478", "deposits": [ { "amount": "54144.7663", @@ -5654,7 +5665,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "20794.3280948756986", + "locked_amount": "20750.558117706745644", "deposits": [ { "amount": "10000", @@ -5847,7 +5858,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1852.669647387113", + "locked_amount": "1849.17364282090325", "deposits": [ { "amount": "5000", @@ -6905,7 +6916,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "150117.9522311023317082554", + "locked_amount": "148761.5525361821611038764", "deposits": [ { "amount": "1852091.69", @@ -40777,7 +40788,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "255180.351788727463654323131", + "locked_amount": "253095.943179135403450236224", "deposits": [ { "amount": "1998.95815", @@ -42170,7 +42181,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "869802.17678213314859352", - "locked_amount": "6204540.728939124626399115372553117991349", + "locked_amount": "6197149.5498413355214668656878001982333063", "deposits": [ { "amount": "16249.93", @@ -48770,7 +48781,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6169862.126766503085603932", - "locked_amount": "6547.158299684973084315598915349103", + "locked_amount": "0", "deposits": [ { "amount": "129284.449", @@ -58879,8 +58890,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "44078.8527972103416", - "locked_amount": "40434.785414001751136630548756968", + "total_removed": "44110.3307271943416", + "locked_amount": "40104.498954824267000350197970596", "deposits": [ { "amount": "3000", @@ -65534,6 +65545,11 @@ "user": "0x4d4AA3f302cbA998AAFC03F9d73484434ed9Fd53", "tx": "0x1e4902d0a3cb7b4f2ba7119dfcaa681a784e1d724c984961767e9feaa078fe54" }, + { + "amount": "31.477929984", + "user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1", + "tx": "0x1b9ddd24634b4c6eab202f0a65dc0d3119fbc5502cbac5086352eab14ebd7b02" + }, { "amount": "168.502276762", "user": "0x38A292CB98Dc602ECAFF94E8E5fADD9800e4bA13", @@ -84359,6 +84375,12 @@ } ], "withdrawals": [ + { + "amount": "31.477929984", + "user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1", + "tranche_id": 5, + "tx": "0x1b9ddd24634b4c6eab202f0a65dc0d3119fbc5502cbac5086352eab14ebd7b02" + }, { "amount": "19.918569252", "user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1", @@ -84403,8 +84425,8 @@ } ], "total_tokens": "400", - "withdrawn_tokens": "334.458891424", - "remaining_tokens": "65.541108576" + "withdrawn_tokens": "365.936821408", + "remaining_tokens": "34.063178592" }, { "address": "0x3738bec36216eA2F11B954891C65AAd1Bc852156", From 023a83e0f7c2dc192f1b9e43aa60c8a47f52e1ac Mon Sep 17 00:00:00 2001 From: dexturr Date: Fri, 5 May 2023 06:08:12 +0000 Subject: [PATCH 5/5] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index e3c0a83e5..b76a81c6b 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -49,7 +49,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "1214.9959502191275", - "locked_amount": "9614.44059587191292221375", + "locked_amount": "9457.0664415991503175975", "deposits": [ { "amount": "188", @@ -867,7 +867,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "5079.76864115505", - "locked_amount": "479.00314814814754512", + "locked_amount": "360.24949074073997136", "deposits": [ { "amount": "111", @@ -4737,7 +4737,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "50810.1172841919093407674", + "locked_amount": "50751.8588230648417449891", "deposits": [ { "amount": "86666.297", @@ -4803,7 +4803,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "370.7373066748068", + "locked_amount": "367.3669935388685", "deposits": [ { "amount": "2500", @@ -4836,7 +4836,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14673.0714070048305146730714070048305", + "locked_amount": "14653.0693312198065146530693312198065", "deposits": [ { "amount": "1.5e-14", @@ -4924,7 +4924,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11316.952873389695", + "locked_amount": "11293.61711830716525", "deposits": [ { "amount": "12500", @@ -5191,7 +5191,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18229.9052332719465", + "locked_amount": "18179.07122851442625", "deposits": [ { "amount": "7500", @@ -5599,7 +5599,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "50763.759445344185166297", + "locked_amount": "50705.5541377325336221035", "deposits": [ { "amount": "129999.45", @@ -5632,7 +5632,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49113.39731426774597774478", + "locked_amount": "49077.09978780568889746099", "deposits": [ { "amount": "54144.7663", @@ -5665,7 +5665,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "20750.558117706745644", + "locked_amount": "20708.477403602233016", "deposits": [ { "amount": "10000", @@ -5858,7 +5858,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1849.17364282090325", + "locked_amount": "1845.81256341958375", "deposits": [ { "amount": "5000", @@ -6916,7 +6916,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "148761.5525361821611038764", + "locked_amount": "147457.5018725717723958", "deposits": [ { "amount": "1852091.69", @@ -40788,7 +40788,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "253095.943179135403450236224", + "locked_amount": "251092.165858100635559352498", "deposits": [ { "amount": "1998.95815", @@ -42181,7 +42181,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "869802.17678213314859352", - "locked_amount": "6197149.5498413355214668656878001982333063", + "locked_amount": "6190044.28411574715560088425053188532414163", "deposits": [ { "amount": "16249.93", @@ -58891,7 +58891,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44110.3307271943416", - "locked_amount": "40104.498954824267000350197970596", + "locked_amount": "39786.9889842268933819326661593", "deposits": [ { "amount": "3000",