ZeroXBridge is a cross-chain liquidity protocol designed to enable secure asset locking on Ethereum (L1) and pegged liquidity minting on Starknet (L2) using Zero-Knowledge proofs. This repository houses the L1 and L2 smart contracts that power the core bridging functionality, xZB token economics, oracle updates, and dynamic protocol configurations.
contracts/
├── L1/ # Ethereum contracts (Solidity + Foundry)
└── L2/ # Starknet contracts (Cairo + Scarb/snfoundry)
Core L1 bridge contract that:
- Accepts asset deposits from users (e.g., ERC-20 tokens)
- Records locked value and user ownership
- Emits events and Merkle-compatible data for L2 proof generation
- Verifies relayer-authenticated proofs for asset redemption
🔒 Uses
ElipticCurve.solfor relayer signature verification
Utility token used for testing deposit functionality.
Unit and integration tests verifying:
- Asset locking logic
- Event emission
- Relayer and proof verification
- Edge case handling
Main bridge contract on Starknet responsible for:
- Accepting zkProofs of locked L1 assets
- Minting
xZBtokens to L2 users - Enforcing unique proof constraints
- Burning
xZBto trigger off-ramp redemptions
Cairo-native ERC-20 implementation of the xZB token.
- Standard balance tracking and transfers
- Internal mint and burn access controlled by the bridge
Wrapper contract/function for controlled minting of xZB.
- Uses access-controlled bridge to mint tokens
- Modularizes mint logic for governance upgrades
Tracks time-weighted average prices (TWAP) or external price feeds.
- Fetches or stores L1-equivalent USD values for locked tokens
- Enables fair value minting of xZB
Dynamic rate controller for minting or redemption.
- Adjusts protocol-wide conversion ratios based on:
- Supply/demand
- Oracle input
- DAO governance
Timelocked governance contract.
- Enforces a delay on critical updates (e.g., oracle, mint cap)
- Protects against instant malicious changes
On-chain governance interface.
- Enables decentralized proposals and voting
- Interfaces with the timelock contract
- Allows community-driven control of bridge parameters
test_ZeroXBridgeL2.cairo: Tests the L2 bridging logictest_xZBERC20.cairo: Tests ERC20 compliance of xZBtest_L2Oracle.cairo: Validates price updates and accuracytest_Dynamicrate.cairo: Simulates variable rate mechanicstest_DAO.cairo: Covers proposal and voting execution paths
cd contracts/L1
forge build
forge testcd contracts/L2
scarb build
snfoundry testZeroXBridge contracts are modular and upgrade-friendly. With security and transparency in mind:
- Proofs are required for minting
- Rates are governed dynamically via DAO
- Timelocks enforce safety for sensitive changes
- All tokens are pegged 1:1 via oracle-fed fair pricing
We welcome PRs and ideas! Please fork the repo and submit pull requests to the relevant contract (L1 or L2). For major changes, start a discussion first to ensure alignment.
MIT License © ZeroXBridge Contributors