Skip to content

Instantly share code, notes, and snippets.

View adrake33's full-sized avatar

Aaron Drake adrake33

View GitHub Profile
export interface GetMarketsInfoResults {
id: string, // MarketCreated.market
universe: string, // MarketCreated.universe
marketType: string, // MarketCreated.marketType
numOutcomes: number, // Derived from MarketCreated.outcomes
minPrice: string, // MarketCreated.minPrice
maxPrice: string, // MarketCreated.maxPrice
cumulativeScale: string, // MarketCreated.maxPrice - MarketCreated.minPrice
author: string, // MarketCreated.marketCreator
creationTime: number, // Block timestamp of MarketCreated event
// Should be called GetTopicResults in v2
export interface GetCategoriesResults {
category: string, // Should be renamed topic for v2. Should log category, nonFinalizedOpenInterest, & openInterest as a single event?
nonFinalizedOpenInterest: string,
openInterest: string,
tags: Array<Tag>, // Deprecated in v2
}
// Should log each update to the market's price history?
export interface TimestampedPriceAmount {
price: string;
amount: string;
timestamp: number;
}
export interface GetMarketPriceHistoryResults {
[outcome: number]: Array<TimestampedPriceAmount>;
// Should log when market creator has unclaimed fees & when they are claimed?
export interface MarketCreatorFee {
marketId: string;
unclaimedFee: string;
}
export interface GetMarketCreatorFeesResults {
[index: number]: Array<MarketCreatorFee>;
}
// May not need any additional logging?
export interface MarketPriceCandlestick {
startTimestamp: number;
start: string;
end: string;
min: string;
max: string;
volume: string;
tokenVolume: string;
// Probably nothing additional to log
export interface GetBetterWorseOrdersResults {
betterOrderId: Address|null;
worseOrderId: Address|null;
}
export interface GetOrdersResults {
[marketId: string]: {
[outcome: number]: {
[orderType: string]: {
[orderId: string]: Order;
};
};
};
}
// Should updates to a user's trading positions in a specific market be emitted as an event?
export interface GetTradingPositionsResult {
averagePrice: string,
cost: string,
marketId: Address,
netPosition: string,
numEscrowed: string,
outcome: number,
position: string,
// This data is all being logged, but currently requires getting info from multiple events, like OrderFilled, OrderCreated, & TokensMinted
export interface UserTrade {
transactionHash: string, // Block transaction hash
logIndex: number, // Block log index
orderId: string, // OrderFilled.orderId
type: string, // OrderCreated.orderType
price: string, // OrderCreated.price
amount: string, // OrderFilled.amountFilled
maker: boolean, // OrderCreated.orderType
// Should add `outcome`, `price`, & `maker` to TradingProceedsClaimed
export interface ProceedTradesRow {
logIndex: number, // Block logIndex
blockNumber: number, // Block number
timestamp: number, // Block timestamp
marketId: Address, // TradingProceedsClaimed.market
outcome: number, // Share token's outcome
price: BigNumberType, // Payout * tickSize * MarketCreated.minPrice
amount: BigNumberType, // TradingProceedsClaimed.numShares