Understanding Swap Protocol

Before moving on understanding Swap protocol, we should cover some of the terminologies used in the protocol.

Maker: Party that provides an order.

An example can be a peer wanting to buy EOS in exchange for TRON

Taker: Party that fills the order.

A peer who wants to do the reverse as a maker is a taker.

Indexer

Service responsible for indexing and matching various makers and takers.

Oracle

Off-chain service to provide prices of orders

Contract: Smart contract on Ethereum which can be used by Taker to process an order.

  1. Peer Discovery (this step is centralised though)
  2. Price Discovery
  3. Execution
  4. Clearing
  5. Custody

Peer Discovery

Overall the first step is peer discovery, wherein the Maker provides the trades they’re willing to make ie trade token A for a token B. At this point, no information is given about the prices publically thereby maintaining the efficiency from the peers who want to manipulate the system to change prices.

In this step, the taker can ask a maker for that particular trade.

Price Discovery

This step involves the Taker who is interested in the trade offered by a/or many Makers.

The Maker can proceed and provide the information to Taker of what price it can trade for.

Execution, Clearing and Custody

The last 3 steps are actually combined into 1 part since it involves the work done by the Smart Contract.

Once the Maker has sent an order for Taker. It can be executed by the Taker using the Smart Contract which helps in exchanging the tokens.

This step involves 2 parts in preliminary steps:

A. Check for expiration date given by Maker by the Smart Contract.

B. Check for approval by both Taker and Maker in the previous step.

Smart Contract on getting the approval can provide the clearing (this makes use of `transferFrom` available in ERC-20.

This providing the custody for respective tokens to each of the parties.

来源

What do you think?

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Loading…

0

Comments

0 comments

Hyundai’s Hdac Launches DApp / Italy’s Banca Sella Opens Bitcoin Trading to 1.2M / China Launches

Track time series automatically