Skip to content

fix: skip ERC-20 transfer for native tokens in multicall builder#247

Open
omaidf wants to merge 1 commit intopushchain:mainfrom
omaidf:fix/native-token-erc20-check
Open

fix: skip ERC-20 transfer for native tokens in multicall builder#247
omaidf wants to merge 1 commit intopushchain:mainfrom
omaidf:fix/native-token-erc20-check

Conversation

@omaidf
Copy link
Copy Markdown

@omaidf omaidf commented Mar 29, 2026

Summary

  • Adds !isNative check to the branching condition in buildExecuteMulticall
  • Prevents native tokens (ETH/SOL) from incorrectly getting an ERC-20 transfer call to the PRC-20 address

Problem

In payload-builders.ts:67, the condition is if (!isArrayMulticall) but should be if (!isNative && !isArrayMulticall). The isNative variable is computed at line 55 and the logging at line 61 correctly shows willAddErc20Transfer: !isNative && !isArrayMulticall, but the actual branch doesn't check isNative.

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

  • Native token multicall no longer includes ERC-20 transfer
  • Non-native token multicall still includes ERC-20 transfer as before
  • Array multicall mode unaffected

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native token transfers incorrectly include ERC-20 call in multicall payload builder

1 participant