Skip to content

[#432] Zap v2 Frontend Lib: Rewrite lib/zap.ts + update constants #434

@realproject7

Description

@realproject7

Parent: #432

Depends on: #433 (need deployed contract address)

Summary

Rewrite lib/zap.ts to match the new multi-token ZapPlotLink v2 contract interface. Update lib/contracts/constants.ts with mainnet addresses.

lib/contracts/constants.ts

lib/zap.ts

Rewrite to match new contract interface with fromToken parameter:

  • getZapQuote(fromToken, storylineToken, amount, mode: 'exact-output' | 'exact-input') — calls estimateMint / estimateMintReverse via simulateContract (non-view functions)
  • buildZapMintTx(fromToken, storylineToken, amount, mode, ...):
    • ETH (address(0)): payable with msg.value, no approval needed
    • ERC-20 (USDC/HUNT): requires prior approval to Zap contract
  • Apply slippage buffer (0.5% for swap, 3% for bonding curve)
  • Remove Uniswap V4 Quoter calls — the contract's estimateMint/estimateMintReverse handle the full path estimation

Acceptance Criteria

  • lib/zap.ts compiles cleanly
  • Constants updated with mainnet Zap address
  • USDC and HUNT addresses added
  • Quote functions work for all 3 input tokens (ETH, USDC, HUNT)
  • Build passes (npm run build)

Branch

task/432-zap-v2-frontend in plotlink repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/T3Assigned to T3 builder agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions