Relayer strategy
@posgnu 已经在做这个了。
开始于 2018年12月7日。
评估
这个 Issue 还没有评估数据。
描述
Strategy:
As a client submit its order, the relayer checks if there is a matching order stored in the order book. Before this, the relayer also checks if the order conforms with fee policy regulated by the DEX. Only the relayer can fill the orders so that there is no primary race condition from the matching process. The relayer also knows when orders are matched before anyone else and can update the order book as soon as the transaction is submitted.
Rest API
submit(inputs: assetTransferInput[], order: Order, marketId: number, makerAddress: string)
Check if the transaction is valid
Before relaying transactions, they have to be checked validity. First, the DEX have to verify that the transaction 's unlock script is valid. It means that the transaction has to provide a correct signature over order. After the validity checking is finished, the transaction will be relayed on the DEX so that other clients can fill the transaction.
Matching
When the transaction arrives at the DEX, there may or may not be combinable orders. If there are not, the transaction will directly go into the order book as order. The case becomes more complicated if there are orders which are combinable with the incoming transaction. It can be divided into three situations.
- There is an order which has exactly the same rate and amount with the incoming transaction - In this case, the order is filled and transmitted to a Codechain node
- There is an order which has the same rate but less amount than an incoming transaction - Fill the order and relay the remainder.
- There is an order which has the same rate but more amount than an incoming transaction - Do the partial fill
Matching priority
First In, Frist Match rule
Sync
All of the operations with DB have to be atomic. In addition, the matching processes have to be synchronized since matching only occurs in the DEX.
- 主要语言
- TypeScript
- 星标
- 17
- 派生
- 4
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CodeChain-io/codechain-exchange 的其他 Issue
-
help wanted test
难度 2/5 1-3 小时 新手友好度 30/100
CodeChain-io/codechain-exchange#28 · 3 条评论 ·
-
design
难度 5/5 一周以上 新手友好度 15/100
-
design
难度 5/5 一周以上 新手友好度 10/100
-
design
难度 4/5 3-5 天 新手友好度 25/100
-
Matcher :m: orderwatcher :eyes:
难度 5/5 一周以上 新手友好度 25/100
CodeChain-io/codechain-exchange#13 · 1 条评论 ·
查看 CodeChain-io/codechain-exchange 的全部 Issue
相似的 Issue
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 1/5 1 小时以内 新手友好度 85/100
-
Mend: dependency security vulnerability untriaged
难度 2/5 1-3 小时 新手友好度 70/100