Skip to content

Latest commit

 

History

History
227 lines (128 loc) · 7.92 KB

TOOLCHAIN.md

File metadata and controls

227 lines (128 loc) · 7.92 KB

TOOLCHAIN

[TOC]

Node.JS package

This part describe the list of libraries present in the file package.json.

Dev

This section concerns the packages installed in the section devDependencies of package.json

Test

Chai Library used for the tests

Coveralls It is used to perform a code coverage

Nomiclabs - Hardhat

hardhat-truffle5

Hardhat plugin for integration with TruffleContract from Truffle 5. This allows tests and scripts written for Truffle to work with Hardhat.

hardhat-web3

This plugin integrates Web3.js 1.x into Hardhat.

hardhat-ethers

Hardhat plugin for integration with ethers.js

hardhat-contract-sizer

Output Solidity contract sizes with Hardhat.

hardhat-gas-reporter

eth-gas-reporter plugin for hardhat.

OpenZeppelin

openzeppelin/hardhat-upgrades

This package adds functions to your Hardhat scripts so you can deploy and upgrade proxies for your contracts

openzeppelin/test-helpers

Assertion library for Ethereum smart contract testing

Linter

eslint JavaScript static analyzer, and the following plugins:

Ethlint Solidity static analyzer.

Ethereum / Solidity

ethereumjs-util Collection of utility functions for Ethereum (account, address, signature, etc.).

ethjs-abi Encode and decode method and event from the smart contract ABI. Warning: marked as experimental package on 22.08.2022.

eth-gas-reporter

A Mocha reporter for Ethereum test suites (Truffle)

Eth-Sig-Util A collection of Ethereum signing functions.

Warning :

  • Deprecated in favor of : @metamask/eth-sig-util
  • It was not possible to use the new version of the library because the test "MetaTxModule.test.js" doesn't work with this one. The check of the signature fails.

keccak256

A wrapper for the keccak library to compute 256 bit keccak hash in JavaScript.

Use by openzeppelin-contracts-upgradeable/test/helpers/eip712imported in `MetaTxModuleCommon.js

solc JavaScript bindings for the Solidity compiler.

Documentation

sol2uml

Generate UML for smart contracts

solidity-coverage

Code coverage for Solidity smart-contracts

solidity-docgen

Program that extracts documentation for a Solidity project.

Surya

Utility tool for smart contract systems.

solidity-coverage

Others

dotenv Loads environment variables from a .env file

Production

This section concerns the packages installed in the section dependencies of package.json

Submodule

OpenZeppelin Contracts Upgradeable Upgradeable variant of OpenZeppelin Contracts, meant for use in upgradeable contracts. The version of the library used is available in the file USAGE.md

Warning:

  • Submodules are not automatically updated when the host repository is updated.
  • Only update the module to a specific version, not an intermediary commit.

Generate documentation

Generate UML for smart contracts

You can generate UML for smart contracts by running the following command:

npm run-script uml

Warning:

From the version v2.3.0, this command is not working and generates the following error

RangeError: Maximum call stack size exceeded

Description Command
Generate UML for all modules npm run-script uml-all
Generate UML for the interfaces EIP1404 npm run-script uml-i-eip1404
Generate UML for the contracts CMTAT_STANDALONE, CMTAT_PROXY && CMTAT_BASE npm run-script uml-partial
Generate UML for core modules npm run-script uml-modules-mandatory
Generate UML for extensions modules npm run-script uml-modules-optional
Generate UML for security modules npm run-script uml-modules-security
Generate UML for mocks npm run-script uml-mocks

To generate documentation with surya, you can call the three bash scripts in doc/script

Task Script Command exemple
Generate graph script_surya_graph.sh npx surya graph -i contracts/**/*.sol
npx surya graph contracts/modules/CMTAT_BASE.sol
Generate inheritance script_surya_inheritance.sh npx surya inheritance contracts/modules/CMTAT_BASE.sol -i
npx surya inheritance contracts/modules/CMTAT_BASE.sol
Generate report script_surya_report.sh npx surya mdreport -i surya_report.md contracts/modules/CMTAT_BASE.sol
npx surya mdreport surya_report.md contracts/modules/CMTAT_BASE.sol

In the report, the path for the different files are indicated in absolute. You have to remove the part which correspond to your local filesystem.

Code coverage for Solidity smart-contracts, installed as a hardhat plugin

npm run-script coverage

Slither is a Solidity static analysis framework written in Python3

slither .  --checklist --filter-paths "openzeppelin-contracts-upgradeable|openzeppelin-contracts|@openzeppelin|test" > slither-report.md
  • Standalone
myth analyze contracts/CMTAT_STANDALONE.sol --solc-json solc_setting.json > myth_standalone_report.md
  • With proxy
myth analyze contracts/CMTAT_PROXY.sol --solc-json solc_setting.json > myth_proxy_report.md

File path for solc is configured in solc_setting.json