Skip to content
agunnaya001Public

About

is a fully on-chain, permissionless token launchpad built on Base, powered by deterministic bonding curve mechanics instead of traditional liquidity pools

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

24 Commits

Folders and files

Repository files navigation

CurvePad

License: MIT Solidity Foundry Network Tests TypeScript React pnpm

Permissionless bonding-curve token launchpad on Base mainnet.
No admin keys Β· No rugs Β· Pure on-chain math Β· Auto-graduates to Uniswap V2

Live App Β· Contract (Basescan) Β· Docs Β· Contributing


Table of Contents


What is CurvePad?

CurvePad lets anyone launch an ERC-20 token in a single transaction. Price is governed by a linear bonding curve enforced entirely on-chain β€” no liquidity pools, no market makers, no admin controls.

When a token's ETH reserve hits 10 ETH, anyone can call graduate(). The contract deploys all liquidity to a Uniswap V2 pool and permanently burns the LP tokens to the dead address (0x000...dEaD), locking liquidity forever.

Property Value
Chain Base Mainnet (chain ID 8453)
Curve Linear: price = 1e12 + 1e6 Γ— supply_in_tokens wei
Creator fee 1% of every buy and sell
Graduation threshold 10 ETH in reserve
LP lock Permanent β€” burned to 0x000...dEaD
Admin None β€” fully immutable

Features

Smart Contract

  • Linear bonding curve with quadratic buy formula solved at full 256-bit precision
  • Reserve invariant β€” ETH balance always equals ∫ price(s) ds, fully collateralized
  • Automatic graduation β€” 10 ETH reserve β†’ Uniswap V2 pool β†’ LP tokens burned
  • ReentrancyGuard on buy() and sell()
  • CEI pattern throughout β€” state before external calls
  • Permissionless β€” no owner, no pause, no upgrades

Frontend

  • πŸ” Explore β€” token grid with multicall batching (7 calls/token), search, sort, live stats
  • πŸš€ Launch β€” deploy a token in one transaction with image upload, social links, seed buy
  • πŸ“ˆ Trade β€” Bloomberg-style terminal with bonding curve chart, depth chart, live event feed
  • πŸ’Ό Portfolio β€” on-chain holdings via multicall, graduation progress bars
  • πŸŽ“ Graduation UI β€” real-time progress, timeline, celebration on threshold

Infrastructure

  • Image upload β€” token logos stored in Replit Object Storage via presigned GCS URLs
  • Metadata API β€” Express server stores off-chain token metadata (description, socials, image)
  • OpenAPI codegen β€” typed React hooks generated from OpenAPI spec via Orval
  • pnpm workspace β€” monorepo with shared TypeScript project references

Architecture

curvepad/
β”‚
β”œβ”€β”€ artifacts/
β”‚   β”œβ”€β”€ curvepad/                  # React + Vite frontend
β”‚   β”‚   └── src/
β”‚   β”‚       β”œβ”€β”€ pages/
β”‚   β”‚       β”‚   β”œβ”€β”€ LandingPage.tsx
β”‚   β”‚       β”‚   β”œβ”€β”€ ExplorePage.tsx     # Token grid, multicall batching
β”‚   β”‚       β”‚   β”œβ”€β”€ CreatePage.tsx      # Deploy + image upload
β”‚   β”‚       β”‚   β”œβ”€β”€ TradePage.tsx       # Bloomberg-style trading terminal
β”‚   β”‚       β”‚   └── PortfolioPage.tsx   # On-chain holdings
β”‚   β”‚       β”œβ”€β”€ components/
β”‚   β”‚       β”‚   β”œβ”€β”€ BondingCurveChart.tsx   # Canvas price curve
β”‚   β”‚       β”‚   β”œβ”€β”€ PriceChart.tsx          # Trade history chart
β”‚   β”‚       β”‚   β”œβ”€β”€ DepthChart.tsx          # Buy/sell depth
β”‚   β”‚       β”‚   β”œβ”€β”€ ActivityFeed.tsx        # Live Trade event stream
β”‚   β”‚       β”‚   β”œβ”€β”€ GraduationBar.tsx       # Progress bar
β”‚   β”‚       β”‚   β”œβ”€β”€ GraduationTimeline.tsx  # Milestone timeline
β”‚   β”‚       β”‚   └── TerminalLog.tsx         # macOS-style live terminal
β”‚   β”‚       └── lib/
β”‚   β”‚           β”œβ”€β”€ web3.ts          # ABI, factory address, math utils
β”‚   β”‚           └── api.ts           # Metadata API client
β”‚   β”‚
β”‚   └── api-server/                # Express metadata + image API
β”‚       └── src/
β”‚           β”œβ”€β”€ routes/
β”‚           β”‚   β”œβ”€β”€ tokens.ts        # Token metadata CRUD
β”‚           β”‚   └── storage.ts       # Image upload + serving
β”‚           └── lib/
β”‚               β”œβ”€β”€ objectStorage.ts # GCS presigned URL helper
β”‚               └── objectAcl.ts     # Access control helpers
β”‚
β”œβ”€β”€ contracts/foundry/             # Solidity contracts
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   └── TokenFactory.sol       # Factory + BondingCurveToken
β”‚   β”œβ”€β”€ test/
β”‚   β”‚   └── TokenFactory.t.sol     # 20 Foundry tests
β”‚   └── script/
β”‚       └── DeployV2.s.sol
β”‚
└── lib/
    β”œβ”€β”€ api-spec/                  # OpenAPI spec (source of truth)
    β”œβ”€β”€ api-client-react/          # Generated React query hooks
    β”œβ”€β”€ api-zod/                   # Generated Zod schemas
    β”œβ”€β”€ object-storage-web/        # React hook + Uppy upload component
    └── db/                        # Drizzle ORM schema + migrations

How the Math Works

Bonding Curve

price(s) = BASE_PRICE + SLOPE Γ— s
  • s β€” total supply in full tokens (WAD-divided)
  • BASE_PRICE = 1e12 wei (0.000001 ETH at supply 0)
  • SLOPE = 1e6 wei per token (price grows as supply grows)

Reserve Invariant

The contract ETH balance always equals the area under the curve:

reserve(s) = BASE_PRICE Γ— s + SLOPE Γ— sΒ² / 2

This invariant is enforced by the buy/sell math, not by admin controls.

Buy Formula (Quadratic)

Given ethForReserve (ETH after 1% fee is deducted), tokens minted x satisfy:

SLOPE/2 Β· xΒ²  +  B Β· x  βˆ’  ethForReserve = 0

x = (√(BΒ² + 2 Β· SLOPE Β· ethForReserve) βˆ’ B) / SLOPE

where B = BASE_PRICE + SLOPE Γ— currentSupply is the current spot price.
The discriminant is computed at full 256-bit precision β€” no premature WAD division β€” preventing catastrophic cancellation on small trades.

Sell Formula

Selling x tokens returns gross = reserve(s) βˆ’ reserve(s βˆ’ x), less 1% fee.

Graduation

if reserve >= 10 ETH:
    anyone can call graduate()
    β†’ addLiquidityETH(reserve, freshMintedTokens) to Uniswap V2
    β†’ LP tokens sent to 0x000...dEaD (burned, permanent lock)
    β†’ buy() and sell() revert forever

Deployed Contracts

V2 (Active) β€” Base Mainnet

Field Value
TokenFactory 0x6EF504b98b4369C0a1aF4fD1885D7acCf843dDf6
Deployer 0xD034E94465Db1669f80D817c66e58cF194d027C8
Deploy TX 0x85681...3df05
Block 49276726
Verified βœ… Basescan

V1 (Deprecated)

0x479596943e70316A0d893De1876EBeA1Ea8E4D5B β€” block 44809260, no graduation support.


Getting Started

Prerequisites

Install

git clone https://github.com/agunnaya001/curvepad
cd curvepad
pnpm install

Run the frontend

pnpm --filter @workspace/curvepad run dev
# β†’ http://localhost:5173

Run the API server

pnpm --filter @workspace/api-server run dev
# β†’ http://localhost:3001/api

Environment variables

Create a .env file (never commit it):

