State of Technology Update — Architecture

DeFIRE
deFIRE
Published in
2 min readJun 7, 2021

Overview

This is one of a series of posts which will keep you updated on the state of technology development of the deFIRE products. The topic of this piece is centered around the initial design of the architecture of the router software.

Figure 1

Figure 1 provides a simplified graphical representation of the system architecture of the Minimum Viable Product (MVP). When building this special care has been taken of the platform’s modularity, scalability and interoperability in anticipation of the significant growth of the use of routers.

Keeping in mind the large number of DEXs that will be integrated, further expansion of the functionality both in terms of backend and frontend, and expected rise in computational demand on the Smart Router and the Internal Matching module, it is clear that the system should be modular by design.

In this way the development of particular modules or their scaling/pipelining will not affect the system as a whole. The same principle is extended to the design and development of the Smart Contracts.

Key Components

Order Handler Smart Contract

This smart contract receives orders and input tokens from users, stores order’s hashes, receives trading signals from the backend executor and calls the order modules to perform the trades.

Smart Router

A function which determines the way the order will be executed based on on-chain DEX states taking into account the order size, input and output tokens, number and state of DEXs.

Internal Matching

The set of limit orders will also serve as an onchain order book. The backend will also monitor this database as a source of liquidity as any other DEX (not just for other limit orders but also for smart router splitting of orders). When an incoming limit order or market order enters the DEX and matches with an existing limit order (either fully or partially) it will be forwarded to a special handler and both orders will be settled. Since both orders are settled at once without a call to an external DEX, the gas cost will be on average lower as compared to a straight DEX trade.

In subsequent posts we will talk more about the mechanics of the Order Types (Market, Limit, Stop Loss) and we will cover the backend module extensively.

--

--