Skip to content

feat: add treasury withdrawal functionality for protocol admin#525

Open
syed-ghufran-hassan wants to merge 1 commit into
accesslayerorg:mainfrom
syed-ghufran-hassan:patch-5
Open

feat: add treasury withdrawal functionality for protocol admin#525
syed-ghufran-hassan wants to merge 1 commit into
accesslayerorg:mainfrom
syed-ghufran-hassan:patch-5

Conversation

@syed-ghufran-hassan

Copy link
Copy Markdown

Summary

  • Add withdraw_treasury() for admin to withdraw accumulated protocol fees
  • Add get_treasury_balance() view function
  • Track treasury balance separately using DataKey::TreasuryBalance
  • Prevent over-withdrawal with InsufficientBalance error
  • Emit TreasuryWithdrawal event with amount, recipient, remaining_balance, ledger

Testing

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace

Checklist

  • Linked issue or backlog item
  • Added or updated creator-keys unit/integration tests for every changed contract behavior, including failure paths for new or reachable ContractError variants
  • Ran cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace, or explained exactly why a command was not run
  • Reviewed persistent storage changes against docs/storage-key-invariants.md; any storage layout change includes a migration/backward-compatibility note
  • Confirmed event names, topic order, payload field order, and field meanings remain compatible with docs/contract-event-conventions.md, or documented the breaking change and versioning plan
  • Updated docs for any changed public contract interface, read-only method, event schema, storage behavior, fee logic, or deployment workflow
  • Scope stays limited to one contract concern and does not include unrelated formatting, lockfile, generated artifact, or dependency changes

- Add withdraw_treasury() for admin to withdraw accumulated protocol fees
- Add get_treasury_balance() view function
- Track treasury balance separately using DataKey::TreasuryBalance
- Prevent over-withdrawal with InsufficientBalance error
- Emit TreasuryWithdrawal event with amount, recipient, remaining_balance, ledger
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.

1 participant