diff --git a/apps/explorer-e2e/src/support/governance.functions.js b/apps/explorer-e2e/src/support/governance.functions.js
index bf0ec9321..b717f7fac 100644
--- a/apps/explorer-e2e/src/support/governance.functions.js
+++ b/apps/explorer-e2e/src/support/governance.functions.js
@@ -26,7 +26,6 @@ function getSuccessorTxBody(parentMarketId) {
positionDecimalPlaces: '5',
linearSlippageFactor: '0.001',
quadraticSlippageFactor: '0',
- lpPriceRange: '10',
instrument: {
name: 'Token test market',
code: 'TEST.24h',
diff --git a/apps/explorer/src/app/components/links/market-link/Market.graphql b/apps/explorer/src/app/components/links/market-link/Market.graphql
index 677b6b8e9..84bb5e9c0 100644
--- a/apps/explorer/src/app/components/links/market-link/Market.graphql
+++ b/apps/explorer/src/app/components/links/market-link/Market.graphql
@@ -13,6 +13,12 @@ query ExplorerMarket($id: ID!) {
decimals
}
}
+ ... on Perpetual {
+ quoteName
+ settlementAsset {
+ decimals
+ }
+ }
}
}
}
diff --git a/apps/explorer/src/app/components/links/market-link/__generated__/Market.ts b/apps/explorer/src/app/components/links/market-link/__generated__/Market.ts
index 6c39eef9a..c6f1a44cd 100644
--- a/apps/explorer/src/app/components/links/market-link/__generated__/Market.ts
+++ b/apps/explorer/src/app/components/links/market-link/__generated__/Market.ts
@@ -8,7 +8,7 @@ export type ExplorerMarketQueryVariables = Types.Exact<{
}>;
-export type ExplorerMarketQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', decimals: number } } } } } | null };
+export type ExplorerMarketQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', decimals: number } } | { __typename?: 'Perpetual', quoteName: string, settlementAsset: { __typename?: 'Asset', decimals: number } } | { __typename?: 'Spot' } } } } | null };
export const ExplorerMarketDocument = gql`
@@ -27,6 +27,12 @@ export const ExplorerMarketDocument = gql`
decimals
}
}
+ ... on Perpetual {
+ quoteName
+ settlementAsset {
+ decimals
+ }
+ }
}
}
}
diff --git a/apps/explorer/src/app/components/links/market-link/market-link.spec.tsx b/apps/explorer/src/app/components/links/market-link/market-link.spec.tsx
index 28761567d..83875d5a1 100644
--- a/apps/explorer/src/app/components/links/market-link/market-link.spec.tsx
+++ b/apps/explorer/src/app/components/links/market-link/market-link.spec.tsx
@@ -61,6 +61,7 @@ describe('Market link component', () => {
instrument: {
name: 'test-label',
product: {
+ __typename: 'Future',
quoteName: 'dai',
},
},
diff --git a/apps/explorer/src/app/components/markets/market-details.tsx b/apps/explorer/src/app/components/markets/market-details.tsx
index de0cdec22..34de36f0d 100644
--- a/apps/explorer/src/app/components/markets/market-details.tsx
+++ b/apps/explorer/src/app/components/markets/market-details.tsx
@@ -3,13 +3,14 @@ import type { MarketInfoWithData } from '@vegaprotocol/markets';
import {
PriceMonitoringBoundsInfoPanel,
SuccessionLineInfoPanel,
+ getDataSourceSpecForSettlementData,
+ getDataSourceSpecForTradingTermination,
} from '@vegaprotocol/markets';
import {
LiquidityInfoPanel,
LiquidityMonitoringParametersInfoPanel,
InstrumentInfoPanel,
KeyDetailsInfoPanel,
- LiquidityPriceRangeInfoPanel,
MetadataInfoPanel,
OracleInfoPanel,
RiskFactorsInfoPanel,
@@ -18,20 +19,21 @@ import {
SettlementAssetInfoPanel,
} from '@vegaprotocol/markets';
import { MarketInfoTable } from '@vegaprotocol/markets';
-import type { DataSourceDefinition } from '@vegaprotocol/types';
+import type { DataSourceFragment } from '@vegaprotocol/markets';
import isEqual from 'lodash/isEqual';
export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => {
if (!market) return null;
+ const { product } = market.tradableInstrument.instrument;
+ const settlementDataSource = getDataSourceSpecForSettlementData(product);
+ const terminationDataSource = getDataSourceSpecForTradingTermination(product);
- const settlementData = market.tradableInstrument.instrument.product
- .dataSourceSpecForSettlementData.data as DataSourceDefinition;
- const terminationData = market.tradableInstrument.instrument.product
- .dataSourceSpecForTradingTermination.data as DataSourceDefinition;
-
- const getSigners = (data: DataSourceDefinition) => {
+ const getSigners = ({ data }: DataSourceFragment) => {
if (data.sourceType.__typename === 'DataSourceDefinitionExternal') {
- const signers = data.sourceType.sourceType.signers || [];
+ const signers =
+ ('signers' in data.sourceType.sourceType &&
+ data.sourceType.sourceType.signers) ||
+ [];
return signers.map(({ signer }, i) => {
return (
@@ -43,10 +45,13 @@ export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => {
return [];
};
- const showTwoOracles = isEqual(
- getSigners(settlementData),
- getSigners(terminationData)
- );
+ const showTwoOracles =
+ settlementDataSource &&
+ terminationDataSource &&
+ isEqual(
+ getSigners(settlementDataSource),
+ getSigners(terminationDataSource)
+ );
const headerClassName = 'font-alpha calt text-xl mt-4 border-b-2 pb-2';
@@ -91,8 +96,6 @@ export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => {
+
{t(
'There is 1 unit of the settlement asset (%s) to every 1 quote unit (%s).',
[assetSymbol, quoteUnit]
@@ -150,17 +151,15 @@ export const InsurancePoolInfoPanel = ({
Get
+
{t( 'There is 1 unit of the settlement asset (%s) to every 1 quote unit (%s).', [assetSymbol, quoteUnit] @@ -588,8 +580,7 @@ export const PriceMonitoringBoundsInfoPanel = ({ variables: { marketId: market.id }, }); - const quoteUnit = - market?.tradableInstrument.instrument.product?.quoteName || ''; + const quoteUnit = getQuoteName(market); const trigger = market.priceMonitoringSettings?.parameters?.triggers?.[triggerIndex]; @@ -604,7 +595,7 @@ export const PriceMonitoringBoundsInfoPanel = ({ } return ( <> -
{t('%s probability price bounds', [ formatNumberPercentage( @@ -612,7 +603,7 @@ export const PriceMonitoringBoundsInfoPanel = ({ ), ])}
-+
{t('Within %s seconds', [formatNumber(trigger.horizonSecs)])}
+
{t('Results in %s seconds auction if breached', [ trigger.auctionExtensionSecs.toString(), ])} @@ -664,10 +655,7 @@ export const LiquidityMonitoringParametersInfoPanel = ({ }; export const LiquidityInfoPanel = ({ market, children }: MarketInfoProps) => { - const assetDecimals = - market.tradableInstrument.instrument.product.settlementAsset.decimals; - const assetSymbol = - market?.tradableInstrument.instrument.product?.settlementAsset.symbol || ''; + const asset = getAsset(market); const { data } = useDataProvider({ dataProvider: marketDataProvider, variables: { marketId: market.id }, @@ -680,112 +668,45 @@ export const LiquidityInfoPanel = ({ market, children }: MarketInfoProps) => { suppliedStake: data?.suppliedStake, marketValueProxy: data?.marketValueProxy, }} - decimalPlaces={assetDecimals} - assetSymbol={assetSymbol} + decimalPlaces={asset.decimals} + assetSymbol={asset.symbol} /> {children} > ); }; -export const LiquidityPriceRangeInfoPanel = ({ - market, - parentMarket, -}: MarketInfoProps) => { - const quoteUnit = - market?.tradableInstrument.instrument.product?.quoteName || ''; - const parentQuoteUnit = - parentMarket?.tradableInstrument.instrument.product?.quoteName || ''; - - const liquidityPriceRange = formatNumberPercentage( - new BigNumber(market.lpPriceRange).times(100) - ); - const parentLiquidityPriceRange = parentMarket - ? formatNumberPercentage( - new BigNumber(parentMarket.lpPriceRange).times(100) - ) - : null; - - const { data } = useDataProvider({ - dataProvider: marketDataProvider, - variables: { marketId: market.id }, - }); - - const { data: parentMarketData } = useDataProvider({ - dataProvider: marketDataProvider, - variables: { marketId: parentMarket?.id || '' }, - skip: !parentMarket, - }); - - let parentData; - - if (parentMarket && parentMarketData && quoteUnit === parentQuoteUnit) { - parentData = { - liquidityPriceRange: `${parentLiquidityPriceRange} of mid price`, - lowestPrice: - parentMarketData?.midPrice && - `${addDecimalsFormatNumber( - new BigNumber(1) - .minus(parentMarket.lpPriceRange) - .times(parentMarketData.midPrice) - .toString(), - parentMarket.decimalPlaces - )} ${quoteUnit}`, - highestPrice: - parentMarketData?.midPrice && - `${addDecimalsFormatNumber( - new BigNumber(1) - .plus(parentMarket.lpPriceRange) - .times(parentMarketData.midPrice) - .toString(), - parentMarket.decimalPlaces - )} ${quoteUnit}`, - }; +export const FundingInfoPanel = ({ + dataSource, +}: { + dataSource: DataSourceFragment; +}) => { + const sourceType = dataSource.data.sourceType.sourceType; + if ( + sourceType.__typename !== 'DataSourceSpecConfigurationTimeTrigger' || + !sourceType.triggers?.[0]?.every + ) { + return null; } - - return ( - <> -
- {`For liquidity orders to count towards a commitment, they must be - within the liquidity monitoring bounds.`} -
-- {`The liquidity price range is a ${liquidityPriceRange} difference from the mid - price.`} -
-@@ -948,6 +861,59 @@ export const DataSourceProof = ({ return
diff --git a/libs/markets/src/lib/components/market-info/market-info.mock.ts b/libs/markets/src/lib/components/market-info/market-info.mock.ts index 8004daa3a..be516e1bc 100644 --- a/libs/markets/src/lib/components/market-info/market-info.mock.ts +++ b/libs/markets/src/lib/components/market-info/market-info.mock.ts @@ -92,7 +92,6 @@ export const marketInfoQuery = ( short: '0.008571790367285281', long: '0.008508132993273576', }, - lpPriceRange: '0.02', liquidityMonitoringParameters: { triggeringRatio: '0.7', targetStakeParameters: { @@ -125,6 +124,7 @@ export const marketInfoQuery = ( quoteName: 'BTC', settlementAsset: { __typename: 'Asset', + quantum: '1', id: 'market-0', symbol: 'tBTC', name: 'tBTC TEST', diff --git a/libs/markets/src/lib/components/oracle-full-profile/oracle-full-profile.tsx b/libs/markets/src/lib/components/oracle-full-profile/oracle-full-profile.tsx index 7e06ec87e..794415adf 100644 --- a/libs/markets/src/lib/components/oracle-full-profile/oracle-full-profile.tsx +++ b/libs/markets/src/lib/components/oracle-full-profile/oracle-full-profile.tsx @@ -252,26 +252,35 @@ export const OracleFullProfile = ({ > {MarketStateMapping[market.state]}