The-GNTL-Project / Exchange

https://exchange.gntl.co.uk
3 stars 0 forks source link

Multiple issues with clearing more than one order at a time from the order books #84

Open ElectricDosh opened 3 years ago

ElectricDosh commented 3 years ago

I'll use whole numbers and ignore fees for simplicity.

Example: there are 3 orders in the sell book to sell 1 XMR, one for 30 GNTL, one for 40 GNTL, and one for 50 GNTL. I place a buy order at a price of 50 GNTL and commit a total of 150 GNTL.

Expected behaviour: I receive 3 XMR for 120 GNTL, and leave a buy order in the book for 0.6 XMR for the remaining 30 GNTL at a price of 50 GNTL. Actual behaviour: I receive 3 XMR and nothing is left over.

In addition, a trade that clears more than one order from the book leaves a massive discrepancy off by several orders of magnitude in the Cost column in the user's trade history. As an example I did a trade that cleared 3 sell orders from the book for a total of ~45 GNTL and the cost shows as 111881.5949 GNTL.

tylerjohneddy commented 3 years ago

When you receive your 3 xmr you get your change in GNTL back too right?

ElectricDosh commented 3 years ago

When you receive your 3 xmr you get your change in GNTL back too right?

Nope, as far as I can tell the full 150 is taken and nothing is returned. I'll do another test and see what happens on the seller's end.

ElectricDosh commented 3 years ago

Just tested and the seller does not receive the missing funds, so they're just disappearing.

tylerjohneddy commented 3 years ago

i think i have fixed this. ill upload the fix soon and post when done

BKdilse commented 3 years ago

@tylerjohneddy this is better, the totals balance out correctly.

1 ARQ selling for 30, 40, 50 GNTL: Seller receives 120 GNTL, and looses 3 ARQ+Fees Buyer receives 3 ARQ, and looses 120 GNTL+Fees

My Completed trades does not look correct: Seller's one looks fine, with 3 orders at correct prices. Buyer's one looks wrong, with 1 order at price of 50 GNTL.

BKdilse commented 2 years ago

@tylerjohneddy I've Re-tested this.

Seller's balances and Completed trades look good, 3 individual trades shown.

Buyers balances look good, but Completed trades has 1 entry @ Price 50 GNTL, 3 ARQ, 120 GNTL Total. When clicking the order buy (50, 3rd in the list), it showed spend of 150 GNTL, instead of 120 GNTL. DB shows 1st amount of 150 GNTL and price in firstticker of 50 GNTL.

BKdilse commented 2 years ago

As the balances for buyer and seller are correct, this appears to be a display issue. When clicking the order, the total is 150 GNTL, but once trade completes, it shows 120 GNTL.

tylerjohneddy commented 2 years ago

so this is a front end issue? and a backend issue stroing the incorrect values in the DB?

BKdilse commented 2 years ago

Yes looks that way.

tylerjohneddy commented 2 years ago

okay, are you able to look at the front end? and take a image of the issue in the DB and send it over?

BKdilse commented 2 years ago

Seller: 30, 40, 50 image

Buyer clicks last order (50): image

Seller completed: image image

Buyer completed: image image

DB: image

Oh, the Fee wallet gained 0.30 (which is for 150 GNTL and not 120 GNTL)