Puzzle Limit Orders: 2.0

Puzzle Network
4 min readSep 22, 2022

--

Puzzle Swap is introducing Limit Orders 2.0. This is necessary to increase the number of users who swap big and assume a central role in Waves DeFi ecosystem, which has been the team’s ambition from the start.

A limit order is an order with a specified buy or sell price. To place a limit order, you must set a buy or sell price for the asset. The order is then posted to the order book and will be filled only if the market price reaches or exceeds the limit price.

Unlike market orders (which are already available on Puzzle Swap), where transactions are executed instantly at the current market price, limit orders allow you to control the selling or buying price of an asset. Limit orders are executed automatically, eliminating the need for users to monitor the market 24/7.

Limit orders on all trading exchanges are much more popular than instant trades among traders around the world. It is due to such popularity and user-friendliness of limit orders that we decided to add them to Puzzle Swap. This should positively affect the number of traders and daily trading volume.

In the Waves ecosystem, limit orders so far have been represented only in one product, Waves Exchange. However, they are not fully on-chain implemented, which makes them unusable in third-party dApps (such as Puzzle Aggregator or Neutrino Protocol).

Also another competitive advantage of Puzzle Swap limit orders is zero commission. You only pay the fee for Puzzle Swap 0% (0.005 WAVES for sending a transaction).

This release not only opens up new potential for Puzzle Swap usage, but also gives room for the creation of advanced DeFi Features on Waves.

New features for traders

So, how do Puzzle Swap limit orders work?

To place a limit order in the Puzzle Swap interface, you need to take a few simple steps. Click on the Limit tab at the top of the trading screen.

When creating a limit order, the user enters the token price at which they would like to buy or sell the token and the amount they are willing to spend. Let’s refer to the example below for a better illustration.

Bob wants to buy $PUZZLE tokens for XTN and expects that some users will be willing to sell them at the price of 1 XTN for 1 $PUZZLE. Bob enters the desired 1 XTN price in the “custom price” field and in the “I want to pay” field, he specifies that he is ready to spend 1000 XTN on this trade.

Thus, the interface informs Bob that when the limit order is 100% executed, he will receive 1000 $PUZZLE tokens. Simple, right? In the same manner, users can create limit orders to sell any tokens available on Puzzle Swap. If the limit order is partially completed, then Bob will receive the respective part of $PUZZLE, this will happen immediately after the execution.

The order can be executed partially and gradually as it is being filled by the aggregator. The efficiency of such transactions should increase, because before it was filled by arbitrage bot. The commission may be increased, and the order execution fee for Puzzle Swap will be 0% (the user only pays 0.005 WAVES for sending a transaction).

Impact on Waves

The introduction of limit orders on Puzzle Swap will not only revolutionize Puzzle itself, but it will also help the entire Waves ecosystem!

Thanks to this release, any third-party smart contract will be able to place an on-chain order in a couple of lines of code using Ride language.

Below you can see a piece of Ride code describing the creation of a limit order using dapp-to-dapp invocation:

let limitOrdersAddress = Address(base58'3PPrfNMnk8z8QhZcqMyJk69mF65s2Rbz3B6')

func getAssetBytes(assetIdStr: String) = {

if (assetIdStr == “WAVES”) then {unit} else {assetIdStr.fromBase58String()}

}

# user says “im selling 1 PUZZLE for 18 USDN”

# token0 = PUZZLE, token1 = USDN

# amount0 = 1 * 1e8, amount1 = 18 * 1e6

let asset0 = “HEB8Qaw9xrWpWs8tHsiATYGBWDBtP2S7kcPALrMu43AS” # PUZZLE ASSET ID

let asset0Bytes = getAssetBytes(asset0)

let amount0 = 100000000 # 1 PUZZLE

let asset1 = “DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p” # USDN ASSET ID

let amount1 = 18000000 # 18 USDN

strict txIdStr = match (invoke(limitOrdersAddress, “createOrder”, [asset1, amount1], [AttachedPayment(asset0Bytes, amount0)])) {

case x: String => x

case _ => throw(“something went wrong during the creation of order”)

}

Opening new horizons

On-chain limit orders significantly increase the efficiency of Puzzle Aggregator, including the aggregation of orders from Waves Exchange.

Puzzle Swap aims to take a central place in the Waves ecosystem and become a revolutionary product in the DeFi space. Smart aggregator, Mega Pools, Limit Orders — all of these combined with Puzzle Lend will make users enjoy the integrity and interoperability of the various products in the Puzzle ecosystem.

Don’t forget to subscribe to our Twitter and join the Telegram group to keep up with the latest news!

Puzzle Chat: t.me/puzzle_network

Puzzle Announcements: t.me/puzzlenetworknews

Puzzle Twitter: twitter.com/puzzle_network

--

--

Puzzle Network

DEX 2.0 built on Waves to support mega pools and bring a new light to DeFi experience 🧩🏆