Skip to content

Integrate Battle Results with VotingEngine and RewardDistributor #13

Description

@Mrwicks00

Description

Display battle results showing the top 3 winners, prize distribution, and NFT minting status on the battle results page.

Tasks

  • Create a custom hook useBattleResults(battleId) that:
    • Fetches top 3 memes using VotingEngine.getTop3(battleId)
    • Fetches meme details for each winner
    • Fetches prize pool distribution amounts
  • Display winners in podium format (1st, 2nd, 3rd place)
  • Show prize amounts distributed (50% / 30% / 20%)
  • Display winner NFT token IDs from WinningMemeNFT.tokenOfMeme(memeId)
  • Show winner addresses and meme IPFS images
  • Display vote weights for each winner
  • Handle battles with fewer than 3 winners
  • Show results only when battle is FINALIZED or ARCHIVED

Contract Functions Used

  • VotingEngine.getTop3(uint256) - Get top 3 meme IDs and vote weights
  • MemeRegistry.getMeme(uint256) - Get meme details for winners
  • WinningMemeNFT.tokenOfMeme(uint256) - Get NFT token ID for winning meme
  • BattleManager.getBattleState(uint256) - Verify battle is finalized

Files to Modify

  • frontend/app/battles/[id]/results/page.tsx
  • frontend/components/podium.tsx
  • frontend/hooks/useBattleResults.ts (new file)

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Fields

    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