DAFI — Exchange Preview ( A new era for DeFi)

DAFI Protocol
DAFI Protocol
Published in
9 min readJun 2, 2023

--

In the rapidly evolving world of decentralized finance (DeFi), market makers play a crucial role in maintaining liquidity and facilitating efficient trading. However, market makers often face challenges due to the fragmentation of orders across various decentralized exchanges (DEXes). This issue leads to a significant portion of orders remaining unfulfilled, resulting in a segregated market. As a consequence, users are compelled to resort to centralized exchanges (CEXes) for order matching, which introduces trust concerns as users must rely on these centralized platforms for account generation and key security.

DAFI’s Hybrid Exchange, a pioneering platform, aims to address these challenges by offering innovative solutions that revolutionize the landscape of decentralized order placement. DAFI tackles the issues of order fragmentation and trust by providing self-custodial account generation and leveraging AI-powered order matching. Let’s take a deeper look into how it works.

Web3 Security meets Web2 user experience

DAFI recognizes the importance of maintaining the principles of decentralization and user autonomy. To this end, our Hybrid Exchange empowers market makers with self-custodial account generation. By allowing users to generate their accounts independently, DAFI ensures that the custody of funds remains under the control of the account owner. This approach eliminates the need for users to rely on centralized exchanges for account creation, mitigating the associated trust concern.

DAFI also takes order fulfilment to the next level by leveraging artificial intelligence (AI) for order matching. This intelligent order routing ensures that market makers’ orders are executed efficiently, minimizing the possibility of unfulfilled orders. By harnessing the power of AI, DAFI creates a more seamless and streamlined trading experience for market makers.

By adopting DAFI’s solutions, market makers targeting DEXes gain several key advantages:

Enhanced Order Fulfilment: DAFI’s AI order matching significantly improves the probability of order fulfilment. Market makers can expect a higher success rate in executing their orders, reducing the frustration of unfulfilled trades.

Independence and Trustlessness: With self-custodial account generation, market makers maintain full control over their funds and private keys. This approach eliminates the need to trust centralized exchanges, promoting a trustless environment.

Increased Liquidity: DAFI’s efficient order matching system helps improve liquidity across DEXes. Market makers benefit from increased trading opportunities and enhanced market depth, leading to a more vibrant and dynamic ecosystem.

System Components

Our system uses components which give users the experience that they deserve! Let’s have a look at these system components.

Price Discovery: Price discovery on the exchange involves the order matching process and determining market prices.

Order Matching on Exchange: The order matching engine on the DAFI Exchange matches buy and sell orders by efficiently analyzing order parameters, such as price and quantity, against existing orders in real-time. When a matching order at the desired price is found, a trade is executed, ensuring prompt fulfilment of user orders. This process utilizes optimized algorithms and high-performance servers to provide users with seamless and efficient trade execution.

Market Price Determination: In the absence of matching orders within the exchange’s primary market, the order is seamlessly directed to the platform’s internal market for further processing. This transition initiates the price discovery process within our proprietary market, where the determination of market prices is driven by the interaction of participant bids and asks. By leveraging our sophisticated market infrastructure, the system facilitates the convergence of supply and demand, allowing for efficient price discovery based on the dynamic interactions of market participants.

Self Custodial Accounts

We believe in empowering users with true financial sovereignty. With our innovative hybrid exchange, you retain full custody of your wallet throughout the trading process. No longer do you need to trust your funds with a centralized entity. Instead, you can confidently execute limit orders, manage your assets, and make informed investment decisions — all while maintaining control over your private keys.

Your private keys remain securely within your possession, ensuring that only you have access to your digital assets. DAFI employs state-of-the-art encryption algorithms, cutting edge technology of Account Abstraction, Social Recovery and advanced security measures to safeguard your assets against potential threats, providing you with peace of mind in the ever-evolving world of decentralized finance.

At the heart of it lies EIP-4337, a groundbreaking protocol that abstracts the complexities of account management. By leveraging EIP-4337, we enable users to seamlessly generate and control their accounts, ensuring complete custody of their private keys throughout the process. But DAFI doesn’t stop there. It takes self-custody to the next level with its robust social recovery mechanisms. Users have the ability to designate trusted individuals who can assist in the recovery of their accounts in the event of key loss or compromise. This innovative social recovery feature adds an extra layer of security and peace of mind, ensuring that users can regain access to their funds while maintaining full control over their private keys.

By combining EIP-4337 and social recovery, DAFI offers users an unparalleled level of control and security in managing their digital assets. Self-custody becomes more than just a concept — it becomes a tangible reality.

Trading made seamless

The order matching engine, residing on our server, manages the order book and facilitates accurate matching and execution. Here’s how it all works.

Order Book Management: The order matching engine maintains a centralized order book that stores active buy and sell orders placed by users. The order book is organized based on price and time priority to enable efficient matching.

Limit Order Matching: The Order Matching Engine on the DAFI Exchange centrally stores and manages all active buy and sell orders in a structured order book. This order book is organized using a combination of price and time priority, ensuring precise matching and execution of orders.

Price-Time Priority: The order matching engine on the DAFI Exchange strictly follows the principle of price-time priority. This means that orders with the most favourable price are given priority over others at the same price level. In case of multiple orders having the same price, the order that arrived first in the system is accorded higher priority for matching and execution. This adherence to price-time priority ensures a fair and systematic approach to order matching, promoting transparency and equitable treatment of users on the exchange.

Trade Execution and Order Updates: Upon identifying a match, the order matching engine promptly executes the trade by updating the account balances of the involved users and the order book. It accomplishes this by removing the executed portions of the orders from the order book and appropriately adjusting the remaining quantities. This meticulous process ensures the integrity of the order book is maintained, as it accurately reflects the available order quantities and avoids any discrepancies or inconsistencies.

In our quest to enhance the order matching process we introduce the concept of an escrow contract. Acting as a crucial intermediary, the escrow contract revolutionizes the coordination of order matching.

Our approach also safekeeps the users from signature DOS Attacks! What does it mean exactly? User signatures make a future commitment to withdraw funds from the account. At the time of execution, if the holder doesn’t hold the amount in wallet, in most systems it results in failed execution. An attacker can spam and execute signature DOS attacks on the order books.

How does our contract mitigate this? When placing the order, user’s funds are transferred in an escrow contract. This adds an additional layer of security and transparency to the order matching process. Users can trust that their funds are held securely within the contract until an order is matched. Users can always get their funds, free of cost, back by sending a cancellation signature.

Our design ensures that the protocol is protected from potential rug-pooling risks as well. The escrow contract operates based on a pre-committed logic, meaning that once the funds are deposited, they are committed for the purpose of order matching and cannot be transferred to any other destination within the protocol.

The complete package for trading

The Hybrid Exchange brings together different features that comprise a complete DeFi experience. These include:

  • Limit Orders

Our exchange harnesses the power of limit orders. Limit orders allow users to specify a maximum or minimum price for buying or selling an asset providing them with more flexibility in their trading strategies

This allows users to manage risk better by entering or exiting positions at desired price levels. This give us a number of benefits such as:

Our order matching systems aggregates liquidity from various platforms and facilitate users find the best prices for their trades with reduced slippage, as well as batching multiple transactions and saving gas fees for users. Our Hybrid Exchange also prevents MEV attacks by using a decentralized order book and off chain settlement, meaning trades are not visible to miners before execution which gives protection against MEV.

  • Swaps

In our Hybrid Exchange, users select the assets they wish to swap, input the desired amount, and review the estimated swap price and platform fees. The DEX charges one time fees on each swap. Upon confirming the transaction, users are given the best price available across platforms.

  • Stop Limit Orders

Stop limit orders automate trade execution based on predefined market conditions, facilitating risk management and protecting investments.

Users set a stop price and a limit price, triggering the order when the market reaches the stop price. The order is then executed at or better than the limit price, ensuring precise control and minimizing losses.

Our server efficiently manages user-submitted stop limit orders, seamlessly integrating with the price monitoring system. Once the trigger price is reached, the system automatically generates corresponding limit orders for swift and accurate trade execution.

Empowering Users Through Rewarding Connections

Referral programs incentivize users, empowering them. These programs are in the roadmap of our dApp, with percentage-based rewards being part of the current launch. In most referral programs users receive a unique referral code or link, which they can share with others. When a new user signs up using the referral code or link, they become connected to the referring user. Both parties will earn rewards based on the new user’s trading activity in 3 ways:

  1. Percentage-based Rewards

Users can enjoy benefits by onboarding more people. They will get a 20% share of the trading fee generated by their referees, fostering a mutually beneficial relation.

That is not the end of it, referees will receive an exclusive 10% trading fee discount, empowering you to maximize your profits in the first 10 days of joining.

  1. Tiered rewards

Supercharge your earning potential with our tiered rewards program. Referrers earn tiered rewards based on the number of successful referrals they bring in. As a referrer, the more successful referrals you bring in, the greater your rewards become. As the rewards keep growing with each new referral, so imagine the possibilities when you unleash your networking skills

  1. Trading volume-based rewards

Earn lucrative rewards based on the trading volume of your referees. As a referrer, you have the opportunity to earn a bonus when the cumulative trading volume of your referees reaches $1000 within a week. The more your referees trade, the more you’ll earn.

This is the future of DAFI, creating a new landmark in the history of DeFi. The DAFI Hybrid Exchange is set to launch in the next month — join the new era of trading where you have full power; and no limits.

--

--