Introducing Limit Orders on Ubeswap!

Zakariya Ahmed
Ubeswap
Published in
5 min readMar 15, 2022

Buy or sell at pre-specified prices on Ubeswap with Limit Orders!

Push it to the Limit!

Ubeswap is the primary DeFi exchange on Celo, with the highest volumes and greatest number of users. But until now, the liquidity tech stack has been built to accommodate retail users, without being able to service the needs of larger liquidity providers or institutions. In an effort to drive additional liquidity and innovation on Celo, Ubeswap is excited to announce the launch of on-chain limit orders! This feature makes Ubeswap even more competitive compared to all other exchanges by allowing users to place any size trade on Ubeswap with no slippage and near-zero fees.

Importantly, the new limit order protocol is the most efficient way to cash-in to DeFi on Celo, by allowing the swapping of any amount of stablecoins at parity.

Rewards and Incentives

  1. Beyond the introduction of new limit order functionality to Celo, Ubeswap participants and $UBE token holders will benefit as well. Every limit order placed is charged an order fee of 1bps ($1 per $10,000 trade). This fee is sent directly back to $UBE holders via the community-controlled Treasury (here)!
  2. The Ubeswap community will also seek to incentivize limit order activity by offsetting the order fees for some tokens. Based on the tokens being traded users could soon earn $UBE or $CELO just for placing orders and providing liquidity!

Placing a Limit Order

Ubeswap’s UI makes placing Limit Orders easy. Here’s a quick example on how to place an order:

  1. Head to app.ubeswap.org, connect your Metamask wallet, and hit the “Limit Order” navigation tab
  2. On this page you will be able to create limit orders. For this example, the user is placing an order for buying 1 CELO token at the limit price of 2.5 mcUSD.

3. Next the user may be asked to Approve mcUSD to be used in this transaction. Once that is done, press Place Order to open the order. Note the user will be charged an Order Fee to place the order, but this is the only fee (aside from regular Celo blockchain gas fees) required to utilize limit orders ! There are no maker or taker fees during fulfillment!

4. Once the order is placed, the UI will show the order as Open. The Open tab will allow usersto track all open orders as well as how much of the order remains left to be fulfilled.

At this point, anyone using the Celo network can directly fill the user’s order! The OrderBook smart contract will publicly broadcast the order to the network, allowing humans, arbitrage bots, or even other protocols to view and fill open orders!

5. Once the order is filled it will be moved to the Completed tab. Any orders the user decides to cancel will also appear here.

Under the Hood

Ubeswap limit orders are a modified fork of 1inch. The major changes include:

(1) Flash fulfillment ability by liquidity sources

(2) A public order book.

So, what is happening when you place a limit order on Ubeswap?

Secure Orders
When an order is placed from the UI, the user must sign the order with their Metamask wallet to authorize execution of the order by the LimitOrder smart contract, ensuring limit orders cannot be forged. This transaction generates an order and a signature used to fill the order.

Publicly Available
The order and signature are broadcast to the public UbeswapOrderBook smart contract. This smart contract then logs the order and signature on-chain. UbeswapOrderBook charges 1bps on the maker to have the order publicly available. On-chain data is public, and liquidity sources are welcome to inspect the order list and see which ones they want to fill. Note that the swap market doesn’t automatically route trades through this limit order list, it only routes through the v2 pools.

Flash Fulfillment Capabilities
During execution, the Limit Order smart contract first executes the transfer of funds from the maker to the taker. The taker can then use maker funds to buy the taker token on Ubeswap, Sushiswap, or Mobius to fulfill the order.

By allowing funds to transfer to the taker first, the taker does not actually need any amount of taker token in their wallet when executing the limit order to fulfill it! Similar to the concept of AAVE Flash Loans, Ubeswap Limit Orders allow you to execute all these steps within one transaction! Think of the transaction as 3 steps:

  1. Transfer funds from wallet making the order (maker) to wallet fulfilling the order (taker)
  2. The taker passes an optional argument of bytes to the Limit Order contract based on the taker’s trading strategy. This will most often be a call to another smart contract or protocol to help fulfill the order, such as selling maker tokens on an exchange to receive taker tokens.
  3. Transfer funds from wallet fulfilling the order (taker) to the wallet making the order (maker)

If you’re interested in diving deeper, the LimitOrderProtocol fillOrderToWithExtraInteraction method is what enables flash fulfillment!

Limitless Potential

The Ubeswap community is passionate about unlocking financial tools and access for the millions of Celo users and those looking for alternatives to traditional finance. The community is excited to release limit orders, which will enable high volume trading, reward $UBE holders, and enable new financial tools for use on Celo!

What are you waiting for? Start trading, hedging, and arbitraging with limit orders right now!

Ubeswap Twitter | Ubeswap Telegram | Ubeswap Discord | Ubeswap Website

Disclaimer: DeFi is a new technology that comes with risk of loss. Statements may be forward-looking and are not intended as guarantees of future performance.

--

--

Zakariya Ahmed
Ubeswap
Writer for

Talking to myself because I am my own consultant.