Skip to content

Implement Contract Analytics and Statistics #111

@RUKAYAT-CODER

Description

@RUKAYAT-CODER

Overview

Add functions to query platform-wide statistics including total quests, total rewards distributed, active users, etc.

Background

Analytics provide insights into platform growth and help with business intelligence.

Specifications

Modules to Create:

  • Platform statistics struct
  • Counter tracking
  • Aggregation functions

Tasks:

  • Track total quests created
  • Count total submissions
  • Calculate total rewards distributed
  • Track active user count
  • Implement get_platform_stats() function
  • Add per-creator statistics
  • Write comprehensive stats tests

Impacted Files:

  • contracts/earn-quest/src/stats.rs (new)
  • contracts/earn-quest/src/types.rs (update)
  • contracts/earn-quest/src/lib.rs (update)
  • contracts/earn-quest/src/storage.rs (update)
  • contracts/earn-quest/tests/test_stats.rs (new)

Labels: contract, analytics, statistics, priority-low

Acceptance Criteria

  • Platform-wide stats accurately tracked
  • Statistics updated on relevant actions
  • Query functions return correct data
  • Per-creator stats available
  • Counters increment atomically
  • All stat calculations tested

🙌Contribution Guidelines:

Assignment required before PR submission
Timeframe: 24-48 hours
PR description must include: Close #[issue-number]
Star the repo⭐
For more context, please refer to the contract README 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions