Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

1030/reverted trades #1087

Merged
merged 33 commits into from
Jun 10, 2020
Merged

1030/reverted trades #1087

merged 33 commits into from
Jun 10, 2020

Conversation

alfetopito
Copy link
Contributor

@alfetopito alfetopito commented Jun 4, 2020

Closes #1030

Update Jun 08

  • No longer removing reverted trades
  • No longer storing reverts on global state
  • Only for testing/debugging, added an icon next to reverted trades. Will filter reverted trades out before merging and remove this entirely.

screenshot_2020-06-08_14-09-35

  • Addressed minor PR comments

screenshot_2020-06-08_15-03-58


Removing reverted trades.

screenshot_2020-06-05_13-56-29

Todo:

  • Use trade reverts on global state to filter out reverted trades
  • Fix type issue on getTrades service return
    screenshot_2020-06-04_15-12-31

@ghost
Copy link

ghost commented Jun 5, 2020

Travis automatic deployment:
https://pr1087--dexreact.review.gnosisdev.com

@alfetopito alfetopito force-pushed the 1030/reverted-trades branch from 32d8854 to 1bc9014 Compare June 5, 2020 20:56
@alfetopito alfetopito marked this pull request as ready for review June 5, 2020 20:58
Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the concern about how the trades are matched that we discussed in the batch, so you make sure for same batch/user/orderId you check the block number and log index to decide wich trade was reverted

Other than that, just minor things addressed in the comments.

src/reducers-actions/trades.ts Outdated Show resolved Hide resolved
src/reducers-actions/trades.ts Outdated Show resolved Hide resolved
src/reducers-actions/trades.ts Outdated Show resolved Hide resolved
src/services/factories/getTrades.ts Outdated Show resolved Hide resolved
@alfetopito alfetopito force-pushed the 1030/reverted-trades branch from 4f0bfd0 to 758adb2 Compare June 8, 2020 21:29
Copy link
Contributor

@W3stside W3stside left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice man, only comments are similar to Anxo's. Good work

@alfetopito alfetopito force-pushed the 1030/reverted-trades branch from fad42a0 to 1205bdc Compare June 9, 2020 21:01
src/hooks/useTrades.ts Outdated Show resolved Hide resolved
src/reducers-actions/trades.ts Outdated Show resolved Hide resolved
src/reducers-actions/trades.ts Outdated Show resolved Hide resolved
src/reducers-actions/trades.ts Outdated Show resolved Hide resolved
src/services/factories/getTrades.ts Outdated Show resolved Hide resolved
src/reducers-actions/trades.ts Show resolved Hide resolved

// Filter out trades in that range (curr ... curr -2).
// The `revertKey` is composed by batchId|orderId, so this regex looks for the batchIds in the keys
const batchesRegex = new RegExp(`^(${currentBatchId}|${currentBatchId - 1}|${currentBatchId - 2})\|`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels a bit strange this way of filtering

also, why you want pending trades from last 2 batches?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels a bit strange this way of filtering

I could instead go over the list of trades and look for the batches instead but...
...there is already a list of batchId|orderId.
Happy to change if you have a better suggestion.

also, why you want pending trades from last 2 batches?

To be "safe(r)". Would you like to live dangerously and reduce it to 1?

src/reducers-actions/trades.ts Outdated Show resolved Hide resolved
src/reducers-actions/trades.ts Outdated Show resolved Hide resolved
@alfetopito alfetopito merged commit b2147ab into develop Jun 10, 2020
@alfetopito alfetopito deleted the 1030/reverted-trades branch June 10, 2020 23:19
@alfetopito alfetopito mentioned this pull request Jul 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show filled orders (trades) - Handle reverts
4 participants