Function call scope no longer accepts native token value#118
Merged
Conversation
7f8b7a6 to
99f8bee
Compare
…icitly configured.
99f8bee to
0346c84
Compare
hanzel98
approved these changes
Dec 15, 2025
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.
📝 Description
When configuring a function call scope, native token value is not restricted. This is ok, so long as the targeted function is not payable.
This change adds a
valueLtecaveat with maximum value of0, ensuring that no native token value is allowed.A delegator may specify a
maxValuefor the caveat, allowing up to a specified amount of native value, for cases where a payable method is being called.🧪 How to Test?
Describe how to test these changes:
Create a delegation using the
functionCallscope without specifying avalueLte, such as https://docs.metamask.io/smart-accounts-kit/reference/delegation/delegation-scopes/#example-7Attempt to redeem the delegation with
valuegreater than 0 specified in the transaction. Expect the delegation to fail with an error related tomaxValue.Create a delegation with
valueLte: { maxValue: 10000n }and redeem in the same way above. Expect the delegation to succeed, with nativevalueup to 10000n.List any breaking changes:
Unless specified in its config, a delegation created with the function call scope will no longer allow native value greater than 0.
📋 Checklist
Check off completed items:
🔗 Related Issues
Link to related issues:
Closes #
Related to #
📚 Additional Notes
Any additional information, concerns, or context:
Note
Enforces a
valueLtecaveat (default 0) in functionCall scope and updates types and tests, including new encoding lengths.createFunctionCallCaveatBuildernow always addsvalueLte(default{ maxValue: 0n }), with optional override viaconfig.valueLte.FunctionCallScopeConfigupdated to include optionalallowedCalldata,exactCalldata, andvalueLtein base config; types/imports adjusted.functionCallScope.test.ts: expectValueLteEnforcercaveat (default 0 or configured), add test for customvalueLte.DelegationManagerencoding tests: update expected encoded lengths (disableDelegation/enableDelegation: 1930;redeemDelegations: 2890).Written by Cursor Bugbot for commit 0346c84. This will update automatically on new commits. Configure here.