This project contains the Solidity code for 𝚝𝟷 L1 bridge and rollup contracts, plus L2 bridge and pre-deployed contracts.
├── script: Deployment scripts ├── src │ ├── 7683: ERC7683 contracts │ ├── L1: Contracts deployed on the L1 (Ethereum) │ │ ├── gateways: Gateway router and token gateway contracts │ │ ├── rollup: Rollup contracts for data availability and finalization │ │ ├── IL1T1Messenger.sol: L1 T1 messenger interface │ │ └── L1T1Messenger.sol: L1 T1 messenger contract │ ├── L2: Contracts deployed on the L2 (T1) │ │ ├── gateways: Gateway router and token gateway contracts │ │ ├── predeploys: Pre-deployed contracts on L2 │ │ ├── IL2T1Messenger.sol: L2 T1 messenger interface │ │ └── L2T1Messenger.sol: L2 T1 messenger contract │ ├── libraries: Shared contract libraries │ ├── misc: Miscellaneous contracts │ ├── mocks: Mock contracts used in the testing │ └── test: Unit tests in solidity ├── foundry.toml: Foundry configuration ├── remappings.txt: Foundry dependency mappings └── deployments: Metadata from previous deployments ...
𝚝𝟷's architecture consists of these key components:
The backbone of 𝚝𝟷, responsible for managing batches, state roots, and cross-chain verification.
- L1T1Messenger: facilitates message passing between L1 and L2, with the ability to retry failed messages
- L2T1Messenger: the L2 counterpart, handling incoming messages from L1 and sending outbound messages
- L1MessageQueue: maintains the ordered queue of L1→L2 messages awaiting processing
- L2MessageQueue: maintains the ordered queue of L2→L1 messages awaiting processing
- T1XChainReader: facilitates cross-chain read requests between supported chains
- GatewayRouter: entry point for all token bridging operations
- L1EthGateway: handles native ETH bridging from L1→L2
- L1WethGateway: specialized gateway for WETH transfers
- L1StandardERC20Gateway: supports general ERC20 token bridging
- Forge: compile, test, fuzz, format, and deploy smart contracts
- Forge Std: collection of helpful contracts and utilities for testing
- Husky: Git hooks made easy
- Openzeppelin: library for secure smart contract development
- Prettier: code formatter for non-Solidity files
- Solhint: linter for Solidity code
- Solmate: gas optimized building blocks
- Uniswap/permit2: next generation token approvals mechanism
This project comes with a set of sensible default configurations for you to use. These defaults can be found in the following files:
├── .editorconfig
├── .gitignore
├── .prettierignore
├── .prettierrc.yml
├── .solhint.json
├── foundry.toml
└── remappings.txt
This project comes with GitHub Actions pre-configured. Your contracts will be linted and tested on every push and pull
request made to the canary branch.
You can edit the CI script in contracts.yml.
curl -L https://foundry.paradigm.xyz | bash
Foundry typically uses git submodules to manage dependencies, but this project uses Node.js packages because submodules don't scale.
This is how to install dependencies:
- Install the dependency using your preferred package manager, e.g.
bun install dependency-name- Use this syntax to install from GitHub:
bun install github:username/repo-name
- Use this syntax to install from GitHub:
- Add a remapping for the dependency in remappings.txt, e.g.
dependency-name=node_modules/dependency-name
To write a new test contract, you start by importing Test from forge-std, and then you inherit it in your test
contract. Forge Std comes with a pre-instantiated cheatcodes environment
accessible via the vm property. If you would like to view the logs in the terminal output, you can add the -vvv flag
and use console.log.
This is a list of the most frequently needed commands.
Build the contracts:
$ bun run buildDelete the build artifacts and cache directories:
$ bun cleanDeploy to Anvil:
$ forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545For this script to work, you need to have a MNEMONIC environment variable set to a valid
BIP39 mnemonic.
For instructions on how to deploy to a testnet or mainnet, check out the Solidity Scripting tutorial.
After deploying contracts, add a new json file to the deployments directory. At minimum, it should include the following:
{
"metadata": {
"version": "chainN",
"date": "00-00-2025",
"by": "<your name>",
"from_machine": "name of VM or local machine",
"from_branch": "canary",
"from_commit": "a7e7dae0dd90aa4091ba034e820ac224213d8a30",
"RPC_URL_L2": "https://rpc.devnet.t1protocol.com",
"RPC_URL_L1": "https://sepolia.infura.io/v3/XXXXX"
},
"addresses": {
"CONTRACT_NAME": "0x0000000000000000000000000000000000000001"
}
}Format the contracts:
$ bun formatGet a gas report:
$ forge test --gas-reportLint the contracts:
$ bun run lintRun the tests:
$ bun run testGenerate test coverage and output result to the terminal:
$ bun test:coverageGenerate test coverage with lcov report (you'll have to open the ./coverage/index.html file in your browser, to do so
simply copy paste the path):
$ bun test:coverage:reportThis project is licensed under the MIT LICENSE.
This repository is a fork of Scroll contracts created by Scroll, licensed under the MIT LICENSE.