Architecture overview

PLUG is a trading and launch platform on Solana with a hook architecture inspired by v4 style hooks. Every pool is a power strip with a row of sockets, and every module is a plug. When a pool is created, its modules are plugged in and its caps are fixed for good. From then on, every trade routed through PLUG runs through a composable hook pipeline with before swap and after swap stages. Modules can set the fee, add a surcharge, or refuse the trade, but never past the caps the pool shows.

PLUG deploys no programs of its own, and that is a design choice. Pools are Meteora DAMM v2 pools, routing goes through Jupiter, and tokens use the standard SPL and Token-2022 programs. PLUG's hooks are composed server side by a deterministic quote engine, then settled on chain as one atomic versioned transaction. Your wallet signs once, and anyone can verify every instruction on chain.

System layers

Two layers. Rules that must hold for every trade, wherever it comes from, run on chain inside the Meteora pool: the base fee, the launch fee time scheduler, the volatility accumulator behind the dynamic fee, the LP lock and the opening time. Everything else runs in PLUG's hook pipeline and lands in the same transaction as the swap.

ComponentWhat it does
Hook pipelineHooks, v4 style. Each Strip module plugs into a stage (before swap, swap, after swap) and returns a verdict: pass, surcharge or refuse. Verdicts compose, and the total is clamped to the pool's caps.
Quote engineDeterministic. Reads live pool state, simulates the swap with the pool's own Q64.64 sqrt price math, then evaluates every router module against the result. Same inputs, same verdict.
Transaction builderCompiles compute budget, the swap, module surcharges or the router fee, and a memo into one v0 versioned transaction, with address lookup tables for multi hop Jupiter routes. All or nothing.
IndexerVerifies each swap PLUG routes from confirmed chain data: the signer, pre and post balance deltas, and the router fee actually paid. Idempotent per signature. Feeds the time weighted average price (TWAP) oracle.
Treasury crankCollects the protocol share of LP fees, runs TWAP guarded buybacks, burns every $PLUG it buys, and permanently locks protocol owned liquidity.
AuthClaims, unstakes and admin actions are ed25519 signed messages. Each signature is time boxed and single use, so a replay is rejected.

Life of a trade

One request in, one signed transaction out. Stage by stage:

  1. Route. The quote engine picks the venue: the PLUG pool for the pair if one exists, otherwise a Jupiter route, multi hop where it pays.
  2. Before swap. Router modules evaluate live context: the 15 minute TWAP, SOL bought on the pool in the current second, the wallet's on chain balance, and recent swap history for sandwich patterns. A refusal stops here, before anything is signed.
  3. Swap. The pool prices the trade on chain with its fee schedule and dynamic fee. Your minimum received is enforced by the swap instruction itself.
  4. After swap. Module surcharges are paid in SOL to the pool's LP holders pro rata, or the router fee goes to the treasury, then a memo tags the trade. Same transaction, same signature.
  5. Settle and index. The transaction lands atomically or not at all. The indexer verifies it from chain data and folds the new price into the TWAP.

Liquidity pools

A PLUG pool is a Meteora DAMM v2 customizable pool, created by PLUG with the settings you choose. Liquidity is bounded by a sqrt price range and priced in Q64.64 fixed point, the same math the program runs on chain. These are set at creation and can never change: the two tokens, the base fee, the launch fee schedule, dynamic fees, the opening time, the liquidity lock and the Strip modules.

Launches put the whole supply in the pool single sided, starting at the market cap you pick. The creator puts in no SOL; buyers bring it. The price rises as people buy, like a bonding curve, and there is nothing to migrate later. Fees are collected in SOL only (OnlyB collect mode), never in the coin.

Mint screening

Before a pool is created, extension aware mint introspection reads the mint account and screens every Token-2022 extension on it. Any SPL token fits, and so do Token-2022 tokens with safe extensions: metadata, transfer fees (quotes and slippage count them), interest bearing and scaled UI amounts. New pump.fun coins are Token-2022 mints and work as they are.

Refused at creationWhy
Permanent delegateCould pull tokens out of the vault
Transfer hookCould block withdrawals
PausableCould freeze the pool
Freeze authorityCould freeze the vault (USDC style hubs excepted)
Closable mintCould be re created with any of the above
Non transferable, default frozen, confidentialCan't trade safely in a pool

Hook modules

The Strip is PLUG's built in module set. Modules marked pool run inside the Meteora pool on chain and apply to every trade, wherever it comes from. Modules marked router are evaluated by PLUG's quote engine as before swap and after swap hooks, and settled by the transaction builder, on every trade routed through PLUG (the site, the API and the SDK).

