This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a bidirectional bridge between Base and Solana that enables:
- Cross-chain token transfers (SOL, SPL tokens, ERC20s, ETH)
- Arbitrary cross-chain message passing
- Wrapped token deployment on both chains
The bridge consists of two main components:
- Base contracts (Solidity/Foundry) - handles Base-side operations
- Solana program (Rust/Anchor) - handles Solana-side operations
cd base
# Build contracts
forge build
# Run tests
forge test
# Test coverage
make coverage
# Install dependencies
make deps
# Deploy to testnet
make deploy
# Create wrapped tokens
make create-wrapped-sol
make create-wrapped-splcd solana
# Install dependencies
bun install
# Build program for specific environment
bun run program:build devnet-alpha
bun run program:build devnet-prod
# Deploy program
bun run program:deploy devnet-alpha
# Generate IDL and client
bun run generate:idl devnet-alpha
bun run generate:client
# Initialize bridge
bun run tx:initialize devnet-alpha
# Bridge operations
bun run tx:bridge-sol devnet-alpha
bun run tx:bridge-spl devnet-alpha
bun run tx:wrap-token devnet-alpha- Bridge.sol: Main contract receiving calls from Solana and managing message execution
- Twin.sol: Execution contract for each Solana sender pubkey
- CrossChainERC20.sol: Mintable/burnable ERC20 for cross-chain transfers
- CrossChainERC20Factory.sol: Factory for deploying wrapped tokens
- Bridge State: Central account with configuration and message nonces
- OutgoingMessage: Messages sent from Solana to Base
- IncomingMessage: Messages sent from Base to Solana
- Vaults: Lock SPL tokens and native SOL during bridging
- Base → Solana: Initiate on Base, wait ~15 minutes for root posting, then prove + finalize on Solana
- Solana → Base: Direct execution after message creation
- Uses Foundry with forge
- Requires
testnet-adminwallet account for deployments - Environment variables in
base/Makefilefor contract addresses
- Uses Anchor framework with Rust
- Requires keypair files in
keypairs/directory - Two environments: devnet-alpha and devnet-prod
- Base: Use
forge testfor Solidity unit tests - Solana: Rust unit tests within the program
- Integration testing via transaction scripts in
solana/scripts/
base/src/Bridge.sol- Core Base bridge logicsolana/programs/bridge/src/lib.rs- Solana program entry pointbase/script/Deploy.s.sol- Base deployment scriptsolana/scripts/onchain/- Solana transaction examples