feat(trading): ethereum oracle spec in oracle panels (#4914)

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
This commit is contained in:
m.ray 2023-10-02 19:48:12 +03:00 committed by GitHub
parent 6c5cd85d96
commit c65c296db2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 413 additions and 41 deletions

View File

@ -49,6 +49,37 @@ fragment ExplorerOracleDataSource on OracleSpec {
}
... on DataSourceDefinitionExternal {
sourceType {
... on EthCallSpec {
abi
args
method
requiredConfirmations
address
normalisers {
name
expression
}
trigger {
trigger {
... on EthTimeTrigger {
initial
every
until
}
}
}
filters {
key {
name
type
numberDecimalPlaces
}
conditions {
value
operator
}
}
}
... on DataSourceSpecConfiguration {
signers {
signer {

View File

@ -5,19 +5,19 @@ import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type ExplorerOracleDataConnectionFragment = { __typename?: 'OracleSpec', dataConnection: { __typename?: 'OracleDataConnection', edges?: Array<{ __typename?: 'OracleDataEdge', node: { __typename?: 'OracleData', externalData: { __typename?: 'ExternalData', data: { __typename?: 'Data', matchedSpecIds?: Array<string> | null, broadcastAt: any, signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, data?: Array<{ __typename?: 'Property', name: string, value: string }> | null } } } } | null> | null } };
export type ExplorerOracleDataSourceFragment = { __typename?: 'OracleSpec', dataSourceSpec: { __typename?: 'ExternalDataSourceSpec', spec: { __typename?: 'DataSourceSpec', id: string, createdAt: any, updatedAt?: any | null, status: Types.DataSourceSpecStatus, data: { __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, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec' } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } } } }, dataConnection: { __typename?: 'OracleDataConnection', edges?: Array<{ __typename?: 'OracleDataEdge', node: { __typename?: 'OracleData', externalData: { __typename?: 'ExternalData', data: { __typename?: 'Data', matchedSpecIds?: Array<string> | null, broadcastAt: any, signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, data?: Array<{ __typename?: 'Property', name: string, value: string }> | null } } } } | null> | null } };
export type ExplorerOracleDataSourceFragment = { __typename?: 'OracleSpec', dataSourceSpec: { __typename?: 'ExternalDataSourceSpec', spec: { __typename?: 'DataSourceSpec', id: string, createdAt: any, updatedAt?: any | null, status: Types.DataSourceSpecStatus, data: { __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, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array<string> | null, args?: Array<string> | null, method: string, requiredConfirmations: number, address: string, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } } } }, dataConnection: { __typename?: 'OracleDataConnection', edges?: Array<{ __typename?: 'OracleDataEdge', node: { __typename?: 'OracleData', externalData: { __typename?: 'ExternalData', data: { __typename?: 'Data', matchedSpecIds?: Array<string> | null, broadcastAt: any, signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, data?: Array<{ __typename?: 'Property', name: string, value: string }> | null } } } } | null> | null } };
export type ExplorerOracleSpecsQueryVariables = Types.Exact<{ [key: string]: never; }>;
export type ExplorerOracleSpecsQuery = { __typename?: 'Query', oracleSpecsConnection?: { __typename?: 'OracleSpecsConnection', pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean }, edges?: Array<{ __typename?: 'OracleSpecEdge', node: { __typename?: 'OracleSpec', dataSourceSpec: { __typename?: 'ExternalDataSourceSpec', spec: { __typename?: 'DataSourceSpec', id: string, createdAt: any, updatedAt?: any | null, status: Types.DataSourceSpecStatus, data: { __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, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec' } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } } } }, dataConnection: { __typename?: 'OracleDataConnection', edges?: Array<{ __typename?: 'OracleDataEdge', node: { __typename?: 'OracleData', externalData: { __typename?: 'ExternalData', data: { __typename?: 'Data', matchedSpecIds?: Array<string> | null, broadcastAt: any, signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, data?: Array<{ __typename?: 'Property', name: string, value: string }> | null } } } } | null> | null } } } | null> | null } | null };
export type ExplorerOracleSpecsQuery = { __typename?: 'Query', oracleSpecsConnection?: { __typename?: 'OracleSpecsConnection', pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean }, edges?: Array<{ __typename?: 'OracleSpecEdge', node: { __typename?: 'OracleSpec', dataSourceSpec: { __typename?: 'ExternalDataSourceSpec', spec: { __typename?: 'DataSourceSpec', id: string, createdAt: any, updatedAt?: any | null, status: Types.DataSourceSpecStatus, data: { __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, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array<string> | null, args?: Array<string> | null, method: string, requiredConfirmations: number, address: string, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } } } }, dataConnection: { __typename?: 'OracleDataConnection', edges?: Array<{ __typename?: 'OracleDataEdge', node: { __typename?: 'OracleData', externalData: { __typename?: 'ExternalData', data: { __typename?: 'Data', matchedSpecIds?: Array<string> | null, broadcastAt: any, signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, data?: Array<{ __typename?: 'Property', name: string, value: string }> | null } } } } | null> | null } } } | null> | null } | null };
export type ExplorerOracleSpecByIdQueryVariables = Types.Exact<{
id: Types.Scalars['ID'];
}>;
export type ExplorerOracleSpecByIdQuery = { __typename?: 'Query', oracleSpec?: { __typename?: 'OracleSpec', dataSourceSpec: { __typename?: 'ExternalDataSourceSpec', spec: { __typename?: 'DataSourceSpec', id: string, createdAt: any, updatedAt?: any | null, status: Types.DataSourceSpecStatus, data: { __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, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec' } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } } } }, dataConnection: { __typename?: 'OracleDataConnection', edges?: Array<{ __typename?: 'OracleDataEdge', node: { __typename?: 'OracleData', externalData: { __typename?: 'ExternalData', data: { __typename?: 'Data', matchedSpecIds?: Array<string> | null, broadcastAt: any, signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, data?: Array<{ __typename?: 'Property', name: string, value: string }> | null } } } } | null> | null } } | null };
export type ExplorerOracleSpecByIdQuery = { __typename?: 'Query', oracleSpec?: { __typename?: 'OracleSpec', dataSourceSpec: { __typename?: 'ExternalDataSourceSpec', spec: { __typename?: 'DataSourceSpec', id: string, createdAt: any, updatedAt?: any | null, status: Types.DataSourceSpecStatus, data: { __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, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array<string> | null, args?: Array<string> | null, method: string, requiredConfirmations: number, address: string, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator } | null> } | { __typename?: 'DataSourceSpecConfigurationTimeTrigger' } } } } }, dataConnection: { __typename?: 'OracleDataConnection', edges?: Array<{ __typename?: 'OracleDataEdge', node: { __typename?: 'OracleData', externalData: { __typename?: 'ExternalData', data: { __typename?: 'Data', matchedSpecIds?: Array<string> | null, broadcastAt: any, signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, data?: Array<{ __typename?: 'Property', name: string, value: string }> | null } } } } | null> | null } } | null };
export const ExplorerOracleDataConnectionFragmentDoc = gql`
fragment ExplorerOracleDataConnection on OracleSpec {
@ -72,6 +72,37 @@ export const ExplorerOracleDataSourceFragmentDoc = gql`
}
... on DataSourceDefinitionExternal {
sourceType {
... on EthCallSpec {
abi
args
method
requiredConfirmations
address
normalisers {
name
expression
}
trigger {
trigger {
... on EthTimeTrigger {
initial
every
until
}
}
}
filters {
key {
name
type
numberDecimalPlaces
}
conditions {
value
operator
}
}
}
... on DataSourceSpecConfiguration {
signers {
signer {

View File

@ -15,6 +15,7 @@ NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/annou
NX_VEGA_INCIDENT_URL=https://blog.vega.xyz/tagged/vega-incident-reports
NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn
NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/firefox/addon/vega-wallet-fairground
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
# Cosmic elevator flags
NX_SUCCESSOR_MARKETS=true

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,10 @@ fragment DataSourceFilter on Filter {
type
numberDecimalPlaces
}
conditions {
value
operator
}
}
fragment DataSource on DataSourceSpec {
@ -12,6 +16,37 @@ fragment DataSource on DataSourceSpec {
sourceType {
... on DataSourceDefinitionExternal {
sourceType {
... on EthCallSpec {
abi
address
args
method
requiredConfirmations
normalisers {
name
expression
}
trigger {
trigger {
... on EthTimeTrigger {
initial
every
until
}
}
}
filters {
key {
name
type
numberDecimalPlaces
}
conditions {
value
operator
}
}
}
... on DataSourceSpecConfiguration {
signers {
signer {

File diff suppressed because one or more lines are too long

View File

@ -6,13 +6,21 @@ import { t } from '@vegaprotocol/i18n';
import { marketDataProvider } from '../../market-data-provider';
import { totalFeesPercentage } from '../../market-utils';
import {
Accordion,
AccordionChevron,
AccordionPanel,
CopyWithTooltip,
ExternalLink,
Intent,
KeyValueTable,
KeyValueTableRow,
Lozenge,
Splash,
SyntaxHighlighter,
Tooltip,
VegaIcon,
VegaIconNames,
truncateMiddle,
} from '@vegaprotocol/ui-toolkit';
import {
addDecimalsFormatNumber,
@ -31,6 +39,7 @@ import { Last24hVolume } from '../last-24h-volume';
import BigNumber from 'bignumber.js';
import type {
DataSourceDefinition,
EthCallSpec,
MarketTradingMode,
SignerKind,
} from '@vegaprotocol/types';
@ -40,6 +49,7 @@ import {
} from '@vegaprotocol/types';
import {
DApp,
EtherscanLink,
FLAGS,
TOKEN_PROPOSAL,
useEnvironment,
@ -65,6 +75,7 @@ import {
} from '@vegaprotocol/network-parameters';
import type { DataSourceFragment } from './__generated__/MarketInfo';
import { formatDuration } from 'date-fns';
import * as AccordionPrimitive from '@radix-ui/react-accordion';
type MarketInfoProps = {
market: MarketInfo;
@ -659,6 +670,97 @@ export const LiquidityMonitoringParametersInfoPanel = ({
return <MarketInfoTable data={marketData} parentData={parentMarketData} />;
};
export const EthOraclePanel = ({ sourceType }: { sourceType: EthCallSpec }) => {
const abis = sourceType.abi?.map((abi) => JSON.parse(abi));
const header = 'uppercase my-1 text-left';
return (
<>
<h3 className={header}>{t('Ethereum Oracle')}</h3>
{sourceType.address && (
<>
<KeyValueTable>
<KeyValueTableRow noBorder>
<div>{t('Address')}</div>
<CopyWithTooltip text={sourceType.address}>
<button
data-testid="copy-eth-oracle-address"
className="uppercase text-right"
>
<span className="flex gap-1">
{truncateMiddle(sourceType.address)}
<VegaIcon name={VegaIconNames.COPY} size={16} />
</span>
</button>
</CopyWithTooltip>
</KeyValueTableRow>
</KeyValueTable>
<div className="my-2">
<EtherscanLink address={sourceType.address}>
{t('View on Etherscan')}
</EtherscanLink>
</div>
</>
)}
<MarketInfoTable
key="eth-call-spec"
data={{
method: sourceType.method,
requiredConfirmations: sourceType.requiredConfirmations,
}}
/>
<Accordion>
<AccordionPanel
itemId="abi"
trigger={
<AccordionPrimitive.Trigger
data-testid="accordion-toggle"
className={classNames(
'w-full pt-2',
'flex items-center gap-2',
'group'
)}
>
<div
data-testid={`abi-dropdown`}
key={'value-dropdown'}
className="flex items-center gap-2 w-full"
>
<div className="underline underline-offset-4 mb-1 uppercase">
{t('ABI specification')}
</div>
<AccordionChevron size={14} />
<div className="flex items-center gap-1"></div>
</div>
</AccordionPrimitive.Trigger>
}
>
<SyntaxHighlighter data={abis} />
</AccordionPanel>
</Accordion>
<h3 className={header}>{t('Normalisers')}</h3>
{sourceType.normalisers?.map((normaliser, i) => (
<MarketInfoTable key={i} data={normaliser} />
))}
<h3 className={header}>{t('Filters')}</h3>
<h3 className={header}>{t('Key')}</h3>
{sourceType.filters?.map((filter, i) => (
<>
<MarketInfoTable key={i} data={filter.key} />
<h3 className={header}>{t('Conditions')}</h3>
{filter.conditions?.map((condition, i) => (
<span>
{ConditionOperatorMapping[condition.operator]} {condition.value}
</span>
))}
</>
))}
</>
);
};
export const LiquidityPriceRangeInfoPanel = ({
market,
parentMarket,
@ -782,7 +884,7 @@ export const LiquiditySLAParametersInfoPanel = ({
market.liquiditySLAParameters?.slaCompetitionFactor
).times(100)
),
commitmentMinimumTimeFraction:
commitmentMinTimeFraction:
market.liquiditySLAParameters?.commitmentMinTimeFraction &&
formatNumberPercentage(
new BigNumber(
@ -797,7 +899,7 @@ export const LiquiditySLAParametersInfoPanel = ({
parentMarket.liquiditySLAParameters?.performanceHysteresisEpochs,
slaCompetitionFactor:
parentMarket.liquiditySLAParameters?.slaCompetitionFactor,
commitmentMinimumTimeFraction:
commitmentMinTimeFraction:
parentMarket.liquiditySLAParameters?.commitmentMinTimeFraction,
}
: undefined;
@ -823,13 +925,13 @@ export const LiquiditySLAParametersInfoPanel = ({
networkParams['market_liquidity_nonPerformanceBondPenaltySlope'],
nonPerformanceBondPenaltyMax:
networkParams['market_liquidity_sla_nonPerformanceBondPenaltyMax'],
maximumLiquidityFeeFactorLevel:
maxLiquidityFeeFactorLevel:
networkParams['market_liquidity_maximumLiquidityFeeFactorLevel'],
stakeToCCYVolume: networkParams['market_liquidity_stakeToCcyVolume'],
earlyExitPenalty: networkParams['market_liquidity_earlyExitPenalty'],
probabilityOfTradingTauScaling:
networkParams['market_liquidity_probabilityOfTrading_tau_scaling'],
minimumProbabilityOfTradingLPOrders:
minProbabilityOfTradingLPOrders:
networkParams['market_liquidity_minimum_probabilityOfTrading_lpOrders'],
feeCalculationTimeStep:
networkParams['market_liquidity_feeCalculationTimeStep'] &&
@ -931,6 +1033,10 @@ export const OracleInfoPanel = ({
</Lozenge>
)}
{dataSourceSpec?.sourceType.sourceType.__typename === 'EthCallSpec' && (
<EthOraclePanel sourceType={dataSourceSpec?.sourceType.sourceType} />
)}
<div className={wrapperClasses}>
{shouldShowParentData &&
parentDataSourceSpec &&
@ -945,6 +1051,13 @@ export const OracleInfoPanel = ({
dataSourceSpecId={parentDataSourceSpecId}
/>
{parentDataSourceSpec?.sourceType.sourceType.__typename ===
'EthCallSpec' && (
<EthOraclePanel
sourceType={parentDataSourceSpec?.sourceType.sourceType}
/>
)}
{dataSourceSpecId && (
<ExternalLink
data-testid="oracle-spec-links"

View File

@ -106,7 +106,7 @@ export const tooltipMapping: Record<string, ReactNode> = {
insurancePoolFraction: t(
'The fraction of the insurance pool balance that is carried over from the parent market to the successor.'
),
commitmentMinimumTimeFraction: t(
commitmentMinTimeFraction: t(
`Specifies the minimum fraction of time LPs must spend 'on the book' providing their committed liquidity. This is a market parameter.`
),
feeCalculationTimeStep: t(
@ -127,7 +127,7 @@ export const tooltipMapping: Record<string, ReactNode> = {
nonPerformanceBondPenaltyMax: t(
`The maximum amount, as a fraction, that an LP's bond can be slashed by if they fail to reach the minimum SLA. This is a network parameter.`
),
maximumLiquidityFeeFactorLevel: t(
maxLiquidityFeeFactorLevel: t(
'Maximum value that a proposed fee amount can be, which is submitted as part of the LP commitment transaction. Note that a value of 0.05 = 5%. This is a network parameter.'
),
stakeToCCYVolume: t(
@ -137,12 +137,12 @@ export const tooltipMapping: Record<string, ReactNode> = {
'How long an epoch is. LP rewards from liquidity fees are paid out once per epoch. How much they receive depends on whether they met the liquidity SLA and their previous performance in recent epochs. This is a network parameter.'
),
earlyExitPenalty: t(
`How much an LP forfeits of their bond if they reduce their commitment while the market is below target stake, expressed as a factor. If set to 0 there is no penalty for early exit. If set to 1 an LP's entire bond is forfeited when an LP removes their full commitment. This is a network parameter.`
`The percentage of their bond an LP forfeits if they reduce their commitment while the market is below target stake. If 100%, an LP's entire bond is forfeited when they cancel their full commitment. This is a network parameter.`
),
probabilityOfTradingTauScaling: t(
`Determines how the probability of trading is scaled from the risk model, and is used to measure the relative competitiveness of an LP's supplied volume. This is a network parameter.`
),
minimumProbabilityOfTradingLPOrders: t(
minProbabilityOfTradingLPOrders: t(
'The lower bound for the probability of trading calculation, used to measure liquidity available on a market to determine if LPs are meeting their commitment. This is a network parameter.'
),
};

View File

@ -505,6 +505,29 @@ export type CoreSnapshotEdge = {
node: CoreSnapshotData;
};
/** Referral program information reported by data node with additional endedAt timestamp. */
export type CurrentReferralProgram = {
__typename?: 'CurrentReferralProgram';
/** Defined tiers in increasing order. First element will give Tier 1, second element will give Tier 2, etc. */
benefitTiers: Array<BenefitTier>;
/** Timestamp as RFC3339Nano, after which when the current epoch ends, the program will end and benefits will be disabled. */
endOfProgramTimestamp: Scalars['Timestamp'];
/** Timestamp as RFC3339Nano when the program ended. If present, the current program has ended and no program is currently running. */
endedAt?: Maybe<Scalars['Timestamp']>;
/** Unique ID generated from the proposal that created this program. */
id: Scalars['ID'];
/**
* Defined staking tiers in increasing order. First element will give Tier 1,
* second element will give Tier 2, and so on. Determines the level of
* benefit a party can expect based on their staking.
*/
stakingTiers: Array<StakingTier>;
/** Incremental version of the program. It is incremented each time the referral program is edited. */
version: Scalars['Int'];
/** Number of epochs over which to evaluate a referral set's running volume. */
windowLength: Scalars['Int'];
};
/** A data source contains the data sent by a data source */
export type Data = {
__typename?: 'Data';
@ -1607,6 +1630,8 @@ export type LiquidityProvider = {
marketId: Scalars['ID'];
/** Party ID of the liquidity provider */
partyId: Scalars['ID'];
/** SLA performance statistics */
sla?: Maybe<LiquidityProviderSLA>;
};
/** Connection type for retrieving cursor-based paginated liquidity provider information */
@ -1642,6 +1667,29 @@ export type LiquidityProviderFeeShare = {
virtualStake: Scalars['String'];
};
/** The SLA statistics for each liquidity provider */
export type LiquidityProviderSLA = {
__typename?: 'LiquidityProviderSLA';
/** Indicates how often LP meets the commitment during the current epoch. */
currentEpochFractionOfTimeOnBook: Scalars['String'];
/** Determines how the fee penalties from past epochs affect future fee revenue. */
hysteresisPeriodFeePenalties?: Maybe<Array<Scalars['String']>>;
/** Indicates the bond penalty amount applied in the previous epoch. */
lastEpochBondPenalty: Scalars['String'];
/** Indicates the fee penalty amount applied in the previous epoch. */
lastEpochFeePenalty: Scalars['String'];
/** Indicates how often LP met the commitment in the previous epoch. */
lastEpochFractionOfTimeOnBook: Scalars['String'];
/** Notional volume of orders within the range provided on the buy side of the book. */
notionalVolumeBuys: Scalars['String'];
/** Notional volume of orders within the range provided on the sell side of the book. */
notionalVolumeSells: Scalars['String'];
/** The liquidity provider party ID */
party: Party;
/** Represents the total amount of funds LP must supply. The amount to be supplied is in the markets settlement currency, spread on both buy and sell sides of the order book within a defined range. */
requiredLiquidity: Scalars['String'];
};
/** The command to be sent to the chain for a liquidity provision submission */
export type LiquidityProvision = {
__typename?: 'LiquidityProvision';
@ -2030,6 +2078,8 @@ export type MarketData = {
lastTradedPrice: Scalars['String'];
/** The equity like share of liquidity fee for each liquidity provider */
liquidityProviderFeeShare?: Maybe<Array<LiquidityProviderFeeShare>>;
/** SLA performance statistics */
liquidityProviderSla?: Maybe<Array<LiquidityProviderSLA>>;
/** The mark price (an unsigned integer) */
markPrice: Scalars['String'];
/** Market of the associated mark price */
@ -2562,6 +2612,29 @@ export type ObservableLiquidityProviderFeeShare = {
partyId: Scalars['ID'];
};
/** The SLA statistics for each liquidity provider */
export type ObservableLiquidityProviderSLA = {
__typename?: 'ObservableLiquidityProviderSLA';
/** Indicates how often LP meets the commitment during the current epoch. */
currentEpochFractionOfTimeOnBook: Scalars['String'];
/** Determines how the fee penalties from past epochs affect future fee revenue. */
hysteresisPeriodFeePenalties?: Maybe<Array<Scalars['String']>>;
/** Indicates the bond penalty amount applied in the previous epoch. */
lastEpochBondPenalty: Scalars['String'];
/** Indicates the fee penalty amount applied in the previous epoch. */
lastEpochFeePenalty: Scalars['String'];
/** Indicates how often LP meets the commitment during last epoch. */
lastEpochFractionOfTimeOnBook: Scalars['String'];
/** Notional volume of orders within the range provided on the buy side of the book. */
notionalVolumeBuys: Scalars['String'];
/** Notional volume of orders within the range provided on the sell side of the book. */
notionalVolumeSells: Scalars['String'];
/** The liquidity provider party ID */
party: Scalars['ID'];
/** Represents the total amount of funds LP must supply. The amount to be supplied is in the markets settlement currency, spread on both buy and sell sides of the order book within a defined range. */
requiredLiquidity: Scalars['String'];
};
/** Live data of a Market */
export type ObservableMarketData = {
__typename?: 'ObservableMarketData';
@ -2595,6 +2668,8 @@ export type ObservableMarketData = {
lastTradedPrice: Scalars['String'];
/** The equity like share of liquidity fee for each liquidity provider */
liquidityProviderFeeShare?: Maybe<Array<ObservableLiquidityProviderFeeShare>>;
/** SLA performance statistics */
liquidityProviderSla?: Maybe<Array<ObservableLiquidityProviderSLA>>;
/** The mark price (an unsigned integer) */
markPrice: Scalars['String'];
/** The market growth factor for the last market time window */
@ -3289,6 +3364,15 @@ export type PartyActivityStreak = {
tradedVolume: Scalars['String'];
};
/** An amount received by a party as a reward or a discount */
export type PartyAmount = {
__typename?: 'PartyAmount';
/** Amount received by the party */
amount: Scalars['String'];
/** Id of the party that received the payment */
partyId: Scalars['String'];
};
/** Connection type for retrieving cursor-based paginated party information */
export type PartyConnection = {
__typename?: 'PartyConnection';
@ -3861,6 +3945,8 @@ export type ProposalTerms = {
/** Various proposal types that are supported by Vega */
export enum ProposalType {
/** Proposal to cancel a transfer */
TYPE_CANCEL_TRANSFER = 'TYPE_CANCEL_TRANSFER',
/** Proposal to change Vega network parameters */
TYPE_NETWORK_PARAMETERS = 'TYPE_NETWORK_PARAMETERS',
/** Proposal to add a new asset */
@ -3869,10 +3955,22 @@ export enum ProposalType {
TYPE_NEW_FREE_FORM = 'TYPE_NEW_FREE_FORM',
/** Propose a new market */
TYPE_NEW_MARKET = 'TYPE_NEW_MARKET',
/** Propose a new spot market */
TYPE_NEW_SPOT_MARKET = 'TYPE_NEW_SPOT_MARKET',
/** Propose a new transfer */
TYPE_NEW_TRANSFER = 'TYPE_NEW_TRANSFER',
/** Proposal to update an existing asset */
TYPE_UPDATE_ASSET = 'TYPE_UPDATE_ASSET',
/** Update an existing market */
TYPE_UPDATE_MARKET = 'TYPE_UPDATE_MARKET'
TYPE_UPDATE_MARKET = 'TYPE_UPDATE_MARKET',
/** Proposal for updating the state of a market */
TYPE_UPDATE_MARKET_STATE = 'TYPE_UPDATE_MARKET_STATE',
/** Proposal to update the referral program */
TYPE_UPDATE_REFERRAL_PROGRAM = 'TYPE_UPDATE_REFERRAL_PROGRAM',
/** Update an existing spot market */
TYPE_UPDATE_SPOT_MARKET = 'TYPE_UPDATE_SPOT_MARKET',
/** Proposal to update the volume discount program */
TYPE_UPDATE_VOLUME_DISCOUNT_PROGRAM = 'TYPE_UPDATE_VOLUME_DISCOUNT_PROGRAM'
}
export type ProposalVote = {
@ -3998,7 +4096,7 @@ export type Query = {
/** List core snapshots */
coreSnapshots?: Maybe<CoreSnapshotConnection>;
/** Get the current referral program */
currentReferralProgram?: Maybe<ReferralProgram>;
currentReferralProgram?: Maybe<CurrentReferralProgram>;
/** Find a deposit using its ID */
deposit?: Maybe<Deposit>;
/** Fetch all deposits */
@ -4095,6 +4193,8 @@ export type Query = {
protocolUpgradeProposals?: Maybe<ProtocolUpgradeProposalConnection>;
/** Flag indicating whether the data-node is ready to begin the protocol upgrade */
protocolUpgradeStatus?: Maybe<ProtocolUpgradeStatus>;
/** Get referrer fee and discount stats */
referralFeeStats?: Maybe<ReferralSetFeeStats>;
referralSetReferees: ReferralSetRefereeConnection;
/** List referral sets */
referralSets: ReferralSetConnection;
@ -4259,6 +4359,7 @@ export type QueryestimatePositionArgs = {
marketId: Scalars['ID'];
openVolume: Scalars['String'];
orders?: InputMaybe<Array<OrderInfo>>;
scaleLiquidationPriceToMarketDecimals?: InputMaybe<Scalars['Boolean']>;
};
@ -4450,6 +4551,14 @@ export type QueryprotocolUpgradeProposalsArgs = {
};
/** Queries allow a caller to read data and filter data via GraphQL. */
export type QueryreferralFeeStatsArgs = {
assetId?: InputMaybe<Scalars['ID']>;
epoch?: InputMaybe<Scalars['Int']>;
marketId?: InputMaybe<Scalars['ID']>;
};
/** Queries allow a caller to read data and filter data via GraphQL. */
export type QueryreferralSetRefereesArgs = {
id?: InputMaybe<Scalars['ID']>;
@ -4595,6 +4704,8 @@ export type RefereeStats = {
__typename?: 'RefereeStats';
/** Discount factor applied to the party. */
discountFactor: Scalars['String'];
/** Current referee notional taker volume */
epochNotionalTakerVolume: Scalars['String'];
/** Unique ID of the party. */
partyId: Scalars['ID'];
/** Reward factor applied to the party. */
@ -4606,10 +4717,8 @@ export type ReferralProgram = {
__typename?: 'ReferralProgram';
/** Defined tiers in increasing order. First element will give Tier 1, second element will give Tier 2, etc. */
benefitTiers: Array<BenefitTier>;
/** Timestamp as RFC3339Nano, after which when the current epoch ends, the programs status will become STATE_CLOSED and benefits will be disabled. */
endOfProgramTimestamp: Scalars['Timestamp'];
/** Timestamp as RFC3339Nano when the program ended. If present, the current program has ended and no program is currently running. */
endedAt?: Maybe<Scalars['Timestamp']>;
/** Timestamp as RFC3339, after which when the current epoch ends, the programs will end and benefits will be disabled. */
endOfProgramTimestamp: Scalars['String'];
/** Unique ID generated from the proposal that created this program. */
id: Scalars['ID'];
/**
@ -4667,6 +4776,25 @@ export type ReferralSetEdge = {
node: ReferralSet;
};
/** Referral rewards and discounts that have been applied on a specific market/asset up to the given epoch. */
export type ReferralSetFeeStats = {
__typename?: 'ReferralSetFeeStats';
/** The settlement asset of the market. */
assetId: Scalars['String'];
/** The epoch for which these stats were valid. */
epoch: Scalars['Int'];
/** The market the fees were paid in */
marketId: Scalars['String'];
/** The total referral discounts applied to all referee taker fees */
refereesDiscountApplied: Array<PartyAmount>;
/** The total referral rewards generated by all referee taker fees. */
referrerRewardsGenerated: Array<ReferrerRewardsGenerated>;
/** The total referral rewards paid to the referrer of the referral set. */
totalRewardsPaid: Array<PartyAmount>;
/** The total volume discounts applied to all referee taker fees */
volumeDiscountApplied: Array<PartyAmount>;
};
/** Data relating to referees that have joined a referral set */
export type ReferralSetReferee = {
__typename?: 'ReferralSetReferee';
@ -4710,6 +4838,15 @@ export type ReferralSetStats = {
setId: Scalars['ID'];
};
/** Rewards generated for referrers by each of their referees */
export type ReferrerRewardsGenerated = {
__typename?: 'ReferrerRewardsGenerated';
/** The amount of rewards generated per party */
generatedReward: Array<PartyAmount>;
/** ID of the referral set's referrer */
referrerId: Scalars['String'];
};
/** Reward information for a single party */
export type Reward = {
__typename?: 'Reward';
@ -5152,10 +5289,10 @@ export enum StopOrderRejectionReason {
REJECTION_REASON_MAX_STOP_ORDERS_PER_PARTY_REACHED = 'REJECTION_REASON_MAX_STOP_ORDERS_PER_PARTY_REACHED',
/** Stop orders submission must be reduce only */
REJECTION_REASON_MUST_BE_REDUCE_ONLY = 'REJECTION_REASON_MUST_BE_REDUCE_ONLY',
/** This stop order does not close the position */
REJECTION_REASON_STOP_ORDER_DOES_NOT_CLOSE_POSITION = 'REJECTION_REASON_STOP_ORDER_DOES_NOT_CLOSE_POSITION',
/** Stop orders are not allowed without a position */
REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_WITHOUT_A_POSITION = 'REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_WITHOUT_A_POSITION',
/** This stop order does not close the position */
REJECTION_REASON_STOP_ORDER_NOT_CLOSING_THE_POSITION = 'REJECTION_REASON_STOP_ORDER_NOT_CLOSING_THE_POSITION',
/** Trading is not allowed yet */
REJECTION_REASON_TRADING_NOT_ALLOWED = 'REJECTION_REASON_TRADING_NOT_ALLOWED'
}
@ -5942,18 +6079,7 @@ export type UpdateProductConfiguration = UpdateFutureProduct | UpdatePerpetualPr
export type UpdateReferralProgram = {
__typename?: 'UpdateReferralProgram';
/** Benefit tiers for the program */
benefitTiers: Array<BenefitTier>;
/** The end time of the program */
endOfProgramTimestamp: Scalars['Timestamp'];
/** ID of the proposal that created the referral program */
id: Scalars['ID'];
/** Determines the level of benefit a party can expect based on their staking */
stakingTiers: Array<StakingTier>;
/** Current version of the referral program */
version: Scalars['Int'];
/** The window legnth to consider for the referral program */
windowLength: Scalars['Int'];
changes: ReferralProgram;
};
/** Update an existing spot market on Vega */

View File

@ -15,7 +15,7 @@ export function CopyWithTooltip({ children, text }: CopyWithTooltipProps) {
return (
<CopyToClipboard text={text} onCopy={() => setCopied(true)}>
{/* Needs this wrapping div as tooltip component interfers with element used to capture click for copy */}
{/* Needs this wrapping div as tooltip component interferes with element used to capture click for copy */}
<span>
<Tooltip description="Copied" open={copied} align="center">
{children}