diff --git a/CONTRACT_VERSIONS.md b/CONTRACT_VERSIONS.md index 6d92b2b5..6c2211bf 100644 --- a/CONTRACT_VERSIONS.md +++ b/CONTRACT_VERSIONS.md @@ -6,13 +6,13 @@ | Version | Contract Name | Address | Status | Deployment Date | |---------|---------------|---------|--------|----------------| -| v1 | `sprintfund-core` | `SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core` | **ACTIVE** | Initial deployment | -| v3 | `sprintfund-core-v3` | `SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core-v3` | Deployed | - | +| v1 | `sprintfund-core` | `SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core` | Deprecated | Initial deployment | +| v3 | `sprintfund-core-v3` | `SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core-v3` | **ACTIVE** | Current production version | ### Active Contract **The frontend and all production systems currently use:** -- Contract: `SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core` +- Contract: `SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core-v3` - Network: Mainnet ## Version Differences @@ -26,7 +26,7 @@ ### v3 (sprintfund-core-v3) - Enhanced version with improvements - May include bug fixes or feature enhancements -- **Note**: Currently deployed but not in active use by frontend +- **Note**: Currently the active production contract ## Versioning Strategy @@ -56,7 +56,7 @@ All contract references use centralized configuration: ```typescript export const CONTRACT_ADDRESS = 'SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T'; -export const CONTRACT_NAME = 'sprintfund-core'; +export const CONTRACT_NAME = 'sprintfund-core-v3'; export const CONTRACT_PRINCIPAL = `${CONTRACT_ADDRESS}.${CONTRACT_NAME}`; ``` @@ -97,10 +97,10 @@ When ready to switch to a new version: ## Current Status -**Frontend is using**: `sprintfund-core` (v1) +**Frontend is using**: `sprintfund-core-v3` (v3) -**Recommendation**: The v3 contract exists but is not in active use. Before switching: -1. Document specific improvements in v3 +**Recommendation**: The v3 contract is now in active use. Future migrations should: +1. Document specific improvements in newer versions 2. Test thoroughly 3. Create migration plan if state needs to be preserved 4. Update all references using the checklist above diff --git a/Clarinet.toml b/Clarinet.toml index 9cc18a8a..5a3d421c 100644 --- a/Clarinet.toml +++ b/Clarinet.toml @@ -5,6 +5,10 @@ authors = [] telemetry = false cache_dir = "./.cache" +[contracts.sprintfund-core-v3] +path = "contracts/sprintfund-core-v3.clar" +epoch = "latest" + [contracts.sprintfund-core] path = "contracts/sprintfund-core.clar" epoch = "latest" @@ -32,3 +36,4 @@ check_checker = { trusted_sender = false, trusted_caller = false, callee_filter # warning, if it gets checked inside. This check will also propagate up to the # caller. # More informations: https://www.hiro.so/blog/new-safety-checks-in-clarinet +# v3 moved to top diff --git a/NETWORK_CONFIG.md b/NETWORK_CONFIG.md index 7e6e09c9..551ab53e 100644 --- a/NETWORK_CONFIG.md +++ b/NETWORK_CONFIG.md @@ -29,7 +29,7 @@ SprintFund supports both Stacks Mainnet and Testnet environments via environment ### `NEXT_PUBLIC_CONTRACT_NAME` - **Type:** String -- **Default:** `sprintfund-core` +- **Default:** `sprintfund-core-v3` - **Description:** The contract name (optional) ### `NEXT_PUBLIC_STACKS_API_URL` @@ -45,14 +45,14 @@ SprintFund supports both Stacks Mainnet and Testnet environments via environment ```bash NEXT_PUBLIC_NETWORK=mainnet NEXT_PUBLIC_CONTRACT_ADDRESS=SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T -NEXT_PUBLIC_CONTRACT_NAME=sprintfund-core +NEXT_PUBLIC_CONTRACT_NAME=sprintfund-core-v3 ``` ### Testnet (Development) ```bash NEXT_PUBLIC_NETWORK=testnet NEXT_PUBLIC_CONTRACT_ADDRESS=ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM -NEXT_PUBLIC_CONTRACT_NAME=sprintfund-core +NEXT_PUBLIC_CONTRACT_NAME=sprintfund-core-v3 ``` ## Testing Network Switching diff --git a/README.md b/README.md index 86a14ee5..e8f87f95 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ SprintFund is a decentralized autonomous organization (DAO) designed to fund sma **Status**: ✅ **Live on Stacks Mainnet** -**Contract Address**: `SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core` +**Contract Address**: `SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core-v3` -**Explorer**: [View on Stacks Explorer](https://explorer.hiro.so/txid/SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core?chain=mainnet) +**Explorer**: [View on Stacks Explorer](https://explorer.hiro.so/txid/SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core-v3?chain=mainnet) ## Key Features @@ -90,7 +90,7 @@ See [frontend/README.md](frontend/README.md) for local development setup. ``` sprintfund/ ├── contracts/ -│ └── sprintfund-core.clar # Main DAO contract +│ └── sprintfund-core-v3.clar # Main DAO contract ├── frontend/ │ ├── app/ │ │ └── page.tsx # Landing page @@ -200,4 +200,4 @@ MIT License - see [LICENSE](LICENSE) for details. **Built with ❤️ on Stacks Blockchain** -🔗 [GitHub](https://github.com/Mosas2000/SprintFund) | 📊 [Contract Explorer](https://explorer.hiro.so/txid/SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core?chain=mainnet) +🔗 [GitHub](https://github.com/Mosas2000/SprintFund) | 📊 [Contract Explorer](https://explorer.hiro.so/txid/SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core-v3?chain=mainnet) diff --git a/create-test-proposal.sh b/create-test-proposal.sh index c422e9e5..6a18adab 100755 --- a/create-test-proposal.sh +++ b/create-test-proposal.sh @@ -5,7 +5,7 @@ # Contract details CONTRACT_ADDRESS="SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T" -CONTRACT_NAME="sprintfund-core" +CONTRACT_NAME="sprintfund-core-v3" FUNCTION_NAME="create-proposal" # Proposal parameters diff --git a/deployments/default.mainnet-plan.yaml b/deployments/default.mainnet-plan.yaml index d3e60757..3ff421ef 100644 --- a/deployments/default.mainnet-plan.yaml +++ b/deployments/default.mainnet-plan.yaml @@ -9,10 +9,10 @@ plan: - id: 0 transactions: - contract-publish: - contract-name: sprintfund-core + contract-name: sprintfund-core-v3 expected-sender: SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T cost: 80580 - path: contracts/sprintfund-core.clar + path: contracts/sprintfund-core-v3.clar anchor-block-only: true clarity-version: 3 - contract-publish: diff --git a/deployments/default.simnet-plan.yaml b/deployments/default.simnet-plan.yaml index 209b6cf3..b7a93b82 100644 --- a/deployments/default.simnet-plan.yaml +++ b/deployments/default.simnet-plan.yaml @@ -68,6 +68,11 @@ plan: emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM path: contracts/sprintfund-core.clar clarity-version: 3 + - emulated-contract-publish: + contract-name: sprintfund-core-v3 + emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM + path: contracts/sprintfund-core-v3.clar + clarity-version: 3 - emulated-contract-publish: contract-name: sprintfund-core-v2 emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM diff --git a/docs/MIGRATION_V3.md b/docs/MIGRATION_V3.md new file mode 100644 index 00000000..b162ba3e --- /dev/null +++ b/docs/MIGRATION_V3.md @@ -0,0 +1,48 @@ +# Migration Guide: Alignment with V3 Contract + +This document outlines the changes and migration steps for aligning the SprintFund frontend and associated scripts with the `sprintfund-core-v3` contract. + +## Rationale + +The SprintFund project has evolved with improved logic and bug fixes in the `v3` version of the core contract. To ensure users interact with the most secure and feature-rich version of the protocol, the frontend and all maintenance scripts have been updated to target `sprintfund-core-v3` by default. + +## Changes + +### 1. Frontend Configuration + +The default `CONTRACT_NAME` in `frontend/src/config.ts` has been updated: + +```typescript +// Previous +export const CONTRACT_NAME = process.env.NEXT_PUBLIC_CONTRACT_NAME || 'sprintfund-core'; + +// Current +export const CONTRACT_NAME = process.env.NEXT_PUBLIC_CONTRACT_NAME || 'sprintfund-core-v3'; +``` + +### 2. Kubernetes Configuration + +The `frontend/k8s/configmap.yaml` now points to the `.sprintfund-core-v3` principal for the `contract-address` key. + +### 3. Interaction Scripts + +All scripts in the `scripts/` directory have been updated to target the `v3` contract by default: +- `stake.js` +- `create-proposal.js` +- `scripts/README.md` (examples and documentation) + +### 4. Developer Environment + +The `frontend/.env.example` has been updated to reflect the new default. Developers should update their local `.env.local` files accordingly. + +## Migration Steps for Users + +Since the `v3` contract maintains compatibility with the core DAO traits, existing users can continue their journey seamlessly. However, if state (like active proposals or stakes) was not migrated on-chain, users may need to re-stake on the `v3` contract. + +1. **Check Stake**: Use the User Dashboard to verify your stake balance on the `v3` contract. +2. **Re-stake if necessary**: If your balance appears as 0, you may need to re-stake the minimum 10 STX to the new contract. +3. **Withdraw from V1**: Users with significant stake in the legacy `sprintfund-core` contract can use the provided `scripts/withdraw-legacy.js` (if provided) or interact directly with the old contract via the Stacks Explorer to recover their STX. + +## Verification + +To verify that you are interacting with the correct version, check the footer of the SprintFund application, which now displays the active contract identifier. diff --git a/frontend/.env.example b/frontend/.env.example index 5b078648..8a335de9 100644 --- a/frontend/.env.example +++ b/frontend/.env.example @@ -11,8 +11,8 @@ NEXT_PUBLIC_NETWORK=mainnet # Deployed contract address NEXT_PUBLIC_CONTRACT_ADDRESS=SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T -# Contract name (optional, defaults to sprintfund-core) -NEXT_PUBLIC_CONTRACT_NAME=sprintfund-core +# Contract name (optional, defaults to sprintfund-core-v3) +NEXT_PUBLIC_CONTRACT_NAME=sprintfund-core-v3 # Stacks API base URL (optional, auto-selected based on network) NEXT_PUBLIC_STACKS_API_URL=https://stacks-node-api.mainnet.stacks.co diff --git a/frontend/README.md b/frontend/README.md index 99c248e0..11ce0e7d 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -22,6 +22,16 @@ Modern Next.js frontend for the SprintFund DAO on Stacks blockchain. - Real-time data fetching from mainnet - In-app notification system for governance events +## V3 Contract Migration + +The SprintFund frontend is fully aligned with the `sprintfund-core-v3` contract. This version includes critical bug fixes and performance improvements. + +- **Active Contract**: `SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core-v3` +- **Migration Guide**: [MIGRATION_V3.md](../docs/MIGRATION_V3.md) +- **Status**: Production Ready + +Users with stakes in legacy contracts can find instructions in the migration guide on how to withdraw and re-stake in the active version. + ## Prerequisites - Node.js 18+ and npm @@ -49,7 +59,7 @@ Available environment variables: |----------|-------------|---------| | `NEXT_PUBLIC_NETWORK` | Stacks network (mainnet/testnet) | mainnet | | `NEXT_PUBLIC_CONTRACT_ADDRESS` | Contract deployer address | SP31PKQ... | -| `NEXT_PUBLIC_CONTRACT_NAME` | Contract name | sprintfund-core | +| `NEXT_PUBLIC_CONTRACT_NAME` | Contract name | sprintfund-core-v3 | For mainnet deployment, no environment changes are typically needed. @@ -111,7 +121,7 @@ frontend/ The frontend interacts with the deployed contract: -**Contract**: `SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core` +**Contract**: `SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core-v3` ### Read-Only Functions - `get-proposal-count()` - Fetch total proposals diff --git a/frontend/docs/DEPLOYMENT.md b/frontend/docs/DEPLOYMENT.md index 5182bc4b..fc73ac08 100644 --- a/frontend/docs/DEPLOYMENT.md +++ b/frontend/docs/DEPLOYMENT.md @@ -14,7 +14,8 @@ Create a `.env.local` file with the following variables: ```bash NEXT_PUBLIC_NETWORK=mainnet -NEXT_PUBLIC_CONTRACT_ADDRESS= +NEXT_PUBLIC_CONTRACT_ADDRESS=SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T +NEXT_PUBLIC_CONTRACT_NAME=sprintfund-core-v3 NEXT_PUBLIC_STACKS_API_URL=https://stacks-node-api.mainnet.stacks.co ``` diff --git a/frontend/docs/ENVIRONMENT.md b/frontend/docs/ENVIRONMENT.md index 8c08a957..4043e84f 100644 --- a/frontend/docs/ENVIRONMENT.md +++ b/frontend/docs/ENVIRONMENT.md @@ -8,6 +8,7 @@ This document describes all environment variables used by the SprintFund fronten |----------|-------------|---------| | `NEXT_PUBLIC_NETWORK` | Stacks network to connect to | `mainnet`, `testnet` | | `NEXT_PUBLIC_CONTRACT_ADDRESS` | Deployed contract address | `SP2...` | +| `NEXT_PUBLIC_CONTRACT_NAME` | Name of the contract | `sprintfund-core-v3` | | `NEXT_PUBLIC_STACKS_API_URL` | Stacks API endpoint | `https://stacks-node-api.mainnet.stacks.co` | ## Optional Variables @@ -27,6 +28,7 @@ Create `.env.local`: ```bash NEXT_PUBLIC_NETWORK=testnet NEXT_PUBLIC_CONTRACT_ADDRESS=ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM +NEXT_PUBLIC_CONTRACT_NAME=sprintfund-core-v3 NEXT_PUBLIC_STACKS_API_URL=https://stacks-node-api.testnet.stacks.co ``` @@ -37,6 +39,7 @@ Set environment variables in your deployment platform or create `.env.production ```bash NEXT_PUBLIC_NETWORK=mainnet NEXT_PUBLIC_CONTRACT_ADDRESS=SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9 +NEXT_PUBLIC_CONTRACT_NAME=sprintfund-core-v3 NEXT_PUBLIC_STACKS_API_URL=https://stacks-node-api.mainnet.stacks.co ``` diff --git a/frontend/k8s/configmap.yaml b/frontend/k8s/configmap.yaml index d8ab7ac1..1d49057e 100644 --- a/frontend/k8s/configmap.yaml +++ b/frontend/k8s/configmap.yaml @@ -6,5 +6,5 @@ metadata: app: sprintfund-frontend data: network: "mainnet" - contract-address: "SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core" + contract-address: "SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.sprintfund-core-v3" stacks-api-url: "https://stacks-node-api.mainnet.stacks.co" diff --git a/frontend/scripts/validate-deploy.sh b/frontend/scripts/validate-deploy.sh index bb6911aa..7dc3621c 100755 --- a/frontend/scripts/validate-deploy.sh +++ b/frontend/scripts/validate-deploy.sh @@ -30,6 +30,7 @@ echo "" echo "Required environment variables:" check_env_var "NEXT_PUBLIC_NETWORK" "true" check_env_var "NEXT_PUBLIC_CONTRACT_ADDRESS" "true" +check_env_var "NEXT_PUBLIC_CONTRACT_NAME" "true" check_env_var "NEXT_PUBLIC_STACKS_API_URL" "true" echo "" diff --git a/frontend/src/components/Footer.tsx b/frontend/src/components/Footer.tsx index 93c69a09..dda6ce3f 100644 --- a/frontend/src/components/Footer.tsx +++ b/frontend/src/components/Footer.tsx @@ -1,3 +1,5 @@ +import { CONTRACT_NAME } from '@/config'; + export function Footer() { return (