[Soroban] Add timelock for platform fee withdrawal#114
Open
Calebux wants to merge 2 commits intoANYTECHS:mainfrom
Open
[Soroban] Add timelock for platform fee withdrawal#114Calebux wants to merge 2 commits intoANYTECHS:mainfrom
Calebux wants to merge 2 commits intoANYTECHS:mainfrom
Conversation
added 2 commits
April 25, 2026 14:29
- Add WITHDRAWAL_TIMELOCK_SECS constant (172_800 seconds = 48 hours) - Add three new error codes: WithdrawalLocked (13), NoFeesAccumulated (14), WithdrawalNotRequested (15) - Add three new DataKey variants: AccumulatedFees(Address), WithdrawUnlocksAt, LastWithdrawalTs - Add FeeWithdrawalRequestedEvent and FeeClaimedEvent structs - Modify pay_royalty: platform recipient share is now held in contract escrow (AccumulatedFees storage) instead of transferred immediately - Add request_fee_withdrawal(admin) -> starts 48-hour timelock, returns unlock timestamp - Add claim_platform_fees(admin, asset_address) -> transfers escrowed balance to platform recipient after timelock expires, stores LastWithdrawalTs - Add get_platform_fees(asset_address) -> view accumulated balance - Add withdraw_unlocks_at() -> view pending unlock timestamp - Add last_withdrawal_ts() -> view timestamp of last completed withdrawal - Add 9 unit tests covering: timestamp calculation, error cases (WithdrawalNotRequested, WithdrawalLocked, NoFeesAccumulated), timer reset behaviour, admin-only auth, and event emission
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.
Closes #51
PR closes issue #51
Summary
Testing