feat(1355): lp dashboard adding equity like share (#2017)

* refactor: use the lpAggregatedDataProvider rather than liquidityProvisionsDataProvider

The lpAggregatedDataProvider seems to provide the same data as the
liquidityProvisionsDataProvider, but also contains further details that
we'll need for other fields on the liquitidy provider details page.

* feat: replace GALPS with equity-like share and fetch value from LiquidityProviderFeeShare

Updates the type for LiquidityProviders prop to more accurately reflect
that we're using the data from lpAggregatedDataProvider, which includes
the fee share data.

We use the fee share data to display equity-like share % for each LP, and
have replaced GALPS, which was previously empty, with this value.
This commit is contained in:
Ciaran McGhie 2022-11-10 14:08:57 +00:00 committed by GitHub
parent dccc750154
commit 045454b484
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 7 deletions

View File

@ -11,7 +11,7 @@ import {
getFeeLevels,
sumLiquidityCommitted,
marketLiquidityDataProvider,
liquidityProvisionsDataProvider,
lpAggregatedDataProvider,
} from '@vegaprotocol/liquidity';
import type { MarketLpQuery } from '@vegaprotocol/liquidity';
@ -34,10 +34,10 @@ const formatMarket = (data: MarketLpQuery) => {
};
export const lpDataProvider = makeDerivedDataProvider(
[marketLiquidityDataProvider, liquidityProvisionsDataProvider],
([market, providers]) => ({
[marketLiquidityDataProvider, lpAggregatedDataProvider],
([market, lpAggregatedData]) => ({
market: { ...formatMarket(market) },
liquidityProviders: providers || [],
liquidityProviders: lpAggregatedData || [],
})
);

View File

@ -4,7 +4,10 @@ import { AgGridColumn } from 'ag-grid-react';
import type { GetRowIdParams } from 'ag-grid-community';
import { t } from '@vegaprotocol/react-helpers';
import type { LiquidityProvisionFieldsFragment } from '@vegaprotocol/liquidity';
import type {
LiquidityProviderFeeShareFieldsFragment,
LiquidityProvisionFieldsFragment,
} from '@vegaprotocol/liquidity';
import { formatWithAsset } from '@vegaprotocol/liquidity';
import { Grid } from '../../grid';
@ -24,7 +27,8 @@ export const LPProvidersGrid = ({
liquidityProviders,
settlementAsset,
}: {
liquidityProviders: LiquidityProvisionFieldsFragment[];
liquidityProviders: LiquidityProvisionFieldsFragment &
LiquidityProviderFeeShareFieldsFragment[];
settlementAsset: {
decimals?: number;
symbol?: string;
@ -55,7 +59,14 @@ export const LPProvidersGrid = ({
valueFormatter={formatToHours}
field="createdAt"
/>
<AgGridColumn headerName={t('Galps')} field="Galps" />
<AgGridColumn
headerName={t('Equity-like share')}
field="equityLikeShare"
valueFormatter={({ value }: { value?: string | null }) => {
const valueOr0 = value ? value : '';
return `${parseInt(valueOr0) * 100}%`;
}}
/>
<AgGridColumn
headerName={t('committed bond/stake')}
field="commitmentAmount"