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
Branch
task/432-zap-v2-frontend in plotlink repo
Parent: #432
Depends on: #433 (need deployed contract address)
Summary
Rewrite
lib/zap.tsto match the new multi-token ZapPlotLink v2 contract interface. Updatelib/contracts/constants.tswith mainnet addresses.lib/contracts/constants.tsZAP_PLOTLINKmainnet value with deployed address from [#432] Zap v2 Contract: Re-fork with multi-token support + mainnet deploy #433SUPPORTED_ZAP_TOKENSlist for the frontend selectorlib/zap.tsRewrite to match new contract interface with
fromTokenparameter:getZapQuote(fromToken, storylineToken, amount, mode: 'exact-output' | 'exact-input')— callsestimateMint/estimateMintReverseviasimulateContract(non-view functions)buildZapMintTx(fromToken, storylineToken, amount, mode, ...):msg.value, no approval neededestimateMint/estimateMintReversehandle the full path estimationAcceptance Criteria
lib/zap.tscompiles cleanlynpm run build)Branch
task/432-zap-v2-frontendin plotlink repo