Skip to content

Kingscliq/fundstar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FundStar is a Soroban smart contract for creating and reading crowdfunding campaigns.

🌐 Live Deployment

fundstar.vercel.app

This repository includes helper scripts so users can run the project without manually typing long CLI commands.

Prerequisites

  1. Rust + Cargo installed
  2. Stellar CLI installed (stellar --version)
  3. Wasm target installed:
rustup target add wasm32v1-none
  1. A Stellar testnet identity (example name: fundstar)
stellar keys generate fundstar
stellar keys fund fundstar --network testnet

Project Scripts

scripts/contract.sh

Used for test/build/deploy.

./scripts/contract.sh test
./scripts/contract.sh build
./scripts/contract.sh deploy
./scripts/contract.sh all

Defaults used by this script:

  1. NETWORK=testnet
  2. SOURCE_ACCOUNT=fundstar
  3. ALIAS=fundstar_contract

Override them per command if needed:

NETWORK=testnet SOURCE_ACCOUNT=fundstar ALIAS=fundstar_contract ./scripts/contract.sh all

scripts/invoke.sh

Used to invoke contract functions.

It expects:

  1. CONTRACT_ID (required)
  2. NETWORK (optional, default testnet)
  3. SOURCE_ACCOUNT (optional, default fundstar)

The script auto-loads .env if present.

Quick Start (Recommended)

  1. Copy environment template:
cp .env.example .env
  1. Open .env and set your deployed contract id:
CONTRACT_ID=CXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
NETWORK=testnet
SOURCE_ACCOUNT=fundstar
  1. Run full contract flow:
./scripts/contract.sh all
  1. Invoke contract methods:
./scripts/invoke.sh get_campaign_count
./scripts/invoke.sh get_all_campaigns
./scripts/invoke.sh get_campaign --campaign_id 0

Create Campaign Example

Set a future deadline (30 days from now) and create a campaign:

DEADLINE=$(( $(date +%s) + 2592000 ))

./scripts/invoke.sh create_campaign \
  --creator fundstar \
  --name "FundStar Demo Campaign" \
  --description "First campaign created via script" \
  --goal 1000000 \
  --deadline "$DEADLINE"

Read Methods

Get number of campaigns:

./scripts/invoke.sh get_campaign_count

Get one campaign by id:

./scripts/invoke.sh get_campaign --campaign_id 0

Get all campaigns:

./scripts/invoke.sh get_all_campaigns

Troubleshooting

Missing CONTRACT_ID

  1. Confirm .env exists in project root
  2. Confirm .env contains a valid CONTRACT_ID=C...
  3. Ensure no trailing characters in the id

Check quickly:

cat .env

Wrong network or wrong contract id

Make sure deploy and invoke use the same network (testnet).

Contract changed but behavior is old

You likely deployed an old Wasm artifact. Re-run:

./scripts/contract.sh all

Level 2 Submission Details

This project fulfills all requirements for the FundStar Level 2 bounty.

βœ… Submission Checklist

  • 3 error cases handled: CampaignNotFound, GoalNotReached, and token-level insufficient-balance failures surfaced through transaction simulation/submission.
  • Contract deployed on testnet: Live at CDZIHKUBUJ3F6W6E2NRWP5JZXNBZP4O4PASBRQGW4FODFWK6I3PTDWE7.
  • Contract called from the frontend: Integrated using stellar-sdk and signature-based transactions.
  • Transaction status visible: Real-time toast notifications for preparation, signing, submission, and finalization.
  • Minimum 2+ meaningful commits: Multiple logical commits covering contract logic, frontend integration, and multi-wallet support.
  • Multi-wallet support: Wallet selector includes both Freighter and Albedo, with Freighter wired as the primary signing flow.
  • Real-time activity feed: Implemented getCampaignEvents to stream contract events for live contribution updates.

πŸ“œ Contract Information

  • Contract ID: CDZIHKUBUJ3F6W6E2NRWP5JZXNBZP4O4PASBRQGW4FODFWK6I3PTDWE7
  • Reward Token (STAR): CBERWLOGNDQGNCAJIF44D46HQ3PP5LAKO3FXIGZQJODRS3RCC7CZKTRD
  • Configured From: frontend/.env
  • Network: Stellar Testnet
  • Native XLM SAC: CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC
  • RPC Endpoint: https://soroban-testnet.stellar.org

πŸ“Έ UI Proof & Screenshots

Here are my screenshots for UI proofs, showcasing the completed features and on-chain integrations:

1. Multi-Wallet Selector

Show the modal with Freighter and Albedo options. Multi-Wallet Selector

2. Live Activity Feed

Capture the "Activity" tab on a campaign page showing real on-chain contributions. Live Activity Feed

3. Transaction Status

Demonstrate the real-time feedback (Toasts) during the funding process. Transaction Status

4. Creator Dashboard

Show the withdrawal controls visible only to the campaign owner once the goal is reached. Creator Dashboard

5. Wallet Connection

Proof of successful wallet connection (Freighter) and account authorization. Wallet Connected

6. Smart Contract Test Output

Verified results showing the Rust contract test suite passing in the local development environment. Smart Contract Test Output

πŸš€ Key Features

  • Zero-Lag Caching: In-memory caching for instantaneous navigation and zero-lag transition between pages.
  • High-Fidelity Skeletons: Standardized skeleton loaders for a smooth, professional loading experience.
  • Dynamic Activity Feed: Real-time updates for on-chain contributions using contract events.
  • Smart Wallet Routing: Wallet chooser supports both Freighter and Albedo entry paths, with Freighter used for the main signed transaction flow.
  • Creator Controls: Role-based access for campaign creators to withdraw funds once goals are reached.

🟠 Level 3 - Orange Belt Submission

FundStar has been upgraded to meet the high standards of the Level 3 (Orange Belt) graduation.

βœ… Level 3 Requirements

  • Mini-dApp fully functional: Deployed and tested on Stellar Testnet.
  • Minimum 3 tests passing: 15 comprehensive contract tests passing (see below).
  • Loading states and progress indicators: Implemented high-fidelity Skeleton Loaders for all data grids and detail views.
  • Basic caching implementation: Integrated a Zero-Lag Caching Layer in the frontend for instantaneous navigation.
  • README complete: Documentation, test results, CI proof, and mobile screenshots included.

πŸŽ₯ Demo Video

Watch the 1-minute demo video

πŸ§ͺ Test Output (15 Passing)

FundStar uses a robust testing suite in Rust to ensure the safety of all crowdfunding operations.

running 15 tests
test tests::test_create_campaign_current_time_deadline ... ok
test tests::test_create_campaign_invalid_goal_zero ... ok
test tests::test_get_campaign_count_empty ... ok
test tests::test_create_campaign_deadline_too_far ... ok
test tests::test_create_campaign_invalid_goal_negative ... ok
test tests::test_get_all_campaigns_empty ... ok
test tests::test_get_nonexistent_campaign ... ok
test tests::test_create_campaign_success ... ok
test tests::test_campaign_initial_state ... ok
test tests::test_get_all_campaigns_returns_all_in_order ... ok
test tests::test_multiple_campaigns_sequential_ids ... ok
test tests::test_fund_campaign_success ... ok
test tests::test_withdraw_fails_if_goal_not_reached ... ok
test tests::test_withdraw_funds_success ... ok
test tests::test_reward_minting_on_funding ... ok

test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s

🟒 Level 4 - Green Belt Submission

FundStar has been upgraded with advanced inter-contract patterns and production-ready CI/CD infrastructure.

FundStar CI

βœ… Level 4 Requirements

  • Inter-contract call working: FundStar now mints STAR tokens via the Reward Token contract.
  • Custom token deployed: The STAR Loyalty Token (SAC interface) is live.
  • CI/CD running: GitHub Actions pipeline active for automated testing and builds.
  • Mobile responsive: UI fully optimized for mobile devices.
  • Advanced event streaming: Real-time contribution tracking via on-chain event indexing.

⛓️ Advanced Contract Details

  • Main Contract: CDZIHKUBUJ3F6W6E2NRWP5JZXNBZP4O4PASBRQGW4FODFWK6I3PTDWE7
  • Reward Token (STAR): CBERWLOGNDQGNCAJIF44D46HQ3PP5LAKO3FXIGZQJODRS3RCC7CZKTRD
  • Native XLM SAC: CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC
  • Deployment Source of Truth: frontend/.env
  • Reward Minting Proof: Verified by the test_reward_minting_on_funding contract test and the frontend STAR balance integration.

πŸ“± Mobile UI Proof

These mobile screenshots demonstrate that FundStar remains usable across key flows on a narrow viewport:

1. Home Page

Responsive hero layout, CTA stacking, and mobile-safe stats card. Mobile Home Page

2. Create Campaign Flow

Mobile-friendly form spacing and adaptive input layout for campaign creation. Mobile Create Campaign

3. Wallet Selector Modal

Responsive wallet connection modal with touch-friendly actions. Mobile Wallet Modal

4. Active Campaigns View

Scrollable card layout and campaign browsing optimized for smaller screens. Mobile Active Campaigns

5. Campaign Detail View (Dark Mode)

Responsive campaign detail layout showing that the mobile experience also holds up in dark theme. Mobile Campaign Detail Dark Mode

πŸš€ Key Features (Level 4)

  • Loyalty Reward System: Automated inter-contract minting of STAR tokens for every backer.
  • Automated QA: Every push is verified by GitHub Actions (Rust tests + Next.js build).
  • Production Persistence: Persistent session caching and optimized mobile layout.

Security Notes

  1. Commit scripts (scripts/contract.sh, scripts/invoke.sh)
  2. Do not commit .env with secrets
  3. Keep private keys and seed phrases out of repository files

About

A smart contract for crowdfunding and donations for charitable campaigns

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors