This section defines the way in which the state of the Market is being stored in the chain.
Market
A market is an entity being stored in the SGE Network chain to hold the data related to a market that has been verifiably pushed to the blockchain. It contains the following fields:
uid: It is the unique identifier of a market.
start_ts: It is the timestamp when a particular market will start.
end_ts: It is the timestamp when a particular market will end.
odds: It is a list of all the odds for a particular market. the meta is a human-readable description of the odds, it can be a JSON string to be used by oracle services.
Ex: { "uid" :uid_win_event, "meta": "tam A wins" }, { "uid": uid_draw_event, "meta": "draw"}, { "uid": uid_loose_event, "meta": "team A loose"}
winner_odds_uids: It is a list of all the UIDs of odds that have won the market. This should necessarily be a subset of the above-provided odds_uids.
status: It defines the current state of the market.
resolution_ts: It is the timestamp when the market came to a resolution i.e. when the system received a resolution request for a market.
creator: It holds the account address responsible for the addition of the market to the blockchain.
meta: It is a human-readable description of the market, it can be a JSON string to be used by oracle services.
book_id is the ID of the order book created and assigned to the market, this is the same value as market UID.
The proto for the market is as follows:
// Market is the representation of the market to be stored in
// the market state.
message Market {
// uid is the universal unique identifier of the market.
string uid = 1 [
(gogoproto.customname) = "UID",
(gogoproto.jsontag) = "uid",
json_name = "uid"
];
// start_ts is the start timestamp of the market.
uint64 start_ts = 2 [
(gogoproto.customname) = "StartTS",
(gogoproto.jsontag) = "start_ts",
json_name = "start_ts"
];
// end_ts is the end timestamp of the market.
uint64 end_ts = 3 [
(gogoproto.customname) = "EndTS",
(gogoproto.jsontag) = "end_ts",
json_name = "end_ts"
];
// odds is the list of odds of the market.
repeated Odds odds = 4;
// winner_odds_uids is the list of winner odds universal unique identifiers.
repeated string winner_odds_uids = 5 [
(gogoproto.customname) = "WinnerOddsUIDs",
(gogoproto.jsontag) = "winner_odds_uids",
json_name = "winner_odds_uids"
];
// status is the current status of the market.
MarketStatus status = 6;
// resolution_ts is the timestamp of the resolution of market.
uint64 resolution_ts = 7 [
(gogoproto.customname) = "ResolutionTS",
(gogoproto.jsontag) = "resolution_ts",
json_name = "resolution_ts"
];
// creator is the address of the creator of market.
string creator = 8;
// meta contains human-readable metadata of the market.
string meta = 9;
// book_uid is the unique identifier corresponding to the book
string book_uid = 10 [
(gogoproto.customname) = "BookUID",
(gogoproto.jsontag) = "book_uid",
json_name = "book_uid"
];
}
Market Status
The status of a market in the chain can be defined in either of the five following ways:
// MarketStatus is the market status enumeration
enum MarketStatus {
// unspecified market
MARKET_STATUS_UNSPECIFIED = 0;
// market is active
MARKET_STATUS_ACTIVE = 1;
// market is inactive
MARKET_STATUS_INACTIVE = 2;
// market is canceled
MARKET_STATUS_CANCELED = 3;
// market is aborted
MARKET_STATUS_ABORTED = 4;
// result of the market is declared
MARKET_STATUS_RESULT_DECLARED = 5;
}