chore: fix and improve types for market proposal (#2493)

* chore: fix and improve types for market proposal

* chore: remove unused type definition
This commit is contained in:
Matthew Russell 2022-12-30 12:05:48 -06:00 committed by GitHub
parent aac3799b14
commit 82833cc06a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,13 +76,13 @@ interface ProposalNewMarketTerms {
changes: {
decimalPlaces: string;
positionDecimalPlaces: string;
lpPriceRange: string;
instrument: {
name: string;
code: string;
future: {
settlementAsset: string;
quoteName: string;
settlementPriceDecimals: number;
dataSourceSpecForSettlementData: DataSourceSpec;
dataSourceSpecForTradingTermination: DataSourceSpec;
dataSourceSpecBinding: DataSourceSpecBinding;
@ -100,12 +100,6 @@ interface ProposalNewMarketTerms {
};
logNormal: LogNormal;
};
liquidityCommitment: {
commitmentAmount: string;
fee: string;
buys: Buy[];
sells: Buy[];
};
};
closingTimestamp: number;
enactmentTimestamp: number;
@ -184,35 +178,66 @@ interface ProposalUpdateAssetTerms {
}
interface DataSourceSpecBinding {
settlementPriceProperty: string;
settlementDataProperty: string;
tradingTerminationProperty: string;
}
interface DataSourceSpec {
config: {
signers: Signer[];
filters: Filter[];
interface InternalDataSourceSpec {
internal: {
time: {
conditions: Condition[];
};
};
}
interface ExternalDataSourceSpec {
external: {
oracle: {
signers: Signer[];
filters: Filter[];
};
};
}
type DataSourceSpec = InternalDataSourceSpec | ExternalDataSourceSpec;
type Signer =
| {
address: string;
ethAddress: {
address: string;
};
}
| {
key: string;
pubKey: {
key: string;
};
};
interface Filter {
key: {
name: string;
type: string;
};
key: DefaultFilterKey | IntegerFilterKey;
conditions?: Condition[];
}
interface DefaultFilterKey {
name: string;
type: 'TYPE_DECIMAL' | 'TYPE_BOOLEAN' | 'TYPE_TIMESTAMP' | 'TYPE_STRING';
}
interface IntegerFilterKey {
name: string;
type: 'TYPE_INTEGER';
numberDecimalPlaces: string;
}
type ConditionOperator =
| 'OPERATOR_EQUALS'
| 'OPERATOR_GREATER_THAN'
| 'OPERATOR_GREATER_THAN_OR_EQUAL'
| 'OPERATOR_LESS_THAN'
| 'OPERATOR_LESS_THAN_OR_EQUAL';
interface Condition {
operator: string;
operator: ConditionOperator;
value: string;
}
@ -236,12 +261,6 @@ interface Trigger {
auctionExtension: string;
}
interface Buy {
offset: string;
proportion: number;
reference: string;
}
export interface ProposalSubmission {
rationale: {
description: string;