Bridge Template
Production-ready L1-to-L2 ERC-20 token bridge with rate limiting and emergency pause.
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 1042 files
📖 Documentation Preview README excerpt
Bridge Template
Production-ready L1↔L2 ERC-20 token bridge with rate limiting, emergency pause, and cross-domain message verification.
Price: $14.99 | License: MIT | Category: Contracts | Solidity: ^0.8.24
Overview
bridge-template is a complete Solidity bridge implementation for moving ERC-20 tokens between L1 and L2. It includes both the L1 and L2 gateway contracts, a cross-domain message verification layer, and production security features including rate limiting, emergency pause, and two-step ownership.
Built on OpenZeppelin v5 with Foundry for compilation, testing, and deployment. The bridge follows the lock-and-mint pattern on L1→L2 and burn-and-unlock on L2→L1.
Features
- L1↔L2 ERC-20 token bridge — Lock tokens on L1, mint on L2; burn on L2, unlock on L1
- Cross-domain message verification — Validate bridge messages via the L1/L2 messenger with nonce tracking
- Rate limiting — Configurable per-token and global rate limits to cap bridging volume per time window
- Emergency pause — Owner can pause all bridge operations; pending withdrawals remain claimable
- Ownable2Step — Two-step ownership transfer prevents accidental admin lockout
- ReentrancyGuard — All deposit/withdraw functions are reentrant-safe
- Deposit registry — On-chain mapping of all deposits for off-chain indexing and verification
Architecture
L1 (Ethereum) L2 (Rollup)
┌─────────────────────┐ ┌─────────────────────┐
│ L1Bridge.sol │ │ L2Bridge.sol │
│ │ Messenger │ │
│ deposit() ───────────────────────→ │ finalizeDeposit() │
│ (lock tokens) │ │ (mint tokens) │
│ │ │ │
│ finalizeWithdraw() │ ←──────────────│ withdraw() │
│ (unlock tokens) │ │ (burn tokens) │
│ │ │ │
│ RateLimiter │ │ RateLimiter │
│ Pausable │ │ Pausable │
└─────────────────────┘ └─────────────────────┘
Tech Stack
| Component | Technology |
|---|---|
| Contracts | Solidity ^0.8.24 |
| Dependencies | OpenZeppelin Contracts v5 |
| Framework | Foundry (forge, cast, anvil) |
| Testing | Foundry fuzz + invariant tests |
Quick Start
Prerequisites
- [Foundry](https://getfoundry.sh/) installed
forge install OpenZeppelin/openzeppelin-contracts
Build & Test
... continues with setup instructions, usage examples, and more.