Skip to content

Transfer tokens in fee deposit and withdraw #1187

Closed

Description

@greatest0fallt1me

Summary

FeeContract::deposit only increments DataKey::Accumulated for any authenticated caller, and withdraw decrements it and emits fee_withdrawn without moving any token. The contract has no token address.

Why this matters

Anyone can inflate the accumulated fee counter, and withdrawals report payouts that never happen, so accounting built on these values is meaningless.

Scope

Store a fee token at init, make deposit pull amount from the caller via token::Client::transfer, and make withdraw push to the recipient. Restrict deposit callers to configured sources if needed.

Relevant code in CalloraOrg/Callora-Contracts:

  • contracts/fee/src/lib.rs
  • contracts/fee/src/errors.rs

Priority

High

Acceptance criteria

  • Deposit increases contract token balance and counter equally
  • Withdraw decreases both equally
  • Counter can never exceed token balance in tests
  • Token address exposed via a getter

Validation

cargo test -p callora-fee

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/registry/tests/overflow_safe.rs[/+] on Sep 27, 2026
  2. changed the title [-]Add focused test coverage for contracts/registry/tests/overflow_safe.rs[/-] [+]Transfer tokens in fee deposit and withdraw[/+] on Sep 27, 2026
  3. p70436464-prog commented on Sep 27, 2026

    @p70436464-prog

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

    I’d like to be assigned this issue. I’ll work on the implementation and make sure the changes are properly tested

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

  4. AkpakaProsper commented on Sep 29, 2026

    @AkpakaProsper

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

    I would love to contribute to this issue

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

  5. 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.

  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. shobhamerabacha-star commented on Oct 7, 2026

    @shobhamerabacha-star

    Hello maintainers,

    I am interested in taking up Transfer tokens in fee deposit and withdraw.

    Technical outline:

    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.

    Could you please assign this issue to me? Looking forward to delivering a clean PR.

  8. Bkizzy16 commented on Oct 15, 2026

    @Bkizzy16

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

    Please kindly assign me this issue.

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

  9. lienhoatienphung-svg commented on Oct 16, 2026

    @lienhoatienphung-svg

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

  10. Escelit commented on Oct 16, 2026

    @Escelit
    Contributor

    @Escelit 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 @Escelit to this issue.

  11. El-Khaleefa01 commented on Oct 16, 2026

    @El-Khaleefa01

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

    Dear maintainer
    Kindly assign me please

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

  12. Oluwanifemi18-ux commented on Oct 16, 2026

    @Oluwanifemi18-ux

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

    Hello, this issue caught my interest and I’ve taken time to understand its requirements. I’m ready to work on it and provide a quality result.

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

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