Tonic : The Completely Open-Source Orderbook DEX on NEAR

Tonic : The Completely Open-Source Orderbook DEX on NEAR


Context: Derivatives trading has surged by over 358% since 2020, with perpetual futures trading accounting for more than half of it. Similarly, orderbook-based decentralised exchanges (DEXs) saw a 3,700% growth in trading volume since January 2020. (Proximity, Coindesk). This coincides with an increasing shift of DEXs from Automatic Market Maker (AMM) models to more performant order book-based models.

Tonic is a fully open-source and on-chain orderbook DEX on NEAR, aiming to provide the speed and convenience of traditional exchanges without intermediaries or centralised authorities. NEAR ensures the DEX has high throughput, low fees, and robust security through its Nightshade sharding, which guarantees infinite scalability and near-instant finality time for transactions.


  • Tonic is an open-source, decentralised exchange (DEX) built on NEAR’s PoS blockchain. The DEX leverages NEAR’s Nightshade technology to run an on-chain orderbook without sacrificing performance or composability
  • Tonic’s evolving suite of products include a spot orderbook and perpetual futures; it also has a referral portal (allowing users to net up to 20% in trade fees) and a fully open-source SDK for developers
  • Committed to fostering the DeFi community on NEAR, Tonic has teamed up with Proximity and partner projects to launch a $10M fund for decentralised orderbook solutions on NEAR
  • Tonic is offering zero-fee perps trading for the next $10 million in eligible trading volume!

Tonic: Twitter, DEX, Perps, Goblin NFT Collection

Bringing DeFi A Step Closer to True Decentralisation

On-chain and permissionless, Tonic brings DeFi one step closer to true decentralisation; the DEX offers users complete control, deep liquidity, and a battle-tested price discovery mechanism via their orderbook model—all while remaining fully open-source.

‘As the only fully open-source orderbook and perps exchange on NEAR, we wanted to set the standard for transparency and composability.’
— Lix, team Tonic

Tonic also allows for cross-shard and cross-chain composability, making it a foundational unit for developers wanting to build using its source code or integrate the platform into their dApp.

By merging these properties, Tonic has built a robust DEX that promotes user trust and lays the foundation for a more sustainable DeFi ecosystem on NEAR, as developers interact with its products to build more layered, efficient, and interoperable DeFi products.

NEAR: The Ultimate Layer-1 DeFi Protocol

NEAR’s sharded blockchain does not have a beacon chain; its shards have single or multiple smart contracts that can be efficiently optimized for specific use cases, all running on a shared Layer 1. For DeFi this means:

  1. Actual dynamic and infinite scalability.
  2. No bridged or fragmented liquidity.
  3. The development of specific execution environments, AKA private shards, deployed for a particular purpose (for instance, orderbooks).

Tonic has a private shard, equivalent to having a dedicated standalone chain with the added advantage of cross-shard composability. This translates to more market and capital efficient concentrated liquidity (instead of it being fragmented / bridged / third-party), speed, and a more streamlined user and developer experience.

The Tonic product suite

Tonic offers a suite of trading products allowing users to trade any native NEP-141 asset on NEAR via its spot orderbook or perpetual futures contract.

1. Spot Orderbook

The Tonic spot orderbook is fully on-chain, and the goal is for users to provide liquidity. The orderbook model is a better fit as it is more capital efficient than AMMs and gives users better price discovery and control over their trades. To execute a spot trade:

  • Connect your wallet
  • Select between Simple or Advanced mode at the click of a button (in Advanced mode, assets are paired)
  • Decide on the order amount, regulate slippage, and place order
  • Tradable assets include: NEAR, AURORA, USDC.e, PEM, NearX, PARAS, and STNEAR

Simple mode

Simple mode offers a streamlined interface, allowing users to place swap orders between assets directly.

Advanced mode

Advanced mode contains a more detailed dashboard, it displays the market chart, recent trades, and the orderbook; this mode gives users more control over their trade direction (buy or sell) and order type (limit or market).

Incentives page

Meanwhile, Tonic also hosts an Incentives page on its Spot dashboard, which displays ongoing and past incentives to take advantage of as you trade.

2. Perpetual Futures

Perpetuals trading recently launched on Tonic mainnet and the platform allows users to trade against holders of $GIN, the liquidity pool (LP) token on Tonic.

Below is an overview of how the Tonic GIN Pool works:

  • Liquidity providers (LPs) deposit assets (NEAR, ETH, USDT) into the pool to mint $GIN
  • The assets are converted at oracle price, which is determined by the sum of the value of all tokens in the pool plus the unrealised profit and loss from all open positions
  • Users will soon be able to stake their $GIN tokens to earn passive yield
  • Assets can be withdrawn by burning the $GIN token to redeem the asset.

‘Our goal is to provide a product that allows users to stake and earn real yield passively, not yield dependent on inflationary token emissions.’
— Lix, team Tonic

To initiate a perpetuals trade on Tonic, users can do the following:

  • Select a market (NEAR or ETH)
  • Choose a position (long or short)
  • Choose which asset to use as collateral and the position size (NEAR, ETH, USDT)
  • Leverage collateral (2x, 5x, 10x)
  • Submit a desired position

SDK for developers

Tonic enables developers to interact with JavaScript SDK to build apps such as trading bots, swap dashboards, exchange frontends, or even a Rust SDK to integrate on-chain calls to Tonic directly.

‘With our available documentation, any project in the NEAR ecosystem can integrate Tonic functionalities into their own project. Whether it’s something straightforward like powering swaps or building more complex DeFi products on top of our primitives, we’ve made everything is available to developers.’
— Lix, team Tonic

To get started, you can visit Tonic’s API Reference documentation.

Powering the Next Wave of Orderbook DEXs on NEAR

Tonic is extremely engaged in growing the DeFi community on the NEAR ecosystem. The project has teamed up with Orderly Network, a permissionless modular protocol with an off-chain central limit orderbook (CLOB); Spin Finance, the first orderbook DEX on NEAR; and Proximity Labs, to launch a $10M Fund for Decentralised Orderbook Solutions on NEAR. The fund will be deployed as grants and/or investments to DeFi projects that use the orderbook primitives of Tonic, Spin, and Orderly.

Referral Portal

The referral program is one of the features on Tonic that encourages builders to develop frontends on top of the platform. Users can bring others and get rebates, allowing the referrer to net 20% of trade fees to their exchange balance.

The Tonic Goblin NFT collection

To engage their community and reward active members, the Tonic team launched the Goblin NFT collection last year. Available on Tradeport, the NFTs unlock special perks for owners:

  • Advantages of Tonic DEX Events
  • Whitelist from our partner companies
  • Exclusive access to Tonic DEX Physical Event
  • NFT Holder Role on Discord and Private Chat Channel
  • Automatic membership to Goblin DAO

Builders at Heart

Tonic manages to effortlessly provide both experienced and casual traders with a complete and seamless DeFi experience. The current bear market has been a welcome and distraction-free time for the team to focus on polishing their products while the market picks up.

‘With the major scare around what’s happened with centralised entities, many users are now looking to migrate to DEXs — we aim to ease the transition to the DeFi world as much as possible.’
— Lix, team Tonic

Looking at Tonic’s extensive product suite, it’s clear the project has been successful in this endeavour. Be sure to check them out!

Written by Beet
Edited by @achildhoodhero

About NEAR Protocol

NEAR is a dynamically sharded Proof-of-Stake, carbon-neutral blockchain built for usability and scalability. NEAR combines the power of both PoS and sharding in a technology called Nightshade, making the chain infinitely scalable without compromising security and decentralization.


NEARWEEK is one of the first decentralised news sources within the NEAR ecosystem. Via the production of high-quality content, news, and promotional support, NEARWEEK unleashes the full potential of its media outlets to act as the social epicentre of the NEAR ecosystem.
Website | Twitter | Newsletter

Tonic : The Completely Open-Source Orderbook DEX on NEAR was originally published in NEAR Protocol on Medium, where people are continuing the conversation by highlighting and responding to this story.