feat: implement Treasury.withdraw_fees() with unit tests (#965) - #1176
Merged
Conversation
- Implements withdraw_fees() in the Treasury smart contract - Admin authorization via admin.require_auth() - Validates amount <= BALANCE before withdrawal - Transfers XLM to recipient via token::Client - Logs withdrawal to WITHDRAWAL_LOG and emits FeesWithdrawn event Changes: - contracts/treasury/src/lib.rs: withdraw_fees() fully implemented - contracts/treasury/src/lib.rs: deposit_fees() duplicate caller removed - contracts/treasury/src/lib.rs: bare amount expression removed - contracts/shared/src/lib.rs: stray #![no_std] and duplicate module removed - contracts/shared/src/types.rs: Option<Outcome> -> OptionalOutcome enum Tests: 10 passed (6 new + 4 existing) Resolves Netwalls#965
adewuyito
force-pushed
the
feat/issue-965-withdraw-fees
branch
from
July 29, 2026 09:01
dd0e95b to
06cd957
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
withdraw_fees()in the Treasury smart contract with all acceptance criteria:admin.require_auth()amount <= BALANCEbefore withdrawaltoken::ClientWITHDRAWAL_LOGand emitsFeesWithdrawneventChanges
contracts/treasury/src/lib.rs:withdraw_fees()fully implemented with 6 new unit testscontracts/treasury/src/lib.rs:deposit_fees()duplicatelet callerremovedcontracts/shared/src/lib.rs: stray#![no_std]and duplicatepub mod typesremovedcontracts/shared/src/types.rs:Option<Outcome>replaced withOptionalOutcomeenum (Soroban SDK v27 compatibility)Testing
All 10 unit tests pass:
test_withdraw_fees_happy_pathtest_withdraw_fees_full_balancetest_withdraw_fees_exceeds_balance_panicstest_withdraw_fees_non_admin_panicstest_withdraw_fees_multiple_withdrawals_loggedtest_withdraw_fees_zero_balance_panicsinitializetestsResolves #965