How Anti-Sniper Starting-Fee Decay Works in Meteora Dynamic Bonding Curve

Meteora’s Dynamic Bonding Curve implements anti-sniper protection through an exponential decay algorithm that gradually reduces swap fees from a high starting basis point value to a minimum floor over a configurable time window.

The Meteora Dynamic Bonding Curve (DBC) protects new liquidity pools from front-running bots by charging elevated fees immediately after launch that decay to stable rates. In the CloddsBot codebase, this mechanism is orchestrated through TypeScript modules that calculate time-weighted fee reductions based on slot-based elapsed time.

Configuration Parameters in the Meteora DBC Skill

The anti-sniper parameters are defined in src/skills/bundled/meteora-dbc/index.ts when the DBC-based pool is queried. The skill constructs a MeteoraDlmmQuote request containing three critical fee-related settings:

  • startingFeeBps: The initial fee expressed in basis points (bps), applied immediately after pool creation to deter snipers.
  • minimumFeeBps: The floor fee that serves as the lower bound; the decaying fee never falls below this value.
  • feeDecayPeriod: The duration, measured in slots, over which the fee transitions from the starting value to the minimum.

These values are injected into the quote request at line 151 of the skill file, ensuring every price calculation accounts for the pool's maturity level.

The Exponential Decay Formula Implementation

The actual decay calculation resides in src/solana/meteora.ts, where the getMeteoraDlmmQuote function computes the effective fee based on elapsed blockchain slots. The implementation uses an exponential decay formula:

const elapsed = currentSlot - pool.creationSlot;
const decayFactor = Math.exp(-elapsed / feeDecayPeriod);
const feeBps = Math.max(
  minimumFeeBps,
  Math.round(startingFeeBps * decayFactor)
);

The logic operates through three steps:

  1. Elapsed Time Calculation: Subtracts the pool's creationSlot from the currentSlot to determine how many slots have passed since initialization.
  2. Decay Factor Computation: Applies Math.exp(-elapsed / feeDecayPeriod) to generate an exponential decay multiplier approaching zero as time progresses.
  3. Floor Enforcement: Uses Math.max to ensure the calculated fee respects the minimumFeeBps threshold, preventing fees from dropping below the configured floor even after extended decay periods.

Integration with Arbitrage Scanning

When the bot evaluates arbitrage opportunities, it invokes getMeteoraDlmmQuote from src/trading/venue-arbitrage-scanner.ts. The function automatically applies the anti-sniper decay logic, returning a sellQuote object where the feeBps property reflects the decay-adjusted rate:

const quote = await deps.getMeteoraDlmmQuote(ctx.connection, {
  mintA: baseMint,
  mintB: quoteMint,
  amount: baseAmount.toString(),
  // startingFeeBps, minimumFeeBps, and feeDecayPeriod 
  // are injected by the Meteora-DBC skill context
});

This integration ensures that arbitrage calculations account for the actual trading costs imposed by the anti-sniper mechanism, protecting profit calculations from fee surprises as pools mature.

Practical Code Examples

Fetching a Quote with Anti-Sniper Fee Decay

import { getMeteoraDlmmQuote } from '@/solana/meteora';

async function fetchQuote(
  conn: Connection,
  baseMint: string,
  quoteMint: string,
  amount: number
) {
  const quote = await getMeteoraDlmmQuote(conn, {
    mintA: baseMint,
    mintB: quoteMint,
    amount: amount.toString(),
    // Parameters injected by Meteora-DBC skill:
    // startingFeeBps, minimumFeeBps, feeDecayPeriod
  });
  
  console.log('Effective fee (bps):', quote.feeBps);
  console.log('Amount out:', quote.outAmount);
  return quote;
}

Manual Fee-Decay Calculation

For testing or simulation purposes, you can calculate the anti-sniper fee independently:

function calculateAntiSniperFee(
  startingFeeBps: number,
  minimumFeeBps: number,
  feeDecayPeriod: number,
  elapsedSlots: number
): number {
  const decay = Math.exp(-elapsedSlots / feeDecayPeriod);
  return Math.max(
    minimumFeeBps,
    Math.round(startingFeeBps * decay)
  );
}

// Example: 500 bps start, 30 bps minimum, decay over 10,000 slots
// After 2,000 slots:
const fee = calculateAntiSniperFee(500, 30, 10_000, 2_000);
console.log(`Current fee: ${fee} bps`); // Output: ~410 bps

Summary

  • The anti-sniper mechanism uses exponential decay to reduce fees from startingFeeBps to minimumFeeBps over a feeDecayPeriod measured in Solana slots.
  • Configuration resides in src/skills/bundled/meteora-dbc/index.ts, while the decay formula executes in src/solana/meteora.ts.
  • The getMeteoraDlmmQuote function automatically applies decay calculations, ensuring arbitrage scanners in src/trading/venue-arbitrage-scanner.ts receive accurate fee estimates.
  • Fees are protected by a hard floor via Math.max, guaranteeing they never drop below minimumFeeBps regardless of pool age.

Frequently Asked Questions

How is the elapsed time calculated for the fee decay?

The elapsed time is computed by subtracting the pool's creationSlot from the current blockchain slot, as captured in the meteora.ts wrapper. This slot-based approach ensures deterministic, on-chain verifiable timing rather than relying on wall-clock time.

What prevents the fee from dropping below the intended minimum?

The decay formula explicitly wraps the calculation in Math.max(minimumFeeBps, ...), ensuring that even as the exponential decay factor approaches zero, the fee cannot fall below the configured minimumFeeBps value defined in the DBC skill parameters.

Can the decay period be adjusted for different liquidity pools?

Yes, the feeDecayPeriod is a configurable parameter passed through the MeteoraDlmmQuote request in src/skills/bundled/meteora-dbc/index.ts. Different pools can specify distinct decay durations based on their specific anti-sniper requirements and expected trading patterns.

How does this mechanism protect against front-running bots?

By setting a high startingFeeBps immediately after pool creation, the mechanism imposes prohibitive costs on bots attempting to snipe initial liquidity. As the feeDecayPeriod progresses and legitimate trading stabilizes, the fee decays to minimumFeeBps, allowing normal market participation while the pool matures.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →