Skip to content

Feat/issue 259 deploy community factory - #285

Merged
Caneryy merged 3 commits into
stolla-labs:mainfrom
Oluwa-Laughter:feat/issue-259-deploy-community-factory
Aug 30, 2026
Merged

Feat/issue 259 deploy community factory#285
Caneryy merged 3 commits into
stolla-labs:mainfrom
Oluwa-Laughter:feat/issue-259-deploy-community-factory

Conversation

@Oluwa-Laughter

@Oluwa-Laughter Oluwa-Laughter commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Testnet Deployment Update

Extends scripts/deploy-testnet.sh to deploy and configure CommunityFactory on
Stellar testnet as outlined in ADR-005
and Plan N3.

Motivation and Problem

Previously, scripts/deploy-testnet.sh was constrained to the initial MVP
architecture:

  • It only deployed standalone community_nft and community_governor instances.
  • It did not upload contract WASM binaries or obtain approved WASM hashes.
  • It did not deploy CommunityFactory.
  • It omitted NEXT_PUBLIC_GOVERNOR_START_LEDGER, which is required for proposal
    event indexing.
  • It overwrote apps/web/.env.local with cat >, removing unrelated custom
    environment variables and comments.
  • It provided no dry-run testing support or explorer link output.

Key Changes

  1. WASM uploads: Upload approved community_nft.wasm and
    community_governor.wasm with stellar contract upload, capturing their
    SHA-256 hashes as NFT_WASM_HASH and GOV_WASM_HASH.

  2. CommunityFactory deployment: Deploy community_factory.wasm with the
    following constructor arguments:

    --owner "$DEPLOYER" \
    --nft_wasm_hash "$NFT_WASM_HASH" \
    --governor_wasm_hash "$GOV_WASM_HASH"
    
  3. Backward compatibility: Deploy default community_nft and
    community_governor instances so existing single-community fallback views
    (/community and /proposals) and health endpoints remain functional.

  4. Ledger capture: Query Soroban RPC getLatestLedger immediately after
    deployment to record NEXT_PUBLIC_GOVERNOR_START_LEDGER.

  5. Non-destructive .env.local update: Parse the existing
    apps/web/.env.local line by line, updating managed keys in place and
    appending new keys while preserving unrelated custom variables, comments,
    and whitespace. For example, preserve NEXT_PUBLIC_IPFS_GATEWAY_URL.

  6. Output and explorer links: Emit a formatted deployment table containing
    contract IDs, WASM hashes, deployment ledger, and direct Stellar Expert
    explorer links for every deployed contract and the deployer account.

  7. Dry-run and safe shell behavior: Support --dry-run, --network,
    --rpc-url, and --help flags with set -euo pipefail and identity
    validation.

  8. Automated test suite: Add scripts/deploy-testnet.test.mjs to verify
    command construction, argument passing, .env.local preservation, and
    dry-run execution. Wire the tests into the root npm test command.

  9. Documentation: Update README.md with the new deployment steps and
    --dry-run command options.

  10. Test doubles fix: Update outdated test mock references in the web app:
    stellar.ts, voteAggregation.test.ts, ProposalDetailPage.test.tsx,
    and the Vitest test runner configuration, so the web test suite passes
    cleanly.

Test Plan

1. Automated Tests

Run the workspace test suite and layout verification:

npm test && npm run check:workspace

Expected results:

  • Web tests: 64 test files passed, with 439 of 439 tests passing.
  • Script tests: 11 Node.js tests passed in
    scripts/check-production-health.test.mjs and
    scripts/deploy-testnet.test.mjs.
  • Workspace layout: validated by scripts/check-workspace-layout.mjs.

2. Dry-Run Command Construction Verification

Run the deployment script with --dry-run to verify CLI argument construction,
mock outputs, and non-destructive .env.local updates without broadcasting
transactions:

./scripts/deploy-testnet.sh --dry-run
./scripts/deploy-testnet.sh my-custom-identity --dry-run

3. Manual Live Testnet Deployment

Generate and fund a testnet identity, then run the deployment:

stellar keys generate deployer --network testnet
./scripts/fund-testnet.sh deployer
./scripts/deploy-testnet.sh deployer

Verify that:

  • apps/web/.env.local contains updated values for
    NEXT_PUBLIC_COMMUNITY_FACTORY_CONTRACT_ID,
    NEXT_PUBLIC_NFT_CONTRACT_ID, NEXT_PUBLIC_GOVERNOR_CONTRACT_ID, and
    NEXT_PUBLIC_GOVERNOR_START_LEDGER.
  • Existing variables in .env.local remain unaltered.
  • The terminal outputs the factory contract ID, WASM hashes, deployment ledger,
    and valid Stellar Expert testnet explorer links.

Checklist

  • [✓] Ran npm run lint and fixed warnings introduced by these changes.
  • [✓] Ran npm run build successfully.
  • [✓] Changes do not introduce new environment variables, secrets, or generated
    files.
  • UI changes include screenshots at mobile and desktop widths.
  • [✓] Contract changes include or update unit tests, and
    npm run test:contracts passes.

…lla-labs#259)

- Upload approved community_nft and community_governor WASM to testnet
- Deploy CommunityFactory with owner and approved WASM hashes
- Deploy default community NFT and Governor instances for fallback routes
- Capture deployment ledger sequence from Soroban RPC
- Update apps/web/.env.local preserving unrelated variables and comments
- Display contract IDs, WASM hashes, deploy ledger, and Stellar Expert explorer links
- Add --dry-run option for testability and offline command verification
- Add scripts/deploy-testnet.test.mjs automated test suite and wire into npm test
- Update README with new deploy flow, parameters, and dry-run usage
- Fix broken test mock references in web workspace so npm test passes cleanly
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@Oluwa-Laughter is attempting to deploy a commit to the caneryy's projects Team on Vercel.

A member of the Team first needs to authorize it.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Caneryy
Caneryy merged commit bafe8ef into stolla-labs:main Aug 30, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants