Skip to content

feat(payment-escrow): Implement treasury with admin withdrawal - #184

Merged
Qoder-Voidd merged 2 commits into
Akazajan:mainfrom
DevMuhdishaq:feat/CT
Jul 28, 2026
Merged

feat(payment-escrow): Implement treasury with admin withdrawal#184
Qoder-Voidd merged 2 commits into
Akazajan:mainfrom
DevMuhdishaq:feat/CT

Conversation

@DevMuhdishaq

Copy link
Copy Markdown
Contributor

Closes #99
This commit introduces a treasury system to the Payment Escrow contract for more robust and auditable fee management.

Previously, fees were transferred to the recipient immediately upon escrow completion. This change modifies the logic to accumulate all collected fees into a central treasury balance within the contract.
Closes #100
Key changes:

  • The release, claim, and resolve_dispute functions now add the fee amount to a new treasury storage item instead of transferring it directly.
  • A new withdraw_treasury function has been added, callable only by the contract admin, to transfer accumulated fees to a specified address.
    Closes CT-22 — Add treasury withdrawal support with admin guardrails #101
  • This function includes validation to ensure the withdrawal amount does not exceed the available treasury balance, returning an InsufficientBalance error if it does.
  • A treasury_w event is emitted upon successful withdrawal to provide an on-chain audit trail of all treasury movements.
  • Added a new test module (treasury.rs) with tests covering successful withdrawals, unauthorized access attempts, and insufficient balance scenarios.
    Closes CT-24 — Add support for multiple payment token types in the future #103

This commit introduces a treasury system to the Payment Escrow contract for more robust and auditable fee management.

Previously, fees were transferred to the recipient immediately upon escrow completion. This change modifies the logic to accumulate all collected fees into a central treasury balance within the contract.

Key changes:
-   The `release`, `claim`, and `resolve_dispute` functions now add the fee amount to a new treasury storage item instead of transferring it directly.
-   A new `withdraw_treasury` function has been added, callable only by the contract admin, to transfer accumulated fees to a specified address.
-   This function includes validation to ensure the withdrawal amount does not exceed the available treasury balance, returning an `InsufficientBalance` error if it does.
-   A `treasury_w` event is emitted upon successful withdrawal to provide an on-chain audit trail of all treasury movements.
-   Added a new test module (`treasury.rs`) with tests covering successful withdrawals, unauthorized access attempts, and insufficient balance scenarios.
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@DevMuhdishaq Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Qoder-Voidd Qoder-Voidd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Qoder-Voidd
Qoder-Voidd merged commit 4c56ff3 into Akazajan:main Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants