etherdelta / etherdelta.github.io

https://etherdelta.com
552 stars 688 forks source link

Out of sync off-chain Order Book from WETH transaction #572

Open bbeeley opened 5 years ago

bbeeley commented 5 years ago

TL;DR: EtherDelta orders may be getting taken without properly updating the off-chain order book -- transactions using WETH may have something to do with it.

I'll start with what I observed. I tried executing a testOrder to take the following order for LINK:

{ id: 'b1368fbed78fe13bb0440efa8ca9354a3def6063f003301d99850d5f23e74947_buy', amount: '4.375e+21', price: '0.000709315', tokenGet: '0x514910771af9ca656af840dff83e8264ecf986ca', amountGet: '4.375e+21', tokenGive: '0x0000000000000000000000000000000000000000', amountGive: '3103253125000000000', expires: '6068534', nonce: '4290858552', v: 28, r: '0x43f2feeb07372a39a0033178bec1b1bd8b6c07a2fea263a195f11bc25ceef2eb', s: '0x2266c42d940b35d3609c605df1137f3ce830f473361f99387a55e3e0e03944f6', user: '0x3ceAb05040309b427ED2afBf8DbaCF351700DB2c', updated: '2018-07-30T17:49:17.072Z', availableVolume: '4.375e+21', ethAvailableVolume: '4375', availableVolumeBase: '3103253125000000000', ethAvailableVolumeBase: '3.103253125', amountFilled: null }

The testOrder failed, and I don't know exactly why. My calls to testOrder with other LINK orders succeed for the same amount.

Looking at the trades listed for LINK on EtherDelta, I noticed the following transaction:

https://etherscan.io/tx/0x65607dbfdc9a156b39f4b225ce0ea965e8bdd83f6e169ca2b03479cc182488b7

If you look at that transaction you will see an amount of LINK exchanged with EtherDelta to almost fill the order, at the exact same price as the order.

Did the EtherDelta order book get out of sync? It appears so, since many hours later, the quantity available for the transaction updated to be 13.562, which was the difference between the transaction I mentioned and the order reference above.

Did WETH have anything to do with EtherDelta getting out of sync? I don't know.