fix: skip ERC-20 transfer for native tokens in multicall builder#247
Open
omaidf wants to merge 1 commit intopushchain:mainfrom
Open
fix: skip ERC-20 transfer for native tokens in multicall builder#247omaidf wants to merge 1 commit intopushchain:mainfrom
omaidf wants to merge 1 commit intopushchain:mainfrom
Conversation
The isNative flag was computed and logged correctly but was not used in the branching condition. Native tokens (ETH/SOL bridged as native PC) incorrectly had an ERC-20 transfer call added to the PRC-20 address. Ref: pushchain#246
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
!isNativecheck to the branching condition inbuildExecuteMulticallProblem
In
payload-builders.ts:67, the condition isif (!isArrayMulticall)but should beif (!isNative && !isArrayMulticall). TheisNativevariable is computed at line 55 and the logging at line 61 correctly showswillAddErc20Transfer: !isNative && !isArrayMulticall, but the actual branch doesn't checkisNative.When a native token is used in a non-array multicall, this causes an ERC-20
transfer()call to be encoded for the PRC-20 address, which will either revert or produce unexpected behavior.One-line fix — matches the logic already described in the comment on line 64 and the diagnostic logging on line 61.
Fixes #246
Test plan