diff --git a/apps/governance/src/routes/home/index.tsx b/apps/governance/src/routes/home/index.tsx index 98ddff74d..6ae4df185 100644 --- a/apps/governance/src/routes/home/index.tsx +++ b/apps/governance/src/routes/home/index.tsx @@ -188,6 +188,7 @@ const GovernanceHome = ({ name }: RouteChildProps) => { variables: { includeNewMarketProductFields: !!FLAGS.PRODUCT_PERPETUALS, includeUpdateMarketStates: !!FLAGS.UPDATE_MARKET_STATE, + includeUpdateReferralPrograms: !!FLAGS.REFERRALS, }, }); diff --git a/apps/governance/src/routes/proposals/proposal/Proposal.graphql b/apps/governance/src/routes/proposals/proposal/Proposal.graphql index 194baf983..0cea759b1 100644 --- a/apps/governance/src/routes/proposals/proposal/Proposal.graphql +++ b/apps/governance/src/routes/proposals/proposal/Proposal.graphql @@ -43,10 +43,36 @@ fragment UpdateMarketState on Proposal { } } +fragment UpdateReferralProgram on Proposal { + terms { + change { + ... on UpdateReferralProgram { + changes { + id + version + benefitTiers { + minimumEpochs + minimumRunningNotionalTakerVolume + referralDiscountFactor + referralRewardFactor + } + endOfProgramTimestamp + windowLength + stakingTiers { + minimumStakedTokens + referralRewardMultiplier + } + } + } + } + } +} + query Proposal( $proposalId: ID! $includeNewMarketProductField: Boolean! $includeUpdateMarketState: Boolean! + $includeUpdateReferralProgram: Boolean! ) { proposal(id: $proposalId) { id @@ -64,6 +90,7 @@ query Proposal( errorDetails ...NewMarketProductField @include(if: $includeNewMarketProductField) ...UpdateMarketState @include(if: $includeUpdateMarketState) + ...UpdateReferralProgram @include(if: $includeUpdateReferralProgram) terms { closingDatetime enactmentDatetime diff --git a/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts b/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts index 850399ab0..08219753e 100644 --- a/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts +++ b/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts @@ -7,14 +7,17 @@ export type NewMarketProductFieldFragment = { __typename?: 'Proposal', terms: { export type UpdateMarketStateFragment = { __typename?: 'Proposal', terms: { __typename?: 'ProposalTerms', change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateMarketState', updateType: Types.MarketUpdateType, price?: string | null, market: { __typename?: 'Market', decimalPlaces: number, id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string, product: { __typename: 'Future', quoteName: string } | { __typename: 'Perpetual', quoteName: string } | { __typename: 'Spot' } } } } } | { __typename?: 'UpdateNetworkParameter' } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } } }; +export type UpdateReferralProgramFragment = { __typename?: 'Proposal', terms: { __typename?: 'ProposalTerms', change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateMarketState' } | { __typename?: 'UpdateNetworkParameter' } | { __typename?: 'UpdateReferralProgram', changes: { __typename?: 'ReferralProgram', id: string, version: number, endOfProgramTimestamp: string, windowLength: number, benefitTiers: Array<{ __typename?: 'BenefitTier', minimumEpochs: number, minimumRunningNotionalTakerVolume: string, referralDiscountFactor: string, referralRewardFactor: string }>, stakingTiers: Array<{ __typename?: 'StakingTier', minimumStakedTokens: string, referralRewardMultiplier: string }> } } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } } }; + export type ProposalQueryVariables = Types.Exact<{ proposalId: Types.Scalars['ID']; includeNewMarketProductField: Types.Scalars['Boolean']; includeUpdateMarketState: Types.Scalars['Boolean']; + includeUpdateReferralProgram: Types.Scalars['Boolean']; }>; -export type ProposalQuery = { __typename?: 'Query', proposal?: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array | null, positionDecimalPlaces: number, linearSlippageFactor: string, quadraticSlippageFactor: string, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } | { __typename?: 'EthCallSpec' } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null, product?: { __typename: 'FutureProduct' } | { __typename: 'PerpetualProduct' } | { __typename: 'SpotProduct' } | null }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } } } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } | { __typename?: 'EthCallSpec' } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | { __typename?: 'UpdatePerpetualProduct', quoteName: string, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } | { __typename?: 'EthCallSpec' } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecPerpetualBinding', settlementDataProperty: string, settlementScheduleProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename?: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | null } | { __typename?: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename?: 'UpdateMarketState', updateType: Types.MarketUpdateType, price?: string | null, market: { __typename?: 'Market', decimalPlaces: number, id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string, product: { __typename: 'Future', quoteName: string } | { __typename: 'Perpetual', quoteName: string } | { __typename: 'Spot' } } } } } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } | null }; +export type ProposalQuery = { __typename?: 'Query', proposal?: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array | null, positionDecimalPlaces: number, linearSlippageFactor: string, quadraticSlippageFactor: string, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } | { __typename?: 'EthCallSpec' } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null, product?: { __typename: 'FutureProduct' } | { __typename: 'PerpetualProduct' } | { __typename: 'SpotProduct' } | null }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } } } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } | { __typename?: 'EthCallSpec' } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | { __typename?: 'UpdatePerpetualProduct', quoteName: string, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } | { __typename?: 'EthCallSpec' } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecPerpetualBinding', settlementDataProperty: string, settlementScheduleProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename?: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | null } | { __typename?: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename?: 'UpdateMarketState', updateType: Types.MarketUpdateType, price?: string | null, market: { __typename?: 'Market', decimalPlaces: number, id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string, product: { __typename: 'Future', quoteName: string } | { __typename: 'Perpetual', quoteName: string } | { __typename: 'Spot' } } } } } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename?: 'UpdateReferralProgram', changes: { __typename?: 'ReferralProgram', id: string, version: number, endOfProgramTimestamp: string, windowLength: number, benefitTiers: Array<{ __typename?: 'BenefitTier', minimumEpochs: number, minimumRunningNotionalTakerVolume: string, referralDiscountFactor: string, referralRewardFactor: string }>, stakingTiers: Array<{ __typename?: 'StakingTier', minimumStakedTokens: string, referralRewardMultiplier: string }> } } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } | null }; export const NewMarketProductFieldFragmentDoc = gql` fragment NewMarketProductField on Proposal { @@ -63,8 +66,34 @@ export const UpdateMarketStateFragmentDoc = gql` } } `; +export const UpdateReferralProgramFragmentDoc = gql` + fragment UpdateReferralProgram on Proposal { + terms { + change { + ... on UpdateReferralProgram { + changes { + id + version + benefitTiers { + minimumEpochs + minimumRunningNotionalTakerVolume + referralDiscountFactor + referralRewardFactor + } + endOfProgramTimestamp + windowLength + stakingTiers { + minimumStakedTokens + referralRewardMultiplier + } + } + } + } + } +} + `; export const ProposalDocument = gql` - query Proposal($proposalId: ID!, $includeNewMarketProductField: Boolean!, $includeUpdateMarketState: Boolean!) { + query Proposal($proposalId: ID!, $includeNewMarketProductField: Boolean!, $includeUpdateMarketState: Boolean!, $includeUpdateReferralProgram: Boolean!) { proposal(id: $proposalId) { id rationale { @@ -81,6 +110,7 @@ export const ProposalDocument = gql` errorDetails ...NewMarketProductField @include(if: $includeNewMarketProductField) ...UpdateMarketState @include(if: $includeUpdateMarketState) + ...UpdateReferralProgram @include(if: $includeUpdateReferralProgram) terms { closingDatetime enactmentDatetime @@ -368,7 +398,8 @@ export const ProposalDocument = gql` } } ${NewMarketProductFieldFragmentDoc} -${UpdateMarketStateFragmentDoc}`; +${UpdateMarketStateFragmentDoc} +${UpdateReferralProgramFragmentDoc}`; /** * __useProposalQuery__ @@ -385,6 +416,7 @@ ${UpdateMarketStateFragmentDoc}`; * proposalId: // value for 'proposalId' * includeNewMarketProductField: // value for 'includeNewMarketProductField' * includeUpdateMarketState: // value for 'includeUpdateMarketState' + * includeUpdateReferralProgram: // value for 'includeUpdateReferralProgram' * }, * }); */ diff --git a/apps/governance/src/routes/proposals/proposal/proposal-container.tsx b/apps/governance/src/routes/proposals/proposal/proposal-container.tsx index 214603871..8b490e7f2 100644 --- a/apps/governance/src/routes/proposals/proposal/proposal-container.tsx +++ b/apps/governance/src/routes/proposals/proposal/proposal-container.tsx @@ -57,6 +57,7 @@ export const ProposalContainer = () => { proposalId: params.proposalId || '', includeNewMarketProductField: !!FLAGS.PRODUCT_PERPETUALS, includeUpdateMarketState: !!FLAGS.UPDATE_MARKET_STATE, + includeUpdateReferralProgram: !!FLAGS.REFERRALS, }, skip: !params.proposalId, }); diff --git a/apps/governance/src/routes/proposals/proposals/Proposals.graphql b/apps/governance/src/routes/proposals/proposals/Proposals.graphql index 3d21f3117..0b61d3de3 100644 --- a/apps/governance/src/routes/proposals/proposals/Proposals.graphql +++ b/apps/governance/src/routes/proposals/proposals/Proposals.graphql @@ -43,6 +43,31 @@ fragment UpdateMarketStates on Proposal { } } +fragment UpdateReferralPrograms on Proposal { + terms { + change { + ... on UpdateReferralProgram { + changes { + id + version + benefitTiers { + minimumEpochs + minimumRunningNotionalTakerVolume + referralDiscountFactor + referralRewardFactor + } + endOfProgramTimestamp + windowLength + stakingTiers { + minimumStakedTokens + referralRewardMultiplier + } + } + } + } + } +} + fragment ProposalFields on Proposal { id rationale { @@ -127,6 +152,7 @@ fragment ProposalFields on Proposal { query Proposals( $includeNewMarketProductFields: Boolean! $includeUpdateMarketStates: Boolean! + $includeUpdateReferralPrograms: Boolean! ) { proposalsConnection { edges { @@ -134,6 +160,7 @@ query Proposals( ...ProposalFields ...NewMarketProductFields @include(if: $includeNewMarketProductFields) ...UpdateMarketStates @include(if: $includeUpdateMarketStates) + ...UpdateReferralPrograms @include(if: $includeUpdateReferralPrograms) } } } diff --git a/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts b/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts index a7d13c794..1bad38398 100644 --- a/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts +++ b/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts @@ -7,15 +7,18 @@ export type NewMarketProductFieldsFragment = { __typename?: 'Proposal', terms: { export type UpdateMarketStatesFragment = { __typename?: 'Proposal', terms: { __typename?: 'ProposalTerms', change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateMarketState', updateType: Types.MarketUpdateType, price?: string | null, market: { __typename?: 'Market', decimalPlaces: number, id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string, product: { __typename: 'Future', quoteName: string } | { __typename: 'Perpetual', quoteName: string } | { __typename: 'Spot' } } } } } | { __typename?: 'UpdateNetworkParameter' } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } } }; +export type UpdateReferralProgramsFragment = { __typename?: 'Proposal', terms: { __typename?: 'ProposalTerms', change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateMarketState' } | { __typename?: 'UpdateNetworkParameter' } | { __typename?: 'UpdateReferralProgram', changes: { __typename?: 'ReferralProgram', id: string, version: number, endOfProgramTimestamp: string, windowLength: number, benefitTiers: Array<{ __typename?: 'BenefitTier', minimumEpochs: number, minimumRunningNotionalTakerVolume: string, referralDiscountFactor: string, referralRewardFactor: string }>, stakingTiers: Array<{ __typename?: 'StakingTier', minimumStakedTokens: string, referralRewardMultiplier: string }> } } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } } }; + export type ProposalFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateMarketState' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } }; export type ProposalsQueryVariables = Types.Exact<{ includeNewMarketProductFields: Types.Scalars['Boolean']; includeUpdateMarketStates: Types.Scalars['Boolean']; + includeUpdateReferralPrograms: Types.Scalars['Boolean']; }>; -export type ProposalsQuery = { __typename?: 'Query', proposalsConnection?: { __typename?: 'ProposalsConnection', edges?: Array<{ __typename?: 'ProposalEdge', node: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null, product?: { __typename: 'FutureProduct' } | { __typename: 'PerpetualProduct' } | { __typename: 'SpotProduct' } | null } } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateMarketState', updateType: Types.MarketUpdateType, price?: string | null, market: { __typename?: 'Market', decimalPlaces: number, id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string, product: { __typename: 'Future', quoteName: string } | { __typename: 'Perpetual', quoteName: string } | { __typename: 'Spot' } } } } } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } } | null> | null } | null }; +export type ProposalsQuery = { __typename?: 'Query', proposalsConnection?: { __typename?: 'ProposalsConnection', edges?: Array<{ __typename?: 'ProposalEdge', node: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null, product?: { __typename: 'FutureProduct' } | { __typename: 'PerpetualProduct' } | { __typename: 'SpotProduct' } | null } } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateMarketState', updateType: Types.MarketUpdateType, price?: string | null, market: { __typename?: 'Market', decimalPlaces: number, id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string, product: { __typename: 'Future', quoteName: string } | { __typename: 'Perpetual', quoteName: string } | { __typename: 'Spot' } } } } } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename?: 'UpdateReferralProgram', changes: { __typename?: 'ReferralProgram', id: string, version: number, endOfProgramTimestamp: string, windowLength: number, benefitTiers: Array<{ __typename?: 'BenefitTier', minimumEpochs: number, minimumRunningNotionalTakerVolume: string, referralDiscountFactor: string, referralRewardFactor: string }>, stakingTiers: Array<{ __typename?: 'StakingTier', minimumStakedTokens: string, referralRewardMultiplier: string }> } } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } } | null> | null } | null }; export const NewMarketProductFieldsFragmentDoc = gql` fragment NewMarketProductFields on Proposal { @@ -64,6 +67,32 @@ export const UpdateMarketStatesFragmentDoc = gql` } } `; +export const UpdateReferralProgramsFragmentDoc = gql` + fragment UpdateReferralPrograms on Proposal { + terms { + change { + ... on UpdateReferralProgram { + changes { + id + version + benefitTiers { + minimumEpochs + minimumRunningNotionalTakerVolume + referralDiscountFactor + referralRewardFactor + } + endOfProgramTimestamp + windowLength + stakingTiers { + minimumStakedTokens + referralRewardMultiplier + } + } + } + } + } +} + `; export const ProposalFieldsFragmentDoc = gql` fragment ProposalFields on Proposal { id @@ -147,20 +176,22 @@ export const ProposalFieldsFragmentDoc = gql` } `; export const ProposalsDocument = gql` - query Proposals($includeNewMarketProductFields: Boolean!, $includeUpdateMarketStates: Boolean!) { + query Proposals($includeNewMarketProductFields: Boolean!, $includeUpdateMarketStates: Boolean!, $includeUpdateReferralPrograms: Boolean!) { proposalsConnection { edges { node { ...ProposalFields ...NewMarketProductFields @include(if: $includeNewMarketProductFields) ...UpdateMarketStates @include(if: $includeUpdateMarketStates) + ...UpdateReferralPrograms @include(if: $includeUpdateReferralPrograms) } } } } ${ProposalFieldsFragmentDoc} ${NewMarketProductFieldsFragmentDoc} -${UpdateMarketStatesFragmentDoc}`; +${UpdateMarketStatesFragmentDoc} +${UpdateReferralProgramsFragmentDoc}`; /** * __useProposalsQuery__ @@ -176,6 +207,7 @@ ${UpdateMarketStatesFragmentDoc}`; * variables: { * includeNewMarketProductFields: // value for 'includeNewMarketProductFields' * includeUpdateMarketStates: // value for 'includeUpdateMarketStates' + * includeUpdateReferralPrograms: // value for 'includeUpdateReferralPrograms' * }, * }); */ diff --git a/apps/governance/src/routes/proposals/proposals/proposals-container.tsx b/apps/governance/src/routes/proposals/proposals/proposals-container.tsx index 8c1e87344..104897726 100644 --- a/apps/governance/src/routes/proposals/proposals/proposals-container.tsx +++ b/apps/governance/src/routes/proposals/proposals/proposals-container.tsx @@ -49,6 +49,7 @@ export const ProposalsContainer = () => { variables: { includeNewMarketProductFields: !!FLAGS.PRODUCT_PERPETUALS, includeUpdateMarketStates: !!FLAGS.UPDATE_MARKET_STATE, + includeUpdateReferralPrograms: !!FLAGS.REFERRALS, }, }); diff --git a/apps/governance/src/routes/proposals/rejected/rejected-proposals-container.tsx b/apps/governance/src/routes/proposals/rejected/rejected-proposals-container.tsx index 246c8cdf3..2e78b61d1 100644 --- a/apps/governance/src/routes/proposals/rejected/rejected-proposals-container.tsx +++ b/apps/governance/src/routes/proposals/rejected/rejected-proposals-container.tsx @@ -41,6 +41,7 @@ export const RejectedProposalsContainer = () => { variables: { includeNewMarketProductFields: !!FLAGS.PRODUCT_PERPETUALS, includeUpdateMarketStates: !!FLAGS.UPDATE_MARKET_STATE, + includeUpdateReferralPrograms: !!FLAGS.REFERRALS, }, }); diff --git a/libs/types/src/__generated__/types.ts b/libs/types/src/__generated__/types.ts index 273f0710f..fc05118b9 100644 --- a/libs/types/src/__generated__/types.ts +++ b/libs/types/src/__generated__/types.ts @@ -505,6 +505,29 @@ export type CoreSnapshotEdge = { node: CoreSnapshotData; }; +/** Referral program information reported by data node with additional endedAt timestamp. */ +export type CurrentReferralProgram = { + __typename?: 'CurrentReferralProgram'; + /** Defined tiers in increasing order. First element will give Tier 1, second element will give Tier 2, etc. */ + benefitTiers: Array; + /** Timestamp as RFC3339Nano, after which when the current epoch ends, the program will end and benefits will be disabled. */ + endOfProgramTimestamp: Scalars['Timestamp']; + /** Timestamp as RFC3339Nano when the program ended. If present, the current program has ended and no program is currently running. */ + endedAt?: Maybe; + /** Unique ID generated from the proposal that created this program. */ + id: Scalars['ID']; + /** + * Defined staking tiers in increasing order. First element will give Tier 1, + * second element will give Tier 2, and so on. Determines the level of + * benefit a party can expect based on their staking. + */ + stakingTiers: Array; + /** Incremental version of the program. It is incremented each time the referral program is edited. */ + version: Scalars['Int']; + /** Number of epochs over which to evaluate a referral set's running volume. */ + windowLength: Scalars['Int']; +}; + /** A data source contains the data sent by a data source */ export type Data = { __typename?: 'Data'; @@ -1264,6 +1287,39 @@ export type Filter = { key: PropertyKey; }; +/** The funding payment from a perpetual market. */ +export type FundingPayment = { + __typename?: 'FundingPayment'; + /** Amount transferred */ + amount?: Maybe; + /** Sequence number of the funding period the funding payment belongs to. */ + fundingPeriodSeq: Scalars['Int']; + /** Market the funding payment applies to. */ + marketId: Scalars['ID']; + /** Party the funding payment applies to. */ + partyId: Scalars['ID']; + /** RFC3339Nano timestamp when the data point was received. */ + timestamp: Scalars['Timestamp']; +}; + +/** Connection type for funding payment */ +export type FundingPaymentConnection = { + __typename?: 'FundingPaymentConnection'; + /** List of funding payments */ + edges: Array; + /** Pagination information */ + pageInfo: PageInfo; +}; + +/** Edge type for funding payment */ +export type FundingPaymentEdge = { + __typename?: 'FundingPaymentEdge'; + /** Cursor identifying the funding payment */ + cursor: Scalars['String']; + /** The funding payment */ + node: FundingPayment; +}; + /** Details of a funding interval for a perpetual market. */ export type FundingPeriod = { __typename?: 'FundingPeriod'; @@ -1607,6 +1663,8 @@ export type LiquidityProvider = { marketId: Scalars['ID']; /** Party ID of the liquidity provider */ partyId: Scalars['ID']; + /** SLA performance statistics */ + sla?: Maybe; }; /** Connection type for retrieving cursor-based paginated liquidity provider information */ @@ -1642,6 +1700,29 @@ export type LiquidityProviderFeeShare = { virtualStake: Scalars['String']; }; +/** The SLA statistics for each liquidity provider */ +export type LiquidityProviderSLA = { + __typename?: 'LiquidityProviderSLA'; + /** Indicates how often LP meets the commitment during the current epoch. */ + currentEpochFractionOfTimeOnBook: Scalars['String']; + /** Determines how the fee penalties from past epochs affect future fee revenue. */ + hysteresisPeriodFeePenalties?: Maybe>; + /** Indicates the bond penalty amount applied in the previous epoch. */ + lastEpochBondPenalty: Scalars['String']; + /** Indicates the fee penalty amount applied in the previous epoch. */ + lastEpochFeePenalty: Scalars['String']; + /** Indicates how often LP met the commitment in the previous epoch. */ + lastEpochFractionOfTimeOnBook: Scalars['String']; + /** Notional volume of orders within the range provided on the buy side of the book. */ + notionalVolumeBuys: Scalars['String']; + /** Notional volume of orders within the range provided on the sell side of the book. */ + notionalVolumeSells: Scalars['String']; + /** The liquidity provider party ID */ + party: Party; + /** Represents the total amount of funds LP must supply. The amount to be supplied is in the market’s settlement currency, spread on both buy and sell sides of the order book within a defined range. */ + requiredLiquidity: Scalars['String']; +}; + /** The command to be sent to the chain for a liquidity provision submission */ export type LiquidityProvision = { __typename?: 'LiquidityProvision'; @@ -2030,6 +2111,8 @@ export type MarketData = { lastTradedPrice: Scalars['String']; /** The equity like share of liquidity fee for each liquidity provider */ liquidityProviderFeeShare?: Maybe>; + /** SLA performance statistics */ + liquidityProviderSla?: Maybe>; /** The mark price (an unsigned integer) */ markPrice: Scalars['String']; /** Market of the associated mark price */ @@ -2562,6 +2645,29 @@ export type ObservableLiquidityProviderFeeShare = { partyId: Scalars['ID']; }; +/** The SLA statistics for each liquidity provider */ +export type ObservableLiquidityProviderSLA = { + __typename?: 'ObservableLiquidityProviderSLA'; + /** Indicates how often LP meets the commitment during the current epoch. */ + currentEpochFractionOfTimeOnBook: Scalars['String']; + /** Determines how the fee penalties from past epochs affect future fee revenue. */ + hysteresisPeriodFeePenalties?: Maybe>; + /** Indicates the bond penalty amount applied in the previous epoch. */ + lastEpochBondPenalty: Scalars['String']; + /** Indicates the fee penalty amount applied in the previous epoch. */ + lastEpochFeePenalty: Scalars['String']; + /** Indicates how often LP meets the commitment during last epoch. */ + lastEpochFractionOfTimeOnBook: Scalars['String']; + /** Notional volume of orders within the range provided on the buy side of the book. */ + notionalVolumeBuys: Scalars['String']; + /** Notional volume of orders within the range provided on the sell side of the book. */ + notionalVolumeSells: Scalars['String']; + /** The liquidity provider party ID */ + party: Scalars['ID']; + /** Represents the total amount of funds LP must supply. The amount to be supplied is in the market’s settlement currency, spread on both buy and sell sides of the order book within a defined range. */ + requiredLiquidity: Scalars['String']; +}; + /** Live data of a Market */ export type ObservableMarketData = { __typename?: 'ObservableMarketData'; @@ -2595,6 +2701,8 @@ export type ObservableMarketData = { lastTradedPrice: Scalars['String']; /** The equity like share of liquidity fee for each liquidity provider */ liquidityProviderFeeShare?: Maybe>; + /** SLA performance statistics */ + liquidityProviderSla?: Maybe>; /** The mark price (an unsigned integer) */ markPrice: Scalars['String']; /** The market growth factor for the last market time window */ @@ -3289,6 +3397,15 @@ export type PartyActivityStreak = { tradedVolume: Scalars['String']; }; +/** An amount received by a party as a reward or a discount */ +export type PartyAmount = { + __typename?: 'PartyAmount'; + /** Amount received by the party */ + amount: Scalars['String']; + /** Id of the party that received the payment */ + partyId: Scalars['String']; +}; + /** Connection type for retrieving cursor-based paginated party information */ export type PartyConnection = { __typename?: 'PartyConnection'; @@ -3861,6 +3978,8 @@ export type ProposalTerms = { /** Various proposal types that are supported by Vega */ export enum ProposalType { + /** Proposal to cancel a transfer */ + TYPE_CANCEL_TRANSFER = 'TYPE_CANCEL_TRANSFER', /** Proposal to change Vega network parameters */ TYPE_NETWORK_PARAMETERS = 'TYPE_NETWORK_PARAMETERS', /** Proposal to add a new asset */ @@ -3869,10 +3988,22 @@ export enum ProposalType { TYPE_NEW_FREE_FORM = 'TYPE_NEW_FREE_FORM', /** Propose a new market */ TYPE_NEW_MARKET = 'TYPE_NEW_MARKET', + /** Propose a new spot market */ + TYPE_NEW_SPOT_MARKET = 'TYPE_NEW_SPOT_MARKET', + /** Propose a new transfer */ + TYPE_NEW_TRANSFER = 'TYPE_NEW_TRANSFER', /** Proposal to update an existing asset */ TYPE_UPDATE_ASSET = 'TYPE_UPDATE_ASSET', /** Update an existing market */ - TYPE_UPDATE_MARKET = 'TYPE_UPDATE_MARKET' + TYPE_UPDATE_MARKET = 'TYPE_UPDATE_MARKET', + /** Proposal for updating the state of a market */ + TYPE_UPDATE_MARKET_STATE = 'TYPE_UPDATE_MARKET_STATE', + /** Proposal to update the referral program */ + TYPE_UPDATE_REFERRAL_PROGRAM = 'TYPE_UPDATE_REFERRAL_PROGRAM', + /** Update an existing spot market */ + TYPE_UPDATE_SPOT_MARKET = 'TYPE_UPDATE_SPOT_MARKET', + /** Proposal to update the volume discount program */ + TYPE_UPDATE_VOLUME_DISCOUNT_PROGRAM = 'TYPE_UPDATE_VOLUME_DISCOUNT_PROGRAM' } export type ProposalVote = { @@ -3998,7 +4129,9 @@ export type Query = { /** List core snapshots */ coreSnapshots?: Maybe; /** Get the current referral program */ - currentReferralProgram?: Maybe; + currentReferralProgram?: Maybe; + /** Get the current volume discount program */ + currentVolumeDiscountProgram?: Maybe; /** Find a deposit using its ID */ deposit?: Maybe; /** Fetch all deposits */ @@ -4030,6 +4163,8 @@ export type Query = { estimatePosition?: Maybe; /** Query for historic ethereum key rotations */ ethereumKeyRotations: EthereumKeyRotationsConnection; + /** Funding payment for perpetual markets. */ + fundingPayments: FundingPaymentConnection; /** * Funding period data points for a perpetual market. The data points within a funding period are used to calculate the * time-weighted average price (TWAP), funding rate and funding payments for each funding period. @@ -4095,7 +4230,11 @@ export type Query = { protocolUpgradeProposals?: Maybe; /** Flag indicating whether the data-node is ready to begin the protocol upgrade */ protocolUpgradeStatus?: Maybe; + /** Get referrer fee and discount stats */ + referralFeeStats?: Maybe; referralSetReferees: ReferralSetRefereeConnection; + /** Get referral set statistics */ + referralSetStats: ReferralSetStatsConnection; /** List referral sets */ referralSets: ReferralSetConnection; /** Get statistics about the Vega node */ @@ -4124,6 +4263,8 @@ export type Query = { transfer?: Maybe; /** Get a list of all transfers for a public key */ transfersConnection?: Maybe; + /** Get volume discount statistics */ + volumeDiscountStats: VolumeDiscountStatsConnection; /** Find a withdrawal using its ID */ withdrawal?: Maybe; /** Fetch all withdrawals */ @@ -4259,6 +4400,7 @@ export type QueryestimatePositionArgs = { marketId: Scalars['ID']; openVolume: Scalars['String']; orders?: InputMaybe>; + scaleLiquidationPriceToMarketDecimals?: InputMaybe; }; @@ -4268,6 +4410,14 @@ export type QueryethereumKeyRotationsArgs = { }; +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryfundingPaymentsArgs = { + marketId?: InputMaybe; + pagination?: InputMaybe; + partyId: Scalars['ID']; +}; + + /** Queries allow a caller to read data and filter data via GraphQL. */ export type QueryfundingPeriodDataPointsArgs = { dateRange?: InputMaybe; @@ -4450,6 +4600,14 @@ export type QueryprotocolUpgradeProposalsArgs = { }; +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryreferralFeeStatsArgs = { + assetId?: InputMaybe; + epoch?: InputMaybe; + marketId?: InputMaybe; +}; + + /** Queries allow a caller to read data and filter data via GraphQL. */ export type QueryreferralSetRefereesArgs = { id?: InputMaybe; @@ -4459,6 +4617,15 @@ export type QueryreferralSetRefereesArgs = { }; +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryreferralSetStatsArgs = { + epoch?: InputMaybe; + id: Scalars['ID']; + pagination?: InputMaybe; + partyId?: InputMaybe; +}; + + /** Queries allow a caller to read data and filter data via GraphQL. */ export type QueryreferralSetsArgs = { id?: InputMaybe; @@ -4533,6 +4700,14 @@ export type QuerytransfersConnectionArgs = { }; +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryvolumeDiscountStatsArgs = { + epoch?: InputMaybe; + pagination?: InputMaybe; + partyId?: InputMaybe; +}; + + /** Queries allow a caller to read data and filter data via GraphQL. */ export type QuerywithdrawalArgs = { id: Scalars['ID']; @@ -4591,25 +4766,13 @@ export type RecurringTransfer = { startEpoch: Scalars['Int']; }; -export type RefereeStats = { - __typename?: 'RefereeStats'; - /** Discount factor applied to the party. */ - discountFactor: Scalars['String']; - /** Unique ID of the party. */ - partyId: Scalars['ID']; - /** Reward factor applied to the party. */ - rewardFactor: Scalars['String']; -}; - /** Referral program information */ export type ReferralProgram = { __typename?: 'ReferralProgram'; /** Defined tiers in increasing order. First element will give Tier 1, second element will give Tier 2, etc. */ benefitTiers: Array; - /** Timestamp as RFC3339Nano, after which when the current epoch ends, the programs status will become STATE_CLOSED and benefits will be disabled. */ - endOfProgramTimestamp: Scalars['Timestamp']; - /** Timestamp as RFC3339Nano when the program ended. If present, the current program has ended and no program is currently running. */ - endedAt?: Maybe; + /** Timestamp as RFC3339, after which when the current epoch ends, the programs will end and benefits will be disabled. */ + endOfProgramTimestamp: Scalars['String']; /** Unique ID generated from the proposal that created this program. */ id: Scalars['ID']; /** @@ -4633,22 +4796,10 @@ export type ReferralSet = { id: Scalars['ID']; /** Party that created the set. */ referrer: Scalars['ID']; - /** - * Referral set statistics for the latest or specific epoch. - * If provided the results can be filtered for a specific referee - */ - stats?: Maybe; /** Timestamp as RFC3339Nano when the referral set was updated. */ updatedAt: Scalars['Timestamp']; }; - -/** Data relating to a referral set. */ -export type ReferralSetstatsArgs = { - epoch?: InputMaybe; - referee?: InputMaybe; -}; - /** Connection type for retrieving cursor-based paginated referral set information */ export type ReferralSetConnection = { __typename?: 'ReferralSetConnection'; @@ -4667,6 +4818,25 @@ export type ReferralSetEdge = { node: ReferralSet; }; +/** Referral rewards and discounts that have been applied on a specific market/asset up to the given epoch. */ +export type ReferralSetFeeStats = { + __typename?: 'ReferralSetFeeStats'; + /** The settlement asset of the market. */ + assetId: Scalars['String']; + /** The epoch for which these stats were valid. */ + epoch: Scalars['Int']; + /** The market the fees were paid in */ + marketId: Scalars['String']; + /** The total referral discounts applied to all referee taker fees */ + refereesDiscountApplied: Array; + /** The total referral rewards generated by all referee taker fees. */ + referrerRewardsGenerated: Array; + /** The total referral rewards paid to the referrer of the referral set. */ + totalRewardsPaid: Array; + /** The total volume discounts applied to all referee taker fees */ + volumeDiscountApplied: Array; +}; + /** Data relating to referees that have joined a referral set */ export type ReferralSetReferee = { __typename?: 'ReferralSetReferee'; @@ -4700,14 +4870,45 @@ export type ReferralSetRefereeEdge = { export type ReferralSetStats = { __typename?: 'ReferralSetStats'; - /** Epoch at which the set's statistics are updated. */ - atEpoch?: Maybe; - /** Referees' statistics for that epoch. */ - referees_stats: Array; + /** Epoch at which the statistics are updated. */ + atEpoch: Scalars['Int']; + /** Discount factor applied to the party. */ + discountFactor: Scalars['String']; + /** Current referee notional taker volume */ + epochNotionalTakerVolume: Scalars['String']; + /** Unique ID of the party. */ + partyId: Scalars['ID']; /** Running volume for the set based on the window length of the current referral program. */ referralSetRunningNotionalTakerVolume: Scalars['String']; - /** Unique ID of the set */ - setId: Scalars['ID']; + /** Reward factor applied to the party. */ + rewardFactor: Scalars['String']; +}; + +/** Connection type for retrieving cursor-based paginated referral set statistics information */ +export type ReferralSetStatsConnection = { + __typename?: 'ReferralSetStatsConnection'; + /** The referral set statistics in this connection */ + edges: Array>; + /** The pagination information */ + pageInfo: PageInfo; +}; + +/** Edge type containing the referral set statistics and cursor information returned by a ReferralSetStatsConnection */ +export type ReferralSetStatsEdge = { + __typename?: 'ReferralSetStatsEdge'; + /** The cursor for this referral set statistics */ + cursor: Scalars['String']; + /** The referral set statistics */ + node: ReferralSetStats; +}; + +/** Rewards generated for referrers by each of their referees */ +export type ReferrerRewardsGenerated = { + __typename?: 'ReferrerRewardsGenerated'; + /** The amount of rewards generated per party */ + generatedReward: Array; + /** ID of the referral set's referrer */ + referrerId: Scalars['String']; }; /** Reward information for a single party */ @@ -5152,10 +5353,10 @@ export enum StopOrderRejectionReason { REJECTION_REASON_MAX_STOP_ORDERS_PER_PARTY_REACHED = 'REJECTION_REASON_MAX_STOP_ORDERS_PER_PARTY_REACHED', /** Stop orders submission must be reduce only */ REJECTION_REASON_MUST_BE_REDUCE_ONLY = 'REJECTION_REASON_MUST_BE_REDUCE_ONLY', - /** This stop order does not close the position */ - REJECTION_REASON_STOP_ORDER_DOES_NOT_CLOSE_POSITION = 'REJECTION_REASON_STOP_ORDER_DOES_NOT_CLOSE_POSITION', /** Stop orders are not allowed without a position */ REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_WITHOUT_A_POSITION = 'REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_WITHOUT_A_POSITION', + /** This stop order does not close the position */ + REJECTION_REASON_STOP_ORDER_NOT_CLOSING_THE_POSITION = 'REJECTION_REASON_STOP_ORDER_NOT_CLOSING_THE_POSITION', /** Trading is not allowed yet */ REJECTION_REASON_TRADING_NOT_ALLOWED = 'REJECTION_REASON_TRADING_NOT_ALLOWED' } @@ -5942,18 +6143,7 @@ export type UpdateProductConfiguration = UpdateFutureProduct | UpdatePerpetualPr export type UpdateReferralProgram = { __typename?: 'UpdateReferralProgram'; - /** Benefit tiers for the program */ - benefitTiers: Array; - /** The end time of the program */ - endOfProgramTimestamp: Scalars['Timestamp']; - /** ID of the proposal that created the referral program */ - id: Scalars['ID']; - /** Determines the level of benefit a party can expect based on their staking */ - stakingTiers: Array; - /** Current version of the referral program */ - version: Scalars['Int']; - /** The window legnth to consider for the referral program */ - windowLength: Scalars['Int']; + changes: ReferralProgram; }; /** Update an existing spot market on Vega */ @@ -6011,6 +6201,53 @@ export type VolumeBenefitTier = { volumeDiscountFactor: Scalars['String']; }; +/** Volume discount program information */ +export type VolumeDiscountProgram = { + __typename?: 'VolumeDiscountProgram'; + /** Defined tiers in increasing order. First element will give Tier 1, second element will give Tier 2, etc. */ + benefitTiers: Array; + /** Timestamp as Unix time in nanoseconds, after which when the current epoch ends, the programs will end and benefits will be disabled. */ + endOfProgramTimestamp: Scalars['Timestamp']; + /** Timestamp as RFC3339Nano when the program ended. If present, the current program has ended and no program is currently running. */ + endedAt?: Maybe; + /** Unique ID generated from the proposal that created this program. */ + id: Scalars['ID']; + /** Incremental version of the program. It is incremented each time the volume discount program is edited. */ + version: Scalars['Int']; + /** Number of epochs over which to evaluate parties' running volume. */ + windowLength: Scalars['Int']; +}; + +export type VolumeDiscountStats = { + __typename?: 'VolumeDiscountStats'; + /** Epoch at which the statistics are updated. */ + atEpoch: Scalars['Int']; + /** Discount factor applied to the party. */ + discountFactor: Scalars['String']; + /** Unique ID of the party. */ + partyId: Scalars['ID']; + /** Party's running volume. */ + runningVolume: Scalars['String']; +}; + +/** Connection type for retrieving cursor-based paginated volume discount statistics information */ +export type VolumeDiscountStatsConnection = { + __typename?: 'VolumeDiscountStatsConnection'; + /** The volume discount statistics in this connection */ + edges: Array>; + /** The pagination information */ + pageInfo: PageInfo; +}; + +/** Edge type containing the volume discount statistics and cursor information returned by a VolumeDiscountStatsConnection */ +export type VolumeDiscountStatsEdge = { + __typename?: 'VolumeDiscountStatsEdge'; + /** The cursor for this volume discount statistics */ + cursor: Scalars['String']; + /** The volume discount statistics */ + node: VolumeDiscountStats; +}; + export type Vote = { __typename?: 'Vote'; /** RFC3339Nano time and date when the vote reached Vega network */