Skip to main content


Pool / LP Token

Unlike AMM liquidity pools using constant product to price pairs of assets, the Tonic pool is comprised of a basket of assets. It will include NEAR and USDT at launch, with ETH coming soon after.

Liquidity providers can mint the LP token with any asset in the pool, which are converted at oracle price (see below). The price of the LP token is determined by the sum of the value of all the tokens in the pool plus unrealized profits and losses from all open positions.

The contract has a parameter set per asset to cap withdrawals to a configurable percentage of pool assets per specified time period.

  • Deposits: Funds are deposited into the Vault through the minting of GLP tokens. e.g. if the price of GLP is $1.50, a user can mint 1 GLP by depositing 1.50 USDC tokens.
  • Withdrawals: Funds can be withdrawn from the vault through the burning of GLP tokens. e.g. if the price of GLP is $1.50, a user can burn 1 GLP to redeem 1.50 USDC tokens.

Price Feed

The price feed is updated with a feed based on the median prices of multiple exchanges. Each asset has a configurable parameter for maximum price change per price feed update. A spread may optionally be supplied to charge users above/below mid-market for buying/selling respectively.

Spot Trading

The contract supports swapping between any two assets in the pool (and the LP token) at oracle price, with an optional spread. If dynamic fees are enabled, users swapping from an asset that is currently underweight to one that is overweight in the pool will pay above the base fee, while users doing the opposite will pay less.

Margin Trading


Users can open a long position using the vault. e.g. to open a long, a user can deposit 1 ETH into the vault and open a position of $25,000, if the price of ETH at the time of opening the position is $5000, then this would be a 5x long position. If the price of ETH increases by 10%, the user would make a profit of $25,000 * 10% = $2500. A snapshot of the collateral is taken when the position is opened, so in this example, the collateral would be recorded as $5000 and will not change even if the price of ETH changes. To ensure the vault has sufficient funds to pay out any profits, an amount of ETH equivalent to the position’s size is marked as reserved, for this position, 5 ETH in the vault would be reserved.


Users can open a short position using the vault. e.g. to open a short, a user can deposit 5000 USDC into the vault and open a position of $25,000. Stablecoins are required as collateral for shorts and similar to longs, an amount of stablecoins equivalent to the size of the position would be reserved to pay out any profits.


A position can be liquidated by keepers if the losses of the position reduces the collateral to the point where position size / remaining collateral is more than the max allowed leverage.

Fee Structure

There are 3 types of fees.

  • Margin Fee/Position Fee: 0.1% of the total position size when increasing or decreasing an order. This is taken out of the collateral when increasing a position. When decreasing a position, this is taken out of the profit or the collateral if the trade is at a loss.
  • Swap Fee: Called when a user is swapping directly or if the user provides collateral in a different token than what is required for opening a position. This is dynamic based on asset weight in the pool. If a swap adds more to an asset that is currently underweight, it will be cheaper. If a swap adds more to an asset that is overweight, it will be more expensive.
  • Funding Fee: This is the interest paid to borrow assets needed for a position. Unlike traditional perps, this rate is based on the asset utilization in the pool. The interest charged is base_rate * utilization rate. This is charged hourly. See below for a detailed description

Funding Rates

“Funding rate” might be better understood as the margin fee rate. The margin fee is paid from traders to LPs. Consider the following scenario:

  • At time A, user opens a position
  • At time B 4 hours later, the user closes the position. In the hours that passed, the hourly funding rates were as follows (in BPS)
    • hour 1: 11
    • hour 2: 12
    • hour 3: 13
    • hour 4: 14

That is, the user incurs fees of 11 bps in the first hour, 12 bps in the second hour, etc, summing to 50 bps total by the time the position is closed.

To achieve this result without iterating over all positions each time funding rates are updated, Tonic uses a mechanism based on “cumulative funding rate”. A per-asset global counter called the cumulative funding rate records the sum of hourly funding rates since contract initialization. When opening a position, a snapshot is saved to the position. On decreasing/closing the position, the difference between the current cumulative funding rate and saved rate are multiplied by the decrease amount to calculate the margin fee for the borrowing period.

In the above example, suppose the cumulative funding rate at time A were 1000000 (bps), referred to as the “entry (cumulative) funding rate”. Then at time B, the new cumulative funding rate would be 1000000 + 11 + 12 + 13 + 14 = 1000050. Subtracting the entry (cumulative) funding rate from that at time B, we get 1000050 - 1000000 = 50 as desired.


Profits/losses from trades go directly to LP holders: gains are added to the pool and losses are paid out of the pool. Platform fees are accounted for separately, and are used to pay users who stake their LP tokens.

100% of fees are swapped to NEAR and then used as rewards for staking Tonic LP tokens into the farming contract. This percentage may be reduced in the future if Tonic releases its own token.