This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Travis automatic deployment: |
alfetopito
approved these changes
May 22, 2020
Comment on lines
-135
to
-148
/** | ||
* TradeEvent enriches BaseTradeEvent with block, order and token data | ||
*/ | ||
export interface TradeEvent extends BaseTradeEvent { | ||
batchId: number | ||
hashKey: string // orderId + batchId, to find reverts | ||
indexOnBatch: number // tracks trade position on batch, in case of reverts | ||
time: Date | ||
buyToken: TokenDetails | ||
sellToken: TokenDetails | ||
limitPrice: BigNumber | ||
fillPrice: BigNumber | ||
reverted: boolean | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no, my beautiful yet unused interface :(
alfetopito
added a commit
that referenced
this pull request
Jun 3, 2020
* Mock trades page with suggestion for listing user trades * Added web3-eth-contract as dep * WIP attempt to fetch and subscribe to trade events * Added simple hook for getting user trades * Updated Trades page to use dynamically loaded list of trades * fix build * New dex-js version * New types needs extra hop of casting * Pinning web3 1.2.7 as 1.2.8 is breaking the app * Improved subscription, types, unsubscription and so on, still WIP * Keeping one trade subscription per network and clearing subscriptions before creating new ones * Making a copy of trades before returning * Moving log position to after clearing current subscriptions * Getting subscription after clearing previous subscriptions, if any * Trades/types (#1038) * update dex-js * fix types * fix mock types * Fixing Weth contract type * Added optional fromBlock parameter to getPastTrades method * Accept timestamp on dateToBatchId * New method getOrder on exchangeApi * New service getTrades * Using new service and temporarily showing some different columns * Adding more stuff to Trades page * Typing fix * Adding helper function to check whether trade is filled/partial * New trades column: market * Populating trades column: type * It's actually `Full` trade, not `Filled` * Remaining trade amount != remaining order amount * Caching last seen block when querying for new trades * Updating trades on every new block * Added trades to global state * Keeping track of last checked block moved to global state * Experimenting with Amount column up and added Received amount * Fetch trades up to latest - 4 blocks (~1m delay) * Added extra space on log message * Should use `logIndex` instead of `transactionIndex` from event data * Added `settlingDate` to trade interface * Extracted `StatusCountdown` to an independent component * Added back `Settled` column, with countdown when order is not yet settled * Renamed `hashKey` to `revertKey` * Transforming unix timestamp to JS timestamp inside the fn * Removed `batchId | orderId` column * Added batchId as data prop * New etherscan type: event, pointing to eventLogs * Pointing txs to events on etherscan * Showing date in local time * Using formatSmart * Moved displayTokenSymbolOrLink to utils * Displaying token address when there's no symbol * Adjusting column sizes * Avoid circular dependencies... * Moving page code to TradesWidget * Extracting inner trade component TradeRow * Refreshing TradeRow and updating component to remove countdown when done * `now` must be inside the row in order for the refresh to work * Save trades as csv (#1071) * add FileDownloader component * format trades as CSV * more generic FileDownloader * Optional function to generate csv instead of receiving raw string * Added utils function `toCsv` * More csv columns, more things, more everything, more fun! Co-authored-by: Leandro Boscariol <leandro.boscariol@gnosis.io> * Do not expose trades that are not settled * Inverting buy/sell symbols on market column * Refactoring TradeRow variables * Added css `pills` for types column * When no new trades, update only lastCheckedBlock to avoid unecessary rerenders * Avoid querying twice same set of events from block * Over engineering as always to query for new trades only once every batch After all, there's only one final solution per batch * Service params consistency * There's a getBlockNumber web3 method, how convenient * Splitting up fetch events call to when it fails * Using orders from global state if any, and fetch only ones not found * Reseting global trades state on network change * Fix typo * Adjusting service interface * Adding pottentially missing tokens to tokenList * Show ConnectWalletBanner when not connected * Checking properly whether file data exists * Clearing only on hook unmount * Tracking intervalId only inside useEffect * Adjusting trades reducer types * Using console.assert :) * settlingDate is now settlingTimestamp * Using typeof instead of instanceof * Removing unecessary filter * Refactoring order fetching for minor optimizations * Refactored toCsv to no longer accept headers as parameter, +unit tests * New method to get order data from OrderPlacement event * Moving isOrderDeleted helper function to utils * When order has been deleted, fetch info from OrderPlacement event * Adding data-label and title to TradeRow * Moved Time column up and renamed it Date. Also displaying relative time on ui, and ISO time on title * Moved CSV download button into last column header * Fancy Record usage Co-authored-by: Velenir <Velenir@users.noreply.github.com> * Moved csv file options to a const outside of component * Moving all logic inside try clause * Allowing optional blockNumber parameter to getOrders method With this we can query for the order at the given block when we know the order hasn't been deleted * Removed extra check for deleted orders which is no longer needed * Removing getOrderFromOrderPlacementEvent method * Removed unused imports, extra comment added * Removing event subscription from ExchangeApi * Refactor: organizing methods inside ExchangeApi * Moving contract deployment block to config * Inline styles are bad! * Moves calculateSettlingTimestamp to utils * Accounting for the fact that we might fail to fetch some orders * Revert "Removing getOrderFromOrderPlacementEvent method" This reverts commit 7818498. * Revert "Removed extra check for deleted orders which is no longer needed" This reverts commit 249647f. Co-authored-by: Leandro Boscariol <leandro.boscariol@gnosis.io> Co-authored-by: Velenir <velenir@gmail.com> Co-authored-by: Velenir <Velenir@users.noreply.github.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
More types