Skip to content

Feature/campaign contract#29

Merged
ayshadogo merged 3 commits intoDfunder:mainfrom
LaGodxy:feature/campaign-contract
Mar 6, 2026
Merged

Feature/campaign contract#29
ayshadogo merged 3 commits intoDfunder:mainfrom
LaGodxy:feature/campaign-contract

Conversation

@LaGodxy
Copy link
Contributor

@LaGodxy LaGodxy commented Mar 6, 2026

🏗️ Core Features Implemented:

  1. Storage Management:

    • CAMPAIGN_MAP: Map for storing campaign data
    • CAMPAIGN_COUNT: Counter for total campaigns
  2. Data Structures:

    • Campaign tuple: (id, owner, goal, deadline, status, created_at)
    • CampaignStatus constants: Active (0), Completed (1), Cancelled (2), Expired (3)
  3. Contract Functions:

    • ✅ register_campaign(env, owner, goal, deadline) -> u64
    • ✅ get_campaign(env, campaign_id) -> Campaign
    • ✅ update_campaign_status(env, campaign_id, status)
    • ✅ get_campaign_count(env) -> u64
  4. Events:

    • ✅ CampaignRegistered: Emitted when new campaign is created
    • ✅ CampaignStatusUpdated: Emitted when campaign status changes

🔧 Technical Implementation:

  • Soroban Compatible: Uses tuples instead of custom structs for WASM compatibility
  • Proper Authentication: owner.require_auth() ensures only campaign owners can update status
  • Efficient Storage: Map-based storage with proper instance storage
  • Event System: Structured events for off-chain monitoring
  • Error Handling: Proper panic messages for invalid operations

✅ Verification:

  • WASM Compilation: Contract successfully compiles to wasm32-unknown-unknown target
  • Type Safety: All functions properly typed with Soroban SDK types
  • Storage Pattern: Follows established patterns from other contracts in project

📋 Acceptance Criteria Met:

  • ✅ Contract compiles to WASM
  • ✅ Campaign can be registered with unique ID
  • ✅ Campaign data can be retrieved from storage
  • ✅ Status updates work with proper authorization
  • ✅ Events are emitted for key operations

closes #26

@ayshadogo ayshadogo merged commit d2d7e0b into Dfunder:main Mar 6, 2026
3 checks passed
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.

Create Soroban Campaign Registry Contract

2 participants