Feat/creator self spending limit#250
Merged
Kingsman-99 merged 2 commits intoJun 26, 2026
Merged
Conversation
Implements set_self_limit and request_raise_self_limit functions as per issue Stellar-split#241. This feature allows creators to voluntarily self-restrict their spending independent of admin-imposed caps. Key features: - set_self_limit(creator, limit): Creator can immediately lower or set limit (requires creator auth) - request_raise_self_limit(creator, new_limit): Request to raise limit via timelock - Limit is enforced daily and resets at UTC midnight (86400s boundaries) - Whichever is lower wins: admin cap or creator self limit - Immediate raise attempts are blocked with clear error message Implementation Details: - Added RaiseCreatorSelfLimit to TimelockAction enum - New storage keys for limit, daily usage, and last day marker - Execute_action updated to handle self-limit raises after timelock - Create_invoice enforces self-limit alongside admin caps - Daily usage counter resets automatically at day boundary Acceptance Criteria Met: ✓ set_self_limit requires creator auth, applies only to their address ✓ Lowering takes effect immediately ✓ Raising requires timelock + execute_action ✓ Invoice creation enforces self-limit (whichever is lower with admin cap) ✓ Comprehensive test coverage including: - Immediate lower works - Immediate raise blocked - Timelock raise succeeds - Enforcement in invoice creation - Daily reset behavior - Unlimited when set to 0 - Auth requirement - Interaction with admin caps
|
@Ajadu-Saviour 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! 🚀 |
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
Implemented creator self-imposed daily spending limits, allowing creators to voluntarily restrict their invoice creation spending while ensuring any increase to the limit is protected by the existing timelock mechanism.
What Changed
set_self_limit,request_raise_self_limit,get_self_limit, andget_self_limit_usedfunctions.RaiseCreatorSelfLimitaction.0.Testing
Added comprehensive test coverage for:
0) self-limit handlingResult
Creators can now proactively control their own daily spending limits without affecting platform-wide policies. Immediate reductions improve account safety, while timelocked increases help prevent accidental or malicious limit changes, providing an additional layer of financial protection with comprehensive regression coverage.
Closes #229