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