Shonen-Labs/Roster-Rumble

CONTRACT: Automated Prize Distribution

Open

#28 ouverte le 23 avr. 2025

Voir sur GitHub
 (0 commentaires) (0 réactions) (0 assignés)TypeScript (11 forks)auto 404
ODHack 14contractgood first issue

Métriques du dépôt

Stars
 (4 stars)
Métriques de merge PR
 (Métriques PR en attente)

Description

Title: Chainlink Automation Integration
Description
Create contract to trigger prize distribution via Chainlink Automation.

Acceptance Criteria:

  • Checks contest end time
  • Verifies all scores are finalized
  • Triggers PrizePool distribution
  • Emits PayoutExecuted event

Technical Details:

#[starknet::contract]
mod PayoutAutomation {
    #[storage]
    struct Storage {
        contests: LegacyMap<felt252, Contest>,
        merkle_root: felt252 // For score verification
    }

    #[external(v0)]
    fn check_upkeep(ref self: ContractState) -> bool {
        let contest = self.contests.read(contest_id);
        block_timestamp >= contest.end_time && 
        self.scores_finalized.read(contest_id)
    }

    #[external(v0)]
    fn perform_upkeep(ref self: ContractState, contest_id: felt252) {
        assert(self.check_upkeep(), 'Not ready');
        PrizePoolDispatcher { contract_address: PRIZE_POOL }
            .distribute_prizes(contest_id, self.merkle_root.read());
    }
}

Notes:

  • Implement Merkle proof verification
  • Add failed transaction handling
  • Test idempotent execution

Guide contributeur