-
Notifications
You must be signed in to change notification settings - Fork 41
Conversation
Travis automatic deployment: |
Amazing proposal.
Very good suggestion!
👌
I think we should do it. It offers transparency, and a user can start to understand how his trade "magically" happens because someone submits a solution
Depending on the effort, but ideally yes for a recent batch, because otherwise, the user would just see the trade disapear or change slightly his values. Offers more transparency in how the protocol work. I would say, reverted trades it's a "good to have"
Probably for now we can keep it simple and not show it.
This would be amazing. Not from this proposal, but it looks that filters by tokens, dates, filled/unfilled are really good aditions, both for ORDERS and for TRADES. By the way, @Rafanator likes to call TRADES "Filled", probably is better. Also, instead of Bough, I would use "Received" to be coherent with the trading widget. Regarding the dates, I see UTC, I guess we are showing the local time of the user, right? The layout, I would ask @biocom, but I would vote for get rid of the Liquidity orders here, and move it to the Liquidity section (there's a proposal already) and use the space for the "Filled" Lastly, although we don't show the order id and the batch id, but I think it's a good idea to at least add it hidden in the HTML5 data in the row (to easily check this thigns): |
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.
☝️comments above (this is just to tell github, I already reviewed so it don't show up anymore)
Hi Leandro - looks smooth and clearer, thanks!! |
Very nice Leandro! Regarding what Anxo said, I think a more proper term to use here is "Fills" instead of "Trades".
Using fills enables you to have a relevant Here is DY/DX as an example of the columns in their In the context of GP, I would suggest that our Limit Price | Fill Price | Amount | Type | Time | Transaction Limit Price -> Limit Price of the original order (i.e. 150 WETH/DAI) Observations:
I hope this makes sense :) |
Lot's of great feedback, thank you all!
@anxolin sure, was just an example of showing the full date time as opposed to what we have else where which is "x minutes ago" etc.
@c3rnst we sure can do that. I'll split this into a separated task though, to not over extend the scope of this one
@Rafanator that information is not part of the event (as well as the limit price). We can of course get the data from the original order. May or may not have a performance impact. I'll try it out. Also, in your suggested columns Rafa, you don't mention Settled. Would you rather not have it or are you indifferent? Summary:
|
Rafa knows more about trading than me, I just want to point out, that regarding this:
This is what they show in Changly: Also, that regarding this:
For me time is important, I don't understand why would we want to remove it. You shouldn't be having to click on all the fills and check the date in Etherescan for see if the last fills are from today or not. This is for example Kraken, they show fills too. By the way, they call them trades 🤷♂️ |
before creating new ones
@bh2smith the latest version should not show you any more NaNs. |
src/services/factories/getTrades.ts
Outdated
if (isOrderDeleted(order) && orderInfo) { | ||
const { buyTokenId, sellTokenId, blockNumber } = orderInfo | ||
try { | ||
order = await exchangeApi.getOrderFromOrderPlacementEvent({ | ||
userAddress, | ||
networkId, | ||
orderId, | ||
// Parameters bellow not required, but help narrow down the search | ||
buyTokenId, | ||
sellTokenId, | ||
toBlock: blockNumber, | ||
}) |
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.
There may be a better way
we can make calls to check contract state at a specific block
You have blockNumber
from TradeEvent
and Order
corresponding to that event must be active at that point, of course. So you can do
contract.methods.getEncodedUserOrders(userAddress).call({}, blockNumber)
// then you'll have to decode orders as usual and find the one you need
But maybe even better since we have paginated orders and know orderId
exchangeApi.getOrdersPaginated({
userAddress.
networkId,
offset: orderId,
pageSize:1,
}, blockNumber) // fetches that exact order as it was at that block
I wonder if to have fewer fetches we could, if we have multiple deleted orders close by in id, fetch them all together with appropriate pageSize
, but probably not, cause will be hard to guess at what blockNumber
they all would be alive.
This is much cheaper (probably) than getting a bunch of unindexed events.
blockNumber
isn't typed though, it's not even in the docs
So try with //@ts-ignore
first and if it works for you, once again I'll need to hack around types in dex-js, ugh...
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.
Well, if that's the case, I could use the getOrder
directly with the blockNumber
.
Then orders will never be empty and I can skip this additional step entirely.
I'll give this a try 👍
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.
Yes, that does work!
No need to check for this event then, I'll remove the method getOrderFromOrderPlacementEvent
and this extra hop.
And, as expected, the build does fail:
ERROR in /home/alfeto/work/dfusion/dex-react/src/api/exchange/ExchangeApi.ts
ERROR in /home/alfeto/work/dfusion/dex-react/src/api/exchange/ExchangeApi.ts(347,83):
TS2554: Expected 0-1 arguments, but got 2.
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.
Several layers of ignore later :D
1cb9671
I'm wondering if I should still leave the check for empty orders there as an additional check.
But maybe not. There shouldn't be a case that a Trade event is emitted while an order does not exist on the contract.
Co-authored-by: Velenir <Velenir@users.noreply.github.com>
With this we can query for the order at the given block when we know the order hasn't been deleted
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.
@alfetopito this PR is getting too big and difficult to review the new things.
I'm quite happy with the current state.
What do you think is about merging and doing small PRs to address the pending issues?
Not for this PR, but once it's merge we can style it further. I did some clumsy test, and I think it looks better with a bit more of air/padding for the rows: Also I tried to play a bit with the pills. display: inline-block;
font-size: 0.9rem;
padding: 0.2rem 0.8rem;
min-width: 5em;
font-weight: 800;
} Also, probably we'll have to do something with the date. "about 2 months ago" is a bit long. We should address mobile independently, maybe @W3stside can help here |
As Anxo suggested, merged branch as it currently is. Too big to review, will address comments in new PRs. |
Update (Jun 1):
Couple improvements:
Update (May 27):
Page is working, loading trade events with the minimal functionality needed.
Ready for testing with your own trades on https://pr1012--dexreact.review.gnosisdev.com/trades/
(remember to connect your wallet)
To be decided based on feedback on this PR:
Follow ups to this PR
Proposal for a Trades view
Added a very basic table with ideas for a trades view (page or tab, to be decided).
For now listing a few fields I think might be useful for users.
One idea as to where to put this is as an additional tab on the Trade page, such as:
(Keep in mind the image above is not in the PR)
The current mock is under
/trades
path.Notes
Settled
column indicates whether the trade is final or can still be reverted (batch still open for submissions). Possibly display the countdown for how long until settlement.orderId
, but likebatchId
, this is not displayed anywhere else. Might not be worth starting it now.While we discuss this proposal, I'll fiddle around with blockchain events to populate this table.