This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
cargo test --workspace # Run all 33 contract tests
cargo test -p workspace # Run tests for one contract (workspace, milestone, or rewards)
cargo test -p milestone -- test_name # Run a single test by name
cargo fmt --all -- --check # Check formatting
cargo clippy --workspace --all-targets # Lint
stellar contract build # Build optimized WASM binariescd frontend
pnpm install --frozen-lockfile # Install deps
pnpm dev # Dev server at localhost:5173
pnpm build # Type-check (tsc -b) + production build
pnpm lint # ESLintLernza is a learn-to-earn platform on Stellar. A creator makes a Quest, enrolls learners, sets milestones with token rewards. Completed milestones trigger on-chain token distribution. There is no backend — all state lives on Stellar's ledger.
Each contract is #![no_std], compiled to WASM, and has its own lib.rs + test.rs:
- workspace (being renamed to quest) — Quest creation, enrollee management, stores
WorkspaceInfoand enrollee lists. Auto-incrementing IDs viaNextIdcounter. - milestone — Milestone definition per workspace, owner-verified completion tracking. Caches workspace owner on first milestone creation for auth. Returns
reward_amounton verification so frontend can trigger rewards. - rewards — SAC-based token pools.
fund_workspace()deposits tokens (funder becomes authority),distribute_reward()transfers from pool to enrollee. Usessoroban_sdk::token::Clientfor transfers.
Contract patterns:
- Auth:
address.require_auth()+ storage-based ownership checks - Storage tiers: Instance (counters/config), Persistent (entities/auth)
- TTL bumping:
BUMP = 518_400(~30 days),THRESHOLD = 120_960(~7 days) - No cross-contract calls — frontend orchestrates the flow between contracts
- No router library — URL-based routing in
App.tsxviapushState/popstate - Path alias:
@/maps tosrc/(configured invite.config.ts) hooks/use-wallet.ts— Freighter wallet integration (@stellar/freighter-api)components/ui/— shadcn/ui components (button, card, badge, progress)pages/— Landing, Dashboard, Workspace, Profilelib/mock-data.ts— Mock data (contracts not wired to frontend yet)
- Conventional Commits required for PR titles (enforced by CI):
feat:,fix:,docs:,refactor:,test:,chore:,ci:,build:,perf:,style:,revert: - PRs require at least one label from the project's label set
- Frontend: TypeScript strict mode, no
anytypes, kebab-case filenames, Tailwind only (no CSS modules), prefer shadcn/ui components - Contracts:
cargo fmt, address clippy warnings, public functions returnResult<T, Error> - Deployment handled by Vercel (no deploy workflows in CI)
"Workspace" is being renamed to "Quest" throughout the codebase. The contract directory is contracts/workspace/ but the entity concept is "Quest." GitHub issues track this rename.