diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index b8b9d348d..b76a81c6b 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", @@ -37,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": "9937.5330975115729338", + "total_removed": "1214.9959502191275", + "locked_amount": "9457.0664415991503175975", "deposits": [ { "amount": "188", @@ -236,6 +247,11 @@ "amount": "422.1034736680125", "user": "0xf915Da10e5136352Ba049acB0545Deb119054256", "tx": "0x5932f574afe019060f5812fc89c7298ab9f768cddebe0a803c27e9914b45dc3d" + }, + { + "amount": "255.671354165325", + "user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756", + "tx": "0x92cd553dcee22eb58abadc7aab2dc8d4d9b2285943b41aacea8ed09eff5a0914" } ], "users": [ @@ -297,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", @@ -845,7 +867,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "5079.76864115505", - "locked_amount": "722.8069444444451328", + "locked_amount": "360.24949074073997136", "deposits": [ { "amount": "111", @@ -4715,7 +4737,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "50929.7231498068801776055", + "locked_amount": "50751.8588230648417449891", "deposits": [ { "amount": "86666.297", @@ -4781,7 +4803,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "377.65663156288155", + "locked_amount": "367.3669935388685", "deposits": [ { "amount": "2500", @@ -4814,7 +4836,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14714.136096014493014714136096014493", + "locked_amount": "14653.0693312198065146530693312198065", "deposits": [ { "amount": "1.5e-14", @@ -4902,7 +4924,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11364.8616772342995", + "locked_amount": "11293.61711830716525", "deposits": [ { "amount": "12500", @@ -5169,7 +5191,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18334.268531307550125", + "locked_amount": "18179.07122851442625", "deposits": [ { "amount": "7500", @@ -5577,7 +5599,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "50883.256185656170147137", + "locked_amount": "50705.5541377325336221035", "deposits": [ { "amount": "129999.45", @@ -5610,7 +5632,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49187.91691173374041346364", + "locked_amount": "49077.09978780568889746099", "deposits": [ { "amount": "54144.7663", @@ -5643,7 +5665,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "20836.950722983256762", + "locked_amount": "20708.477403602233016", "deposits": [ { "amount": "10000", @@ -5836,7 +5858,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1856.07401065448985", + "locked_amount": "1845.81256341958375", "deposits": [ { "amount": "5000", @@ -6894,7 +6916,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "151438.7964147451270015398", + "locked_amount": "147457.5018725717723958", "deposits": [ { "amount": "1852091.69", @@ -40766,7 +40788,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "257209.934903168881888467304", + "locked_amount": "251092.165858100635559352498", "deposits": [ { "amount": "1998.95815", @@ -42159,7 +42181,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "869802.17678213314859352", - "locked_amount": "6211737.5003512443867025914959180178169776", + "locked_amount": "6190044.28411574715560088425053188532414163", "deposits": [ { "amount": "16249.93", @@ -48759,7 +48781,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6169862.126766503085603932", - "locked_amount": "13191.17171553312990484487088804078", + "locked_amount": "0", "deposits": [ { "amount": "129284.449", @@ -58868,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": "40756.38446007669418433357128362", + "total_removed": "44110.3307271943416", + "locked_amount": "39786.9889842268933819326661593", "deposits": [ { "amount": "3000", @@ -65523,6 +65545,11 @@ "user": "0x4d4AA3f302cbA998AAFC03F9d73484434ed9Fd53", "tx": "0x1e4902d0a3cb7b4f2ba7119dfcaa681a784e1d724c984961767e9feaa078fe54" }, + { + "amount": "31.477929984", + "user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1", + "tx": "0x1b9ddd24634b4c6eab202f0a65dc0d3119fbc5502cbac5086352eab14ebd7b02" + }, { "amount": "168.502276762", "user": "0x38A292CB98Dc602ECAFF94E8E5fADD9800e4bA13", @@ -84348,6 +84375,12 @@ } ], "withdrawals": [ + { + "amount": "31.477929984", + "user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1", + "tranche_id": 5, + "tx": "0x1b9ddd24634b4c6eab202f0a65dc0d3119fbc5502cbac5086352eab14ebd7b02" + }, { "amount": "19.918569252", "user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1", @@ -84392,8 +84425,8 @@ } ], "total_tokens": "400", - "withdrawn_tokens": "334.458891424", - "remaining_tokens": "65.541108576" + "withdrawn_tokens": "365.936821408", + "remaining_tokens": "34.063178592" }, { "address": "0x3738bec36216eA2F11B954891C65AAd1Bc852156", diff --git a/libs/liquidity/src/lib/liquidity-data-provider.ts b/libs/liquidity/src/lib/liquidity-data-provider.ts index 231822c8a..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.updatedAt}` - : `${entry.partyID}${entry.status}${entry.createdAt}${entry.updatedAt}`; - 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={{