{"id":24423074,"url":"https://github.com/sumit03guha/smart-contracts-development-boilerplate","last_synced_at":"2025-04-12T07:20:23.980Z","repository":{"id":45188925,"uuid":"490682793","full_name":"sumit03guha/smart-contracts-development-boilerplate","owner":"sumit03guha","description":"A boilerplate repository for smart contracts development, based on hardhat and includes foundry fuzzing.","archived":false,"fork":false,"pushed_at":"2023-07-07T07:50:48.000Z","size":453,"stargazers_count":4,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T02:33:48.138Z","etag":null,"topics":["ethereum","ethersjs","foundry","fuzzing","hardhat","hardhat-boilerplate","solidity","truffle","typescript","yarn"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sumit03guha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-10T12:17:11.000Z","updated_at":"2024-01-12T18:30:25.000Z","dependencies_parsed_at":"2022-07-19T18:03:21.145Z","dependency_job_id":null,"html_url":"https://github.com/sumit03guha/smart-contracts-development-boilerplate","commit_stats":null,"previous_names":["sumit03guha/smart-contracts-development-boilerplate"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumit03guha%2Fsmart-contracts-development-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumit03guha%2Fsmart-contracts-development-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumit03guha%2Fsmart-contracts-development-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumit03guha%2Fsmart-contracts-development-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sumit03guha","download_url":"https://codeload.github.com/sumit03guha/smart-contracts-development-boilerplate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530737,"owners_count":21119624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","ethersjs","foundry","fuzzing","hardhat","hardhat-boilerplate","solidity","truffle","typescript","yarn"],"created_at":"2025-01-20T10:16:28.618Z","updated_at":"2025-04-12T07:20:23.960Z","avatar_url":"https://github.com/sumit03guha.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart Contracts Development Boilerplate\n\n\u003e This smart-contracts-development-boilerplate is mostly based on hardhat and includes foundry fuzz-testing feature.\n\n## Prerequisites\n\n- Install [foundry](https://book.getfoundry.sh/) for fuzzing the smart contracts. Go through the [installation instructions](https://book.getfoundry.sh/getting-started/installation) to install foundry.\n- Configure the foundry.toml as per your requirements. Refer to the [foundry config reference](https://book.getfoundry.sh/reference/config/) for more details.\n- Install truffle : `npm i -g truffle`\n- The latest version of truffle has issues with installation on Windows.\n- To resolve the errors, go to [this page](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community\u0026channel=Release\u0026version=VS2022\u0026source=VSLandingPage\u0026cid=2030\u0026passive=false), download Microsoft Visual Studio 2022 and then install the Visual Studio Installer.\n- Select Desktop Development with C++ and uncheck all the optional installation options.\n- Once it is done, the truffle can be installed with `npm i -g truffle`\n\n## Instructions and commands\n\n- Install the boilerplate project dependencies. \\\n  Do a check for the latest npm package versions. \\\n  This will update the versions inside the package.json.\n\n  ```shell\n  npx npm-check-updates -u\n  ```\n\n  ```shell\n  git submodule update --init --recursive\n  ```\n\n  ```shell\n  yarn\n  ```\n\n  This will install the packages mentioned inside the `package.json` file.\n\n- Compile the smart contracts.\n\n  ```shell\n  yarn clean-compile\n  ```\n\n- Check for linting and formatting errors in the code. This will display all the code errors and warnings in the terminal.\n\n  ```shell\n  yarn check\n  ```\n\n- Generate the typechain types for the smart contracts. This will create a `typechain-types` folder comprising all the typechain types, in the root directory of the project.\n\n  ```shell\n  yarn typechain\n  ```\n\n- Compute the size of the smart contracts. This will display the size of the smart contracts in the terminal.\n\n  ```shell\n  yarn size\n  ```\n\n- Run the test scripts. This uses the hardhat network configured in the `hardhat.config.ts` file to run the tests.\n\n  ```shell\n  yarn test\n  ```\n\n- To run the tests on your localhost node for debugging purposes, you can run the following commands.\\\n  Instantiate the hardhat local node.\n\n  ```shell\n  yarn localnode\n  ```\n\n- Split the terminal running the hardhat node, or, open another terminal and run the project test scripts using the local node.\n\n  ```shell\n  yarn test:local\n  ```\n\n- Run the foundry test cases, written in solidity, which should be present inside the `test/foundry` folder.\n\n  ```shell\n  yarn test:forge\n  ```\n\n- Generate the code coverage report. \\\n  After generating the report, you can open the `coverage/index.html` file to see the results.\n\n  ```shell\n  yarn coverage\n  ```\n\n- Generate the documentation for the smart contracts. This will create a `docs` folder comprising all the documentation related to the smart contracts, in the root directory of the project.\n\n  ```shell\n  yarn doc\n  ```\n\n- Instantiate the truffle dashboard. \\\n  This lets you deploy the contracts without the need of pasting the private key anywhere in the project.\n\n  ```shell\n  truffle dashboard\n  ```\n\n- The browser will open up and then you have to connect with the MetaMask extension. Select the preferred network and the account to deploy the smart contract.\n\n- Deploy the hardhat project smart contracts using your preferred network or the truffle dashboard, by specifying the `NETWORK`. If you are using any network other than `truffle` or `localhost`, then the private key of the account from which the smart contract is to be deployed, should be specified in the `.env` file.\n\n  ```shell\n  yarn deploy {NETWORK}\n  ```\n\n- If `truffle` has been specified as the `NETWORK`, then switch to the browser and sign the deployment transaction from the MetaMask extension.\n\n- After the succesful deployment of the smart contracts, a `build/deploy.json` file will be generated comprising the deployed addresse and the ABI of the smart contracts.\n\n- Verify the smart contract using the `NETWORK` on which it was deployed and the smart contract address, alongwith the constructor arguments by modifiying the `verify.ts` file, and entering the network name in the CLI after running the following command.\n\n  ```shell\n  yarn verify {NETWORK}\n  ```\n\n## A typical top-level directory layout\n\n```shell\n.\n├── build                 # deployed addresses and the ABI of the smart contract (scripts/deploy.ts)\n  └── artifacts           # hardhat deployment information [hardhat default]\n  └── cache               # hardhat deployment information [hardhat default]\n  └── deployments         # address and ABI of the smart contract [modified after hardhat default]\n  └── foundry             # cache and output generated by foundry [gitignored]\n├── contracts             # smart contracts solidity files\n├── coverage              # coverage report (index.html) [gitignored]\n├── docs                  # smart contracts documentation\n├── lib                   # git submodule for foundry testing\n├── node_modules          # npm/yarn dependency files [gitignored]\n├── scripts               # deployment scripts (deploy.ts) and other tasks [modified after hardhat default]\n├── test                  # test scripts [modified after hardhat default]\n  └── foundry             # test scripts for foundry and fuzzing\n├── typechain-types       # typechain types, generated after compilation [gitignored]\n├── .env                  # API keys of block explorers for smart contract verification [should be gitignored]\n├── .env.example          # format for structuring the .env file\n├── .prettierrc           # prettier formatting configuration\n├── .solhint.json         # solhint configuration\n├── .solhintignore        # solhint ignore configuration\n├── .yarnrc.yml           # https://yarnpkg.com/getting-started/migration#if-required-enable-the-node-modules-plugin\n├── coverage.json         # gitignored\n├── foundry.toml          # foundry configuration https://book.getfoundry.sh/static/config.default.toml\n├── hardhat-config.ts     # hardhat configuration [modified after hardhat default]\n├── package.json          # project details and dependencies\n├── README.md             # project details and instructions\n├── remappings.txt        # foundry remappings https://book.getfoundry.sh/reference/forge/forge-remappings\n├── tsconfig.json         # typescript configuration [hardhat default]\n├── yarn.lock             # yarn dependencies\n├── .gitmodules\n└── .gitignore\n```\n\n## Notes\n\n- All the files and folders that have been [modified after hardhat default], as mentioned in the above directory layout, consists of well-commented codes in the respective places, regarding the modifications.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsumit03guha%2Fsmart-contracts-development-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsumit03guha%2Fsmart-contracts-development-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsumit03guha%2Fsmart-contracts-development-boilerplate/lists"}