ModuleRuns inWhat it does
Launch guardpoolSnipers pay the opening fee, and it goes to LPs.
Dynamic feepoolThe fee rises on fast moves and settles when it is calm.
TWAP oraclerouterA time weighted price that one trade cannot bend.
Creator feepoolA cut of every trade for the creator, capped for good.
Sandwich GuardrouterA sandwich bot pays LPs, or its sandwich fails.
Buy and sell feesrouterCheaper to buy in, more expensive to dump.
Level UprouterFees drop once the market cap passes a milestone.
Holder discountrouterBigger holders pay a lower fee on every trade.
Price BandrouterTrades that stretch the price far from its average pay more.
Max WalletrouterNo wallet can buy past a set share of supply early on.
Fee splitpoolSend the fee to you, to a burn, to holders, or a mix.

Router module surcharges are paid in SOL, in the same atomic transaction as the trade, to the pool's LP holders pro rata. Price Band reads a 15 minute TWAP built from indexed swaps, Holder discount reads the wallet's on chain balance on every quote, and the launch rate limiter sums buys per second. If a module refuses, nothing moves.

LP positions

Every liquidity position is an NFT, tracked on chain by the pool program. Whoever holds it owns the liquidity and the fees, so a position can be sent, sold or used as collateral. A lock stops withdrawals until a date, or for good. Locks only extend, and fees keep flowing to the holder while locked, so "LP locked" is something anyone can check on chain.

Each launch splits its position: 20% goes to the PLUG treasury as the platform fee (50% of its fees go to $PLUG stakers in SOL, the rest to the $PLUG buyback, burn and liquidity engine), and the rest follows the fee split you chose: you, a burn of your coin, your coin's stakers, or a mix.

Fees, buyback and burn

Swaps PLUG routes through Jupiter pay a 0.5% fee in SOL. 50% goes to $PLUG stakers; the rest goes to the buyback. Swaps through PLUG pools pay their pool fee instead.

The treasury crank collects the protocol share of launch LP fees: the platform fee. 50% of it goes to $PLUG stakers in SOL. Of the other half, 30% funds the liquidity engine and the rest goes to the buyback and burn. Each buyback spends 10% of the budget, at most once per 10 minutes, and only when the price is within 2% of its 30 minute average. The TWAP guard means a single wick cannot trigger a buyback at a bad price. Every $PLUG bought is burned with an SPL burn in its own transaction, listed live on the $PLUG page.

Staking

Stake $PLUG and earn SOL from 50% of the platform fee (the protocol share of launch LP fees) and 50% of the router fee, pro rata to your stake. Accounting uses a reward per share accumulator, so each fee is credited to every stake in constant time, however many stakers there are. With SOL instead, one transaction buys $PLUG and sends it straight into the staking vault. Rewards accrue on every fee. Claim any time. Unstaking stops earning at once and releases after 24 hours. Coins launched with a Holders share get the same staking on the Earn page.

Hook registry

Module presets can be listed by staking $PLUG. Admins can verify a listing or slash it, which burns the stake and marks it for good. Unlisting has a 7 day cooldown, after which the stake is returned automatically.

API

Every endpoint returns JSON. Transactions come back as base64 encoded v0 versioned transactions, fully built and ready to sign.

GET  /api/quote?in=<mint>&out=<mint>&amount=<ui amount>&slippageBps=100&wallet=<optional>
POST /api/swap          { in, out, amount, slippageBps, wallet }  ->  { tx, lastValidBlockHeight, quote }
POST /api/swap/confirm  { sig, wallet, in, out, pool, fired }
GET  /api/pools         GET /api/pool/<address or mint>   GET /api/live   GET /api/stats
GET  /api/mint/<mint>   inspection: extensions, refusals, transfer fee
POST /api/launch        { creator, name, symbol, startMcapSol, config }  ->  { mint, pool, txs }
GET  /api/stake/PLUG?wallet=<wallet>

SDK

The SDK is the API above. A full swap in a few lines:

const q = await fetch(`/api/quote?in=${SOL}&out=${mint}&amount=1`).then(r => r.json());
const { tx } = await fetch("/api/swap", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ in: SOL, out: mint, amount: 1, slippageBps: 100, wallet }),
}).then(r => r.json());
const signed = await wallet.signTransaction(VersionedTransaction.deserialize(Buffer.from(tx, "base64")));
await connection.sendRawTransaction(signed.serialize());

Design

A pool is a power strip and a module is a plug. Pool settings are chosen once and written into the pool, so the only thing a launcher decides later is when to collect fees. Everything a trader pays is shown before they sign: pool fee, module surcharges, router fee, price impact and the minimum received.

Security and limits

Your keys never leave your wallet. Every transaction is built server side and shown in your wallet before you sign. Wallet signed actions use ed25519 message signatures that expire and work once. Server wallets only co sign what they create: new position NFTs, the treasury's own position splits and locks. They can't move your tokens.

Limits worth knowing: router modules apply to trades routed through PLUG; a trade sent straight to the Meteora pool from elsewhere pays only the on chain pool fee. Pool fee, launch fee schedule, dynamic fee, LP lock and opening time are enforced on chain for every trade.