Skip to main content

4626.fun

4626.fun is a Base-native protocol + app stack for launching creator-centered vault economies. It combines ERC-4626 vaults, account abstraction, cross-chain OFT shares, and a fee-driven incentive layer for creator coins.

License: MIT Solidity LayerZero Tests

Quick Navigation

What This Repository Contains

4626 focuses on three outcomes:

  • Launch creator vault infrastructure from a single user flow (/deploy).
  • Route creator coin activity into vault and incentive mechanics.
  • Operate lifecycle + maintenance through automated keepers and API-driven workflows.

This monorepo includes:

  • Smart contracts (contracts/) for vaults, gauges, lottery, wrappers, OFT, and deploy infra.
  • Frontend app (frontend/) using Vite + React with local/Vercel API handlers.
  • CRE automation workflows (cre/) for tending, reporting, settlement, and queue operations.
  • Docusaurus docs site (apps/docs-site/) fed by docs/ content and generated references.

System Atlas

1) Architecture (Experience -> Control -> Protocol)

2) Deployment Lifecycle (Phased and Guarded)

Creator deployment is exposed as one user flow, but executed as guarded phases with deterministic addresses and prechecks.

3) Fee + Incentive Routing

The documented model applies a 6.9% trading fee to DEX trades (buy + sell), then routes proceeds through the gauge controller.

4) Omnichain Share Topology (Base Hub)

4626 is Base-hub-first with omnichain share transport via LayerZero V2 OFT.

Core Protocol Components

ComponentRole
CreatorRegistryCanonical registry of creator coin -> vault stack mappings and chain config
CreatorOVaultERC-4626 vault for creator coin deposits and strategy accounting
CreatorOVaultWrapperWraps vault shares into transportable OFT-compatible share form
CreatorShareOFTLayerZero V2 OFT share token with DEX-aware fee hooks
CreatorGaugeControllerReceives and routes trading-fee proceeds to downstream sinks
CreatorLotteryManagerExecutes lottery odds/payout flow with VRF randomness
CreatorOraclePrice and accounting inputs for vault/share mechanics
CreatorCCAStrategyCCA launch path and post-auction liquidity transition

Supported Chains (Current Configuration)

Source of truth: docs/chains.md.

NetworkChain IDLayerZero Endpoint IDStatus
Base845330184Hub chain
Ethereum130101Configured
Arbitrum4216130110Configured
BSC5630102Configured
Avalanche4311430106Configured
Monad1014330390Configured
Sonic14630332Configured
HyperEVM99930275Configured

Quick Start (Local Development)

Prerequisites

  • Node.js 20+
  • pnpm (root/frontend/docs)
  • npm (CRE package install and scripts)
  • Foundry (forge) for Solidity build/test

1) Clone and install

git clone https://github.com/wenakita/4626.git
cd 4626

# root
pnpm install

# frontend
pnpm -C frontend install

# docs (optional if app-only)
pnpm -C apps/docs-site install

# cre
npm --prefix cre install

2) Configure local env files

# root / contracts
cp .env.example .env

# frontend
cp frontend/.env.example frontend/.env

# cre
cp cre/secrets.example.env cre/.env

Keep real secrets in local env files or your deployment secret manager; do not commit secrets.

3) Run services

# app (default: http://localhost:5173)
pnpm -C frontend dev

# cre workflows (optional)
npm --prefix cre run start

# docs site (optional, default: http://localhost:3000)
pnpm -C apps/docs-site start

Testing and Build Commands

Common validation commands

SurfaceCommands
Frontendpnpm -C frontend test
pnpm -C frontend typecheck
pnpm -C frontend lint
CREnpm --prefix cre test
npm --prefix cre run typecheck
Contractsforge build
forge test -vvv
Frontend buildpnpm -C frontend build
Docs buildpnpm -C apps/docs-site build

Frontend Routes and API Surface

Primary frontend routes

RoutePurpose
/Landing and navigation entry
/deployCreator deployment and activation flow
/waitlistWaitlist onboarding path
/vault/:addressVault interaction surface
/dashboardLegacy redirect path
/launchLegacy redirect to deploy flow

API routing model

  • Production entrypoint: frontend/api/[...path].ts
  • Handler modules: frontend/api/_handlers/*
  • Local dev API mapping: frontend/vite.config.ts

Important bundling rule: register endpoints through static route mapping in frontend/api/_handlers/_routes.ts; do not rely on ad hoc dynamic imports for production handler inclusion.

Environment and Secrets

Core frontend/server variables (examples)

VariableScopePurpose
VITE_CDP_PAYMASTER_URLclientOptional paymaster/bundler override
CDP_PAYMASTER_URLserverPaymaster endpoint for server handlers
VITE_ZORA_PUBLIC_API_KEYclientPublic Zora integration key
ZORA_SERVER_API_KEYserverServer-side Zora API access
BASE_RPC_URLserverBase RPC URL for handlers/workflows
DATABASE_URLserverDatabase connectivity
AUTH_SESSION_SECRETserverAuth session signing secret
PRIVY_APP_ID / PRIVY_APP_SECRETserverPrivy integration keys

Core CRE variables (examples)

VariablePurpose
KEEPR_PRIVATE_KEYKeeper signer for workflow-triggered writes
KEEPR_API_BASE_URLTarget API base URL for keeper bridge
KEEPR_API_KEYAuth between CRE workflows and API

For complete env references, see frontend/README.md and cre/README.md.

Security and Invariants

  • Frontend API routing and auth boundaries are enforced in frontend/api + frontend/server/auth.
  • Wallet/account invariants are documented in .cursor/rules/ERC-4337-Wallet-Invariants.mdc.
  • Deploy/session ownership + creator access checks are enforced server-side before phased execution.
  • CRE automation uses an HTTP bridge pattern; write execution happens through audited API surfaces.

Documentation Map

  • Root docs index: docs/index.md
  • Narrative architecture model: docs/compressions/index.md
  • Primitive model (account/market/game loop): docs/primitives/index.md
  • Deployment operations: docs/operations/deployment/index.md
  • Current contract inventory: docs/current-contract-inventory.md
  • Security docs: docs/security/index.md
  • Frontend guide: frontend/README.md
  • CRE guide: cre/README.md

Cloud Agent Onboarding

Cursor Cloud Agent config is committed under .cursor/:

  • .cursor/environment.json
  • .cursor/install.sh
  • .cursor/start.sh
  • .cursor/sandbox.json

Runbook:

  • docs/operations/cursor-cloud-agent-onboarding.md

Repository Layout

PathPurpose
contracts/Protocol smart contracts and related components
script/Foundry scripts for deploy/ops
frontend/Vite React app + local/Vercel API handlers
cre/CRE workflow runners, scripts, and tests
apps/docs-site/Docusaurus documentation site
docs/Product, architecture, operations, and reference docs
deployments/Deployment artifacts and addresses

Contributing

  1. Branch from main.
  2. Keep changes scoped (contracts, frontend, CRE, docs).
  3. Run relevant tests before opening a PR.
  4. Include migration or ops notes when behavior changes.

License

MIT - AKITA, LLC