Skip to content

Conversation

@barskhianfannie
Copy link
Member

@barskhianfannie barskhianfannie commented Nov 26, 2025

Problem

The existing parser fails in two example swaps:

  • Example: 0x7eea91c5c715ef4bb1e39ddf4c7832113693e87c18392740353d5ae669406a46 Etherscan
  • Example: 0xdee6f4fea0250f297ed9663c4ca4479e8a253c62e16faa60759e25832cd1f34f OpScan

This is occurring because we are relying on MultiCall3 to parse txns when we should instead rely on Forwarding Multi Call.

Resolves Issue #94

Solution

Apply the necessary logic for Forward Multi Call support.

Changes

  • src/index.ts: Added logic for txn decoding when the to address equals the Forwarding Multi Call address (0x00000000000000CF9E3c5A26621af382fA17f24f),
  • src/tests/index.test.ts: Added tests for the failing txns
  • src/tests/constants.tsx: Added FORWARDING_MULTICALL_ADDRESS and FORWARDING_MULTICALL_ABI

Testing

Ensure all tests are passing locally.

Additional Changes

  • Updated README.md to ensure table display has a consistent number of columns in every row.
  • Added more context to the .env.example regarding the various environment variables needed to successfully run all tests.

@barskhianfannie barskhianfannie marked this pull request as draft November 26, 2025 06:10
@barskhianfannie barskhianfannie force-pushed the main branch 2 times, most recently from 85599bb to 502eade Compare November 26, 2025 22:49
@barskhianfannie barskhianfannie self-assigned this Nov 26, 2025
@barskhianfannie barskhianfannie marked this pull request as ready for review November 26, 2025 23:08
@barskhianfannie barskhianfannie changed the title feat: add fallback parsing for complex multi-hop transactions feat: add first in/out heuristic for transactions which fail to parse Nov 26, 2025
@barskhianfannie barskhianfannie changed the title feat: add first in/out heuristic for transactions which fail to parse feat: add first/last transfer heuristic for transactions which fail to parse Nov 26, 2025
@hzhu hzhu self-requested a review November 29, 2025 09:46
address: "0x4200000000000000000000000000000000000006",
},
});
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a new line here? 🙏

Suggested change
});
});

hzhu
hzhu previously approved these changes Nov 30, 2025
@hzhu
Copy link
Member

hzhu commented Nov 30, 2025

Thanks for the PR! Appreciate the description, and tying the PR to an issue.

@barskhianfannie barskhianfannie changed the title feat: add first/last transfer heuristic for transactions which fail to parse feat: add last transfer heuristic for transactions which fail to parse Dec 2, 2025
Comment on lines +117 to +150
if (to?.toLowerCase() === FORWARDING_MULTICALL_ADDRESS.toLowerCase()) {
const { args: multicallArgs } = decodeFunctionData({
abi: FORWARDING_MULTICALL_ABI,
data: transaction.input,
});

if (multicallArgs && Array.isArray(multicallArgs) && multicallArgs[0] && Array.isArray(multicallArgs[0])) {
const { args: settlerArgs } = decodeFunctionData({
abi: SETTLER_META_TXN_ABI,
data: multicallArgs[0][1]?.data,
});

const recipient =
settlerArgs[0].recipient.toLowerCase() as Address;

const msgSender = settlerArgs[3];

const nativeAmountToTaker = calculateNativeTransfer(trace, {
recipient,
});

if (nativeAmountToTaker === "0") {
[output] = logs.filter(
(log) => log.to.toLowerCase() === msgSender.toLowerCase()
);
} else {
output = {
symbol: NATIVE_SYMBOL_BY_CHAIN_ID[chainId],
amount: nativeAmountToTaker,
address: NATIVE_TOKEN_ADDRESS,
};
}
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MultiCall3 will no longer be used and we can instead rely on the forwarding multi call address and abi @ this step of txn parsing. I decided to leave the previous logic related to Multicall3 to maintain backwards compatibility.
cc: @duncancmt

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.

2 participants