Skip to content

feat(treasury): add treasury deposit, balance query, and timelock wit… - #123

Merged
ameeribro4-sudo merged 1 commit into
OpenPeerX:mainfrom
Bigg770:feat/issue-85-treasury
Jul 28, 2026
Merged

feat(treasury): add treasury deposit, balance query, and timelock wit…#123
ameeribro4-sudo merged 1 commit into
OpenPeerX:mainfrom
Bigg770:feat/issue-85-treasury

Conversation

@Bigg770

@Bigg770 Bigg770 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

…hdraw (#85)

  • Add TreasuryError variants (codes 610-614) to errors.rs
  • Create treasury.rs with TreasuryManager:
    • deposit(amount, source): credits balance, emits event
    • balance(): read-only query
    • request_withdraw(amount, dest): creates timelock-gated WithdrawRequest
    • execute_withdraw(id): executes after timelock elapses
    • get_withdraw_request / get_stats for auditability
    • configurable timelock (default 48 h) via set_timelock_duration
  • Wire early-unstake 10% penalty into TreasuryManager::deposit in staking_bonus.rs (acceptance criterion: penalty path credits treasury)
  • Expose three entry points in lib.rs on CounterContract:
    • treasury_deposit(amount, source)
    • treasury_balance() -> i128
    • treasury_withdraw(admin, phase, amount, destination, request_id) (two-phase: request + execute, both admin-gated)
  • Add 8 unit tests in treasury.rs covering all paths

Closes #85

…hdraw (OpenPeerX#85)

- Add TreasuryError variants (codes 610-614) to errors.rs
- Create treasury.rs with TreasuryManager:
    - deposit(amount, source): credits balance, emits event
    - balance(): read-only query
    - request_withdraw(amount, dest): creates timelock-gated WithdrawRequest
    - execute_withdraw(id): executes after timelock elapses
    - get_withdraw_request / get_stats for auditability
    - configurable timelock (default 48 h) via set_timelock_duration
- Wire early-unstake 10% penalty into TreasuryManager::deposit in
  staking_bonus.rs (acceptance criterion: penalty path credits treasury)
- Expose three entry points in lib.rs on CounterContract:
    - treasury_deposit(amount, source)
    - treasury_balance() -> i128
    - treasury_withdraw(admin, phase, amount, destination, request_id)
      (two-phase: request + execute, both admin-gated)
- Add 8 unit tests in treasury.rs covering all paths

Closes OpenPeerX#85
Depends-on: OpenPeerX#38

@ameeribro4-sudo ameeribro4-sudo 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

@ameeribro4-sudo
ameeribro4-sudo merged commit 42bd1cc into OpenPeerX:main Jul 28, 2026
3 checks passed
@Bigg770

Bigg770 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

please i will like to be among the selected people to be paid please

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PeerX Backlog # 85] Add a Treasury deposit function

2 participants