Skip to content

Instantly share code, notes, and snippets.

@adrake33
Last active March 17, 2019 23:59
Show Gist options
  • Save adrake33/f8877156a5d2a703ff2dd0d6a7ef2fb9 to your computer and use it in GitHub Desktop.
Save adrake33/f8877156a5d2a703ff2dd0d6a7ef2fb9 to your computer and use it in GitHub Desktop.
export interface GetOrdersResults {
[marketId: string]: {
[outcome: number]: {
[orderType: string]: {
[orderId: string]: Order;
};
};
};
}
export interface Order {
amount: string, // fullPrecisionAmount (rounded)
creationBlockNumber: number, // Block number of OrderCreated event
creationTime: number, // Block timestamp of OrderCreated event
fullPrecisionAmount: string, // Not sure what the best way to get this is?
fullPrecisionPrice: string, // Not sure what the best way to get this is?
logIndex: // Block log index of OrderCreated event
orderId: OrderId, // OrderCreated.orderId
orderState: OrderState, // Not sure what the best way to get this is?
originalAmount: string, // OrderCreated.amount (rounded)
originalFullPrecisionAmount: string, // OrderCreated.amount
originalSharesEscrowed: string, // OrderCreated.sharesEscrowed
originalTokensEscrowed: string, // OrderCreated.moneyEscrowed
owner: Address, // OrderCreated.creator
price: string, // fullPrecisionPrice (rounded)
shareToken: Address, // OrderCreated.shareToken
sharesEscrowed: string, // OrderCreated.sharesEscrowed
tokensEscrowed: string, // OrderCreated.moneyEscrowed
transactionHash: TransactionHash, // Block transaction hash of OrderCreated event
}
@adrake33
Copy link
Author

This getter can be used in either situation. (There is an optional creator parameter, and either a universe or market address must be specified.) We can retrieve/calculate the full precision amounts depending on whether the creator is specified. We can also rename the "full precision" values to something else and get rid of the order state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment