Repository navigation
Conversation
For native token spend permissions, the recipient call was an ERC20 transfer to the ERC-7528 placeholder address, which has no code, so the recipient never received the spent ETH. Append a plain value transfer to the recipient instead. The ERC20 path is unchanged. Fixes base#424
Collaborator
🟡 Heimdall Review Status
|
This branch has not been deployed
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
Fixes #424.
For a native token spend permission (
token=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE),prepareSpendCallData(permission, amount, recipient)appended an ERC20transfer(recipient, amount)call to the ERC-7528 placeholder address. That address has no code, so the call succeeds without doing anything: the recipient receives nothing and the spent ETH stays with the spender.SpendPermissionManager.spendsends native tokens to the spender (_transferFrom→SafeTransferLib.safeTransferETH(spender, value)), so the spender can forward them with a plain value transfer. For native token permissions, the recipient call is now:The token address is compared case-insensitively. The ERC20 path is unchanged. The JSDoc for
recipientnow describes both cases.How did you test your changes?
New unit tests in
prepareSpendCallData.test.ts(native token permissionblock):transferencodedmax-remaining-allowance+ recipient, not yet approved → approve, spend, then a value transfer of the remaining spendThe existing ERC20 recipient tests pass unchanged. The three recipient tests fail on
masterand pass with this change.yarn lint,yarn format:checkandyarn typecheckpass. Inpackages/account-sdk,yarn test --runpasses, except for 6 tests increateSmartAccount.test.ts. Those time out locally because they call a live RPC throughhttp(), and this change does not touch them.