A Sui-native memecoin launch and trading protocol that enforces fair launches at the protocol level.
MemeFi is a Sui-native fair launch protocol for memecoins that protects early participants from whale tracking, MEV extraction, and front-running by controlling when on-chain information becomes public.
Problem:
Current memecoin platforms (e.g., Pump.fun) expose all trading activity in real-time — every buy, every wallet balance, every holder count is immediately visible on-chain Whales and analytics tools monitor early accumulator wallets, track their positions, and front-run their exits MEV bots extract value from every visible pending transaction in the mempool "Fair launch" claims are enforced only at the UI level — anyone calling the contract directly can bypass them Small participants consistently get dumped on because their accumulation is transparent before they can exit Solution — Protocol-Enforced Three-Phase Token Lifecycle:
Each token created on MemeFi goes through three distinct phases, with rules enforced at the Move smart contract level (not in the UI):
LAUNCH (configurable, e.g. 3 minutes):
Token is created as a shared MemeToken object on Sui containing an internal balance ledger (Table<address, u64>), a SUI treasury (Balance<SUI>), and phase metadata A linear bonding curve prices tokens dynamically — price = base_price × (1 + (max_multiplier - 1) × circulating/total) — starting at 0.0001 SUI per token and scaling up to 100x as supply fills Max buy per wallet is enforced in Move (assert!(new_total <= token.max_buy_per_wallet)) — no single wallet can dominate early allocation All purchase events (PurchaseMade) are emitted publicly; holder count and volume are tracked in public fields Phase transitions are time-based using Sui's Clock object — any user can call advance_phase() permissionlessly PRIVATE (configurable, e.g. 6 minutes):
Buying continues through the same bonding curve with the same max buy enforcement Event suppression: PurchaseMade and TokensSold events are NOT emitted — if (token.current_phase != PHASE_PRIVATE) gates all event emissions Hidden metrics: New holders and volume during this phase are stored in pending_holder_count and pending_volume fields, separate from the public holder_count and total_volume — on-chain explorers cannot see accumulation activity Session vaults: Users can call open_session() to create a TradingSession object — an owned Sui object transferred to their address. Only the owner can read the session balance. Sessions call buy_in_session() which internally routes through buy_tokens() but tracks accumulation in the session's private balance field The combination of suppressed events + hidden metrics + owned session objects creates a privacy window where early accumulators cannot be tracked OPEN (permanent):
On phase transition, update_phase_internal() automatically merges: holder_count += pending_holder_count, total_volume += pending_volume, then zeroes the pending fields — full transparency is restored in one atomic operation Transfer locks are removed (!token.transfers_locked || token.current_phase == PHASE_OPEN) Sessions can be settled via settle_session() — marks the session as STATE_SETTLED and finalizes the balance Users can call withdraw_to_wallet() to convert platform balances into Coin<WRAPPED_TOKEN> (WMEME) — standard Sui coins minted via a shared TreasuryCap — enabling transfers, DEX listings, and wallet-to-wallet trading Users can also deposit_from_wallet() to burn WMEME coins back into platform balances All events resume, all metrics are public — normal transparent DeFi trading Smart Contract Architecture (Move on Sui):
token_v2.move — Core module containing:
MemeToken shared object with balance tables, purchase tracking, SUI treasury, bonding curve logic, and 4-phase lifecycle state machine launch_token() — creates and shares a new token with configurable phase durations, max buy limits, and transfer locks buy_tokens() / sell_tokens() — bonding curve buy/sell with SUI deposited to / withdrawn from the internal treasury calculate_tokens_for_sui() / calculate_sui_for_tokens() — bonding curve math using linear price scaling get_current_price() — returns price in MIST per full token based on supply percentage withdraw_to_wallet() / deposit_from_wallet() — WMEME mint/burn for wallet interop (OPEN phase only) advance_phase() — permissionless phase advancement based on Clock timestamps session.move — Private accumulation module:
TradingSession owned object with owner, state, token_id, balance, created_at open_session() — creates session (PRIVATE phase only), transfers to caller buy_in_session() — accumulates tokens privately, routes through token_v2::buy_tokens settle_session() — marks session settled (SETTLEMENT/OPEN phase only) wrapped_token.move — Wallet interop:
WRAPPED_TOKEN one-time witness for Coin creation Shared TreasuryCap for minting/burning WMEME coins Enables platform balance ↔ wallet coin conversion Frontend (Next.js + TypeScript):
Phase-aware UI: Token pages display different controls based on current phase — buy/sell during LAUNCH/PRIVATE, session management during PRIVATE, withdrawal during OPEN Real-time trading chart: Candlestick + volume charts using lightweight-charts, with timeframe selection (1m/5m/15m/1H/1D) and USD/SUI price toggle Token launcher: Form to create new tokens with configurable name, symbol, supply, max buy, phase durations, and image upload Portfolio tracker: Displays holdings, P&L, average buy price, transaction history, and investment breakdown with pie chart Sessions page: Lists all tokens in PRIVATE phase with countdown timers, session open/buy/settle controls External Integrations:
Pyth Network (Oracle):
Fetches real-time SUI/USD price from Hermes API (/v2/updates/price/latest) using the SUI/USD feed ID Used for USD market cap calculation, price display in charts, and portfolio valuation Falls back to $1.50 if API unavailable Walrus (Decentralized Storage):
Token logo images are uploaded to Walrus testnet via HTTP PUT to /v1/blobs Returns a blobId used to construct retrieval URLs via the Walrus aggregator Provides decentralized, censorship-resistant image hosting for token metadata ENS (Ethereum Name Service — Sepolia):
Users connect MetaMask to Ethereum Sepolia testnet Two-step ENS registration: commit (with 60-second waiting period) → register (pays ETH for 1-year registration) After registration, the ENS name is mapped to both the ETH address and the connected Sui wallet address Creates a cross-chain identity: ENS name → ETH address → Sui address Stored locally with wallet-mapping-storage.ts — enables future on-chain resolution Key Innovation:
Privacy during accumulation, transparency during trading — enforced at the smart contract level, not the UI level Session-based private accumulation as a new DeFi primitive for any volatile asset launch where premature transparency creates extraction Treats memecoins as a market microstructure problem — controlling information timing to create fairer outcomes for all participants
Smart Contracts (Move on Sui): The core protocol is three Move modules deployed on Sui testnet. token_v2.move is the main module — it creates a shared MemeToken object containing an internal balance ledger (Table<address, u64>), a purchase tracker for max buy enforcement, and a Balance<SUI> treasury that backs a linear bonding curve. The bonding curve prices tokens dynamically: price = base_price × (1 + (max_multiplier - 1) × circulating_supply / total_supply), starting at 0.0001 SUI per token and scaling up to 100x as supply fills. Phase transitions are time-based using Sui's shared Clock object (0x6) — any user can call advance_phase() permissionlessly, eliminating admin key dependency. The privacy mechanism works by gating event emissions and metric accumulation on current_phase: during PRIVATE, PurchaseMade and TokensSold events are suppressed entirely, and new holder counts and volume are routed to pending_holder_count and pending_volume fields instead of the public ones. On transition to OPEN, update_phase_internal() atomically merges pending stats into public fields. session.move creates owned TradingSession objects transferred to the caller — Sui's ownership model means only the owner can read the session balance, providing natural access control without encryption. wrapped_token.move uses a one-time witness pattern to create a shared TreasuryCap<WRAPPED_TOKEN> that token_v2 calls to mint WMEME coins when users withdraw platform balances to their wallet during the OPEN phase.
Frontend (Next.js + TypeScript): Built with Next.js App Router, the frontend uses @mysten/sui.js for Sui transaction construction and @mysten/dapp-kit for wallet connection (Slush/Sui Wallet). Wagmi + viem handle the Ethereum side for ENS registration on Sepolia. The trading chart uses TradingView's lightweight-charts library rendering real-time candlestick + volume data, with timeframe switching (1m/5m/15m/1H/1D) and a USD/SUI price toggle. The UI is phase-aware — components check currentPhase from on-chain data and conditionally render buy/sell controls, session management, or withdrawal buttons. Framer Motion handles animations, and the design system uses a custom theme with Tailwind CSS. All token data is fetched by querying Sui events (TokenLaunched, PurchaseMade, TokensSold, PhaseChanged) from the blockchain and reconstructing state client-side.
Pyth Network Integration: SUI/USD pricing is fetched live from Pyth's Hermes API (/v2/updates/price/latest) using the verified SUI/USD feed ID. The price data includes confidence intervals and publish timestamps. This powers USD market cap calculations, portfolio valuation, and dual-currency price display in charts. The integration parses Pyth's exponential price format (price × 10^expo) into human-readable values.
Walrus (Decentralized Storage): Token logo images are uploaded to Walrus testnet via HTTP PUT to the publisher endpoint (/v1/blobs?epochs=1). The response returns a blobId used to construct retrieval URLs through the Walrus aggregator. This provides censorship-resistant, decentralized image hosting without relying on IPFS pinning services or centralized CDNs.
ENS Cross-Chain Identity (Hacky/Notable): This is the most unconventional piece — we bridge Ethereum and Sui identity using ENS on Sepolia. The ENS registration uses the official ETH Registrar Controller contract with a two-step commit-reveal scheme (commit → 60 second wait → register). After registration, we create a local mapping (ENS name → ETH address → Sui wallet address) that gives users a unified .eth identity across both chains. The wallet mapping hook verifies that the currently connected Sui wallet matches the stored mapping before displaying it, preventing stale identity display. The commit and register calls use explicit gas limits (100K and 500K respectively) to stay under Sepolia's block gas cap, since viem's gas estimator overshoots for the ENS registrar's complex tuple-based function signatures.
Notable Technical Decisions:
Platform balances instead of direct Coin objects — allows the protocol to control visibility and enforce phase rules without wrapping/unwrapping tokens on every trade Shared MemeToken with internal Tables rather than per-user Coin objects — enables the contract to suppress events and defer metrics at the protocol level Instant settlement (SETTLEMENT phase skipped) — update_phase_internal() jumps directly from PRIVATE to OPEN, merging pending stats atomically rather than requiring a separate settlement window TransactionBlock construction happens client-side with @mysten/sui.js, signed by the connected wallet — no backend server required for any on-chain operation

