Skip to content

batch_claim_reward does not append claim records to history -- get_claim_history is incomplete #502

Description

@DeFiVC

What

batch_claim_reward (learn-token lib.rs:717-780) does not call storage::append_claim_record() for each successful quiz claim. Compare with claim_reward (lib.rs:690-699) which appends a ClaimRecord after each successful claim.

This means get_claim_history(learner) returns an incomplete history -- rewards claimed via batch_claim_reward are missing.

// claim_reward -- appends record:
storage::append_claim_record(&env, &learner, &storage::ClaimRecord { ... }); // line 690

// batch_claim_reward -- no append_claim_record call:
storage::set_reward_claimed(&env, &learner, &course_id, &quiz_id); // line 769
events::reward_claimed(...); // line 770
successful.push_back(quiz_id); // line 771
// ... no append_claim_record

Why

get_claim_history is documented as returning the "Full reward claim history for a learner." But rewards claimed via batch are silently omitted. This breaks auditability and could confuse learners who claimed rewards via batch and see an incomplete history.

Scope

Add storage::append_claim_record() inside the batch loop (after line 770), matching the pattern in claim_reward.

Acceptance Criteria

  • get_claim_history returns all claims, including those from batch_claim_reward
  • Test verifies batch claims appear in history

Technical Context

  • contracts/learn-token/src/lib.rs:717-780 -- batch_claim_reward
  • contracts/learn-token/src/lib.rs:690-699 -- append_claim_record in claim_reward

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programbugSomething isn't workingmediumFunctionality impaired but workaround exists, edge case, partial featurerustRust language

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions