Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(native-launch): decay the native lane's trading fee from 50% to tax snipers
nirholas406d95833fce
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1bbd9a313..8b088a238 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -17,6 +17,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **MCP clients can now prepare a pump.fun launch for you to sign**: The hosted MCP server gained pumpfun_prepare_launch: an assistant (Claude Desktop, Cursor, or any MCP client) that has agreed a coin name, ticker, description and image with you can call this tool to validate every field the same way the /launch page does, fetch and type/size-check the image through the SSRF-hardened fetcher, and hand back a pre-filled /launch URL plus a plain-English summary. The tool never signs or launches anything; it is marked read-only and non-destructive, and its response always carries requires_human_signature: true. Opening the returned link on /launch now shows a 'prepared from your assistant' banner so you know exactly which fields came from the conversation before you review and sign. (`/launch`) `[feature]`- **Robinhood Chain feed worker now runs the published SDK, not a stale local snapshot**: workers/robinhood-feed depended on robinhood/robinhood-chain-sdk through a file: link, a reference copy that drifts from the standalone robinhood-chain-sdk repo it mirrors. The worker now installs hoodchain from npm like any other dependency, so it always runs the released SDK. Also fixed: seven pointer READMEs staged for duplicate or superseded standalone repos (three-ui, crypto-market-data, crypto-market-data-ts, crypto-data-aggregator, memescope-monday-directory, and one of each duplicate Robinhood Chain repo pair), ready for the owner to push and archive. `[fix, infra]`- **Standalone GitHub mirrors now stage instead of force-pushing**: scripts/sync-standalone-repos.mjs force-pushed straight to main on every run, which could silently create duplicate repos for the eleven mirrors already renamed on GitHub and bypassed the owner's push-approval rule. data/standalone-mirrors.json is now the single source of truth for which monorepo directory maps to which public repo, read by every exporter (sync, growth satellites, the awesome list, the skill-repo builder) instead of each keeping its own list. The sync script only stages a snapshot under dist/standalone-mirrors/, fixes any stale pre-Apache-2.0 README or LICENSE footer, and prints the push command for the owner; npm run sync:repos:check compares what is staged against each mirror's live tree and reports drift without writing anything. (`/docs/contributing`) `[infra, docs]`+- **The native $THREE launchpad now taxes snipers, not just steady trading**: Every pool on the native launchpad lane used to open at the same flat 1% trading fee a coin keeps forever, which is exactly what a sniper bot wants: the same price whether it buys in the pool's first block or an hour later. New pools now open at a 50% fee that decays exponentially down to the normal 1% over the first 100 slots (about 40 seconds), so a bot buying in the first block pays close to half its $THREE in fees while an organic buyer a minute later pays the standard rate. The coin creator's own bundled first buy stays exempt, since that is the creator funding their own launch, not a snipe. The schedule runs entirely on Meteora's own Dynamic Bonding Curve fee scheduler, no new contract. (`/docs/native-launchpad`) `[feature, security]`- **three.ws Avatar MCP clamps unbounded tool arguments before they reach generated HTML**: render_avatar's name and camera-orbit arguments flowed into the generated <model-viewer> HTML with no length bound, unlike the model URL, which already rejected oversized or unsafe values. Both are now clamped the same way, closing the one argument path that could still balloon a rendered page or chat payload. `[fix, security, sdk]`## 2026-10-13diff --git a/api/_lib/native-launch/config.js b/api/_lib/native-launch/config.jsindex 247a2211a..3c31ea65f 100644--- a/api/_lib/native-launch/config.js+++ b/api/_lib/native-launch/config.js@@ -18,8 +18,11 @@// $THREE price on 2026-09-20. The thresholds are fixed in the on-chain// config, so re-sizing them later means creating a new config and// re-pinning the env key; coins already launched keep the curve they had.-// - 1% trading fee in $THREE, split 50/50 creator / three.ws, plus Meteora's-// volatility-scaled dynamic fee on top during spikes+// - 1% steady-state trading fee in $THREE, split 50/50 creator / three.ws, plus+// Meteora's volatility-scaled dynamic fee on top during spikes. A new pool opens+// at a 50% anti-snipe fee that decays to that 1% over the first 100 slots+// (~40s), so a bot buying in the pool's first blocks pays far more than someone+// buying a minute later; the creator's own first buy is exempt.// - graduates to DAMM v2 with 100% of LP permanently locked (50 creator /// 50 platform): the pool can never be pulled, both sides earn LP fees// forever@@ -57,6 +60,18 @@ export const NATIVE_LANE = {migrationFeePercent: 1,creatorMigrationFeePercent: 50,lpLockedPercent: 100,+ // Anti-snipe decaying fee: the owner's EVM `anti-snipe-ramp` hook opens a pool at a+ // punitive fee that decays to normal so bots sniping the first blocks pay for it.+ // This is that mechanism on Solana, built on the DBC program's own fee scheduler+ // instead of a new contract. activationType is Slot (below), so the window below+ // is measured in slots, not seconds.+ antiSnipeStartFeeBps: 5_000, // 50% for a buy landing in the pool's first slot+ antiSnipeEndFeeBps: 100, // decays down to the steady-state 1% trade fee (tradeFeeBps)+ antiSnipeDecayPeriods: 25, // discrete steps the fee drops through on its way down+ // 100 slots at Solana's ~400ms/slot is about 40 seconds: long enough to tax a sniper+ // bot's first few blocks hard, short enough that an organic buyer a block or two+ // later already sees most of the fee gone (exponential decay front-loads the drop).+ antiSnipeDecaySlots: 100,};// Params for buildCurveWithMarketCap(). Enum values are inlined as numbers so@@ -77,19 +92,31 @@ export function curveBuildParams() {},fee: {baseFeeParams: {- baseFeeMode: 0, // BaseFeeMode.FeeSchedulerLinear (flat: start == end)+ // FeeSchedulerExponential, not RateLimiter: this SDK's own+ // getBaseFeeParams() throws "BaseFeeMode.RateLimiter is deprecated.+ // New configs must use FeeSchedulerLinear or FeeSchedulerExponential"+ // for any new config, which settles the choice the task asked to+ // measure on devnet before it gets there. Exponential over linear+ // because it front-loads the decay (steepest drop right after+ // activation, where the snipers are, instead of a constant slope).+ baseFeeMode: 1, // BaseFeeMode.FeeSchedulerExponentialfeeSchedulerParam: {- startingFeeBps: NATIVE_LANE.tradeFeeBps,- endingFeeBps: NATIVE_LANE.tradeFeeBps,- numberOfPeriod: 0,- totalDuration: 0,+ startingFeeBps: NATIVE_LANE.antiSnipeStartFeeBps,+ endingFeeBps: NATIVE_LANE.antiSnipeEndFeeBps,+ numberOfPeriod: NATIVE_LANE.antiSnipeDecayPeriods,+ totalDuration: NATIVE_LANE.antiSnipeDecaySlots,},},dynamicFeeEnabled: true,collectFeeMode: 0, // CollectFeeMode.QuoteToken (fees accrue in $THREE)creatorTradingFeePercentage: NATIVE_LANE.creatorTradeFeePercent,poolCreationFee: 0,- enableFirstSwapWithMinFee: true, // creator's own first buy pays the minimum fee+ // The creator's own buy is bundled into the same transaction as pool+ // creation (buildCreatePoolTx's firstBuyParam), so it is the only+ // "snipe-shaped" buy that is actually the creator funding their own+ // launch. This keeps it exempt from the anti-snipe rate: it always+ // pays the lane's minimum fee, never the decaying start fee.+ enableFirstSwapWithMinFee: true,},migration: {migrationOption: 1, // MigrationOption.MET_DAMM_V2@@ -158,6 +185,13 @@ export function laneInfo(network = 'mainnet') {creator_percent: NATIVE_LANE.creatorTradeFeePercent,platform_percent: 100 - NATIVE_LANE.creatorTradeFeePercent,},+ anti_snipe: {+ start_fee_bps: NATIVE_LANE.antiSnipeStartFeeBps,+ end_fee_bps: NATIVE_LANE.antiSnipeEndFeeBps,+ decay_periods: NATIVE_LANE.antiSnipeDecayPeriods,+ decay_slots: NATIVE_LANE.antiSnipeDecaySlots,+ creator_first_buy_exempt: true,+ },migration_fee_percent: NATIVE_LANE.migrationFeePercent,lp_locked_percent: NATIVE_LANE.lpLockedPercent,graduates_to: 'Meteora DAMM v2 against $THREE (LP permanently locked, creator keeps earning LP fees)',diff --git a/data/changelog.json b/data/changelog.jsonindex 08b729583..0bec3444a 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,16 @@{"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security, desktop (desktop entries become the desktop app's release notes). `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-10-14",+ "title": "The native $THREE launchpad now taxes snipers, not just steady trading",+ "summary": "Every pool on the native launchpad lane used to open at the same flat 1% trading fee a coin keeps forever, which is exactly what a sniper bot wants: the same price whether it buys in the pool's first block or an hour later. New pools now open at a 50% fee that decays exponentially down to the normal 1% over the first 100 slots (about 40 seconds), so a bot buying in the first block pays close to half its $THREE in fees while an organic buyer a minute later pays the standard rate. The coin creator's own bundled first buy stays exempt, since that is the creator funding their own launch, not a snipe. The schedule runs entirely on Meteora's own Dynamic Bonding Curve fee scheduler, no new contract.",+ "tags": [+ "feature",+ "security"+ ],+ "link": "/docs/native-launchpad"+ },{"date": "2026-10-14","title": "MCP clients can now prepare a pump.fun launch for you to sign",diff --git a/docs/native-launchpad.md b/docs/native-launchpad.mdindex 1a6b6701d..0dd8441de 100644--- a/docs/native-launchpad.md+++ b/docs/native-launchpad.md@@ -45,7 +45,7 @@ All of it lives in one file, [`api/_lib/native-launch/config.js`](../api/_lib/na| Metadata authority | Immutable at launch || Starting market cap | 4,000,000 $THREE || Graduation market cap | 60,000,000 $THREE (about 12.3M $THREE raised on the curve) |-| Trading fee | 1%, taken in $THREE, plus a volatility-scaled dynamic fee during spikes |+| Trading fee | 1% steady-state, taken in $THREE, plus a volatility-scaled dynamic fee during spikes. Decays down from 50% over a pool's first 100 slots (below) || Trading fee split | 50% coin creator / 50% three.ws || Migration fee | 1% of the raised $THREE, split 50/50 || Graduates into | A Meteora DAMM v2 pool against $THREE |@@ -63,6 +63,14 @@ The curve deliberately mirrors the shape traders already recognise from pump.funThe DBC program takes the quote mint's token program as an ordinary account, so a Token-2022 quote is supported on-chain. SDK 1.5.x nevertheless hardcodes the legacy SPL Token program into `token_quote_program` when it builds a pool-initialize instruction, and with a Token-2022 quote the instruction fails with `IncorrectProgramId` as soon as the program creates the quote vault. `withQuoteTokenProgram` in [`dbc.js`](../api/_lib/native-launch/dbc.js) rewrites that one account, located by its position in the program's own IDL. Swaps are unaffected: the SDK reads the token program from the config for those. Remove the patch when the SDK is fixed upstream.+### Anti-snipe: a decaying fee instead of a flat one++Every pool opens at a 50% trading fee (`antiSnipeStartFeeBps`), which decays exponentially down to the steady-state 1% (`antiSnipeEndFeeBps`) over the pool's first 100 slots (`antiSnipeDecaySlots`, about 40 seconds at Solana's ~400ms/slot), stepped through 25 discrete periods (`antiSnipeDecayPeriods`). A bot buying in the pool's first block pays close to half its $THREE in fees; an organic buyer a minute later pays the normal 1%. The coin's own creator is exempt: their bundled first buy (the same transaction as pool creation) always pays the lane's minimum fee via `enableFirstSwapWithMinFee`, since it is the creator funding their own launch, not a snipe.++This mirrors the owner's EVM `anti-snipe-ramp` hook concept, but it is built entirely on the DBC program's own fee scheduler rather than a new contract: `fee.baseFeeParams` in [`config.js`](../api/_lib/native-launch/config.js) sets `BaseFeeMode.FeeSchedulerExponential` with a starting and ending fee, a period count, and a duration in slots. Exponential was chosen over linear because it front-loads the drop (steepest right after activation, where snipers are, instead of a constant slope), and over the SDK's `RateLimiter` mode because that mode is deprecated in this SDK version and throws for any new config.++One honest difference from the EVM hook: on an EVM AMM, an anti-snipe ramp's excess fee typically accrues to the pool's liquidity providers. On this lane, all trading fees (ramped or steady-state) flow through the same 50/50 creator/three.ws split that every other trade uses, never to LPs, because DBC pools have no third-party LPs before graduation. The anti-snipe premium a sniper pays is extra revenue for the coin's creator and the platform, not a yield booster for outside liquidity.+### Why `leftover: 1`The DBC program requires that the tokens on the curve, the tokens reserved for migration, and the leftover reconcile *exactly* against the fixed supply. A leftover of `0` fails that check on-chain with `InvalidTokenSupply`. One base unit of dust satisfies it. This was found by simulating the real `create_config` instruction against devnet, and it is pinned by a test so nobody "cleans it up" later.diff --git a/public/changelog-recent.json b/public/changelog-recent.jsonindex fcc4539e0..e8126e7b2 100644--- a/public/changelog-recent.json+++ b/public/changelog-recent.json@@ -1,11 +1,11 @@{- "generated_at": "2026-10-14T19:13:50.717Z",+ "generated_at": "2026-10-14T20:00:23.214Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws","url": "https://three.ws"},- "total": 4090,+ "total": 4091,"complete": false,"full_feed": "/changelog.json","entries": [@@ -125,6 +125,17 @@"docs"]},+ {+ "date": "2026-10-14",+ "type": "update",+ "title": "The native $THREE launchpad now taxes snipers, not just steady trading",+ "summary": "Every pool on the native launchpad lane used to open at the same flat 1% trading fee a coin keeps forever, which is exactly what a sniper bot wants: the same price whether it buys in the pool's first block or an hour later. New pools now open at a 50% fee that decays exponentially down to the normal 1% over the first 100 slots (about 40 seconds), so a bot buying in the first block pays close to half its $THREE in fees while an organic buyer a minute later pays the standard rate. The coin creator's own bundled first buy stays exempt, since that is the creator funding their own launch, not a snipe. The schedule runs entirely on Meteora's own Dynamic Bonding Curve fee scheduler, no new contract.",+ "link": "/docs/native-launchpad",+ "tags": [+ "feature",+ "security"+ ]+ },{"date": "2026-10-14","type": "update",@@ -1546,16 +1557,6 @@"feature","security"]- },- {- "date": "2026-10-10",- "type": "update",- "title": "AI agents now forecast Event Markets and build a public track record",- "summary": "Agents can call a market as themselves, with a confidence, a rationale and evidence links, and the market page shows what each agent thinks under an Agent badge. Every agent profile gets its calls, hit rate, a calibration chart built from resolved markets only, and its best calls. A new forecasters page ranks people and agents, with an agents-only filter, and you can follow an agent to be notified when it calls. Owners can switch on autonomous forecasting per agent within a points budget, off by default and fully visible in the activity log. Assistants get event_market_analyze over MCP.",- "link": "/event-markets/forecasters",- "tags": [- "feature"- ]}]}diff --git a/public/changelog.json b/public/changelog.jsonindex d9557b6f5..f3f052103 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-10-14T19:13:50.696Z",+ "generated_at": "2026-10-14T20:00:23.194Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -122,6 +122,17 @@"docs"]},+ {+ "date": "2026-10-14",+ "type": "update",+ "title": "The native $THREE launchpad now taxes snipers, not just steady trading",+ "summary": "Every pool on the native launchpad lane used to open at the same flat 1% trading fee a coin keeps forever, which is exactly what a sniper bot wants: the same price whether it buys in the pool's first block or an hour later. New pools now open at a 50% fee that decays exponentially down to the normal 1% over the first 100 slots (about 40 seconds), so a bot buying in the first block pays close to half its $THREE in fees while an organic buyer a minute later pays the standard rate. The coin creator's own bundled first buy stays exempt, since that is the creator funding their own launch, not a snipe. The schedule runs entirely on Meteora's own Dynamic Bonding Curve fee scheduler, no new contract.",+ "link": "/docs/native-launchpad",+ "tags": [+ "feature",+ "security"+ ]+ },{"date": "2026-10-14","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 129970873..1340a2a46 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -94,6 +94,14 @@<category>infra</category><description>scripts/sync-standalone-repos.mjs force-pushed straight to main on every run, which could silently create duplicate repos for the eleven mirrors already renamed on GitHub and bypassed the owner's push-approval rule. data/standalone-mirrors.json is now the single source of truth for which monorepo directory maps to which public repo, read by every exporter (sync, growth satellites, the awesome list, the skill-repo builder) instead of each keeping its own list. The sync script only stages a snapshot under dist/standalone-mirrors/, fixes any stale pre-Apache-2.0 README or LICENSE footer, and prints the push command for the owner; npm run sync:repos:check compares what is staged against each mirror's live tree and reports drift without writing anything.</description></item>+ <item>+ <title>The native $THREE launchpad now taxes snipers, not just steady trading</title>+ <link>https://three.ws/docs/native-launchpad</link>+ <guid isPermaLink="false">2026-10-14:The native $THREE launchpad now taxes snipers, not just steady trading</guid>+ <pubDate>Wed, 14 Oct 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>Every pool on the native launchpad lane used to open at the same flat 1% trading fee a coin keeps forever, which is exactly what a sniper bot wants: the same price whether it buys in the pool's first block or an hour later. New pools now open at a 50% fee that decays exponentially down to the normal 1% over the first 100 slots (about 40 seconds), so a bot buying in the first block pays close to half its $THREE in fees while an organic buyer a minute later pays the standard rate. The coin creator's own bundled first buy stays exempt, since that is the creator funding their own launch, not a snipe. The schedule runs entirely on Meteora's own Dynamic Bonding Curve fee scheduler, no new contract.</description>+ </item><item><title>three.ws Avatar MCP clamps unbounded tool arguments before they reach generated HTML</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex a08e8de0d..3360eb253 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-10-14T19:13:50.683Z",+ "generated_at": "2026-10-14T20:00:23.182Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/scripts/native-launchpad-e2e-devnet.mjs b/scripts/native-launchpad-e2e-devnet.mjsindex 71c0aa179..a80d065c9 100644--- a/scripts/native-launchpad-e2e-devnet.mjs+++ b/scripts/native-launchpad-e2e-devnet.mjs@@ -3,8 +3,11 @@// quoteBuy -> real swap buy -> state again.import 'dotenv/config';import bs58 from 'bs58';+import BN from 'bn.js';import { Connection, Keypair, VersionedTransaction } from '@solana/web3.js';+import { getBaseFeeParams, getBaseFeeNumerator, feeNumeratorToBps } from '@meteora-ag/dynamic-bonding-curve-sdk';import { buildCreatePoolTx, buildSwapTx, getPoolState, quoteBuy } from '../api/_lib/native-launch/dbc.js';+import { curveBuildParams, NATIVE_LANE } from '../api/_lib/native-launch/config.js';const conn = new Connection(process.env.SOLANA_RPC_URL_DEVNET || 'https://api.devnet.solana.com', 'confirmed');const secret = process.env.NATIVE_LAUNCH_PARTNER_SECRET_BASE58 || process.env.X402_TREASURY_SECRET_BASE58;@@ -58,6 +61,55 @@ const afterCreate = await getPoolState({ network: 'devnet', mint });console.log('state after create + first buy:', JSON.stringify(afterCreate, null, 1));assert(afterCreate.quote_reserve_three > 0, 'the first buy put $THREE into the curve');+// Anti-snipe check: quote the identical buy right after the pool activates, then+// again once real slots have passed, and confirm the live config on devnet is+// actually taxing the early quote the way api/_lib/native-launch/config.js says+// it should (this is the same pool a sniper bot would be hitting).+console.log('');+console.log('anti-snipe fee check:');+const createTxInfo = await conn.getTransaction(createSig, { commitment: 'confirmed', maxSupportedTransactionVersion: 0 });+const activationSlot = createTxInfo.slot;+const antiSnipeAmountThree = 1_000;++function predictedFeeBps(slotsSinceActivation) {+ const sp = getBaseFeeParams(curveBuildParams().fee.baseFeeParams);+ const numerator = getBaseFeeNumerator(+ sp.cliffFeeNumerator,+ sp.firstFactor,+ sp.secondFactor,+ sp.thirdFactor,+ sp.baseFeeMode,+ new BN(slotsSinceActivation),+ new BN(0),+ );+ return feeNumeratorToBps(numerator);+}++const slotAtQuoteA = await conn.getSlot();+const quoteA = await quoteBuy({ network: 'devnet', mint, threeIn: antiSnipeAmountThree });+console.log(+ `slot ${slotAtQuoteA} (+${slotAtQuoteA - activationSlot} since activation): fee for ${antiSnipeAmountThree} $THREE = ${quoteA.trading_fee_three} $THREE (predicted base fee ${predictedFeeBps(slotAtQuoteA - activationSlot)} bps)`,+);++const waitSlots = 20; // comfortably inside the 100-slot decay window, no long sleep needed+console.log(`waiting for ~${waitSlots} more slots to pass on devnet...`);+let slotNow = slotAtQuoteA;+while (slotNow < slotAtQuoteA + waitSlots) {+ await new Promise((r) => setTimeout(r, 1000));+ slotNow = await conn.getSlot();+}+const quoteB = await quoteBuy({ network: 'devnet', mint, threeIn: antiSnipeAmountThree });+console.log(+ `slot ${slotNow} (+${slotNow - activationSlot} since activation): fee for ${antiSnipeAmountThree} $THREE = ${quoteB.trading_fee_three} $THREE (predicted base fee ${predictedFeeBps(slotNow - activationSlot)} bps)`,+);++assert(quoteB.trading_fee_three < quoteA.trading_fee_three, 'the anti-snipe fee must decay as slots since activation increase');+assert(+ quoteB.trading_fee_three < quoteA.trading_fee_three * 0.9,+ 'the fee drop over the waited slots must be more than rounding noise',+);+console.log(`anti-snipe fee decayed: ${quoteA.trading_fee_three} -> ${quoteB.trading_fee_three} $THREE over ${slotNow - slotAtQuoteA} slots`);+const quote = await quoteBuy({ network: 'devnet', mint, threeIn: 250_000 });console.log(`quote 250,000 $THREE -> ${quote.tokens_out} tokens, fee ${quote.trading_fee_three} $THREE`);diff --git a/tests/native-launch-curve.test.js b/tests/native-launch-curve.test.jsindex 8331e9b5b..55f5229e3 100644--- a/tests/native-launch-curve.test.js+++ b/tests/native-launch-curve.test.js@@ -10,6 +10,9 @@ import { describe, it, expect, beforeEach, afterEach } from 'vitest';import {buildCurveWithMarketCap,validateConfigParameters,+ getBaseFeeParams,+ getBaseFeeNumerator,+ feeNumeratorToBps,TokenType,TokenDecimal,TokenAuthorityOption,@@ -20,6 +23,7 @@ import {ActivationType,} from '@meteora-ag/dynamic-bonding-curve-sdk';import { Keypair } from '@solana/web3.js';+import BN from 'bn.js';import { NATIVE_LANE, curveBuildParams, configKeyFor, laneInfo } from '../api/_lib/native-launch/config.js';const params = () => curveBuildParams();@@ -64,7 +68,7 @@ describe('curveBuildParams', () => {expect(p.token.tokenQuoteDecimal).toBe(TokenDecimal.SIX);// Immutable metadata: no one, including us, can rewrite a launched coin.expect(p.token.tokenAuthorityOption).toBe(TokenAuthorityOption.Immutable);- expect(p.fee.baseFeeParams.baseFeeMode).toBe(BaseFeeMode.FeeSchedulerLinear);+ expect(p.fee.baseFeeParams.baseFeeMode).toBe(BaseFeeMode.FeeSchedulerExponential);// Fees accrue in the quote token so creators are paid in SOL, not in// their own (possibly worthless) coin.expect(p.fee.collectFeeMode).toBe(CollectFeeMode.QuoteToken);@@ -73,10 +77,18 @@ describe('curveBuildParams', () => {expect(p.activationType).toBe(ActivationType.Slot);});- it('charges a flat fee for the whole curve (no decaying schedule)', () => {+ it('opens at a punitive anti-snipe fee that decays to the steady-state fee', () => {const { feeSchedulerParam: f } = params().fee.baseFeeParams;- expect(f.startingFeeBps).toBe(f.endingFeeBps);- expect(f.startingFeeBps).toBe(NATIVE_LANE.tradeFeeBps);+ expect(f.startingFeeBps).toBe(NATIVE_LANE.antiSnipeStartFeeBps);+ expect(f.endingFeeBps).toBe(NATIVE_LANE.antiSnipeEndFeeBps);+ expect(f.endingFeeBps).toBe(NATIVE_LANE.tradeFeeBps);+ expect(f.startingFeeBps).toBeGreaterThan(f.endingFeeBps);+ expect(f.numberOfPeriod).toBe(NATIVE_LANE.antiSnipeDecayPeriods);+ expect(f.totalDuration).toBe(NATIVE_LANE.antiSnipeDecaySlots);+ });++ it('exempts only the creator-bundled first buy from the anti-snipe rate', () => {+ expect(params().fee.enableFirstSwapWithMinFee).toBe(true);});it('keeps a leftover dust unit so the program supply check passes', () => {@@ -93,6 +105,52 @@ describe('curveBuildParams', () => {});});+describe('anti-snipe fee schedule', () => {+ // feeAtSlot mirrors exactly what the DBC program does on-chain: resolve the+ // scheduler's cliff/reduction factors once (getBaseFeeParams), then evaluate+ // the fee at a given slot since pool activation (getBaseFeeNumerator). No+ // network call, no mocking of the curve math itself.+ const schedulerParams = () => getBaseFeeParams(params().fee.baseFeeParams);+ const activationPoint = new BN(0);+ function feeBpsAtSlot(slot) {+ const sp = schedulerParams();+ const numerator = getBaseFeeNumerator(+ sp.cliffFeeNumerator,+ sp.firstFactor,+ sp.secondFactor,+ sp.thirdFactor,+ sp.baseFeeMode,+ new BN(slot),+ activationPoint,+ );+ return feeNumeratorToBps(numerator);+ }++ it('starts at the configured anti-snipe fee in the pool\'s first slot', () => {+ expect(feeBpsAtSlot(0)).toBe(NATIVE_LANE.antiSnipeStartFeeBps);+ });++ it('decays monotonically slot by slot across the decay window', () => {+ let previous = feeBpsAtSlot(0);+ for (let slot = 1; slot <= NATIVE_LANE.antiSnipeDecaySlots; slot++) {+ const fee = feeBpsAtSlot(slot);+ expect(fee).toBeLessThanOrEqual(previous);+ previous = fee;+ }+ });++ it('reaches exactly the steady-state fee at the window\'s end, and stays there', () => {+ expect(feeBpsAtSlot(NATIVE_LANE.antiSnipeDecaySlots)).toBe(NATIVE_LANE.antiSnipeEndFeeBps);+ expect(feeBpsAtSlot(NATIVE_LANE.antiSnipeDecaySlots + 1000)).toBe(NATIVE_LANE.antiSnipeEndFeeBps);+ });++ it('taxes a snipe in the first few slots well above the steady-state fee', () => {+ // A bot landing in slot 1-3 (one to a couple of blocks after activation)+ // should still pay a meaningfully punitive fee, not something close to normal.+ expect(feeBpsAtSlot(2)).toBeGreaterThan(NATIVE_LANE.antiSnipeEndFeeBps * 10);+ });+});+describe('curve built through the SDK', () => {const built = () => buildCurveWithMarketCap(params());