For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Implement a trustless FastWithdrawalPool v2 as an L1 Sidecar contract that uses era Mailbox proof verification for settlement.
Architecture: Standalone Solidity contract on L1 alongside era's native bridge. LPs provide liquidity; users get instant withdrawals by binding an L2 standard withdrawal tx hash; anyone can settle by providing a valid era L2→L1 message proof. No era contracts are modified.
Tech Stack: Solidity 0.8.26, Foundry, OpenZeppelin v5.6.1 (ReentrancyGuard), era IMailbox interface (minimal local copy)
This is a local copy of the era Mailbox proof verification interface. We copy only what we need to avoid cross-project build dependencies.
// contracts/src/interfaces/IMailbox.sol// SPDX-License-Identifier: MITpragmasolidity^0.8.26;/// @notice Minimal interface for era Diamond Proxy Mailbox facet./// Copied from era-contracts: state-transition/chain-interfaces/IMailboxImpl.sol/// Only includes the proof verification function needed by FastWithdrawalPool v2.interface IMailbox{/// @notice L2-to-L1 message structurestructL2Message{uint16 txNumberInBatch;address sender;bytes data;}/// @notice Verify that an L2-to-L1 message was included in a finalized batch/// @param_batchNumber L2 batch number where the message was sent/// @param_index Message index within the batch/// @param_message The L2 message content/// @param_proof Merkle proof of inclusion/// @returnWhether the proof is validfunctionproveL2MessageInclusion(uint256_batchNumber,uint256_index,L2Messagecalldata_message,bytes32[]calldata_proof)externalviewreturns(bool);}
Step 2: Create the IFastWithdrawalPoolV2 interface
Step 3: Verify compilation
Run: cd /Users/judybaby/CodeBase/github/Layer2/contracts && forge build Expected: Compiles with no errors
Step 4: Commit
Task 2: MockMailbox Test Helper
Files:
Create: contracts/test/mocks/MockMailbox.sol
Step 1: Create MockMailbox
Step 2: Verify compilation
Run: cd /Users/judybaby/CodeBase/github/Layer2/contracts && forge build Expected: Compiles with no errors
Run: cd /Users/judybaby/CodeBase/github/Layer2/contracts && forge test --match-contract FastWithdrawalPoolV2Test -v Expected: Compilation error — FastWithdrawalPoolV2 not found
Run: cd /Users/judybaby/CodeBase/github/Layer2/contracts && forge test --match-contract FastWithdrawalPoolV2Test -v Expected: All tests PASS (26 + 4 = 30)
Step 3: Commit
Task 8: Run Full Project Test Suite
Files: None (verification only)
Step 1: Run FastWithdrawalPoolV2 tests
Run: cd /Users/judybaby/CodeBase/github/Layer2/contracts && forge test --match-contract FastWithdrawalPoolV2Test -v Expected: 30 tests PASS
Step 2: Run entire project tests to verify no regressions
Run: cd /Users/judybaby/CodeBase/github/Layer2/contracts && forge test Expected: All tests pass (existing 83 v1 tests + 30 new v2 tests)
Step 3: Check gas report
Run: cd /Users/judybaby/CodeBase/github/Layer2/contracts && forge test --match-contract FastWithdrawalPoolV2Test --gas-report Expected: View gas costs for key functions (requestFastWithdrawal, settleWithdrawal should be < 100k gas)