From 93e4b5fdb9b8d69a8411bc43f93544b2b871b93b Mon Sep 17 00:00:00 2001 From: Edd Date: Thu, 10 Aug 2023 09:51:44 +0100 Subject: [PATCH] feat(explorer): successor markets (#4522) --- .../app/components/markets/market-details.tsx | 7 +++- .../components/txs/details/tx-proposal.tsx | 39 ++++++++++++++++++- .../src/app/components/txs/tx-order-type.tsx | 6 ++- 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/apps/explorer/src/app/components/markets/market-details.tsx b/apps/explorer/src/app/components/markets/market-details.tsx index 48409bb60..de0cdec22 100644 --- a/apps/explorer/src/app/components/markets/market-details.tsx +++ b/apps/explorer/src/app/components/markets/market-details.tsx @@ -1,6 +1,9 @@ import { t } from '@vegaprotocol/i18n'; import type { MarketInfoWithData } from '@vegaprotocol/markets'; -import { PriceMonitoringBoundsInfoPanel } from '@vegaprotocol/markets'; +import { + PriceMonitoringBoundsInfoPanel, + SuccessionLineInfoPanel, +} from '@vegaprotocol/markets'; import { LiquidityInfoPanel, LiquidityMonitoringParametersInfoPanel, @@ -103,6 +106,8 @@ export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => { )} +

{t('Succession line')}

+ ); }; diff --git a/apps/explorer/src/app/components/txs/details/tx-proposal.tsx b/apps/explorer/src/app/components/txs/details/tx-proposal.tsx index 9465f4cf1..12a89ab24 100644 --- a/apps/explorer/src/app/components/txs/details/tx-proposal.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-proposal.tsx @@ -10,6 +10,8 @@ import Hash from '../../links/hash'; import { t } from '@vegaprotocol/i18n'; import { ProposalSignatureBundleNewAsset } from './proposal/signature-bundle-new'; import { ProposalSignatureBundleUpdateAsset } from './proposal/signature-bundle-update'; +import { MarketLink } from '../../links'; +import { formatNumber } from '@vegaprotocol/utils'; export type Proposal = components['schemas']['v1ProposalSubmission']; export type ProposalTerms = components['schemas']['vegaProposalTerms']; @@ -53,7 +55,11 @@ export function proposalTypeLabel(terms?: ProposalTerms): string { } else if (has(terms, 'updateAsset')) { return t('Update asset proposal'); } else if (has(terms, 'newMarket')) { - return t('New market proposal'); + if (terms?.newMarket?.changes?.successor) { + return t('Successor market proposal'); + } else { + return t('New market proposal'); + } } else if (has(terms, 'updateMarket')) { return t('Update market proposal'); } else if (has(terms, 'updateNetworkParameter')) { @@ -85,6 +91,13 @@ export const TxProposal = ({ txData, pubKey, blockData }: TxProposalProps) => { } const tx = proposal.terms?.newAsset || proposal.terms?.updateAsset; + const isSuccessorMarketProposal = + proposal?.terms?.newMarket?.changes?.successor; + const parentMarketId = + isSuccessorMarketProposal && + proposal?.terms.newMarket?.changes?.successor?.parentMarketId; + const insurancePoolFraction = + proposal?.terms?.newMarket?.changes?.successor?.insurancePoolFraction; // This component is not rendered if no bundle is required const SignatureBundleComponent = proposal.terms?.newAsset @@ -111,6 +124,30 @@ export const TxProposal = ({ txData, pubKey, blockData }: TxProposalProps) => { + {isSuccessorMarketProposal ? ( + <> + {parentMarketId ? ( + + {t('Previous market')} + + + + + ) : null} + {insurancePoolFraction ? ( + + {t('Insurance pool fraction')} + + {formatNumber(Number(insurancePoolFraction) * 100, 0)}% + + + ) : null} + + ) : null}