From be8de04686732789bea529f1e59759fda6f07300 Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Thu, 14 Mar 2024 18:42:23 +0200 Subject: [PATCH] feat(trading): add cap reward fee multiple on the reward cards (#5999) --- .../rewards-container/active-rewards.tsx | 19 +++++++++++++ apps/trading/lib/hooks/Rewards.graphql | 1 + .../lib/hooks/__generated__/Rewards.ts | 3 ++- libs/i18n/src/locales/en/trading.json | 2 ++ libs/types/src/__generated__/types.ts | 27 +++++++++++++++++++ 5 files changed, 51 insertions(+), 1 deletion(-) diff --git a/apps/trading/components/rewards-container/active-rewards.tsx b/apps/trading/components/rewards-container/active-rewards.tsx index bf281f5dd..06515b335 100644 --- a/apps/trading/components/rewards-container/active-rewards.tsx +++ b/apps/trading/components/rewards-container/active-rewards.tsx @@ -384,6 +384,25 @@ const RewardCard = ({ })} + {/** CAPPED AT */} + {dispatchStrategy.capRewardFeeMultiple && ( + + {t('Capped at')} + + + x{dispatchStrategy.capRewardFeeMultiple} + + + + )} {/** DISPATCH METRIC DESCRIPTION */} {dispatchStrategy?.dispatchMetric && ( diff --git a/apps/trading/lib/hooks/Rewards.graphql b/apps/trading/lib/hooks/Rewards.graphql index ba72d9e63..921d6ef1b 100644 --- a/apps/trading/lib/hooks/Rewards.graphql +++ b/apps/trading/lib/hooks/Rewards.graphql @@ -79,6 +79,7 @@ query ActiveRewards( startEpoch endEpoch dispatchStrategy { + capRewardFeeMultiple dispatchMetric dispatchMetricAssetId marketIdsInScope diff --git a/apps/trading/lib/hooks/__generated__/Rewards.ts b/apps/trading/lib/hooks/__generated__/Rewards.ts index 2ea7adf12..5b3f7ee69 100644 --- a/apps/trading/lib/hooks/__generated__/Rewards.ts +++ b/apps/trading/lib/hooks/__generated__/Rewards.ts @@ -18,7 +18,7 @@ export type ActiveRewardsQueryVariables = Types.Exact<{ }>; -export type ActiveRewardsQuery = { __typename?: 'Query', transfersConnection?: { __typename?: 'TransferConnection', edges?: Array<{ __typename?: 'TransferEdge', node: { __typename?: 'TransferNode', transfer: { __typename?: 'Transfer', amount: string, id: string, from: string, fromAccountType: Types.AccountType, to: string, toAccountType: Types.AccountType, reference?: string | null, status: Types.TransferStatus, timestamp: any, gameId?: string | null, reason?: string | null, asset?: { __typename?: 'Asset', id: string, symbol: string, decimals: number, name: string, quantum: string, status: Types.AssetStatus } | null, kind: { __typename?: 'OneOffGovernanceTransfer' } | { __typename?: 'OneOffTransfer' } | { __typename?: 'RecurringGovernanceTransfer' } | { __typename?: 'RecurringTransfer', startEpoch: number, endEpoch?: number | null, dispatchStrategy?: { __typename?: 'DispatchStrategy', dispatchMetric: Types.DispatchMetric, dispatchMetricAssetId: string, marketIdsInScope?: Array | null, entityScope: Types.EntityScope, individualScope?: Types.IndividualScope | null, teamScope?: Array | null, nTopPerformers?: string | null, stakingRequirement: string, notionalTimeWeightedAveragePositionRequirement: string, windowLength: number, lockPeriod: number, distributionStrategy: Types.DistributionStrategy, rankTable?: Array<{ __typename?: 'RankTable', startRank: number, shareRatio: number } | null> | null } | null } }, fees?: Array<{ __typename?: 'TransferFee', transferId: string, amount: string, epoch: number } | null> | null } } | null> | null } | null }; +export type ActiveRewardsQuery = { __typename?: 'Query', transfersConnection?: { __typename?: 'TransferConnection', edges?: Array<{ __typename?: 'TransferEdge', node: { __typename?: 'TransferNode', transfer: { __typename?: 'Transfer', amount: string, id: string, from: string, fromAccountType: Types.AccountType, to: string, toAccountType: Types.AccountType, reference?: string | null, status: Types.TransferStatus, timestamp: any, gameId?: string | null, reason?: string | null, asset?: { __typename?: 'Asset', id: string, symbol: string, decimals: number, name: string, quantum: string, status: Types.AssetStatus } | null, kind: { __typename?: 'OneOffGovernanceTransfer' } | { __typename?: 'OneOffTransfer' } | { __typename?: 'RecurringGovernanceTransfer' } | { __typename?: 'RecurringTransfer', startEpoch: number, endEpoch?: number | null, dispatchStrategy?: { __typename?: 'DispatchStrategy', capRewardFeeMultiple?: string | null, dispatchMetric: Types.DispatchMetric, dispatchMetricAssetId: string, marketIdsInScope?: Array | null, entityScope: Types.EntityScope, individualScope?: Types.IndividualScope | null, teamScope?: Array | null, nTopPerformers?: string | null, stakingRequirement: string, notionalTimeWeightedAveragePositionRequirement: string, windowLength: number, lockPeriod: number, distributionStrategy: Types.DistributionStrategy, rankTable?: Array<{ __typename?: 'RankTable', startRank: number, shareRatio: number } | null> | null } | null } }, fees?: Array<{ __typename?: 'TransferFee', transferId: string, amount: string, epoch: number } | null> | null } } | null> | null } | null }; export type RewardsHistoryQueryVariables = Types.Exact<{ partyId: Types.Scalars['ID']; @@ -150,6 +150,7 @@ export const ActiveRewardsDocument = gql` startEpoch endEpoch dispatchStrategy { + capRewardFeeMultiple dispatchMetric dispatchMetricAssetId marketIdsInScope diff --git a/libs/i18n/src/locales/en/trading.json b/libs/i18n/src/locales/en/trading.json index 3d36c192d..4913a7ce5 100644 --- a/libs/i18n/src/locales/en/trading.json +++ b/libs/i18n/src/locales/en/trading.json @@ -29,6 +29,7 @@ "Best offer": "Best offer", "Browse": "Browse", "By using the Vega Console, you acknowledge that you have read and understood the <0>Vega Console Disclaimer": "By using the Vega Console, you acknowledge that you have read and understood the <0>Vega Console Disclaimer", + "Capped at": "Capped at", "Cancel": "Cancel", "Change (24h)": "Change (24h)", "Changes have been proposed for this market. <0>View proposals": "Changes have been proposed for this market. <0>View proposals", @@ -299,6 +300,7 @@ "Rewards funded using the pro-rata strategy should be distributed pro-rata by each entity's reward metric scaled by any active multipliers that party has": " Rewards funded using the pro-rata strategy should be distributed pro-rata by each entity's reward metric scaled by any active multipliers that party has", "Rewards history": "Rewards history", "Rewards multipliers": "Rewards multipliers", + "Reward will be capped at {{capRewardFeeMultiple}} X of taker fees paid in the epoch": "Reward will be capped at {{capRewardFeeMultiple}} X of taker fees paid in the epoch", "SCCR": "SCCR", "Search": "Search", "See all markets": "See all markets", diff --git a/libs/types/src/__generated__/types.ts b/libs/types/src/__generated__/types.ts index 7dde3b7b5..20d039b53 100644 --- a/libs/types/src/__generated__/types.ts +++ b/libs/types/src/__generated__/types.ts @@ -4959,6 +4959,8 @@ export type Query = { * If a team does not have at least the number of epochs worth of data, it is ignored. */ teamsStatistics?: Maybe; + /** Time weighted notional position is a metric used to determine if a reward should be paid to a party */ + timeWeightedNotionalPosition?: Maybe; /** Get total transfer fee discount available */ totalTransferFeeDiscount?: Maybe; /** Get a list of all trades and apply any given filters to the results */ @@ -5462,6 +5464,15 @@ export type QueryteamsStatisticsArgs = { }; +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerytimeWeightedNotionalPositionArgs = { + assetId: Scalars['ID']; + epochSeq?: InputMaybe; + gameId: Scalars['ID']; + partyId: Scalars['ID']; +}; + + /** Queries allow a caller to read data and filter data via GraphQL. */ export type QuerytotalTransferFeeDiscountArgs = { assetId: Scalars['String']; @@ -6615,6 +6626,22 @@ export type TimeUpdate = { timestamp: Scalars['Timestamp']; }; +export type TimeWeightedNotionalPosition = { + __typename?: 'TimeWeightedNotionalPosition'; + /** Settlement asset for this position */ + assetId: Scalars['ID']; + /** Epoch the time weighted notional position was calculated for */ + epoch: Scalars['Int']; + /** Game the time weighted notional position was calculated for */ + gameId: Scalars['ID']; + /** Time of the last block in which the metric was updated */ + lastUpdated: Scalars['Timestamp']; + /** Party holding the position */ + partyId: Scalars['ID']; + /** Time weighted notional position */ + timeWeightedNotionalPosition: Scalars['String']; +}; + /** Returns total transfer fee discount available */ export type TotalTransferFeeDiscount = { __typename?: 'TotalTransferFeeDiscount';