From 22703d937e3688cf9c6512ad6c264a3078184bcb Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:14:18 +0200 Subject: [PATCH 1/7] fix(trading): fix percentage formatter rounding in liquidity table (#5250) --- libs/liquidity/src/lib/liquidity-table.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libs/liquidity/src/lib/liquidity-table.tsx b/libs/liquidity/src/lib/liquidity-table.tsx index d78ea51e3..764b5414f 100644 --- a/libs/liquidity/src/lib/liquidity-table.tsx +++ b/libs/liquidity/src/lib/liquidity-table.tsx @@ -2,7 +2,6 @@ import { useMemo } from 'react'; import { addDecimalsFormatNumber, addDecimalsFormatNumberQuantum, - formatNumberPercentage, getDateTimeFormat, } from '@vegaprotocol/utils'; import { t } from '@vegaprotocol/i18n'; @@ -29,6 +28,12 @@ import { LiquidityProvisionStatus } from '@vegaprotocol/types'; import { LiquidityProvisionStatusMapping } from '@vegaprotocol/types'; import type { LiquidityProvisionData } from './liquidity-data-provider'; +const formatNumberPercentage = (value: BigNumber, decimals?: number) => { + const decimalPlaces = + typeof decimals === 'undefined' ? value.dp() || 0 : decimals; + return `${value.toFixed(decimalPlaces, 1)}%`; +}; + const percentageFormatter = ({ value }: ValueFormatterParams) => { if (!value) return '-'; return formatNumberPercentage(new BigNumber(value).times(100), 2) || '-'; @@ -126,11 +131,11 @@ export const LiquidityTable = ({ new BigNumber(data.sla.currentEpochFractionOfTimeOnBook).times( 100 ), - 2 + 4 ), formatNumberPercentage( new BigNumber(data.commitmentMinTimeFraction).times(100), - 2 + 4 ), ] ); @@ -143,7 +148,7 @@ export const LiquidityTable = ({ new BigNumber(data.sla.currentEpochFractionOfTimeOnBook).times( 100 ), - 2 + 4 ), ] ); From 5661b74082e29e23fcd78a326c59fcf8f979e0c8 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Thu, 16 Nov 2023 01:34:38 -0800 Subject: [PATCH 2/7] fix(trading): do not use stakeToCcyVolume to format fees value (#5280) --- libs/liquidity/src/lib/liquidity-table.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/liquidity/src/lib/liquidity-table.tsx b/libs/liquidity/src/lib/liquidity-table.tsx index 764b5414f..ded9057d0 100644 --- a/libs/liquidity/src/lib/liquidity-table.tsx +++ b/libs/liquidity/src/lib/liquidity-table.tsx @@ -399,7 +399,7 @@ export const LiquidityTable = ({ headerTooltip: t( `The liquidity fees accrued by each provider, which will be distributed at the end of the epoch after applying any penalties.` ), - valueFormatter: stakeToCcyVolumeQuantumFormatter, + valueFormatter: assetDecimalsQuantumFormatter, tooltipValueGetter: feesAccruedTooltip, cellClassRules: { 'text-warning': ({ data }: { data: LiquidityProvisionData }) => { From 79a16b85620c9e5e1283e146ca7ebdf599a1d294 Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Thu, 16 Nov 2023 19:08:20 +0200 Subject: [PATCH 3/7] fix(trading): show deal ticket in sidebar by default (#5292) --- .../client-pages/markets/markets-sidebar.tsx | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/apps/trading/client-pages/markets/markets-sidebar.tsx b/apps/trading/client-pages/markets/markets-sidebar.tsx index 7f010c47f..cc6edc3ef 100644 --- a/apps/trading/client-pages/markets/markets-sidebar.tsx +++ b/apps/trading/client-pages/markets/markets-sidebar.tsx @@ -1,7 +1,5 @@ -import { Route, Routes, useParams } from 'react-router-dom'; -import { MarketState } from '@vegaprotocol/types'; +import { Route, Routes } from 'react-router-dom'; import { t } from '@vegaprotocol/i18n'; -import { useMarket } from '@vegaprotocol/markets'; import { VegaIconNames } from '@vegaprotocol/ui-toolkit'; import { SidebarButton, @@ -11,12 +9,7 @@ import { import { useGetCurrentRouteId } from '../../lib/hooks/use-get-current-route-id'; export const MarketsSidebar = () => { - const { marketId } = useParams(); const currentRouteId = useGetCurrentRouteId(); - const { data } = useMarket(marketId); - const active = - data && - [MarketState.STATE_ACTIVE, MarketState.STATE_PENDING].includes(data.state); return ( <> @@ -44,14 +37,12 @@ export const MarketsSidebar = () => { element={ <> - {active && ( - - )} + Date: Fri, 17 Nov 2023 14:00:19 +0200 Subject: [PATCH 4/7] fix(proposals): perpetual proposed markets (#5290) --- .../src/fixtures/mocks/proposals.ts | 4 +- .../proposal-header.spec.tsx | 2 +- .../proposal-header.tsx | 16 +- .../proposals/proposal/Proposal.graphql | 137 +++++++----------- .../proposal/__generated__/Proposal.ts | 98 +++++++------ .../proposals/proposals/Proposals.graphql | 13 +- .../proposals/__generated__/Proposals.ts | 17 ++- libs/markets/src/lib/__generated__/index.ts | 2 +- libs/markets/src/lib/markets-candles.graphql | 9 -- .../proposals-list/proposal-list.spec.tsx | 1 - .../proposals-list/use-column-defs.tsx | 86 ++++------- .../proposals-data-provider/Proposals.graphql | 122 +++++++++------- .../__generated__/Proposals.ts | 128 ++++++++-------- .../proposals-data-provider/proposals.mock.ts | 26 ++-- 14 files changed, 326 insertions(+), 335 deletions(-) diff --git a/apps/governance-e2e/src/fixtures/mocks/proposals.ts b/apps/governance-e2e/src/fixtures/mocks/proposals.ts index 066c67eba..95dd78ded 100644 --- a/apps/governance-e2e/src/fixtures/mocks/proposals.ts +++ b/apps/governance-e2e/src/fixtures/mocks/proposals.ts @@ -133,7 +133,7 @@ export const proposalsData = { instrument: { name: 'UNIDAI Monthly (Dec 2022)', code: 'UNIDAI.MF21', - futureProduct: { + product: { settlementAsset: { symbol: 'tDAI', __typename: 'Asset' }, __typename: 'FutureProduct', }, @@ -240,7 +240,7 @@ export const proposalsData = { instrument: { name: 'ETHBTC Quarterly (Feb 2023)', code: 'ETHBTC.QM21', - futureProduct: { + product: { settlementAsset: { symbol: 'tBTC', __typename: 'Asset' }, __typename: 'FutureProduct', }, diff --git a/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx b/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx index 01652c52e..efe870b69 100644 --- a/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx +++ b/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx @@ -77,7 +77,7 @@ describe('Proposal header', () => { __typename: 'InstrumentConfiguration', name: 'Some market', code: 'FX:BTCUSD/DEC99', - futureProduct: { + product: { __typename: 'FutureProduct', settlementAsset: { __typename: 'Asset', diff --git a/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx b/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx index 836b62822..09c563358 100644 --- a/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx +++ b/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx @@ -39,6 +39,18 @@ export const ProposalHeader = ({ const titleContent = shorten(title ?? '', 100); + const getAsset = (proposal: ProposalQuery['proposal']) => { + const terms = proposal?.terms; + if ( + terms?.change.__typename === 'NewMarket' && + (terms.change.instrument.product?.__typename === 'FutureProduct' || + terms.change.instrument.product?.__typename === 'PerpetualProduct') + ) { + return terms.change.instrument.product.settlementAsset; + } + return undefined; + }; + switch (change?.__typename) { case 'NewMarket': { proposalType = @@ -54,10 +66,10 @@ export const ProposalHeader = ({ {t('Code')}: {change.instrument.code}. {' '} - {change.instrument.futureProduct?.settlementAsset.symbol ? ( + {proposal?.terms && getAsset(proposal)?.symbol ? ( <> - {change.instrument.futureProduct.settlementAsset.symbol} + {getAsset(proposal)?.symbol} {' '} {t('settled future')}. diff --git a/apps/governance/src/routes/proposals/proposal/Proposal.graphql b/apps/governance/src/routes/proposals/proposal/Proposal.graphql index 10d48c8b3..d950dde31 100644 --- a/apps/governance/src/routes/proposals/proposal/Proposal.graphql +++ b/apps/governance/src/routes/proposals/proposal/Proposal.graphql @@ -132,46 +132,25 @@ query Proposal( instrument { name code - futureProduct { - settlementAsset { - id - name - symbol - decimals - quantum - } - quoteName - - dataSourceSpecForSettlementData { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - operator - value - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address - } - } - } - filters { - key { - name - type - } + product { + ... on FutureProduct { + settlementAsset { + id + name + symbol + decimals + quantum + } + quoteName + dataSourceSpecBinding { + settlementDataProperty + tradingTerminationProperty + } + dataSourceSpecForSettlementData { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { conditions { operator value @@ -179,52 +158,44 @@ query Proposal( } } } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } + } } } } - # dataSourceSpecForTradingTermination { - # sourceType { - # ... on DataSourceDefinitionInternal { - # sourceType { - # ... on DataSourceSpecConfigurationTime { - # conditions { - # operator - # value - # } - # } - # } - # } - # ... on DataSourceDefinitionExternal { - # sourceType { - # ... on DataSourceSpecConfiguration { - # signers { - # signer { - # ... on PubKey { - # key - # } - # ... on ETHAddress { - # address - # } - # } - # } - # filters { - # key { - # name - # type - # } - # conditions { - # operator - # value - # } - # } - # } - # } - # } - # } - # } - dataSourceSpecBinding { - settlementDataProperty - tradingTerminationProperty + ... on PerpetualProduct { + settlementAsset { + id + name + symbol + decimals + quantum + } + quoteName } } } diff --git a/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts b/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts index 974d2a19c..64c5e7d5a 100644 --- a/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts +++ b/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts @@ -20,7 +20,7 @@ export type ProposalQueryVariables = Types.Exact<{ }>; -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', windowLength: number, endOfProgram: any, benefitTiers: Array<{ __typename?: 'BenefitTier', minimumEpochs: number, minimumRunningNotionalTakerVolume: string, referralDiscountFactor: string, referralRewardFactor: string }>, stakingTiers: Array<{ __typename?: 'StakingTier', minimumStakedTokens: string, referralRewardMultiplier: string }> } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram', endOfProgramTimestamp: any, windowLength: number, benefitTiers: Array<{ __typename?: 'VolumeBenefitTier', minimumRunningNotionalTakerVolume: string, volumeDiscountFactor: string }> } }, 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, product?: { __typename: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: 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' } } } } | { __typename: 'PerpetualProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string } } | { __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', windowLength: number, endOfProgram: any, benefitTiers: Array<{ __typename?: 'BenefitTier', minimumEpochs: number, minimumRunningNotionalTakerVolume: string, referralDiscountFactor: string, referralRewardFactor: string }>, stakingTiers: Array<{ __typename?: 'StakingTier', minimumStakedTokens: string, referralRewardMultiplier: string }> } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram', endOfProgramTimestamp: any, windowLength: number, benefitTiers: Array<{ __typename?: 'VolumeBenefitTier', minimumRunningNotionalTakerVolume: string, volumeDiscountFactor: string }> } }, 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 { @@ -154,45 +154,25 @@ export const ProposalDocument = gql` instrument { name code - futureProduct { - settlementAsset { - id - name - symbol - decimals - quantum - } - quoteName - dataSourceSpecForSettlementData { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - operator - value - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address - } - } - } - filters { - key { - name - type - } + product { + ... on FutureProduct { + settlementAsset { + id + name + symbol + decimals + quantum + } + quoteName + dataSourceSpecBinding { + settlementDataProperty + tradingTerminationProperty + } + dataSourceSpecForSettlementData { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { conditions { operator value @@ -200,12 +180,44 @@ export const ProposalDocument = gql` } } } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } + } } } } - dataSourceSpecBinding { - settlementDataProperty - tradingTerminationProperty + ... on PerpetualProduct { + settlementAsset { + id + name + symbol + decimals + quantum + } + quoteName } } } diff --git a/apps/governance/src/routes/proposals/proposals/Proposals.graphql b/apps/governance/src/routes/proposals/proposals/Proposals.graphql index eacd865a3..c031f53b3 100644 --- a/apps/governance/src/routes/proposals/proposals/Proposals.graphql +++ b/apps/governance/src/routes/proposals/proposals/Proposals.graphql @@ -101,9 +101,16 @@ fragment ProposalFields on Proposal { instrument { name code - futureProduct { - settlementAsset { - symbol + product { + ... on FutureProduct { + settlementAsset { + symbol + } + } + ... on PerpetualProduct { + settlementAsset { + symbol + } } } } diff --git a/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts b/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts index 0a8c107bd..9999bdb88 100644 --- a/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts +++ b/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts @@ -11,7 +11,7 @@ export type UpdateReferralProgramsFragment = { __typename?: 'Proposal', terms: { export type UpdateVolumeDiscountProgramsFragment = { __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' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram', endOfProgramTimestamp: any, windowLength: number, benefitTiers: Array<{ __typename?: 'VolumeBenefitTier', minimumRunningNotionalTakerVolume: string, volumeDiscountFactor: string }> } } }; -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 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, product?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | { __typename?: 'PerpetualProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | { __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' } | { __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']; @@ -21,7 +21,7 @@ export type ProposalsQueryVariables = Types.Exact<{ }>; -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', windowLength: number, endOfProgram: any, benefitTiers: Array<{ __typename?: 'BenefitTier', minimumEpochs: number, minimumRunningNotionalTakerVolume: string, referralDiscountFactor: string, referralRewardFactor: string }>, stakingTiers: Array<{ __typename?: 'StakingTier', minimumStakedTokens: string, referralRewardMultiplier: string }> } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram', endOfProgramTimestamp: any, windowLength: number, benefitTiers: Array<{ __typename?: 'VolumeBenefitTier', minimumRunningNotionalTakerVolume: string, volumeDiscountFactor: string }> } }, 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, product?: { __typename: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | { __typename: 'PerpetualProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | { __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', windowLength: number, endOfProgram: any, benefitTiers: Array<{ __typename?: 'BenefitTier', minimumEpochs: number, minimumRunningNotionalTakerVolume: string, referralDiscountFactor: string, referralRewardFactor: string }>, stakingTiers: Array<{ __typename?: 'StakingTier', minimumStakedTokens: string, referralRewardMultiplier: string }> } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram', endOfProgramTimestamp: any, windowLength: number, benefitTiers: Array<{ __typename?: 'VolumeBenefitTier', minimumRunningNotionalTakerVolume: string, volumeDiscountFactor: string }> } }, 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 { @@ -131,9 +131,16 @@ export const ProposalFieldsFragmentDoc = gql` instrument { name code - futureProduct { - settlementAsset { - symbol + product { + ... on FutureProduct { + settlementAsset { + symbol + } + } + ... on PerpetualProduct { + settlementAsset { + symbol + } } } } diff --git a/libs/markets/src/lib/__generated__/index.ts b/libs/markets/src/lib/__generated__/index.ts index b31cc4c84..78fcd4137 100644 --- a/libs/markets/src/lib/__generated__/index.ts +++ b/libs/markets/src/lib/__generated__/index.ts @@ -6,4 +6,4 @@ export * from './markets-candles'; export * from './markets-data'; export * from './OracleMarketsSpec'; export * from './OracleSpecDataConnection'; -export * from './SuccessorMarket' \ No newline at end of file +export * from './SuccessorMarket' diff --git a/libs/markets/src/lib/markets-candles.graphql b/libs/markets/src/lib/markets-candles.graphql index b66ee9d29..7363ca846 100644 --- a/libs/markets/src/lib/markets-candles.graphql +++ b/libs/markets/src/lib/markets-candles.graphql @@ -1,12 +1,3 @@ -fragment MarketCandlesFields on Candle { - high - low - open - close - volume - periodStart -} - query MarketsCandles($interval: Interval!, $since: String!) { marketsConnection { edges { diff --git a/libs/proposals/src/components/proposals-list/proposal-list.spec.tsx b/libs/proposals/src/components/proposals-list/proposal-list.spec.tsx index 65d723f55..0f7f7deda 100644 --- a/libs/proposals/src/components/proposals-list/proposal-list.spec.tsx +++ b/libs/proposals/src/components/proposals-list/proposal-list.spec.tsx @@ -85,7 +85,6 @@ describe('ProposalsList', () => { 'Settlement asset', 'State', 'Parent market', - 'Voting', 'Closing date', 'Enactment date', '', // actions col diff --git a/libs/proposals/src/components/proposals-list/use-column-defs.tsx b/libs/proposals/src/components/proposals-list/use-column-defs.tsx index c0ce65d31..ed88837c2 100644 --- a/libs/proposals/src/components/proposals-list/use-column-defs.tsx +++ b/libs/proposals/src/components/proposals-list/use-column-defs.tsx @@ -1,8 +1,6 @@ import { useMemo } from 'react'; -import BigNumber from 'bignumber.js'; import type { ColDef } from 'ag-grid-community'; import { - CenteredGridCellWrapper, COL_DEFS, DateRangeFilter, SetFilter, @@ -11,33 +9,18 @@ import { import compact from 'lodash/compact'; import { getDateTimeFormat } from '@vegaprotocol/utils'; import { t } from '@vegaprotocol/i18n'; -import { - NetworkParams, - useNetworkParams, -} from '@vegaprotocol/network-parameters'; import type { VegaICellRendererParams, VegaValueFormatterParams, } from '@vegaprotocol/datagrid'; import { - ProductTypeMapping, - ProductTypeShortName, + ProposalProductTypeShortName, ProposalStateMapping, } from '@vegaprotocol/types'; import type { ProposalListFieldsFragment } from '../../lib/proposals-data-provider/__generated__/Proposals'; -import { VoteProgress } from '../voting-progress'; import { ProposalActionsDropdown } from '../proposal-actions-dropdown'; export const useColumnDefs = () => { - const { params } = useNetworkParams([ - NetworkParams.governance_proposal_market_requiredMajority, - ]); - const requiredMajorityPercentage = useMemo(() => { - const requiredMajority = - params?.governance_proposal_market_requiredMajority ?? 1; - return new BigNumber(requiredMajority).times(100); - }, [params?.governance_proposal_market_requiredMajority]); - const columnDefs: ColDef[] = useMemo(() => { return compact([ { @@ -54,27 +37,38 @@ export const useColumnDefs = () => { }) => { if (!value || !data) return '-'; - // TODO: update when we switch to ProductConfiguration - const productType = 'Future'; + const getProductType = (data: ProposalListFieldsFragment) => { + if ( + data.terms.__typename === 'ProposalTerms' && + data.terms.change.__typename === 'NewMarket' + ) { + return data.terms.change.instrument.product?.__typename; + } + return undefined; + }; + + const productType = getProductType(data); return ( - - {ProductTypeShortName[productType]} - - } - /> + productType && ( + + {ProposalProductTypeShortName[productType]} + + } + /> + ) ); }, }, { colId: 'asset', headerName: t('Settlement asset'), - field: 'terms.change.instrument.futureProduct.settlementAsset.symbol', + field: 'terms.change.instrument.product.settlementAsset.symbol', }, { colId: 'state', @@ -94,32 +88,6 @@ export const useColumnDefs = () => { field: 'terms.change.successorConfiguration.parentMarketId', cellRenderer: 'ParentMarketCell', }, - { - colId: 'voting', - headerName: t('Voting'), - cellRenderer: ({ - data, - }: VegaICellRendererParams) => { - if (data) { - const yesTokens = new BigNumber(data.votes.yes.totalTokens); - const noTokens = new BigNumber(data.votes.no.totalTokens); - const totalTokensVoted = yesTokens.plus(noTokens); - const yesPercentage = totalTokensVoted.isZero() - ? new BigNumber(0) - : yesTokens.multipliedBy(100).dividedBy(totalTokensVoted); - return ( - - - - ); - } - return '-'; - }, - filter: false, - }, { colId: 'closing-date', headerName: t('Closing date'), @@ -156,7 +124,7 @@ export const useColumnDefs = () => { }, }, ]); - }, [requiredMajorityPercentage]); + }, []); return columnDefs; }; diff --git a/libs/proposals/src/lib/proposals-data-provider/Proposals.graphql b/libs/proposals/src/lib/proposals-data-provider/Proposals.graphql index b1dc5c418..273ae7902 100644 --- a/libs/proposals/src/lib/proposals-data-provider/Proposals.graphql +++ b/libs/proposals/src/lib/proposals-data-provider/Proposals.graphql @@ -16,78 +16,90 @@ fragment NewMarketFields on NewMarket { instrument { name code - futureProduct { - settlementAsset { - id - name - symbol - decimals - quantum - } - quoteName - dataSourceSpecForSettlementData { - sourceType { - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address + product { + ... on FutureProduct { + settlementAsset { + id + name + symbol + decimals + quantum + } + quoteName + dataSourceSpecForSettlementData { + sourceType { + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } } } - } - filters { - key { - name - type - } - conditions { - operator - value + filters { + key { + name + type + } + conditions { + operator + value + } } } } } } } - } - dataSourceSpecForTradingTermination { - sourceType { - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address + dataSourceSpecForTradingTermination { + sourceType { + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } } } - } - filters { - key { - name - type - } - conditions { - operator - value + filters { + key { + name + type + } + conditions { + operator + value + } } } } } } } + dataSourceSpecBinding { + settlementDataProperty + tradingTerminationProperty + } } - dataSourceSpecBinding { - settlementDataProperty - tradingTerminationProperty + ... on PerpetualProduct { + settlementAsset { + id + name + symbol + decimals + quantum + } + quoteName } } } diff --git a/libs/proposals/src/lib/proposals-data-provider/__generated__/Proposals.ts b/libs/proposals/src/lib/proposals-data-provider/__generated__/Proposals.ts index 51c4d3bb5..e3b2761b7 100644 --- a/libs/proposals/src/lib/proposals-data-provider/__generated__/Proposals.ts +++ b/libs/proposals/src/lib/proposals-data-provider/__generated__/Proposals.ts @@ -5,7 +5,7 @@ import * as Apollo from '@apollo/client'; const defaultOptions = {} as const; export type UpdateMarketStateFieldsFragment = { __typename?: 'UpdateMarketState', updateType: Types.MarketUpdateType, price?: string | null, market: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string } } } }; -export type NewMarketFieldsFragment = { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array | null, 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' } }, dataSourceSpecForTradingTermination: { __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' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, 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 } }, successorConfiguration?: { __typename?: 'SuccessorConfiguration', parentMarketId: string } | null }; +export type NewMarketFieldsFragment = { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array | null, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, product?: { __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' } }, dataSourceSpecForTradingTermination: { __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' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | { __typename?: 'PerpetualProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string } } | { __typename?: 'SpotProduct' } | null }, 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 } }, successorConfiguration?: { __typename?: 'SuccessorConfiguration', parentMarketId: string } | null }; export type UpdateMarketFieldsFragment = { __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' } }, dataSourceSpecForTradingTermination: { __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' } }, 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' } }, dataSourceSpecForSettlementSchedule: { __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' } }, 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', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } }; @@ -19,7 +19,7 @@ export type NewTransferFieldsFragment = { __typename?: 'NewTransfer', source: st export type CancelTransferFieldsFragment = { __typename?: 'CancelTransfer', transferId: string }; -export type ProposalListFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, requiredMajority: string, requiredParticipation: string, requiredLpMajority?: string | null, requiredLpParticipation?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: 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, 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' } }, dataSourceSpecForTradingTermination: { __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' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, 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 } }, successorConfiguration?: { __typename?: 'SuccessorConfiguration', parentMarketId: string } | null } | { __typename: 'NewSpotMarket' } | { __typename: 'NewTransfer' } | { __typename: 'UpdateAsset', assetId: string, quantum: 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' } }, dataSourceSpecForTradingTermination: { __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' } }, 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' } }, dataSourceSpecForSettlementSchedule: { __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' } }, 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', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename: 'UpdateMarketState' } | { __typename: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename: 'UpdateReferralProgram' } | { __typename: 'UpdateSpotMarket' } | { __typename: 'UpdateVolumeDiscountProgram' } } }; +export type ProposalListFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, requiredMajority: string, requiredParticipation: string, requiredLpMajority?: string | null, requiredLpParticipation?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: 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, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, product?: { __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' } }, dataSourceSpecForTradingTermination: { __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' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | { __typename?: 'PerpetualProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string } } | { __typename?: 'SpotProduct' } | null }, 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 } }, successorConfiguration?: { __typename?: 'SuccessorConfiguration', parentMarketId: string } | null } | { __typename: 'NewSpotMarket' } | { __typename: 'NewTransfer' } | { __typename: 'UpdateAsset', assetId: string, quantum: 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' } }, dataSourceSpecForTradingTermination: { __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' } }, 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' } }, dataSourceSpecForSettlementSchedule: { __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' } }, 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', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename: 'UpdateMarketState' } | { __typename: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename: 'UpdateReferralProgram' } | { __typename: 'UpdateSpotMarket' } | { __typename: 'UpdateVolumeDiscountProgram' } } }; export type ProposalsListQueryVariables = Types.Exact<{ proposalType?: Types.InputMaybe; @@ -27,7 +27,7 @@ export type ProposalsListQueryVariables = Types.Exact<{ }>; -export type ProposalsListQuery = { __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, requiredMajority: string, requiredParticipation: string, requiredLpMajority?: string | null, requiredLpParticipation?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: 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, 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' } }, dataSourceSpecForTradingTermination: { __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' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, 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 } }, successorConfiguration?: { __typename?: 'SuccessorConfiguration', parentMarketId: string } | null } | { __typename: 'NewSpotMarket' } | { __typename: 'NewTransfer' } | { __typename: 'UpdateAsset', assetId: string, quantum: 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' } }, dataSourceSpecForTradingTermination: { __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' } }, 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' } }, dataSourceSpecForSettlementSchedule: { __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' } }, 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', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename: 'UpdateMarketState' } | { __typename: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename: 'UpdateReferralProgram' } | { __typename: 'UpdateSpotMarket' } | { __typename: 'UpdateVolumeDiscountProgram' } } } } | null> | null } | null }; +export type ProposalsListQuery = { __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, requiredMajority: string, requiredParticipation: string, requiredLpMajority?: string | null, requiredLpParticipation?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: 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, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, product?: { __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' } }, dataSourceSpecForTradingTermination: { __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' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | { __typename?: 'PerpetualProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string } } | { __typename?: 'SpotProduct' } | null }, 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 } }, successorConfiguration?: { __typename?: 'SuccessorConfiguration', parentMarketId: string } | null } | { __typename: 'NewSpotMarket' } | { __typename: 'NewTransfer' } | { __typename: 'UpdateAsset', assetId: string, quantum: 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' } }, dataSourceSpecForTradingTermination: { __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' } }, 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' } }, dataSourceSpecForSettlementSchedule: { __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' } }, 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', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename: 'UpdateMarketState' } | { __typename: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename: 'UpdateReferralProgram' } | { __typename: 'UpdateSpotMarket' } | { __typename: 'UpdateVolumeDiscountProgram' } } } } | null> | null } | null }; export type NewMarketSuccessorFieldsFragment = { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string }, successorConfiguration?: { __typename?: 'SuccessorConfiguration', parentMarketId: string } | null }; @@ -83,78 +83,90 @@ export const NewMarketFieldsFragmentDoc = gql` instrument { name code - futureProduct { - settlementAsset { - id - name - symbol - decimals - quantum - } - quoteName - dataSourceSpecForSettlementData { - sourceType { - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address + product { + ... on FutureProduct { + settlementAsset { + id + name + symbol + decimals + quantum + } + quoteName + dataSourceSpecForSettlementData { + sourceType { + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } } } - } - filters { - key { - name - type - } - conditions { - operator - value + filters { + key { + name + type + } + conditions { + operator + value + } } } } } } } - } - dataSourceSpecForTradingTermination { - sourceType { - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address + dataSourceSpecForTradingTermination { + sourceType { + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } } } - } - filters { - key { - name - type - } - conditions { - operator - value + filters { + key { + name + type + } + conditions { + operator + value + } } } } } } } + dataSourceSpecBinding { + settlementDataProperty + tradingTerminationProperty + } } - dataSourceSpecBinding { - settlementDataProperty - tradingTerminationProperty + ... on PerpetualProduct { + settlementAsset { + id + name + symbol + decimals + quantum + } + quoteName } } } diff --git a/libs/proposals/src/lib/proposals-data-provider/proposals.mock.ts b/libs/proposals/src/lib/proposals-data-provider/proposals.mock.ts index cfc249402..0592fbe98 100644 --- a/libs/proposals/src/lib/proposals-data-provider/proposals.mock.ts +++ b/libs/proposals/src/lib/proposals-data-provider/proposals.mock.ts @@ -128,7 +128,7 @@ export const createProposalListFieldsFragment = ( instrument: { code: 'ETHUSD', name: 'ETHUSD', - futureProduct: { + product: { settlementAsset: { id: 'b340c130096819428a62e5df407fd6abe66e444b89ad64f670beb98621c9c663', name: 'tDAI TEST', @@ -262,7 +262,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'ETHUSD', name: 'ETHUSD', - futureProduct: { + product: { settlementAsset: { id: 'b340c130096819428a62e5df407fd6abe66e444b89ad64f670beb98621c9c663', name: 'tDAI TEST', @@ -352,7 +352,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'LINKUSD', name: 'LINKUSD', - futureProduct: { + product: { settlementAsset: { id: 'eb30d55e90e1f9e5c4727d6fa2a5a8cd36ab9ae9738eb8f3faf53e2bee4861ee', name: 'mUSDT-II', @@ -442,7 +442,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'LINKUSD', name: 'LINKUSD', - futureProduct: { + product: { settlementAsset: { id: 'eb30d55e90e1f9e5c4727d6fa2a5a8cd36ab9ae9738eb8f3faf53e2bee4861ee', name: 'mUSDT-II', @@ -532,7 +532,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'ETHUSD', name: 'ETHUSD', - futureProduct: { + product: { settlementAsset: { id: 'b340c130096819428a62e5df407fd6abe66e444b89ad64f670beb98621c9c663', name: 'tDAI TEST', @@ -622,7 +622,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'LINKUSD', name: 'LINKUSD', - futureProduct: { + product: { settlementAsset: { id: 'eb30d55e90e1f9e5c4727d6fa2a5a8cd36ab9ae9738eb8f3faf53e2bee4861ee', name: 'mUSDT-II', @@ -712,7 +712,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'ETHDAI.MF21', name: 'ETHDAI Monthly (Dec 2022)', - futureProduct: { + product: { settlementAsset: { id: 'b340c130096819428a62e5df407fd6abe66e444b89ad64f670beb98621c9c663', name: 'tDAI TEST', @@ -802,7 +802,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'AAPL.MF21', name: 'Apple Monthly (Dec 2022)', - futureProduct: { + product: { settlementAsset: { id: 'c9fe6fc24fce121b2cc72680543a886055abb560043fda394ba5376203b7527d', name: 'tUSDC TEST', @@ -892,7 +892,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'BTCUSD.MF21', name: 'BTCUSD Monthly (Dec 2022)', - futureProduct: { + product: { settlementAsset: { id: 'b340c130096819428a62e5df407fd6abe66e444b89ad64f670beb98621c9c663', name: 'tDAI TEST', @@ -982,7 +982,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'TSLA.QM21', name: 'Tesla Quarterly (Feb 2023)', - futureProduct: { + product: { settlementAsset: { id: '177e8f6c25a955bd18475084b99b2b1d37f28f3dec393fab7755a7e69c3d8c3b', name: 'tEURO TEST', @@ -1072,7 +1072,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'AAVEDAI.MF21', name: 'AAVEDAI Monthly (Dec 2022)', - futureProduct: { + product: { settlementAsset: { id: 'b340c130096819428a62e5df407fd6abe66e444b89ad64f670beb98621c9c663', name: 'tDAI TEST', @@ -1162,7 +1162,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'ETHBTC.QM21', name: 'ETHBTC Quarterly (Feb 2023)', - futureProduct: { + product: { settlementAsset: { id: 'cee709223217281d7893b650850ae8ee8a18b7539b5658f9b4cc24de95dd18ad', name: 'tBTC TEST', @@ -1252,7 +1252,7 @@ const proposalListFields: ProposalListFieldsFragment[] = [ instrument: { code: 'UNIDAI.MF21', name: 'UNIDAI Monthly (Dec 2022)', - futureProduct: { + product: { settlementAsset: { id: 'b340c130096819428a62e5df407fd6abe66e444b89ad64f670beb98621c9c663', name: 'tDAI TEST', From 70f42c1c7e5275edc3de10fc266341db9b2dc05d Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Fri, 17 Nov 2023 08:53:21 -0800 Subject: [PATCH 5/7] fix(trading): fees page fixes for mainnet (#5303) Co-authored-by: asiaznik --- .../components/fees-container/Fees.graphql | 16 +++ .../fees-container/__generated__/Fees.ts | 18 ++- .../fees-container/fees-container.tsx | 129 ++++++++++++++++-- .../components/fees-container/stat.tsx | 22 ++- .../fees-container/use-referral-stats.spec.ts | 4 + .../fees-container/use-referral-stats.ts | 16 ++- .../components/fees-container/utils.spec.ts | 14 +- .../components/fees-container/utils.ts | 8 +- 8 files changed, 196 insertions(+), 31 deletions(-) diff --git a/apps/trading/components/fees-container/Fees.graphql b/apps/trading/components/fees-container/Fees.graphql index 0b058637d..f4e4f6b44 100644 --- a/apps/trading/components/fees-container/Fees.graphql +++ b/apps/trading/components/fees-container/Fees.graphql @@ -36,6 +36,22 @@ query Fees( } } } + referrer: referralSets(referrer: $partyId) { + edges { + node { + id + referrer + } + } + } + referee: referralSets(referee: $partyId) { + edges { + node { + id + referrer + } + } + } referralSetReferees(referee: $partyId) { edges { node { diff --git a/apps/trading/components/fees-container/__generated__/Fees.ts b/apps/trading/components/fees-container/__generated__/Fees.ts index 064f75229..aeb340c17 100644 --- a/apps/trading/components/fees-container/__generated__/Fees.ts +++ b/apps/trading/components/fees-container/__generated__/Fees.ts @@ -15,7 +15,7 @@ export type FeesQueryVariables = Types.Exact<{ }>; -export type FeesQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string }, volumeDiscountStats: { __typename?: 'VolumeDiscountStatsConnection', edges: Array<{ __typename?: 'VolumeDiscountStatsEdge', node: { __typename?: 'VolumeDiscountStats', atEpoch: number, discountFactor: string, runningVolume: string } } | null> }, referralSetReferees: { __typename?: 'ReferralSetRefereeConnection', edges: Array<{ __typename?: 'ReferralSetRefereeEdge', node: { __typename?: 'ReferralSetReferee', atEpoch: number } } | null> }, referralSetStats: { __typename?: 'ReferralSetStatsConnection', edges: Array<{ __typename?: 'ReferralSetStatsEdge', node: { __typename?: 'ReferralSetStats', atEpoch: number, discountFactor: string, referralSetRunningNotionalTakerVolume: string } } | null> } }; +export type FeesQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string }, volumeDiscountStats: { __typename?: 'VolumeDiscountStatsConnection', edges: Array<{ __typename?: 'VolumeDiscountStatsEdge', node: { __typename?: 'VolumeDiscountStats', atEpoch: number, discountFactor: string, runningVolume: string } } | null> }, referrer: { __typename?: 'ReferralSetConnection', edges: Array<{ __typename?: 'ReferralSetEdge', node: { __typename?: 'ReferralSet', id: string, referrer: string } } | null> }, referee: { __typename?: 'ReferralSetConnection', edges: Array<{ __typename?: 'ReferralSetEdge', node: { __typename?: 'ReferralSet', id: string, referrer: string } } | null> }, referralSetReferees: { __typename?: 'ReferralSetRefereeConnection', edges: Array<{ __typename?: 'ReferralSetRefereeEdge', node: { __typename?: 'ReferralSetReferee', atEpoch: number } } | null> }, referralSetStats: { __typename?: 'ReferralSetStatsConnection', edges: Array<{ __typename?: 'ReferralSetStatsEdge', node: { __typename?: 'ReferralSetStats', atEpoch: number, discountFactor: string, referralSetRunningNotionalTakerVolume: string } } | null> } }; export const DiscountProgramsDocument = gql` @@ -81,6 +81,22 @@ export const FeesDocument = gql` } } } + referrer: referralSets(referrer: $partyId) { + edges { + node { + id + referrer + } + } + } + referee: referralSets(referee: $partyId) { + edges { + node { + id + referrer + } + } + } referralSetReferees(referee: $partyId) { edges { node { diff --git a/apps/trading/components/fees-container/fees-container.tsx b/apps/trading/components/fees-container/fees-container.tsx index d63bc4e9a..ea4c8a095 100644 --- a/apps/trading/components/fees-container/fees-container.tsx +++ b/apps/trading/components/fees-container/fees-container.tsx @@ -17,6 +17,14 @@ import { useReferralStats } from './use-referral-stats'; import { formatPercentage, getAdjustedFee } from './utils'; import { Table, Td, Th, THead, Tr } from './table'; import BigNumber from 'bignumber.js'; +import { Links } from '../../lib/links'; +import { Link } from 'react-router-dom'; +import { + Tooltip, + VegaIcon, + VegaIconNames, + truncateMiddle, +} from '@vegaprotocol/ui-toolkit'; export const FeesContainer = () => { const { pubKey } = useVegaWallet(); @@ -56,16 +64,25 @@ export const FeesContainer = () => { referralTierIndex, referralTiers, epochsInSet, + code, + isReferrer, } = useReferralStats( feesData?.referralSetStats, feesData?.referralSetReferees, programData?.currentReferralProgram, - feesData?.epoch + feesData?.epoch, + feesData?.referrer, + feesData?.referee ); const loading = paramsLoading || feesLoading || programLoading; const isConnected = Boolean(pubKey); + const isReferralProgramRunning = Boolean(programData?.currentReferralProgram); + const isVolumeDiscountProgramRunning = Boolean( + programData?.currentVolumeDiscountProgram + ); + return (
{isConnected && ( @@ -90,6 +107,8 @@ export const FeesContainer = () => { { className="sm:col-span-2" loading={loading} > - + {isVolumeDiscountProgramRunning ? ( + + ) : ( +

+ {t('No volume discount program active')} +

+ )}
- + {isReferrer ? ( + + ) : isReferralProgramRunning ? ( + + ) : ( +

+ {t('No referral program active')} +

+ )}
)} @@ -142,7 +175,7 @@ export const FeesContainer = () => { /> @@ -325,26 +358,64 @@ const ReferralBenefits = ({ const TotalDiscount = ({ referralDiscount, volumeDiscount, + isReferralProgramRunning, + isVolumeDiscountProgramRunning, }: { referralDiscount: number; volumeDiscount: number; + isReferralProgramRunning: boolean; + isVolumeDiscountProgramRunning: boolean; }) => { + const totalDiscount = 1 - (1 - volumeDiscount) * (1 - referralDiscount); + const totalDiscountDescription = t( + 'The total discount is calculated according to the following formula: ' + ); + const formula = ( + + 1 - (1 - dvolume) ⋇ (1 - dreferral) + + ); + return (
+ {totalDiscountDescription} + {formula} + + } + value={formatPercentage(totalDiscount) + '%'} highlight={true} /> - + @@ -491,3 +562,31 @@ const YourTier = () => { ); }; + +const ReferrerInfo = ({ code }: { code?: string }) => ( +
+

+ {t('Connected key is owner of the referral set')} + {code && ( + <> + {' '} + + {truncateMiddle(code)} + + + )} + {'. '} + {t('As owner, it is eligible for commission not fee discounts.')} +

+

+ {t('See')}{' '} + + {t('Referrals')} + {' '} + {t('for more information.')} +

+
+); diff --git a/apps/trading/components/fees-container/stat.tsx b/apps/trading/components/fees-container/stat.tsx index fe2784aae..307b77ff0 100644 --- a/apps/trading/components/fees-container/stat.tsx +++ b/apps/trading/components/fees-container/stat.tsx @@ -1,23 +1,31 @@ +import { Tooltip } from '@vegaprotocol/ui-toolkit'; import classNames from 'classnames'; +import type { ReactNode } from 'react'; export const Stat = ({ value, text, highlight, + description, }: { value: string | number; text?: string; highlight?: boolean; + description?: ReactNode; }) => { + const val = ( + + {value} + + ); return (

- - {value} - + {description ? {val} : val} {text && ( {text} )} diff --git a/apps/trading/components/fees-container/use-referral-stats.spec.ts b/apps/trading/components/fees-container/use-referral-stats.spec.ts index ffd3c4a7c..e38eb899d 100644 --- a/apps/trading/components/fees-container/use-referral-stats.spec.ts +++ b/apps/trading/components/fees-container/use-referral-stats.spec.ts @@ -73,6 +73,8 @@ describe('useReferralStats', () => { referralTierIndex: -1, referralTiers: [], epochsInSet: 0, + code: undefined, + isReferrer: false, }); }); @@ -93,6 +95,8 @@ describe('useReferralStats', () => { referralTierIndex: 1, referralTiers: program.benefitTiers, epochsInSet: Number(epoch.id) - set.atEpoch, + code: undefined, + isReferrer: false, }); }); diff --git a/apps/trading/components/fees-container/use-referral-stats.ts b/apps/trading/components/fees-container/use-referral-stats.ts index dbdafb41b..94821ed70 100644 --- a/apps/trading/components/fees-container/use-referral-stats.ts +++ b/apps/trading/components/fees-container/use-referral-stats.ts @@ -2,12 +2,15 @@ import compact from 'lodash/compact'; import maxBy from 'lodash/maxBy'; import { getReferralBenefitTier } from './utils'; import type { DiscountProgramsQuery, FeesQuery } from './__generated__/Fees'; +import { first } from 'lodash'; export const useReferralStats = ( setStats?: FeesQuery['referralSetStats'], setReferees?: FeesQuery['referralSetReferees'], program?: DiscountProgramsQuery['currentReferralProgram'], - epoch?: FeesQuery['epoch'] + epoch?: FeesQuery['epoch'], + setIfReferrer?: FeesQuery['referrer'], + setIfReferee?: FeesQuery['referee'] ) => { const referralTiers = program?.benefitTiers || []; @@ -18,9 +21,18 @@ export const useReferralStats = ( referralTierIndex: -1, referralTiers, epochsInSet: 0, + code: undefined, + isReferrer: false, }; } + const setIfReferrerData = first( + compact(setIfReferrer?.edges).map((e) => e.node) + ); + const setIfRefereeData = first( + compact(setIfReferee?.edges).map((e) => e.node) + ); + const referralSetsStats = compact(setStats.edges).map((e) => e.node); const referralSets = compact(setReferees.edges).map((e) => e.node); @@ -48,5 +60,7 @@ export const useReferralStats = ( referralTierIndex, referralTiers, epochsInSet, + code: (setIfReferrerData || setIfRefereeData)?.id, + isReferrer: Boolean(setIfReferrerData), }; }; diff --git a/apps/trading/components/fees-container/utils.spec.ts b/apps/trading/components/fees-container/utils.spec.ts index c2b3cd86e..3f618cbdc 100644 --- a/apps/trading/components/fees-container/utils.spec.ts +++ b/apps/trading/components/fees-container/utils.spec.ts @@ -21,7 +21,7 @@ describe('getAdjustedFee', () => { new BigNumber(referralDiscount), ]; - // 1 - 0.5 - 0.5 + // 1 - 0.5 = 0.5 const v = new BigNumber(1).minus(new BigNumber(volumeDiscount)); // 1 - 0.5 = 0.5 @@ -34,13 +34,15 @@ describe('getAdjustedFee', () => { // 0.1 + 0.1 + 0.1 = 0.3 const totalFees = fees.reduce((sum, x) => sum.plus(x), new BigNumber(0)); - // 0.3 * 0.75 = 0.225 - const expected = new BigNumber(totalFees).times(factor).toNumber(); + // (1 - 0.3) * 0.75 = 0.525 + const expected = new BigNumber(totalFees) + .times(new BigNumber(1).minus(factor)) + .toNumber(); expect(getAdjustedFee(fees, discounts)).toBe(expected); }); - it('combines discount factors multiplicativly', () => { + it('combines discount factors multiplicatively', () => { const volumeDiscount = 0.4; const referralDiscount = 0.1; @@ -67,7 +69,9 @@ describe('getAdjustedFee', () => { // summed fees const totalFees = fees.reduce((sum, x) => sum.plus(x), new BigNumber(0)); - const expected = new BigNumber(totalFees).times(factor).toNumber(); + const expected = new BigNumber(totalFees) + .times(new BigNumber(1).minus(factor)) + .toNumber(); expect(getAdjustedFee(fees, discounts)).toBe(expected); }); diff --git a/apps/trading/components/fees-container/utils.ts b/apps/trading/components/fees-container/utils.ts index 30a4be30a..68b980035 100644 --- a/apps/trading/components/fees-container/utils.ts +++ b/apps/trading/components/fees-container/utils.ts @@ -12,7 +12,9 @@ export const formatPercentage = (num: number) => { const pct = new BigNumber(num).times(100); const dps = pct.decimalPlaces(); const formatter = new Intl.NumberFormat(getUserLocale(), { - minimumFractionDigits: dps || 0, + // set to 0 in order to remove the "trailing zeroes" for numbers such as: + // 0.123456789 -non-zero-min-> 12.3456800% -zero-min-> 12.34568% + minimumFractionDigits: 0, maximumFractionDigits: dps || 0, }); return formatter.format(parseFloat(pct.toFixed(5))); @@ -101,5 +103,7 @@ export const getAdjustedFee = (fees: BigNumber[], discounts: BigNumber[]) => { const totalFactor = new BigNumber(1).minus(combinedFactors); - return totalFee.times(BigNumber.max(0, totalFactor)).toNumber(); + return totalFee + .times(new BigNumber(1).minus(BigNumber.max(0, totalFactor))) + .toNumber(); }; From 2983c6c6ba87a5554db6c11635dc1e5fbcc94ca9 Mon Sep 17 00:00:00 2001 From: Edd Date: Fri, 17 Nov 2023 18:25:30 +0000 Subject: [PATCH 6/7] feat(governance): enable volume discount update view (#5304) (#5307) --- apps/governance/.env | 3 +-- apps/governance/.env.capsule | 3 +-- apps/governance/.env.devnet | 1 - apps/governance/.env.mainnet | 9 ++++----- apps/governance/.env.mainnet-mirror | 9 ++++----- apps/governance/.env.stagnet1 | 1 - apps/governance/.env.testnet | 1 - apps/governance/.env.validators-testnet | 9 ++++----- apps/governance/src/routes/home/index.tsx | 1 - .../proposal-volume-discount-program-details.tsx | 2 +- .../src/routes/proposals/proposal/Proposal.graphql | 2 -- .../routes/proposals/proposal/__generated__/Proposal.ts | 6 ++---- .../src/routes/proposals/proposal/proposal-container.tsx | 1 - .../src/routes/proposals/proposals/Proposals.graphql | 2 -- .../proposals/proposals/__generated__/Proposals.ts | 6 ++---- .../routes/proposals/proposals/proposals-container.tsx | 1 - .../proposals/rejected/rejected-proposals-container.tsx | 1 - 17 files changed, 19 insertions(+), 39 deletions(-) diff --git a/apps/governance/.env b/apps/governance/.env index 97fcb79ea..07f6f1b48 100644 --- a/apps/governance/.env +++ b/apps/governance/.env @@ -35,6 +35,5 @@ NX_SUCCESSOR_MARKETS=true NX_METAMASK_SNAPS=true NX_PRODUCT_PERPETUALS=false NX_UPDATE_MARKET_STATE=false -NX_REFERRALS=false +NX_REFERRALS=true NX_GOVERNANCE_TRANSFERS=false -NX_VOLUME_DISCOUNTS=false diff --git a/apps/governance/.env.capsule b/apps/governance/.env.capsule index e70efca5e..4de4d9da5 100644 --- a/apps/governance/.env.capsule +++ b/apps/governance/.env.capsule @@ -31,9 +31,8 @@ NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket CYPRESS_FAIRGROUND=false # Cosmic elevator flags -NX_SUCCESSOR_MARKETS=false +NX_SUCCESSOR_MARKETS=true NX_METAMASK_SNAPS=false NX_PRODUCT_PERPETUALS=true NX_UPDATE_MARKET_STATE=true NX_REFERRALS=true -NX_VOLUME_DISCOUNTS=true diff --git a/apps/governance/.env.devnet b/apps/governance/.env.devnet index 019dbda7d..5616a4821 100644 --- a/apps/governance/.env.devnet +++ b/apps/governance/.env.devnet @@ -28,4 +28,3 @@ NX_METAMASK_SNAPS=true NX_PRODUCT_PERPETUALS=true NX_UPDATE_MARKET_STATE=true NX_REFERRALS=true -NX_VOLUME_DISCOUNTS=true diff --git a/apps/governance/.env.mainnet b/apps/governance/.env.mainnet index 4afaabacd..ac676e9ad 100644 --- a/apps/governance/.env.mainnet +++ b/apps/governance/.env.mainnet @@ -22,9 +22,8 @@ NX_TENDERMINT_URL=https://be.vega.community NX_TENDERMINT_WEBSOCKET_URL=wss://be.vega.community/websocket # Cosmic elevator flags -NX_SUCCESSOR_MARKETS=false +NX_SUCCESSOR_MARKETS=true NX_METAMASK_SNAPS=false -NX_PRODUCT_PERPETUALS=false -NX_UPDATE_MARKET_STATE=false -NX_REFERRALS=false -NX_VOLUME_DISCOUNTS=false +NX_PRODUCT_PERPETUALS=true +NX_UPDATE_MARKET_STATE=true +NX_REFERRALS=true diff --git a/apps/governance/.env.mainnet-mirror b/apps/governance/.env.mainnet-mirror index 24af456f4..5521d5d44 100644 --- a/apps/governance/.env.mainnet-mirror +++ b/apps/governance/.env.mainnet-mirror @@ -21,9 +21,8 @@ NX_TENDERMINT_URL=https://be.mainnet-mirror.vega.rocks NX_TENDERMINT_WEBSOCKET_URL=wss://be.mainnet-mirror.vega.rocks/websocket # Cosmic elevator flags -NX_SUCCESSOR_MARKETS=false +NX_SUCCESSOR_MARKETS=true NX_METAMASK_SNAPS=false -NX_PRODUCT_PERPETUALS=false -NX_UPDATE_MARKET_STATE=false -NX_REFERRALS=false -NX_VOLUME_DISCOUNTS=false +NX_PRODUCT_PERPETUALS=true +NX_UPDATE_MARKET_STATE=true +NX_REFERRALS=true diff --git a/apps/governance/.env.stagnet1 b/apps/governance/.env.stagnet1 index a67956b47..b91995447 100644 --- a/apps/governance/.env.stagnet1 +++ b/apps/governance/.env.stagnet1 @@ -25,4 +25,3 @@ NX_PRODUCT_PERPETUALS=true NX_UPDATE_MARKET_STATE=true NX_REFERRALS=true NX_GOVERNANCE_TRANSFERS=true -NX_VOLUME_DISCOUNTS=true diff --git a/apps/governance/.env.testnet b/apps/governance/.env.testnet index ac0d64db9..305473b45 100644 --- a/apps/governance/.env.testnet +++ b/apps/governance/.env.testnet @@ -29,4 +29,3 @@ NX_METAMASK_SNAPS=true NX_PRODUCT_PERPETUALS=true NX_UPDATE_MARKET_STATE=true NX_REFERRALS=true -NX_VOLUME_DISCOUNTS=true diff --git a/apps/governance/.env.validators-testnet b/apps/governance/.env.validators-testnet index f8f57ed8c..dfbf5ba08 100644 --- a/apps/governance/.env.validators-testnet +++ b/apps/governance/.env.validators-testnet @@ -20,9 +20,8 @@ NX_TENDERMINT_URL=https://tm.be.validators-testnet.vega.rocks NX_TENDERMINT_WEBSOCKET_URL=wss://be.validators-testnet.vega. # Cosmic elevator flags -NX_SUCCESSOR_MARKETS=false +NX_SUCCESSOR_MARKETS=true NX_METAMASK_SNAPS=false -NX_PRODUCT_PERPETUALS=false -NX_UPDATE_MARKET_STATE=false -NX_REFERRALS=false -NX_VOLUME_DISCOUNTS=false +NX_PRODUCT_PERPETUALS=true +NX_UPDATE_MARKET_STATE=true +NX_REFERRALS=true diff --git a/apps/governance/src/routes/home/index.tsx b/apps/governance/src/routes/home/index.tsx index 3977a5743..6ae4df185 100644 --- a/apps/governance/src/routes/home/index.tsx +++ b/apps/governance/src/routes/home/index.tsx @@ -189,7 +189,6 @@ const GovernanceHome = ({ name }: RouteChildProps) => { includeNewMarketProductFields: !!FLAGS.PRODUCT_PERPETUALS, includeUpdateMarketStates: !!FLAGS.UPDATE_MARKET_STATE, includeUpdateReferralPrograms: !!FLAGS.REFERRALS, - includeUpdateVolumeDiscountPrograms: !!FLAGS.VOLUME_DISCOUNTS, }, }); diff --git a/apps/governance/src/routes/proposals/components/proposal-volume-discount-program-details/proposal-volume-discount-program-details.tsx b/apps/governance/src/routes/proposals/components/proposal-volume-discount-program-details/proposal-volume-discount-program-details.tsx index 48a72b130..486310f42 100644 --- a/apps/governance/src/routes/proposals/components/proposal-volume-discount-program-details/proposal-volume-discount-program-details.tsx +++ b/apps/governance/src/routes/proposals/components/proposal-volume-discount-program-details/proposal-volume-discount-program-details.tsx @@ -78,7 +78,7 @@ export const ProposalVolumeDiscountProgramDetails = ({ {t('BenefitTiers')} - {benefitTiers + {[...benefitTiers] .sort( (a, b) => Number(a.minimumRunningNotionalTakerVolume) - diff --git a/apps/governance/src/routes/proposals/proposal/Proposal.graphql b/apps/governance/src/routes/proposals/proposal/Proposal.graphql index d950dde31..d460ac147 100644 --- a/apps/governance/src/routes/proposals/proposal/Proposal.graphql +++ b/apps/governance/src/routes/proposals/proposal/Proposal.graphql @@ -84,7 +84,6 @@ query Proposal( $includeNewMarketProductField: Boolean! $includeUpdateMarketState: Boolean! $includeUpdateReferralProgram: Boolean! - $includeUpdateVolumeDiscountProgram: Boolean! ) { proposal(id: $proposalId) { id @@ -104,7 +103,6 @@ query Proposal( ...UpdateMarketState @include(if: $includeUpdateMarketState) ...UpdateReferralProgram @include(if: $includeUpdateReferralProgram) ...UpdateVolumeDiscountProgram - @include(if: $includeUpdateVolumeDiscountProgram) 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 64c5e7d5a..5b8cfaf3f 100644 --- a/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts +++ b/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts @@ -16,7 +16,6 @@ export type ProposalQueryVariables = Types.Exact<{ includeNewMarketProductField: Types.Scalars['Boolean']; includeUpdateMarketState: Types.Scalars['Boolean']; includeUpdateReferralProgram: Types.Scalars['Boolean']; - includeUpdateVolumeDiscountProgram: Types.Scalars['Boolean']; }>; @@ -108,7 +107,7 @@ export const UpdateVolumeDiscountProgramFragmentDoc = gql` } `; export const ProposalDocument = gql` - query Proposal($proposalId: ID!, $includeNewMarketProductField: Boolean!, $includeUpdateMarketState: Boolean!, $includeUpdateReferralProgram: Boolean!, $includeUpdateVolumeDiscountProgram: Boolean!) { + query Proposal($proposalId: ID!, $includeNewMarketProductField: Boolean!, $includeUpdateMarketState: Boolean!, $includeUpdateReferralProgram: Boolean!) { proposal(id: $proposalId) { id rationale { @@ -126,7 +125,7 @@ export const ProposalDocument = gql` ...NewMarketProductField @include(if: $includeNewMarketProductField) ...UpdateMarketState @include(if: $includeUpdateMarketState) ...UpdateReferralProgram @include(if: $includeUpdateReferralProgram) - ...UpdateVolumeDiscountProgram @include(if: $includeUpdateVolumeDiscountProgram) + ...UpdateVolumeDiscountProgram terms { closingDatetime enactmentDatetime @@ -446,7 +445,6 @@ ${UpdateVolumeDiscountProgramFragmentDoc}`; * includeNewMarketProductField: // value for 'includeNewMarketProductField' * includeUpdateMarketState: // value for 'includeUpdateMarketState' * includeUpdateReferralProgram: // value for 'includeUpdateReferralProgram' - * includeUpdateVolumeDiscountProgram: // value for 'includeUpdateVolumeDiscountProgram' * }, * }); */ diff --git a/apps/governance/src/routes/proposals/proposal/proposal-container.tsx b/apps/governance/src/routes/proposals/proposal/proposal-container.tsx index 5f3ff62d0..5f90da2ad 100644 --- a/apps/governance/src/routes/proposals/proposal/proposal-container.tsx +++ b/apps/governance/src/routes/proposals/proposal/proposal-container.tsx @@ -62,7 +62,6 @@ export const ProposalContainer = () => { includeNewMarketProductField: !!FLAGS.PRODUCT_PERPETUALS, includeUpdateMarketState: !!FLAGS.UPDATE_MARKET_STATE, includeUpdateReferralProgram: !!FLAGS.REFERRALS, - includeUpdateVolumeDiscountProgram: !!FLAGS.VOLUME_DISCOUNTS, }, skip: !params.proposalId, }); diff --git a/apps/governance/src/routes/proposals/proposals/Proposals.graphql b/apps/governance/src/routes/proposals/proposals/Proposals.graphql index c031f53b3..9ad43a3e5 100644 --- a/apps/governance/src/routes/proposals/proposals/Proposals.graphql +++ b/apps/governance/src/routes/proposals/proposals/Proposals.graphql @@ -171,7 +171,6 @@ query Proposals( $includeNewMarketProductFields: Boolean! $includeUpdateMarketStates: Boolean! $includeUpdateReferralPrograms: Boolean! - $includeUpdateVolumeDiscountPrograms: Boolean! ) { proposalsConnection { edges { @@ -181,7 +180,6 @@ query Proposals( ...UpdateMarketStates @include(if: $includeUpdateMarketStates) ...UpdateReferralPrograms @include(if: $includeUpdateReferralPrograms) ...UpdateVolumeDiscountPrograms - @include(if: $includeUpdateVolumeDiscountPrograms) } } } diff --git a/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts b/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts index 9999bdb88..a7c223768 100644 --- a/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts +++ b/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts @@ -17,7 +17,6 @@ export type ProposalsQueryVariables = Types.Exact<{ includeNewMarketProductFields: Types.Scalars['Boolean']; includeUpdateMarketStates: Types.Scalars['Boolean']; includeUpdateReferralPrograms: Types.Scalars['Boolean']; - includeUpdateVolumeDiscountPrograms: Types.Scalars['Boolean']; }>; @@ -198,7 +197,7 @@ export const ProposalFieldsFragmentDoc = gql` } `; export const ProposalsDocument = gql` - query Proposals($includeNewMarketProductFields: Boolean!, $includeUpdateMarketStates: Boolean!, $includeUpdateReferralPrograms: Boolean!, $includeUpdateVolumeDiscountPrograms: Boolean!) { + query Proposals($includeNewMarketProductFields: Boolean!, $includeUpdateMarketStates: Boolean!, $includeUpdateReferralPrograms: Boolean!) { proposalsConnection { edges { node { @@ -206,7 +205,7 @@ export const ProposalsDocument = gql` ...NewMarketProductFields @include(if: $includeNewMarketProductFields) ...UpdateMarketStates @include(if: $includeUpdateMarketStates) ...UpdateReferralPrograms @include(if: $includeUpdateReferralPrograms) - ...UpdateVolumeDiscountPrograms @include(if: $includeUpdateVolumeDiscountPrograms) + ...UpdateVolumeDiscountPrograms } } } @@ -232,7 +231,6 @@ ${UpdateVolumeDiscountProgramsFragmentDoc}`; * includeNewMarketProductFields: // value for 'includeNewMarketProductFields' * includeUpdateMarketStates: // value for 'includeUpdateMarketStates' * includeUpdateReferralPrograms: // value for 'includeUpdateReferralPrograms' - * includeUpdateVolumeDiscountPrograms: // value for 'includeUpdateVolumeDiscountPrograms' * }, * }); */ diff --git a/apps/governance/src/routes/proposals/proposals/proposals-container.tsx b/apps/governance/src/routes/proposals/proposals/proposals-container.tsx index 187633f4b..104897726 100644 --- a/apps/governance/src/routes/proposals/proposals/proposals-container.tsx +++ b/apps/governance/src/routes/proposals/proposals/proposals-container.tsx @@ -50,7 +50,6 @@ export const ProposalsContainer = () => { includeNewMarketProductFields: !!FLAGS.PRODUCT_PERPETUALS, includeUpdateMarketStates: !!FLAGS.UPDATE_MARKET_STATE, includeUpdateReferralPrograms: !!FLAGS.REFERRALS, - includeUpdateVolumeDiscountPrograms: !!FLAGS.VOLUME_DISCOUNTS, }, }); 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 f0d4a4fbb..2e78b61d1 100644 --- a/apps/governance/src/routes/proposals/rejected/rejected-proposals-container.tsx +++ b/apps/governance/src/routes/proposals/rejected/rejected-proposals-container.tsx @@ -42,7 +42,6 @@ export const RejectedProposalsContainer = () => { includeNewMarketProductFields: !!FLAGS.PRODUCT_PERPETUALS, includeUpdateMarketStates: !!FLAGS.UPDATE_MARKET_STATE, includeUpdateReferralPrograms: !!FLAGS.REFERRALS, - includeUpdateVolumeDiscountPrograms: !!FLAGS.VOLUME_DISCOUNTS, }, }); From 4b7338ed943c6f1ad9cfe959aa9040059744992b Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Fri, 17 Nov 2023 10:33:24 -0800 Subject: [PATCH 7/7] chore(deal-ticket,markets): dont show margin estimate for perps (#5305) --- .../deal-ticket/deal-ticket-fee-details.tsx | 190 ++++++++++-------- libs/markets/src/lib/market-utils.ts | 16 ++ 2 files changed, 119 insertions(+), 87 deletions(-) diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx index 075d3225f..e7b2cfb10 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react'; import { t } from '@vegaprotocol/i18n'; -import { getAsset, getQuoteName } from '@vegaprotocol/markets'; +import { getAsset, getProductType, getQuoteName } from '@vegaprotocol/markets'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet'; @@ -286,99 +286,115 @@ export const DealTicketMarginDetails = ({ ); const quoteName = getQuoteName(market); + const productType = getProductType(market); return ( -

- - -
-
- - {t('Margin required')} - +
+ {/* + TODO: remove this conditional check once the following PRs are deployed + and the estimatePosition query is working for perps - -
- + + -
- {formatValue( - marginRequiredWorstCase, +
+
+ + + {t('Margin required')} + + + + +
+ +
+ {formatValue( + marginRequiredWorstCase, + assetDecimals, + quantum + )}{' '} + {assetSymbol || ''} +
+
+
+ + } + > +
+ - + ), + assetSymbol + )} + /> + {deductionFromCollateral} + setBreakdownDialog(true) + : undefined + } + value={formatValue(marginAccountBalance, assetDecimals)} + symbol={assetSymbol} + labelDescription={MARGIN_ACCOUNT_TOOLTIP_TEXT} + formattedValue={formatValue( + marginAccountBalance, + assetDecimals, + quantum + )} + />
- - } - > -
- - {deductionFromCollateral} - setBreakdownDialog(true) - : undefined - } - value={formatValue(marginAccountBalance, assetDecimals)} - symbol={assetSymbol} - labelDescription={MARGIN_ACCOUNT_TOOLTIP_TEXT} - formattedValue={formatValue( - marginAccountBalance, - assetDecimals, - quantum - )} - /> -
- - - {projectedMargin} + + + {projectedMargin} + + )} ) => { throw new Error('Failed to retrieve asset. Invalid product type'); }; +export const getProductType = (market: Partial) => { + if (!market.tradableInstrument?.instrument.product) { + throw new Error( + 'Failed to retrieve product type. Invalid tradable instrument' + ); + } + + const type = market.tradableInstrument.instrument.product.__typename; + + if (!type) { + throw new Error('Failed to retrieve asset. Invalid product type'); + } + + return type; +}; + export const getQuoteName = (market: Partial) => { if (!market.tradableInstrument?.instrument.product) { throw new Error(
{t('Volume discount')}{formatPercentage(volumeDiscount)}% + {formatPercentage(volumeDiscount)}% + {!isVolumeDiscountProgramRunning && ( + + + {' '} + + + + )} +
{t('Referral discount')} {formatPercentage(referralDiscount)}% + {!isReferralProgramRunning && ( + + + {' '} + + + + )}