Skip to content

[QuestEngine] Add quest escrow budget tracking #96

Description

@Kaylahray

Description

Quest funding rules need explicit accounting for how much a quest has escrowed, how much has already been committed, and how much remains available for refunds or future approvals.

User Story

As the Learnault Protocol,
I want to track quest escrow consumption explicitly,
so that payouts, refunds, and boosted rewards cannot overrun the intended quest budget.

Requirements and Context

  • Files: contracts/quest-engine/src/lib.rs, contracts/quest-engine/src/types.rs, contracts/quest-engine/src/test.rs
  • Track quest funding, consumed payout amount, refunded amount, and remaining available escrow
  • Update the accounting when submissions are approved, boosted, batch-approved, or refunded
  • Use this accounting to enforce payout and refund eligibility

Suggested Implementation

// 1. Extend quest state with escrow accounting fields or add dedicated accounting storage.
// 2. Increment consumed amount on approval.
// 3. Decrement/close remaining amount on refund.
// 4. Validate that payouts cannot exceed available quest funding.

Acceptance Criteria

  • Quest payouts fail when the quest-specific budget is insufficient.
  • Refunds only return the actual unspent escrow balance.
  • Batch approvals update quest accounting consistently across all learners.

Submission Guidelines

  • Branch: feat/quest-escrow-accounting
  • Depends on: [QuestEngine] Deliver uncapped staking multiplier payouts, [QuestEngine] Build quest refund mechanism
  • PR: feat(quest-engine): add explicit escrow budget tracking

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions