Build and initialize Ethereum development environment with one click.

Time:2022-1-15

This project is a bit like create react app. The purpose is to help developers quickly initialize the development environment. See GitHub homepage for specific project use and introduction.

Use guide

First of all, you have to install truss globally. suchcreate-smart-contract myapp, a project folder will be initialized for you with truss. Then install a series of useful plug-ins and packages for you. Finally, some default configuration files are generated for you. The following are the included frameworks, plug-ins, packages and configuration files. At present, openzeppelin does not support Solc of 0.8, so I use the latest version of 0.7 by default.

  • truffle

    • @truffle/hdwallet-provider
    • eth-gas-reporter
    • solidity-coverage
    • truffle-assertions
  • hardhat

    • @nomiclabs/hardhat-ethers
    • @nomiclabs/hardhat-truffle5
    • @nomiclabs/hardhat-waffle
    • @nomiclabs/hardhat-web3
  • ethers
  • @openzeppelin/contracts
  • chai
  • solidity-docgen
  • mocha
  • prettier
  • prettier-plugin-solidity
  • solc
  • web3
  • ethereum-waffle
  • .gitignore
  • .prettierrc
  • hardhat.config.js
  • slither.config.json
  • solcover.js
  • truffle-config.js

In addition, I also added some useful node scripts.

  • npm run test: used to run tests. I used hardhat. Because it runs test fast and supports the use in smart contractsconsole.log
  • npm run doc: automatically generate documents according to Doxygen.
  • npm run coverage: according to the configuration file.solcover.jsGenerate test coverage reports.
  • npm run analyzeAccording to the configuration fileslither.config.jsonStatic analysis of smart contracts_ Note: slither is required to be installed_

custom

package

You can customize the package you want. changeindex.jsofinstallPackages。 for example

const installPackages = () => {
  return new Promise((resolve) => {
    console.log("\nInstalling hardhat\n".cyan);
    shell.exec(`npm install --save-dev hardhat`, () => {
      console.log("\nFinished installing packages\n".green);
      resolve();
    });
  });
};

Template

You can change, add or delete templates yourself. For example, if you want to add a template, you need to add the template filetemplates/Then modifytemplates/templates.js。 for example

let fs = require("fs");
let path = require("path");
const gitIgnore = fs.readFileSync(path.resolve(__dirname, "./gitignore"));
const solcover = fs.readFileSync(path.resolve(__dirname, "./solcover.js"));
const slither = fs.readFileSync(
  path.resolve(__dirname, "./slither.config.json")
);
const hardhatConfig = fs.readFileSync(
  path.resolve(__dirname, "./hardhat.config.js")
);
const truffleConfig = fs.readFileSync(
  path.resolve(__dirname, "./truffle-config.js")
);
const prettier = fs.readFileSync(path.resolve(__dirname, "./.prettierrc"));
const package = fs.readFileSync(path.resolve(__dirname, "package.json"));
const env = fs.readFileSync(path.resolve(__dirname, ".env"));
module.exports = {
  ".gitignore": gitIgnore,
  "solcover.js": solcover,
  "slither.config.json": slither,
  "truffle-config.js": truffleConfig,
  "hardhat.config.js": hardhatConfig,
  ".prettierrc": prettier,
  "package.json": package,
  ".env": env,
};

I wish you a happy development.

Recommended Today

permutation – full permutation

full permutation problem Topic description output natural numbers in lexicographical order\(1\)arrive\(n\)All non-repeating permutations, i.e.\(n\)The full permutation of , requires that no duplicate digits are allowed in any sequence of digits generated. input format an integer\(n\)。 output format Depend on\(1 \sim n\)Consists of all distinct sequences of numbers, one sequence per line. reserved for each number\(5\)field […]