Files
scroll/contracts
2022-11-10 07:38:38 +01:00
..
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00
2022-10-10 21:04:30 +08:00

Scroll Contracts

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"
...

Dependency

Foundry

First run the command below to get 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 your PATH.

Other ways to install Foundry can be found here.

Hardhat

yarn install

Build

  • Run git submodule update --init --recursive to initialise 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 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
    • L1 Gateways
    • L1 Gateway Router
    • L2 Messenger
    • L2 Gateways
    • L2 Gateway Router
    • ScrollStandardERC20Factory
    • Whitelist
    • SimpleGasOracle
  • integration tests
    • ERC20Gateway
    • GatewayRouter
  • ZKRollup contracts
  • Gas Oracle contracts for cross chain message call
  • ERC721/ERC115 interface design
  • add proof verification codes
  • security analysis