This directory contains the solidity code for Scroll L1 bridge and rollup contracts and L2 bridge and pre-deployed contracts. You can also find contract APIs and more details in the docs
folder.
├── docs: Documentation for the contracts ├── integration-test: Hardhat integration tests ├── lib: External libraries and testing tools ├── scripts: Deployment scripts ├── src │ ├── gas-swap: Utility contract that allows gas payment in other tokens │ ├── interfaces: Common contract interfaces │ ├── L1: Contracts deployed on the L1 (Ethereum) │ │ ├── gateways: Gateway router and token gateway contracts │ │ ├── rollup: Rollup contracts for data availability and finalization │ │ ├── IL1ScrollMessenger.sol: L1 Scroll messenger interface │ │ └── L1ScrollMessenger.sol: L1 Scroll messenger contract │ ├── L2: Contracts deployed on the L2 (Scroll) │ │ ├── gateways: Gateway router and token gateway contracts │ │ ├── predeploys: Pre-deployed contracts on L2 │ │ ├── IL2ScrollMessenger.sol: L2 Scroll messenger interface │ │ └── L2ScrollMessenger.sol: L2 Scroll messenger contract │ ├── libraries: Shared contract libraries │ ├── misc: Miscellaneous contracts │ ├── mocks: Mock contracts used in the testing │ ├── rate-limiter: Rater limiter contract │ └── test: Unit tests in solidity ├── foundry.toml: Foundry configuration ├── hardhat.config.ts: Hardhat configuration ├── remappings.txt: Foundry dependency mappings ...
First install Node.js
and npm
.
Run the following command to install yarn
:
npm install --global yarn
Install foundryup
, the Foundry toolchain installer:
curl -L https://foundry.paradigm.xyz | bash
If you do not want to use the redirect, feel free to manually download the foundryup
installation script from here.
Then, run foundryup
in a new terminal session or after reloading PATH
.
Other ways to install Foundry can be found here.
Run the following command to install Hardhat and other dependencies.
yarn install
- Run
git submodule update --init --recursive
to initialize git submodules. - Run
yarn prettier:solidity
to run linting in fix mode, will auto-format all solidity codes. - Run
yarn prettier
to run linting in fix mode, will auto-format all typescript codes. - Run
yarn prepare
to install the precommit linting hook. - Run
forge build
to compile contracts with foundry. - Run
npx hardhat compile
to compile with hardhat. - Run
forge test -vvv
to run foundry units tests. It will compile all contracts before running the unit tests. - Run
npx hardhat test
to run integration tests. It may not compile all contracts before running, it's better to runnpx hardhat compile
first.