feat(explorer): successor markets (#4522)
This commit is contained in:
parent
1566fc3984
commit
93e4b5fdb9
@ -1,6 +1,9 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import type { MarketInfoWithData } from '@vegaprotocol/markets';
|
import type { MarketInfoWithData } from '@vegaprotocol/markets';
|
||||||
import { PriceMonitoringBoundsInfoPanel } from '@vegaprotocol/markets';
|
import {
|
||||||
|
PriceMonitoringBoundsInfoPanel,
|
||||||
|
SuccessionLineInfoPanel,
|
||||||
|
} from '@vegaprotocol/markets';
|
||||||
import {
|
import {
|
||||||
LiquidityInfoPanel,
|
LiquidityInfoPanel,
|
||||||
LiquidityMonitoringParametersInfoPanel,
|
LiquidityMonitoringParametersInfoPanel,
|
||||||
@ -103,6 +106,8 @@ export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => {
|
|||||||
<OracleInfoPanel market={market} type="settlementData" />
|
<OracleInfoPanel market={market} type="settlementData" />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
<h2 className={`${headerClassName} mb-4`}>{t('Succession line')}</h2>
|
||||||
|
<SuccessionLineInfoPanel market={market} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -10,6 +10,8 @@ import Hash from '../../links/hash';
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { ProposalSignatureBundleNewAsset } from './proposal/signature-bundle-new';
|
import { ProposalSignatureBundleNewAsset } from './proposal/signature-bundle-new';
|
||||||
import { ProposalSignatureBundleUpdateAsset } from './proposal/signature-bundle-update';
|
import { ProposalSignatureBundleUpdateAsset } from './proposal/signature-bundle-update';
|
||||||
|
import { MarketLink } from '../../links';
|
||||||
|
import { formatNumber } from '@vegaprotocol/utils';
|
||||||
|
|
||||||
export type Proposal = components['schemas']['v1ProposalSubmission'];
|
export type Proposal = components['schemas']['v1ProposalSubmission'];
|
||||||
export type ProposalTerms = components['schemas']['vegaProposalTerms'];
|
export type ProposalTerms = components['schemas']['vegaProposalTerms'];
|
||||||
@ -53,7 +55,11 @@ export function proposalTypeLabel(terms?: ProposalTerms): string {
|
|||||||
} else if (has(terms, 'updateAsset')) {
|
} else if (has(terms, 'updateAsset')) {
|
||||||
return t('Update asset proposal');
|
return t('Update asset proposal');
|
||||||
} else if (has(terms, 'newMarket')) {
|
} 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')) {
|
} else if (has(terms, 'updateMarket')) {
|
||||||
return t('Update market proposal');
|
return t('Update market proposal');
|
||||||
} else if (has(terms, 'updateNetworkParameter')) {
|
} 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 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
|
// This component is not rendered if no bundle is required
|
||||||
const SignatureBundleComponent = proposal.terms?.newAsset
|
const SignatureBundleComponent = proposal.terms?.newAsset
|
||||||
@ -111,6 +124,30 @@ export const TxProposal = ({ txData, pubKey, blockData }: TxProposalProps) => {
|
|||||||
<Hash text={deterministicId} />
|
<Hash text={deterministicId} />
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
{isSuccessorMarketProposal ? (
|
||||||
|
<>
|
||||||
|
{parentMarketId ? (
|
||||||
|
<TableRow modifier="bordered">
|
||||||
|
<TableCell>{t('Previous market')}</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<MarketLink
|
||||||
|
id={
|
||||||
|
proposal.terms?.newMarket.changes.successor.parentMarketId
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
) : null}
|
||||||
|
{insurancePoolFraction ? (
|
||||||
|
<TableRow modifier="bordered">
|
||||||
|
<TableCell>{t('Insurance pool fraction')}</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
{formatNumber(Number(insurancePoolFraction) * 100, 0)}%
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
</TableWithTbody>
|
</TableWithTbody>
|
||||||
<ProposalSummary
|
<ProposalSummary
|
||||||
id={deterministicId}
|
id={deterministicId}
|
||||||
|
@ -78,7 +78,11 @@ export function getLabelForProposal(
|
|||||||
} else if (proposal.terms?.updateAsset) {
|
} else if (proposal.terms?.updateAsset) {
|
||||||
return t('Proposal: Update asset');
|
return t('Proposal: Update asset');
|
||||||
} else if (proposal.terms?.newMarket) {
|
} else if (proposal.terms?.newMarket) {
|
||||||
return t('Proposal: New market');
|
if (proposal.terms?.newMarket.changes?.successor) {
|
||||||
|
return t('Proposal: Successor market');
|
||||||
|
} else {
|
||||||
|
return t('Proposal: New market');
|
||||||
|
}
|
||||||
} else if (proposal.terms?.updateMarket) {
|
} else if (proposal.terms?.updateMarket) {
|
||||||
return t('Proposal: Update market');
|
return t('Proposal: Update market');
|
||||||
} else if (proposal.terms?.updateNetworkParameter) {
|
} else if (proposal.terms?.updateNetworkParameter) {
|
||||||
|
Loading…
Reference in New Issue
Block a user