Skip to content

Add Real-time Updates and Event Listening #17

Description

@Mrwicks00

Description

Implement real-time updates for battle states, meme submissions, votes, and prize pool changes using contract events.

Tasks

  • Set up event listeners for BattleManager events:
    • BattleCreated
    • BattleStateChanged
    • BattleArchived
  • Set up event listeners for MemeRegistry events:
    • MemeSubmitted
    • MemeVoteWeightUpdated
  • Set up event listeners for VotingEngine events:
    • VoteCast
    • Withdrawn
  • Set up event listeners for RewardDistributor events:
    • PrizePoolFunded
    • RewardDistributed
    • WinnersDeclared
  • Update UI automatically when events are detected
  • Use wagmi's useWatchContractEvent or useWatchContractRead for real-time updates
  • Implement polling fallback for environments where events aren't reliable

Contract Events Used

  • BattleManager.BattleCreated
  • BattleManager.BattleStateChanged
  • BattleManager.BattleArchived
  • MemeRegistry.MemeSubmitted
  • MemeRegistry.MemeVoteWeightUpdated
  • VotingEngine.VoteCast
  • VotingEngine.Withdrawn
  • RewardDistributor.PrizePoolFunded
  • RewardDistributor.RewardDistributed
  • RewardDistributor.WinnersDeclared

Files to Modify

  • All pages and components that display contract data
  • frontend/hooks/useContractEvents.ts (new file - utility for event listening)

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersnot-paidThis issue or pull request already exists

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions