0xProject / 0x-monorepo

0x protocol monorepo - includes our smart contracts and many developer tools
Other
1.41k stars 466 forks source link

0x trade unfair problem #935

Closed oneroot001 closed 6 years ago

oneroot001 commented 6 years ago

Problem

Is there anyone aware of the “trade unfair problem” suggested in this chinese post in https://www.jianshu.com/p/d12beba14452 . In the PARADEX and DDEX, their own relayer is taker,who take the token from buyer and seller.But when the price of buyer and seller are different,they can not trade at best price.

Solution

This problem can be solved by check the price in the contract when fill order.This is implemented by R1 Protocol The work flow is as bellows:

  1. maker sign his own order;
  2. taker sign his own order;
  3. relayer matched the maker and taker's order;
  4. relayer submit the maker and taker's order on chain to fill order;
  5. the contract's fill order do the job 1) check maker and taker's signature,2)check the two orders' price matched,3) and other check jobs ....

Advantages

  1. maker and taker both sign their own order on client off chain independently;
  2. relayer helps to match orders in matching engine and submit on chain can make relayer controll the orderbooks better;
  3. whithout tade-unfair problem;
fabioberger commented 6 years ago

This issue smells like an advertisement for R1 Protocol. Tbh, we don't see this as "unfair", but rather a situation where both traders get what they stipulated they wanted in their respective orders. Enforcing that they must have the same price to match means that overlapping orders without exact prices won't be matched, which is inefficient.