This directory contains the solidity code for Scroll L1 bridge and rollup contracts and L2 bridge and pre-deployed contracts.
βββ hardhat-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 yarnInstall foundryup, the Foundry toolchain installer:
curl -L https://foundry.paradigm.xyz | bashIf 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 --recursiveto initialize git submodules. - Run
yarn prettier:solidityto run linting in fix mode, will auto-format all solidity codes. - Run
yarn prettierto run linting in fix mode, will auto-format all typescript codes. - Run
yarn prepareto install the precommit linting hook. - Run
forge build --evm-version cancunto compile contracts with foundry. - Run
npx hardhat compileto compile with hardhat. - Run
forge test --evm-version cancun -vvvto run foundry units tests. It will compile all contracts before running the unit tests. - Run
npx hardhat testto run integration tests. It may not compile all contracts before running, it's better to runnpx hardhat compilefirst.