Summary
Multiple UX improvements and HUNT/USDC zap bugs for the TradingWidget after mainnet Zap launch.
1. [Bug] HUNT and USDC zap txs revert on mainnet
Priority: High
Both HUNT and USDC mint via ZapPlotLinkV2 revert on Base mainnet. The E2E Foundry script (PR #61) passed for HUNT, but frontend txs fail. MetaMask warns "This transaction is likely to fail" before submission.
HUNT revert:
- Tx:
0x7287f26fc7309d3f11e809c3c6645c02234fa25e7ef3f9a2eebb70a0a7b9d363
- Block: 43733619
- Method:
mint(HUNT, 0x25617...7c379, 10000...00000, 19356...56092)
- Value: 0 ETH
USDC revert:
- Tx:
0xf288c9d570539fe7bf9f1ed54cd2cded6dd22c23605d99ce5a6fcd5a7f496c0e
- Block: 43733866
- Method:
mint(USDC, 0x25617...7c379, 10000...00000, 8414)
- Value: 0 ETH
Note: ETH zap works fine. Only ERC-20 input tokens (HUNT, USDC) revert.
Investigate root cause. Possible issues:
- HUNT/USDC approval to Zap contract insufficient or approving wrong address
- Frontend passing wrong
maxFromTokenAmount (check slippage calculation)
- Contract's ERC-20
safeTransferFrom failing (allowance, balance, or Permit2 issue)
- Different execution context between Foundry script (deployer direct) and frontend (wagmi/wallet)
- USDC's 6-decimal handling causing overflow in contract
Debug by simulating the exact tx calldata via cast call --trace on both failed txs.
2. [UX] Insufficient balance warning for all token options
The "Insufficient balance" error text already exists but may not show for all zap modes. Verify it displays correctly when:
- ETH balance < estimated cost
- HUNT balance < estimated cost
- USDC balance < estimated cost
- PLOT balance < estimated cost
3. [UX] Show wallet balance below "Pay with" line
Move the balance display from below the amount input to directly below the "PAY WITH" token selector. Show the selected token's balance prominently so users see it before entering an amount.
Format: Balance: 0.0262 ETH / Balance: 100 HUNT / Balance: 0 USDC / Balance: 1816.34 PLOT
4. [UX] "Max" input button for all token options
Add a MAX button on the buy tab (currently only exists on sell tab). For buy mode, MAX should:
- For PLOT: set amount to max storyline tokens buyable with full PLOT balance (use
estimateMintReverse)
- For ETH/USDC/HUNT: set amount to max storyline tokens buyable with full balance via Zap (use
estimateMintReverse with exact-input mode)
- Leave a small ETH buffer for gas when using ETH (~0.001 ETH)
5. [UX] Label change: "TOKENS TO BUY" → "STORY TOKENS TO BUY"
Simple text change in the buy tab label.
6. [UX] Rename "Trade" to "Trade to Support" + tooltip
- Change section title from "Trade" to "Trade to Support" (both the collapsible header and the box
<h2>)
- On the "Trade to Support" title, add a tooltip (hover/tap) explaining: "Every trade generates a 5% creator royalty — buying and selling these story tokens directly supports the writer to keep continuing this story."
- Button text: keep as "Buy with {token}" (no change needed)
Acceptance Criteria
Branch
task/445-trading-widget-fixes in plotlink repo (+ plotlink-contracts if contract fix needed)
Summary
Multiple UX improvements and HUNT/USDC zap bugs for the TradingWidget after mainnet Zap launch.
1. [Bug] HUNT and USDC zap txs revert on mainnet
Priority: High
Both HUNT and USDC mint via ZapPlotLinkV2 revert on Base mainnet. The E2E Foundry script (PR #61) passed for HUNT, but frontend txs fail. MetaMask warns "This transaction is likely to fail" before submission.
HUNT revert:
0x7287f26fc7309d3f11e809c3c6645c02234fa25e7ef3f9a2eebb70a0a7b9d363mint(HUNT, 0x25617...7c379, 10000...00000, 19356...56092)USDC revert:
0xf288c9d570539fe7bf9f1ed54cd2cded6dd22c23605d99ce5a6fcd5a7f496c0emint(USDC, 0x25617...7c379, 10000...00000, 8414)Note: ETH zap works fine. Only ERC-20 input tokens (HUNT, USDC) revert.
Investigate root cause. Possible issues:
maxFromTokenAmount(check slippage calculation)safeTransferFromfailing (allowance, balance, or Permit2 issue)Debug by simulating the exact tx calldata via
cast call --traceon both failed txs.2. [UX] Insufficient balance warning for all token options
The "Insufficient balance" error text already exists but may not show for all zap modes. Verify it displays correctly when:
3. [UX] Show wallet balance below "Pay with" line
Move the balance display from below the amount input to directly below the "PAY WITH" token selector. Show the selected token's balance prominently so users see it before entering an amount.
Format:
Balance: 0.0262 ETH/Balance: 100 HUNT/Balance: 0 USDC/Balance: 1816.34 PLOT4. [UX] "Max" input button for all token options
Add a MAX button on the buy tab (currently only exists on sell tab). For buy mode, MAX should:
estimateMintReverse)estimateMintReversewithexact-inputmode)5. [UX] Label change: "TOKENS TO BUY" → "STORY TOKENS TO BUY"
Simple text change in the buy tab label.
6. [UX] Rename "Trade" to "Trade to Support" + tooltip
<h2>)Acceptance Criteria
Branch
task/445-trading-widget-fixesin plotlink repo (+ plotlink-contracts if contract fix needed)