|
1 | 1 | # StackUp |
2 | 2 |
|
3 | | -Daily streaks on Stacks. Connect your wallet, claim once per day, and earn NFT badge milestones on-chain. |
4 | | - |
5 | | -## What It Does |
6 | | -- `claim()` once per day to build a streak. |
7 | | -- If you miss a day, your streak resets to `1`. |
8 | | -- Badge NFTs are minted automatically at milestone streaks (V2 supports multiple milestones). |
9 | | - |
10 | | -## Contracts |
11 | | -This repo contains two generations of the contract: |
12 | | -- `contracts/streak.clar` (V1): streak tracking + 7-day badge. |
13 | | -- `contracts/streak-v3.clar`: streak tracking + configurable badge milestones + token URIs for metadata. |
14 | | -- `contracts/streak-v3-1.clar`: redeploy name variant (when `streak-v3` is already taken). |
15 | | -- `contracts/streak-v3-2.clar`: redeploy name variant that also auto-mints the 1-day badge on the first claim (if `u1` URI is configured). |
16 | | -- `contracts/streak-v3-3.clar`: adds admin-configurable auto-mint milestones (`set-milestones`) + optional paid mint (`mint-paid-kind`) that accumulates fees in the contract (withdrawable). |
17 | | -- `contracts/streak-v3-4.clar`: same as v3-3, but paid mint fees go directly to a configurable `fee-recipient` wallet. |
18 | | -- `contracts/streak-v3-5.clar`: same as v3-4, but supports per-kind mint fees via `set-mint-fee-kind` / `get-mint-fee-kind` (fallbacks to global `mint-fee`). |
19 | | - |
20 | | -### Badge Metadata (IPFS) |
21 | | -V2 supports token metadata URIs via `set-badge-uri(kind, uri)`: |
22 | | -- Upload PNGs + metadata JSON files to IPFS (Pinata is fine). |
23 | | -- Set the `ipfs://...` metadata URI for each milestone kind (e.g. `3`, `7`, `14`, `30`). |
24 | | - |
25 | | -Metadata templates live in `metadata/`. |
26 | | - |
27 | | -## App |
28 | | -The frontend is a Next.js App Router project. |
29 | | - |
30 | | -Features: |
31 | | -- Leather wallet connect |
32 | | -- Claim transaction flow (`openContractCall`) |
33 | | -- Read-only on-chain state (streak, last-claim day, badge status) |
34 | | -- Light / dark theme |
35 | | -- Badge gallery (3 / 7 / 14 / 30) + custom milestone check/mint UI (V2) |
36 | | - |
37 | | -### Configuration (Frontend) |
38 | | -Set these Cloudflare Pages / local env vars: |
39 | | -- `NEXT_PUBLIC_STACKS_NETWORK` = `mainnet` or `testnet` |
40 | | -- `NEXT_PUBLIC_CONTRACT_ADDRESS` = `SP...` (mainnet) / `ST...` (testnet) |
41 | | -- `NEXT_PUBLIC_CONTRACT_NAME` = `streak`, `streak-v3`, `streak-v3-1`, `streak-v3-2`, `streak-v3-3`, `streak-v3-4`, or `streak-v3-5` |
42 | | - |
43 | | -If env vars are not set, the app falls back to defaults inside `app/ClientPage.tsx`. |
| 3 | + |
44 | 4 |
|
45 | | -## Development |
46 | | -Requirements: |
47 | | -- Node.js + npm |
| 5 | +StackUp is a Stacks dApp for building daily momentum: claim once per day, grow your streak, and unlock on-chain badge NFTs at milestone days. |
48 | 6 |
|
49 | | -Install + run: |
| 7 | +**What You Get** |
| 8 | +- Leather wallet connect |
| 9 | +- One-tap daily `claim` transaction |
| 10 | +- On-chain reads: current streak, last claim day, owned badges |
| 11 | +- Milestone badge gallery (1 / 3 / 7 / 14 / 30 by default) |
| 12 | +- Owner-only admin panel (hidden behind 7 logo taps) for milestones + metadata URIs |
| 13 | + |
| 14 | +## Live Contract (Mainnet) |
| 15 | +Default app target: |
| 16 | +- `SP2022VXQ3E384AAHQ15KFFXVN3CY5G57HWCCQX23.streak-v3-5` |
| 17 | + |
| 18 | +## How Badges Work |
| 19 | +Badge NFTs are minted automatically by the contract when a streak milestone is reached. |
| 20 | + |
| 21 | +Badge art lives off-chain (IPFS) and is referenced by an on-chain token URI. |
| 22 | +- Upload PNG + metadata JSON to IPFS (Pinata is fine). |
| 23 | +- Set the URI on-chain via the admin function `set-badge-uri(kind, uri)`. |
| 24 | +- When a user hits that milestone, the contract mints the NFT and the wallet/explorer can resolve the token URI. |
| 25 | + |
| 26 | +Metadata templates: |
| 27 | +- `metadata/` |
| 28 | + |
| 29 | +## Smart Contracts |
| 30 | +Stacks contracts are immutable. This repo keeps versioned contract files so you can deploy a new name when you iterate. |
| 31 | + |
| 32 | +Current contract (recommended): |
| 33 | +- `contracts/streak-v3-5.clar` |
| 34 | + |
| 35 | +History: |
| 36 | +- `contracts/streak.clar` (v1): streak + 7-day badge |
| 37 | +- `contracts/streak-v3.clar`: configurable badge milestones + token URIs |
| 38 | +- `contracts/streak-v3-1.clar`: redeploy name variant |
| 39 | +- `contracts/streak-v3-2.clar`: auto-mint 1-day badge on first claim (if `u1` URI is configured) |
| 40 | +- `contracts/streak-v3-3.clar`: admin-configurable milestones + optional paid mint (fees collected by contract) |
| 41 | +- `contracts/streak-v3-4.clar`: paid mint fees routed directly to a configurable `fee-recipient` |
| 42 | +- `contracts/streak-v3-5.clar`: per-kind mint fees (fallback to global fee) |
| 43 | + |
| 44 | +If a contract name is already taken on a network, deploy the next versioned name and point the frontend at it via env vars. |
| 45 | + |
| 46 | +## Contract Surface (High-Level) |
| 47 | +Read-only: |
| 48 | +- `get-streak(user)` |
| 49 | +- `get-last-claim-day(user)` |
| 50 | +- `get-owner(token-id)` and `get-token-uri(token-id)` (SIP-009-style) |
| 51 | + |
| 52 | +User actions: |
| 53 | +- `claim` (once per day, on-chain) |
| 54 | + |
| 55 | +Owner/admin actions: |
| 56 | +- `set-badge-uri(kind, uri)` (sets IPFS metadata URI for a badge kind) |
| 57 | +- `set-milestones(list-of-kinds)` (configures which streak days mint badges automatically) |
| 58 | +- `set-fee-recipient(principal)` (where paid mint fees are routed) |
| 59 | +- `set-mint-fee(microstx)` and `set-mint-fee-kind(kind, microstx)` (configures paid mint pricing) |
| 60 | +- `mint-paid-kind(kind)` (paid mint path, when enabled/configured) |
| 61 | + |
| 62 | +## Frontend Config |
| 63 | +Set these as Cloudflare Pages environment variables (or in a local `.env` file): |
| 64 | +- `NEXT_PUBLIC_STACKS_NETWORK`: `mainnet` or `testnet` |
| 65 | +- `NEXT_PUBLIC_CONTRACT_ADDRESS`: `SP...` (mainnet) or `ST...` (testnet) |
| 66 | +- `NEXT_PUBLIC_CONTRACT_NAME`: e.g. `streak-v3-5` |
| 67 | +- `NEXT_PUBLIC_SITE_URL`: your deployed site URL (used for absolute OG/Twitter tags) |
| 68 | + |
| 69 | +If not set, the app falls back to defaults in `app/ClientPage.tsx`. |
| 70 | + |
| 71 | +## Local Development |
50 | 72 | ```bash |
51 | 73 | npm install |
52 | 74 | npm run dev |
53 | 75 | ``` |
54 | 76 |
|
55 | 77 | Open `http://localhost:3000`. |
56 | 78 |
|
57 | | -## Scripts |
| 79 | +Quality checks: |
58 | 80 | ```bash |
59 | | -npm run dev |
60 | | -npm run build |
61 | | -npm run start |
62 | 81 | npm run lint |
63 | | -npm run test |
| 82 | +npm test |
| 83 | +npm run build |
64 | 84 | ``` |
65 | 85 |
|
66 | 86 | ## Deploy (Cloudflare Pages) |
67 | | -This project is configured for static export. |
68 | | - |
69 | | -Recommended Pages settings: |
| 87 | +This app is configured for static export (`next.config.ts` sets `output: "export"`). |
70 | 88 | - Build command: `npm run build` |
71 | 89 | - Build output directory: `out` |
72 | 90 |
|
73 | | -`wrangler.toml` is included for Pages configuration. |
| 91 | +## Share Preview (Open Graph) |
| 92 | +The share card image is `public/og.png` (1200x630). Regenerate it with: |
| 93 | +```bash |
| 94 | +node scripts/gen-og.mjs |
| 95 | +``` |
74 | 96 |
|
75 | 97 | ## Brand Assets |
76 | 98 | - Logos: `public/logo/` |
|
0 commit comments