Enoki Exchange is a fully asynchronous and scalable DEX built on the Internet Computer.
It uses "broker" smart contract canisters to take orders from users. The exchange routinely syncs with the brokers to execute limit orders and create a bid/ask curve that is used to execute swaps.
Swaps are executed directly by the brokers using liquidity from a liquidity pool and with prices obtained from the bid/ask curve. Part of the fee goes to the LP providers, and part goes to the market makers who set the limit orders.
The asynchronous nature of the DEX increases its complexity, but it also has some benefits:
- The DEX is infinitely scalable - just add another broker
- Funds from the LP are not traded at rates determined by a ratio of the funds, and therefore do not suffer from impermanent loss.
Users can lock liquidity into a liquidity pool that works very differently than AMM pools. Instead of relying on simple ratios, the smart contract instead trades along a bid-ask curve determined from the market makers' limit orders. This liquidity is spread evenly among the "broker" canisters, so a user can then swap tokens by interacting only with a single canister.
To allow the brokers to transfer swapped tokens to users, brokers are registered as "spenders" of liquidity pool funds. This way the funds can stay in the liquidity pool, but are immediately available for transfer by brokers. This also considerable increases the state-synchronisation complexity between the broker, exchange, and liquidity pool canisters, but it minimises the total amount of transactions and allows for the instant transfer of funds.
Because the liquidity pool (and the returns for liquidity providers) relies so heavily on bid-ask curves set by market makers, it is imperative to have good incentives for market makers.
Market makers whose orders are posted to the order book (can be ensured by using Maker or Post-only orders) already receive 0.03% in rebates when their order is matched. They also proportionally receive an extra ~0.01% of all swap trades that were traded at their bid/ask.
Additionally, Enoki plans to penalise bad market making (for example, not giving rebates for setting bids/asks that do not have a large enough bid-ask spread, as proven by either historic or future volatility) and use these funds to reward good market making.
- Move the order matcher and order history states to distributed big-maps to allow more scaling
- Keep a history of swaps
- The ability to change brokers easily
- Bulk transfer liquidity from LP worker to broker canisters to decentralise liquidity location among subnets
Last modified 11mo ago