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
- Connect deployer wallet
- Navigate to a story page with an active storyline token
- Select "ETH" in pay token selector
- Enter a small amount (e.g., 1 token)
- Verify estimate shows ETH cost
- Click "Buy with ETH"
- Confirm tx succeeds
- Verify token balance increases
HUNT Zap
- Same flow with "HUNT" selected
- Verify approval step triggers (ERC-20 approve to Zap contract)
- Confirm tx succeeds
USDC Zap
- Same flow with "USDC" selected
- Verify approval step triggers
- Confirm tx succeeds
- Note: USDC is 6 decimals — verify displayed correctly
PLOT Direct
- Select "PLOT" — existing MCV2_Bond.mint flow
- Verify approval → mint works
- Confirm this is unchanged from before
Sell
- After buying tokens, switch to Sell tab
- Sell tokens back
- 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
Branch
task/441-zap-trading-tests in plotlink-contracts repo (if Foundry script) or plotlink repo (if Node.js)
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
HUNT Zap
USDC Zap
PLOT Direct
Sell
Implementation
These tests require a funded wallet with real tokens. Options:
DEPLOYER_PRIVATE_KEY) with small amountsRecommend 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
Branch
task/441-zap-trading-testsin plotlink-contracts repo (if Foundry script) or plotlink repo (if Node.js)