Skip to content

feat: add approval threshold to GroupTreasuryContract initialization …#201

Open
samieazubike wants to merge 1 commit into
codebestia:mainfrom
samieazubike:issue-121
Open

feat: add approval threshold to GroupTreasuryContract initialization …#201
samieazubike wants to merge 1 commit into
codebestia:mainfrom
samieazubike:issue-121

Conversation

@samieazubike

Copy link
Copy Markdown

…and implement related tests

Description

Add approval threshold + withdraw-proposal storage to group_treasury (closes #121)

Scaffolds the storage and initialize changes for the upcoming multisig withdrawal flow.

  • storage.rs: Added DataKey::Threshold, DataKey::ProposalCount, and DataKey::Proposal(u32) variants; a ProposalStatus enum (Active, Passed, Rejected, Executed, mirroring the proposals contract); and a WithdrawProposal struct (id, proposer, to, token, amount, approvals, rejections, status, expires_at).
  • lib.rs: initialize now takes a threshold: u32 parameter - panics with "threshold must be at least 1" if threshold == 0 (validated before any storage write), persists the threshold, and seeds ProposalCount to 0. Added a get_threshold() -> u32 view function.
  • test.rs: Updated existing initialize calls and added tests for the zero-threshold panic and threshold round-trip.
    Verified: cargo test -p group_treasury (20 passed) and cargo build -p group_treasury --target wasm32-unknown-unknown --release (confirms no_std compile).

Note: initialize enforces threshold ≥ 1 only - the "≤ member count" rule isn't checkable at init since the members list starts empty, so it's deferred to the proposal-lifecycle issues.

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Other

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally
  • My code follows the project's coding standards

@drips-wave

drips-wave Bot commented Jun 25, 2026

Copy link
Copy Markdown

@samieazubike 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

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.

Add approval threshold to group_treasury storage and initialize

1 participant