# Required for image upload (Replit Object Storage)
DEFAULT_OBJECT_STORAGE_BUCKET_ID=your-bucket-id
PRIVATE_OBJECT_DIR=your-private-dir
PUBLIC_OBJECT_SEARCH_PATHS=your-public-paths

# Required for the API server session
SESSION_SECRET=your-session-secret

# Required for contract deployment
PRIVATE_KEY=your-deployer-private-key
BASESCAN_API_KEY=your-basescan-key

Deploy a new contract

cd contracts/foundry
forge script script/DeployV2.s.sol \
  --rpc-url https://mainnet.base.org \
  --private-key $PRIVATE_KEY \
  --broadcast \
  --verify \
  --etherscan-api-key $BASESCAN_API_KEY \
  -vv

Then update FACTORY_ADDRESS in artifacts/curvepad/src/lib/web3.ts.

Regenerate API client

After editing lib/api-spec/openapi.yaml:

pnpm --filter @workspace/api-spec run codegen

Testing

Run all Foundry tests

cd contracts/foundry
forge test -v

20 tests, all passing:

# Test Coverage
1 test_createToken Factory deploys correctly
2 test_buyReturnsNonTrivialTokens Buy mints tokens
3 test_buyRequiresPayment Buy reverts with no ETH
4 test_sellReturnsETH Sell returns ETH
5 test_sellRevertsOnInsufficientBalance Sell guard
6 test_reserveInvariantAfterBuy Reserve math
7 test_reserveInvariantAfterSell Reserve math
8 test_creatorFeeIsDeducted 1% fee routing
9 test_multipleTokensIndependent Factory isolation
10 test_buyAndSellRoundTrip Round-trip fidelity
11 test_graduateRevertsBeforeThreshold Threshold guard
12 test_graduateSucceedsAtThreshold State transition
13 test_buyBlockedAfterGraduation Post-grad lock
14 test_sellBlockedAfterGraduation Post-grad lock
15 test_graduateOnlyOnce Double-graduate guard
16 test_getGraduationInfoProgress Progress BPS
17 test_ethFullyDrainedAfterGraduation ETH β†’ Uniswap
18 test_lpBurnedToDeadAddress LP burn verification
19 test_anyoneCanGraduate Permissionless graduation
20 test_fullGraduationLifecycle End-to-end lifecycle

Run specific tests

# Graduation tests only
forge test --match-test "graduation\|Graduate\|Graduated" -v

# With gas reporting
forge test --gas-report

Typecheck (TypeScript)

pnpm run typecheck

API Reference

The API server runs at /api. Full spec: lib/api-spec/openapi.yaml.

Token Metadata

Method Path Description
GET /api/tokens List all token metadata records
GET /api/tokens/:address Get metadata for a token
POST /api/tokens Save token metadata (called after deploy)

Image Storage

Method Path Description
POST /api/storage/uploads/request-url Get presigned GCS URL for image upload
GET /api/storage/objects/:path Serve an uploaded image

Upload flow:

  1. POST /api/storage/uploads/request-url with { name, size, contentType } β†’ returns { uploadURL, objectPath }
  2. PUT the file directly to uploadURL (direct to GCS, no server roundtrip)
  3. Store objectPath and display via GET /api/storage/objects/:path

Security

Concern Mitigation
Reentrancy ReentrancyGuard on buy() and sell()
State ordering CEI pattern β€” all state mutations before external calls
Admin risk No owner, no pause, no upgrade proxy
Reserve solvency Reserve invariant enforced by math, not governance
Precision 256-bit discriminant; no WAD division before sqrt
LP rug LP tokens burned to 0x000...dEaD on graduation
Overflow Checked arithmetic (Solidity 0.8.x default)

The contracts are not audited. Use at your own risk on mainnet.


Contributing

See CONTRIBUTING.md for development setup, code style, and PR guidelines.


License

MIT β€” Β© 2024 CurvePad contributors.


Built on Base Β· Powered by Foundry Β· Deployed with Replit

About

is a fully on-chain, permissionless token launchpad built on Base, powered by deterministic bonding curve mechanics instead of traditional liquidity pools

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages