Skip to content

Settle batch claims with actual token payouts #1198

Closed

Description

@greatest0fallt1me

Summary

batch_claim marks claims consumed and settled and returns total_claimed, but no token is configured and nothing is transferred to claimants.

Why this matters

Claimants authorize a transaction that tells them they were paid while their balance does not change; the design doc describes 'batch-collect' rewards.

Scope

Add a reward token (and funding source) at init, transfer each claimant's pending_amount during settlement after state updates, and check the contract balance covers the batch total up front.

Relevant code in CalloraOrg/Callora-Contracts:

  • contracts/batch_claim/src/lib.rs
  • contracts/batch_claim/docs/storage.md

Priority

Medium

Acceptance criteria

  • Each claimant receives exactly their pending amount
  • Insufficient contract balance fails before any state change
  • Events include token
  • Storage doc updated

Validation

cargo test -p callora-batch-claim

Non-goals

  • Typo-only, formatting-only, or cosmetic changes.
  • Unrelated refactors, dependency upgrades, or broad rewrites.
  • Removing safeguards or weakening validation to make tests pass.

Contributor application

Before coding, describe the affected modules, proposed state/invariant changes, test strategy, compatibility considerations, and an estimate. Wait for assignment before starting implementation.

PR requirements

Use a feature branch and include Closes #<issue-number>. Address every criterion, map criteria to code and tests, explain security and failure-mode handling, and ensure CI passes.

Quality review

A maintainer will assess correctness, completeness, test depth, compatibility, observability, and adverse-case handling. A substantive implementation is required; merge or CI status alone does not guarantee reward eligibility.


Generated by Claude Code

Activity

  1. changed the title [-]Keep leaderboard rank pages deterministic[/-] [+]Add focused test coverage for contracts/revenue_pool/src/test_balance.rs[/+] on Sep 27, 2026
  2. changed the title [-]Add focused test coverage for contracts/revenue_pool/src/test_balance.rs[/-] [+]Settle batch claims with actual token payouts[/+] on Sep 27, 2026
  3. Victorjonah-prog commented on Sep 29, 2026

    @Victorjonah-prog
    Contributor

    @Victorjonah-prog has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    hi maintainer, id love to work on this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Victorjonah-prog to this issue.

  4. Devadakene commented on Sep 30, 2026

    @Devadakene
    Contributor

    @Devadakene has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    I would like to work on this issue having worked on something similar issues in the past. Please assign

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Devadakene to this issue.

  5. Guddy1-tech commented on Sep 30, 2026

    @Guddy1-tech

    @Guddy1-tech has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hi! I'm a full-stack developer with a strong blockchain background. I'd love to handle this issue and can deliver a clean and reliable solution. Kindly assign it to me.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Guddy1-tech to this issue.

  6. Rodrigoue9 commented on Oct 3, 2026

    @Rodrigoue9

    Hi @maintainers! I'd like to work on this issue. Here is my proposed technical approach:

    Proposed Technical Approach:

    1. Contract Logic Implementation: Implement the required Soroban smart contract logic in Rust, ensuring strict validation, authorization checks (require_auth), and gas optimization.
    2. Storage Layout & State Management: Maintain safe data key patterns, TTL management, and prevent state inconsistency or unauthorized state mutations.
    3. Events & Error Encoding: Emit strongly typed contract events and return descriptive custom errors for all failure modes.
    4. Comprehensive Test Vectors: Implement Rust unit and integration tests using soroban-sdk::Env verifying both success and failure execution paths.

    Key Files:

    • contracts/**/src/lib.rs (contract entrypoints and interface implementations)
    • contracts/**/src/types.rs or storage.rs (types, data keys, and state)
    • contracts/**/src/test.rs (unit tests and integration vectors)

    Verification & Testing:

    • Run cargo test across all contract crates verifying 100% pass rate.
    • Run cargo clippy --all-targets -- -D warnings and cargo fmt --check.
    • Verify Soroban WASM build: soroban contract build.

    Relevant Track Record:

    I have successfully implemented and merged multiple production PRs across the Stellar ecosystem and Web3 open-source projects (e.g., Bitcoindefi/OpenAO #218, cybermax4200/stellar-did-credit #898 & #900, and FindMalek/sonaraem #416).

    Please feel free to assign this issue to me so I can proceed with the implementation. Thank you!

  7. rupesh-kumar-sah commented on Oct 7, 2026

    @rupesh-kumar-sah

    Hi team,

    Happy to tackle this. Here is how I plan to implement it:

    Solution overview:

    1. Audit storage layout and state invariants ensuring strict auth guards.
    2. Implement deterministic state transitions with safe checked arithmetic.
    3. Add hermetic unit and regression tests covering authorized, unauthorized, and boundary edge cases.
    4. Profile instruction and CPU/gas limits under Soroban host environment.

    Please assign this to me if the plan looks good. Thanks!

  8. devprom6 commented on Oct 15, 2026

    @devprom6
    Contributor

    @devprom6 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    I'd like to take this issue. It covers an important part of the project, and I want to contribute something that fits the existing architecture and development standards and holds up over time.

    I've worked across backend and frontend development, APIs, databases, testing, DevOps, and blockchain-based applications. I'm comfortable reading an unfamiliar codebase, tracking an issue down to its root cause, and writing clean fixes with tests that guard against regressions.

    My plan is to start by reading the existing implementation and project conventions, then build the solution in small, focused steps. I'll test the changes, document them where needed, and keep the code simple so nothing existing breaks. I'll also respond quickly to review feedback so the PR is easy to merge.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @devprom6 to this issue.

  9. spartan124 commented on Oct 16, 2026

    @spartan124

    @spartan124 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    I have solid experience writing and testing Soroban contracts in Rust, specifically around token transfers, state invariants, and event emission.
    Approach:

    1. Update contract initialization in contracts/batch_claim/src/lib.rs to configure and persist the reward token identifier.
    2. In batch_claim, pre-validate that the contract holds sufficient token balance before modifying any claim or settlement state.
    3. Execute standard Soroban token client transfers to disburse each claimant's pending_amount upon settlement.
    4. Include the token address in claim events and update contracts/batch_claim/docs/storage.md to document the new storage layout.
    5. Add comprehensive unit tests covering successful payouts and balance pre-check reverts (cargo test -p callora-batch-claim).
      ETA: 2–4 hours

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @spartan124 to this issue.

  10. lienhoatienphung-svg commented on Oct 16, 2026

    @lienhoatienphung-svg

    Hi! I have implemented and verified this in #1385 with full unit test coverage and rustfmt compliance.

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 WaveStellar Wave Program issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions