Skip to content

Add protocol treasury withdrawal function so accumulated fees can be moved to a multisig #517

Description

@Chucks1093

Summary

Protocol fees accumulate in the contract but there is currently no function to withdraw them. Without a withdrawal path, fees are permanently locked unless the contract is replaced. An admin-controlled withdrawal function lets the team move accumulated XLM to a multisig wallet or treasury address on demand.

Scope

  • Add withdraw_treasury(amount: i128, recipient: Address) function callable only by the protocol admin
  • amount must be greater than zero and not exceed the contract's current XLM balance reserved for treasury
  • Contract must track treasury balance separately from funds held for key payments and pending dividends to prevent over-withdrawal
  • Emits TreasuryWithdrawal { amount, recipient, remaining_balance, ledger } event
  • Add get_treasury_balance() -> i128 view function returning the withdrawable treasury balance
  • Partial withdrawals are allowed; full withdrawal leaves balance at zero

Acceptance Criteria

  • Admin can withdraw any amount up to the treasury balance
  • Over-withdrawal reverts with a clear error
  • Non-admin call reverts with Unauthorized
  • Treasury balance decreases correctly after withdrawal
  • TreasuryWithdrawal event emitted with correct fields
  • get_treasury_balance reflects the correct withdrawable amount at all times

ETA: 24 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions