-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/enable_compression
- Loading branch information
Showing
7 changed files
with
619 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,78 @@ | ||
# Scroll Contracts | ||
|
||
Note: For more comprehensive documentation, see [`./docs/`](./docs). | ||
This directory contains the solidity code for Scroll L1 bridge and rollup contracts and L2 bridge and pre-deployed contracts. The [`specs`](../specs/) folder describes the overall Scroll protocol including the cross-domain messaging and rollup process. You can also find contract APIs and more details in the [`docs`](./docs) folder. | ||
|
||
## Directory Structure | ||
|
||
``` | ||
integration-test | ||
|- xxx.test.ts - "Hardhat integration tests" | ||
lib | ||
|- forge-std - "foundry dependency" | ||
scripts | ||
|- deploy_xxx.ts - "hardhat deploy script" | ||
|- foundry - "foundry deploy scripts" | ||
src | ||
|- test | ||
| `- xxx.t.sol - "Unit testi in solidity" | ||
`- xxx.sol - "solidity contract" | ||
.gitmodules - "foundry dependecy modules" | ||
foundry.toml - "configure foundry" | ||
hardhat.config.ts - "configure hardhat" | ||
remappings.txt - "foundry dependency mappings" | ||
<pre> | ||
├── <a href="./docs/">docs</a>: Documentation for the contracts | ||
├── <a href="./integration-test/">integration-test</a>: Hardhat integration tests | ||
├── <a href="./lib/">lib</a>: External libraries and testing tools | ||
├── <a href="./scripts">scripts</a>: Deployment scripts | ||
├── <a href="./src">src</a> | ||
│ ├── <a href="./src/gas-swap/">gas-swap</a>: Utility contract that allows gas payment in other tokens | ||
│ ├── <a href="./src/interfaces/">interfaces</a>: Common contract interfaces | ||
│ ├── <a href="./src/L1/">L1</a>: Contracts deployed on the L1 (Ethereum) | ||
│ │ ├── <a href="./src/L1/gateways/">gateways</a>: Gateway router and token gateway contracts | ||
│ │ ├── <a href="./src/L1/rollup/">rollup</a>: Rollup contracts for data availability and finalization | ||
│ │ ├── <a href="./src/L1/IL1ScrollMessenger.sol">IL1ScrollMessenger.sol</a>: L1 Scroll messenger interface | ||
│ │ └── <a href="./src/L1/L1ScrollMessenger.sol">L1ScrollMessenger.sol</a>: L1 Scroll messenger contract | ||
│ ├── <a href="./src/L2/">L2</a>: Contracts deployed on the L2 (Scroll) | ||
│ │ ├── <a href="./src/L2/gateways/">gateways</a>: Gateway router and token gateway contracts | ||
│ │ ├── <a href="./src/L2/predeploys/">predeploys</a>: Pre-deployed contracts on L2 | ||
│ │ ├── <a href="./src/L2/IL2ScrollMessenger.sol">IL2ScrollMessenger.sol</a>: L2 Scroll messenger interface | ||
│ │ └── <a href="./src/L2/L2ScrollMessenger.sol">L2ScrollMessenger.sol</a>: L2 Scroll messenger contract | ||
│ ├── <a href="./src/libraries/">libraries</a>: Shared contract libraries | ||
│ ├── <a href="./src/misc/">misc</a>: Miscellaneous contracts | ||
│ ├── <a href="./src/mocks/">mocks</a>: Mock contracts used in the testing | ||
│ ├── <a href="./src/rate-limiter/">rate-limiter</a>: Rater limiter contract | ||
│ └── <a href="./src/test/">test</a>: Unit tests in solidity | ||
├── <a href="./foundry.toml">foundry.toml</a>: Foundry configuration | ||
├── <a href="./hardhat.config.ts">hardhat.config.ts</a>: Hardhat configuration | ||
├── <a href="./remappings.txt">remappings.txt</a>: Foundry dependency mappings | ||
... | ||
``` | ||
</pre> | ||
|
||
## 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 | ||
|
||
First run the command below to get foundryup, the Foundry toolchain installer: | ||
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). | ||
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 your `PATH`. | ||
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 initialise git submodules. | ||
- 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 `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 run `npx hardhat compile` first. | ||
|
||
## TODO | ||
|
||
- [ ] unit tests | ||
- [ ] L1 Messenger | ||
- [x] L1 Gateways | ||
- [x] L1 Gateway Router | ||
- [ ] L2 Messenger | ||
- [x] L2 Gateways | ||
- [x] L2 Gateway Router | ||
- [x] ScrollStandardERC20Factory | ||
- [x] Whitelist | ||
- [ ] SimpleGasOracle | ||
- [ ] integration tests | ||
- [x] ERC20Gateway | ||
- [x] GatewayRouter | ||
- [ ] ZKRollup contracts | ||
- [x] Gas Oracle contracts for cross chain message call | ||
- [ ] ERC721/ERC115 interface design | ||
- [ ] add proof verification codes | ||
- [ ] security analysis |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.