Skip to content

[QuestEngine] Prevent duplicate Explore quest verification payouts #91

Description

@Kaylahray

Description

The Explore Quest verification flow should track whether a learner has already been paid for a specific Explore Quest, preventing accidental or malicious repeated admin-triggered payouts.

User Story

As the Learnault Protocol,
I want to ensure each Explore Quest payout is one-time per learner,
so that admin retries or replayed calls cannot duplicate reward distribution.

Requirements and Context

  • Files: contracts/quest-engine/src/lib.rs, contracts/quest-engine/src/types.rs, contracts/quest-engine/src/test.rs
  • Add storage that records Explore Quest verification per (learner, quest_id)
  • verify_explore_quest must revert if the learner was already verified for that quest
  • Preserve the current admin-only and QuestType::Explore checks

Suggested Implementation

// 1. Add a verification DataKey for (learner, quest_id).
// 2. Assert the key does not already exist before payout.
// 3. Call RewardPoolClient::distribute_reward.
// 4. Persist the verification marker after successful payout.

Acceptance Criteria

  • A learner can only be paid once per Explore Quest.
  • Repeated verification attempts revert cleanly.
  • Different learners on the same Explore Quest remain independently payable.

Submission Guidelines

  • Branch: feat/explore-verification-replay-guard
  • Depends on: [QuestEngine] Verify explore quest
  • PR: fix(quest-engine): prevent duplicate explore quest payouts

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions