reflect-bothAMM

Tapir uses a Uniswap V3-style concentrated liquidity AMM to facilitate trading between DP and YB tokens. The AMM is the primary venue where users buy protection (DP) or express a yield-seeking view (YB) against the base asset.


Overview

Every Tapir pool deploys a DP/YB trading pair on a Uniswap V3 pool. Users don't interact with the AMM directly — instead, the Tapir Router orchestrates multi-step flows that combine splitting, swapping, and unsplitting into single transactions.

                    ┌─────────────┐
  Base Asset ──▶    │ TapirRouter │ ──▶ DP or YB tokens
                    └──────┬──────┘

              ┌────────────┼────────────┐
              ▼            ▼            ▼
         DepegPool    Uniswap V3   DepegPool
         (split)      (DP/YB       (unsplit)
                       swap)

Trading flows

The router supports four primary trading flows. Each one abstracts away the split/swap mechanics so you can buy or sell DP and YB using only the base asset.

Buy DP with base asset

You want depeg protection. The router:

  1. Splits your base asset into equal DP and YB (deterministic, no slippage).

  2. Swaps the YB portion for additional DP on the Uniswap V3 pool.

  3. Returns the combined DP to your wallet.

Router function: splitAndBuy(buyingYb = false)

Buy YB with base asset

You want yield exposure. The router:

  1. Splits your base asset into equal DP and YB.

  2. Swaps the DP portion for additional YB on the Uniswap V3 pool.

  3. Returns the combined YB to your wallet.

Router function: splitAndBuy(buyingYb = true)

Sell DP for base asset

You want to exit your DP position. The router:

  1. Takes your DP tokens.

  2. Swaps a portion into YB to balance the amounts.

  3. Unsplits the equal DP + YB pair back into base asset.

  4. Returns the base asset to your wallet.

Router function: sellAndUnsplit(sellingYb = false)

Sell YB for base asset

You want to exit your YB position. The router:

  1. Takes your YB tokens.

  2. Swaps a portion into DP to balance the amounts.

  3. Unsplits the equal DP + YB pair back into base asset.

  4. Returns the base asset to your wallet.

Router function: sellAndUnsplit(sellingYb = true)

Swap DP to YB (or vice versa)

For users who already hold DP or YB and want to switch sides, the router provides a direct swap through the Uniswap V3 pool without splitting or unsplitting.

Router function: swapExactIn


Slippage protection

Because trading flows combine a deterministic split with a market swap, slippage only applies to the swap portion. The router enforces two levels of protection:

Parameter
Scope
Purpose

uniV3MinOut

Swap level

Minimum output from the Uniswap V3 swap.

minOut

Flow level

Minimum total output from the entire operation.

For splitAndBuy, 50% of the output comes from the deterministic split (no slippage) and 50% comes from the swap. To achieve your desired total slippage tolerance, the swap portion uses 2x your setting:

Your setting
Split portion
Swap portion
Effective total

0.5%

0% slippage

1.0% slippage

0.5% total

1.0%

0% slippage

2.0% slippage

1.0% total

A transaction deadline (default: 20 minutes) ensures your transaction reverts if not executed in time.


Implied APY

The Tapir UI displays an implied APY for each trade, showing the effective yield based on the exchange rate between the base asset and the DP or YB token.

Implied APY=Base Token APY×Output tokensInput base\text{Implied APY} = \text{Base Token APY} \times \frac{\text{Output tokens}}{\text{Input base}}Implied APY=Base Token APY×Input baseOutput tokens​

Example: Buying DP

DP trades at a premium (you get fewer tokens), so the implied APY is lower than the base — you pay for protection.

Example: Buying YB

YB trades at a discount (you get more tokens), so the implied APY is higher than the base — you earn more for taking risk.


Theta decay

As a Tapir pool approaches maturity, DP and YB prices naturally converge toward 1:1 (parity). This behavior is called theta decay — analogous to how options premiums erode as expiry approaches.

Why does this happen?

As the remaining time decreases, the probability of a depeg event occurring in the remaining window shrinks. With less time for a depeg to materialize, the protection premium embedded in DP's price gradually disappears, and YB's discount narrows.

At maturity, if no depeg has occurred, both tokens redeem at 100% — so the market naturally prices them closer to parity as the deadline nears.

The decay formula

Tapir models theta decay with a square-root function:

Where:

  • T = total pool duration (start to maturity).

  • t = time elapsed since pool start.

  • d(t) = the decay factor, ranging from 1.0 (at pool start) to a floor of 0.05 (near maturity).

The square-root curve means decay is gradual early on and accelerates as the pool approaches its end — matching the intuition that the final days before expiry see the sharpest premium compression.

Impact on liquidity providers

Theta decay affects LP positions because the trading range narrows over time. Manual LPs can improve capital efficiency by adjusting their price range to match the convergence:

  • Suggested new bounds are calculated by multiplying the original range width by the ratio of the current decay factor to the decay factor at last adjustment.

  • A delta (Δ) value indicates how much the optimal range has shifted since the last adjustment. Higher Δ means more benefit from repositioning.

Automated LP vaults handle this rebalancing automatically.


Liquidity provision

Tapir's liquidity model follows Uniswap V3's concentrated liquidity design — LPs choose a price range and deposit DP and YB tokens within that range.

Two management modes

Mode
Description

Manual

You set your own price range, deposit amounts, and manage rebalancing yourself. No management fees. You can perform theta decay adjustments to improve capital efficiency as the pool matures.

Automated

Deposit into an auto-managed vault that handles rebalancing, fee compounding, and range adjustments. A management fee (for example, 10% of earned fees) applies.

Manual LP flow

  1. Select the DP/YB token pair.

  2. Choose a fee tier (for example, 0.05%, 0.30%, or 1.00%).

  3. Set your price range (min and max DP/YB ratio).

  4. Enter your deposit amounts (the ratio is determined by the range and current price).

  5. Confirm the transaction.

Automated LP flow

  1. Select a strategy and vault.

  2. Enter your DP and YB deposit amounts.

  3. Deposit to the vault — the manager handles everything from there.

Automated vaults are currently managed by Gamma Strategiesarrow-up-right, which provides auto-rebalancing and fee compounding for Uniswap V3 positions.

Position management

Existing positions display:

  • Price range — your min and max bounds with in-range/ out-of-range status.

  • Liquidity value — the USD value of your DP + YB in the position.

  • Unclaimed fees — trading fees earned that you can collect.

  • Theta adjustment (manual only) — a prompt to narrow your range as the pool approaches maturity, with suggested new bounds.

Actions available:

  • Collect fees — claim earned trading fees.

  • Increase liquidity — add more DP/YB to your position.

  • Remove liquidity — withdraw some or all of your position.

  • Adjust position (manual only) — rebalance your price range to account for theta decay.


Summary

Feature
Details

AMM type

Uniswap V3 concentrated liquidity

Trading pair

DP / YB

Router

TapirRouter (stateless, wraps split + swap)

Slippage

Dual-layer: swap-level + flow-level protection

Theta decay

Square-root time decay, prices converge to 1:1

LP modes

Manual (full control) or Automated (vault-managed)

Fee tiers

Configurable per pool (0.05%, 0.30%, 1.00%)

Last updated