An open API service indexing awesome lists of open source software.

https://github.com/scroll-tech/scroll-contracts


https://github.com/scroll-tech/scroll-contracts

Last synced: 9 months ago
JSON representation

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.