Skip to content
Back to Home
PR Collective

Onlyup

Next.js Anchor Solana web3.js Metaplex Token Metadata Raydium SDK TradingView Socket.IO Express.js

Onlyup is a Solana bonding-curve token launchpad in the pump.fun lineage. Anyone deploys an SPL token in one flow, traders buy and sell against a curve, and the pool flips to Raydium liquidity once it fills. The frontend is Next.js (Pages Router) on Node, the backend is Express, and the on-chain side is an Anchor program I treat as the source of truth for pricing and graduation.

The program holds two account types: a singleton MainState PDA that stores global config (owner, fee recipient, supply target, initial virtual + real reserves, fee in basis points), and a per-token PoolState PDA that stores the live virtual + real reserves, a u128 invariant, and a complete flag. Pricing is constant-product against the virtual reserves:

konst = virtBaseReserves * virtQuoteReserves

This invariant is set at pool init and every buy or sell solves for the swap amount that preserves konst, mutating real and virtual reserves together. The math runs entirely on-chain - the frontend just submits a SOL or token amount and reads back updated reserves from emitted trade events. Virtual reserves are what shape the pump.fun-style early-price behavior independently of how much SOL has actually entered the pool.

Token creation is one VersionedTransaction with everything bundled: a fresh mint, the rent-funded mint account, an associated token account with full supply minted, a Metaplex metadata account, a setAuthority to null out mint authority, the bonding-curve pool init, and optionally a creator buy on the curve. The bundle is compiled to a v0 message with address-lookup-table support, signed by the wallet plus the mint keypair, and sent. Image and JSON metadata are POSTed separately to the backend, which pins them (with Bundlr / Arweave wired in as an alternative).

Graduation isn't a manual instruction. The buy handler watches reserves; when they cross the configured target, the program flips the complete flag and reverts further trades on the curve. An admin then runs a withdraw instruction that pulls reserves out and seeds a Raydium AmmV4 pool against an OpenBook market. The frontend detects the complete flag on every trade attempt and, instead of buy/sell, fetches the market id from the backend and routes through the Raydium SDK with a slippage cap.

Wallet plumbing is @solana/wallet-adapter-react with the usual Solana wallet roster (Phantom, Solflare, Coin98, Ledger, and friends). TradingView is wired with a custom UDF datafeed that pulls historical bars from the backend and listens for live updates over a global WebSocket that fans out two message types - last token and last trade - to keep the marquee and trade ticker fresh across the app.

The Express backend exposes a flat per-token API for metadata, gallery (with Meilisearch-backed sort and search), threads (replies with likes/dislikes and image attachments), trades, and leaderboards. Trades written from the on-chain confirmation reach the same row that the social feed reads, so price and conversation share a single source of record.