Skip to content

[Contract] Fix USDC multi-hop ABI encoding in ZapPlotLinkV2 #468

@realproject7

Description

@realproject7

Summary

USDC zap is currently disabled on the frontend (PR #466) because the multi-hop swap reverts. The root cause is in ZapPlotLinkV2._executeV4MultiHopSwapExactIn — the SWAP_EXACT_IN action params are ABI-encoded differently from what the Universal Router expects.

ETH single-hop and HUNT (MCV2 bonding curve) routes work fine. Only the USDC→ETH→PLOT multi-hop path is broken.

Root Cause (from #464 investigation)

The USDC→ETH→PLOT multi-hop swap reverts inside Universal Router's unlockCallback with empty revert data (1618 gas consumed). The SWAP_EXACT_IN action params encoding in _executeV4MultiHopSwapExactIn doesn't match what the deployed Router expects.

Fix approach

  1. Compare with MintPad's ZapUniV4MCV2 (0xa2e7BcA51A84Ed635909a8E845d5f66602742A75) — find successful USDC multi-hop txs on Basescan and compare calldata encoding
  2. Check if the USDC/ETH V4 pool exists with the configured params (fee=500, tickSpacing=10) on Base mainnet
  3. Verify PathKey encoding order matches Universal Router V4 spec for multi-hop swaps
  4. Fix _executeV4MultiHopSwapExactIn and _executeV4MultiHopSwapExactOut encoding
  5. Redeploy ZapPlotLinkV2 to Base mainnet, verify on Sourcify

After contract fix

  1. Update ZAP_PLOTLINK in lib/contracts/constants.ts with new address
  2. Re-enable USDC in SUPPORTED_ZAP_TOKENS (was removed in PR Disable USDC zap pending contract fix (#464) #466)
  3. Execute a successful USDC zap trade on mainnet and document tx hash

Contract references

  • Current ZapPlotLinkV2: 0x04f557F8D2806B34FC832a534c08DF514D4dfEeF
  • MintPad ZapUniV4MCV2: 0xa2e7BcA51A84Ed635909a8E845d5f66602742A75
  • Multi-hop code: plotlink-contracts/src/ZapPlotLinkV2.sol lines 463-535
  • USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913

Acceptance Criteria

  • Multi-hop ABI encoding fixed
  • Contract redeployed on Base mainnet
  • Verified on Sourcify + Basescan
  • ZAP_PLOTLINK updated in plotlink constants
  • USDC re-added to SUPPORTED_ZAP_TOKENS
  • Successful USDC zap trade tx hash documented in PR
  • Build passes

Branch

task/466-usdc-multihop-fix in plotlink-contracts repo (+ plotlink for constants + re-enable USDC)

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/T3Assigned to T3 builder agentbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions