https://github.com/scroll-tech/scroll-contracts
https://github.com/scroll-tech/scroll-contracts
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/scroll-tech/scroll-contracts
- Owner: scroll-tech
- Created: 2024-06-06T01:26:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-31T10:09:00.000Z (9 months ago)
- Last Synced: 2025-04-02T12:07:21.725Z (9 months ago)
- Language: Solidity
- Size: 2.7 MB
- Stars: 42
- Watchers: 18
- Forks: 23
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Scroll Contracts
This directory contains the solidity code for Scroll L1 bridge and rollup contracts and L2 bridge and pre-deployed contracts.
## Directory Structure
├── 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
...
## Dependencies
### Node.js
First install [`Node.js`](https://nodejs.org/en) and [`npm`](https://www.npmjs.com/).
Run the following command to install [`yarn`](https://classic.yarnpkg.com/en/):
```bash
npm install --global yarn
```
### Foundry
Install `foundryup`, the Foundry toolchain installer:
```bash
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](https://raw.githubusercontent.com/foundry-rs/foundry/master/foundryup/foundryup).
Then, run `foundryup` in a new terminal session or after reloading `PATH`.
Other ways to install Foundry can be found [here](https://github.com/foundry-rs/foundry#installation).
### Hardhat
Run the following command to install [Hardhat](https://hardhat.org/) and other dependencies.
```
yarn install
```
## Build
- 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 --evm-version cancun` to compile contracts with foundry.
- Run `npx hardhat compile` to compile with hardhat.
- Run `forge test --evm-version cancun -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 run `npx hardhat compile` first.