Skip to content

[Test] E2E Zap Trading Tests — verify all input tokens on mainnet #441

@realproject7

Description

@realproject7

Parent: #426

Depends on: #440 (V4 pools must exist first)

Summary

The current E2E tests (#438) only test UI rendering without wallet connection. The zap trading flow was never tested end-to-end. Write and run E2E tests that verify actual trading via the ZapPlotLinkV2 contract on Base mainnet.

Test Flows

ETH Zap

  1. Connect deployer wallet
  2. Navigate to a story page with an active storyline token
  3. Select "ETH" in pay token selector
  4. Enter a small amount (e.g., 1 token)
  5. Verify estimate shows ETH cost
  6. Click "Buy with ETH"
  7. Confirm tx succeeds
  8. Verify token balance increases

HUNT Zap

  1. Same flow with "HUNT" selected
  2. Verify approval step triggers (ERC-20 approve to Zap contract)
  3. Confirm tx succeeds

USDC Zap

  1. Same flow with "USDC" selected
  2. Verify approval step triggers
  3. Confirm tx succeeds
  4. Note: USDC is 6 decimals — verify displayed correctly

PLOT Direct

  1. Select "PLOT" — existing MCV2_Bond.mint flow
  2. Verify approval → mint works
  3. Confirm this is unchanged from before

Sell

  1. After buying tokens, switch to Sell tab
  2. Sell tokens back
  3. Verify PLOT balance increases

Implementation

These tests require a funded wallet with real tokens. Options:

  • Use the deployer wallet (DEPLOYER_PRIVATE_KEY) with small amounts
  • Write as a Foundry script that executes all trades and verifies results
  • OR write as a Node.js script using viem that connects, trades, and asserts

Recommend a Foundry script in plotlink-contracts/script/ since it can interact with the contracts directly and verify state changes. Post results (tx hashes, amounts) in the PR.

Alternatively, if using Playwright: configure with a test wallet, but this requires injecting a wallet provider which is complex.

Acceptance Criteria

  • ETH → storyline token trade succeeds via ZapPlotLinkV2
  • HUNT → storyline token trade succeeds via ZapPlotLinkV2
  • USDC → storyline token trade succeeds via ZapPlotLinkV2 (if USDC balance available)
  • PLOT direct trade succeeds via MCV2_Bond
  • Sell trade succeeds via MCV2_Bond.burn
  • All tx hashes documented in PR
  • Frontend Buy button becomes active for all input tokens after pools exist

Branch

task/441-zap-trading-tests in plotlink-contracts repo (if Foundry script) or plotlink repo (if Node.js)

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/T3Assigned to T3 builder agenttest

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions