New Features on THORChain: Limit Orders & Memoless Transactions
Two major new features have been activated on THORChain - Limit Orders and Memoless Transactions
Advanced Swap Queue
Limit Orders were activated with THORChain's new Advanced Swap Queue, which contains several enhancements over the old Swap Queue Manager.
THORChain's limit orders aren't a traditional order book that matches makers with takers. Limit orders interact cleanly with THORChain's Automatic Market Maker (AMM) and xy=k curve pricing.
THORChain's Limit Order Model
Liquidity for limit orders are stored outside of the pools as Trade Assets or Secured Assets (corresponding 1:1 with native assets in the vaults). When a user submits a limit order, they send some amount of tokens and define what their trade target is.
For example, a user has 1 BTC and wants to place a limit order to sell for 150,000 ETH.USDC. If the current price is $100,000 BTC/USDC, of course the limit will not execute - the BTC sits idle outside of the pool. If the price change between the two assets changes so that the swap can complete for at least 150,000 USDC, the BTC is automatically swapped through the AMM and the user receives their funds.
Limit Orders are inclusive of fees. Meaning that the limit is defined by the amount of coins that the user receives from the trade, not the price ratios between the two. It takes into account the outbound fees that the chain needs to send the user their funds and won't execute the limit order if the received amount is less than the target.
Limit orders can be placed between any two assets supported by THORChain. A traditional orderbook only has liquidity for assets that have explicit liquidity for that pair, meaning you need active market makers to provide liquidity throughout a lot of markets. Usually this means that only BTC, ETH, and Stablecoin pairs have significant liquidity. Because of the hybrid limit order AMM model, limits can be placed against any two assets - eg BTC/USDT, LTC/DOGE, or even XRP/TCY. Your swap will always execute if your swap can be filled for greater than your limit.
Limit orders can be placed with any asset type: Native, Secured, or Trade assets. This means that arbitrageurs can use limit orders to more efficiently position liquidity to arb the pools, or retail users can use it directly with their native assets.
Additional Limit Order Features
Modifying Limit Orders: Limit orders can be modified by using a special memo to modify the trade target
Custom Time-to-Live (TTL): Limit orders have a default maximum TTL of 3 days (43,200 blocks), however this can be changed to be shorter duration if requested by the user when placing or modifying a limit order
Streaming By Default
The new Advanced Swap Queue has Streaming Swaps enabled by default - meaning users no longer need to explicitly define their intent to do a streaming swap. The advanced swap queue will automatically calculate the optimal streaming parameters.
To disable streaming, explicitly set /1/1 as the streaming parameters in the swap memo.
Upcoming: Rapid Swaps
Rapid Swaps are a major feature of the Advanced Swap Queue, which is not yet activated. This allows multiple sub-swaps of a streaming swap to take place within the same block. This will allow large streaming swaps to complete much more quickly or even instantly, while retaining the same great price execution of streaming.
Using the Advanced Swap Queue
Integrators should read the Advanced Swap Queue Developer Docs to understand how to construct a limit order swap. A quote endpoint exclusive to limit orders will be delivered in THORNode v3.13.
Memoless Transactions
Memoless Transactions are a long awaited feature to allow intents (swap, add liquidity, etc) to be pre-registered onchain, so that the native assets themselves don't need to include a memo, or can use a shortened memo.
How Memoless Deposits Work
Any THORChain address can now pre-register a user's memo along with the asset they intend to deposit. When they register, they get a Reference ID which is a string of 5 numbers like 12345. The reference ID can be used in two ways:
1) Use the Reference ID in the memo eg REF:12345 instead of using a long memo that might be too long for the space provided, such as the 80 byte limit in a Bitcoin OP_RETURN
2) Use the last significant digits in the actual send amount to encode the Reference ID. Eg, Sending exactly 9.99912345 BTC to THORChain.
What Memoless Transactions Accomplish
Not every wallet supports THORChain-powered swaps, or memos. Memoless transactions allow interfaces to allow swaps without a wallet connection. When an interface registers a memoless transaction for a user, they can just send an amount with their encoded reference ID from their wallet to a THORChain vault. This means that you can swap from any asset in any wallet, regardless of whether they support swaps or not.
Once you have a reference ID, an interface can easily generate a QR code with the THORChain inbound address and instruct the user how much of the asset to send
Memoless Limitations
- The user has to send EXACTLY the amount the interface tells them to, because it's important that THORChain can correlate their inbound with their Reference ID.
- There is a maximum number of uses per reference ID. Currently it's set to each reference ID can only be used once
- There is a Reference ID TTL of 6 hours - meaning the Reference ID will expire after 6 hours. Users should ensure they're not sending transactions with low gas that might get stuck and be received after the reference ID expires.
- Only gas assets are available for now - no ERC-20 assets. They will be available after RouterV6 is implemented.
- Pay attention to the "decimals" of the chain you are depositing on. Chains above 8 decimal places like ETH are truncated to 8 digits - anything after the 8 digits are ignored. Conversely, chains below 8 digits (like GAIA which uses 6 digits natively) must use the Reference ID in their last significant digits - eg
x.x12345
Registering Memoless Transactions
FamiliarCow developed a whitelabel backend API for interfaces registering Memoless Transactions for users, checking amounts in preflight, and generating QR codes. Access it on GitHub - contributions are welcome.
Where to get more information about THORChain?
- Twitter Spaces — subscribe on RSS or wherever you get your podcasts
- THORChain Community — educational content, regularposts, & discord server
- THORChain Community Updates — monthly update articles
- GrassRoots Crypto — update videos
Community
To keep up to date, please monitor community channels, particularly Telegram and X:
Website | Documentation | X | Telegram Community | Telegram Alerts | Community Discord | Developer Discord | Explorer | RuneScan | Reddit | Gitlab | Medium | Linktree | Thorcharts | RUNE Tools