{"id":13803316,"url":"https://github.com/pcaversaccio/hardhat-project-template-ts","last_synced_at":"2025-10-25T02:43:07.266Z","repository":{"id":38339839,"uuid":"453676256","full_name":"pcaversaccio/hardhat-project-template-ts","owner":"pcaversaccio","description":"A fully-fledged Hardhat project template based on TypeScript.","archived":false,"fork":false,"pushed_at":"2025-05-16T09:18:26.000Z","size":4270,"stargazers_count":224,"open_issues_count":0,"forks_count":47,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-16T09:42:16.035Z","etag":null,"topics":["ethereum","foundry","hardhat","smart-contracts","solidity","template","typescript"],"latest_commit_sha":null,"homepage":"https://hardhat.org","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pcaversaccio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-01-30T12:38:47.000Z","updated_at":"2025-05-16T09:18:29.000Z","dependencies_parsed_at":"2023-02-19T03:00:31.114Z","dependency_job_id":"dc9df4fe-e32a-415d-9738-f79a78fbdc7b","html_url":"https://github.com/pcaversaccio/hardhat-project-template-ts","commit_stats":{"total_commits":803,"total_committers":10,"mean_commits":80.3,"dds":"0.15193026151930267","last_synced_commit":"ea7bd2b1bf8cbe1fc7552b298238efcfeadb9db4"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcaversaccio%2Fhardhat-project-template-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcaversaccio%2Fhardhat-project-template-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcaversaccio%2Fhardhat-project-template-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcaversaccio%2Fhardhat-project-template-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pcaversaccio","download_url":"https://codeload.github.com/pcaversaccio/hardhat-project-template-ts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254592368,"owners_count":22097011,"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","foundry","hardhat","smart-contracts","solidity","template","typescript"],"created_at":"2024-08-04T01:00:28.826Z","updated_at":"2025-10-25T02:43:07.259Z","avatar_url":"https://github.com/pcaversaccio.png","language":"TypeScript","funding_links":[],"categories":["Templates \u0026 Libraries","typescript"],"sub_categories":[],"readme":"# Fully-Fledged Hardhat Project Template Based on TypeScript\n\n[![🕵️‍♂️ Test smart contracts](https://github.com/pcaversaccio/hardhat-project-template-ts/actions/workflows/test-contracts.yml/badge.svg)](https://github.com/pcaversaccio/hardhat-project-template-ts/actions/workflows/test-contracts.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/mit)\n\n## Installation\n\nIt is recommended to install [`pnpm`](https://pnpm.io) through the `npm` package manager, which comes bundled with [Node.js](https://nodejs.org/en) when you install it on your system. It is recommended to use a Node.js version `\u003e=24.2.0`.\n\nOnce you have `npm` installed, you can run the following both to install and upgrade `pnpm`:\n\n```console\nnpm install -g pnpm\n```\n\nAfter having installed `pnpm`, simply run:\n\n```console\npnpm install\n```\n\n## Running Deployments\n\n\u003e [!NOTE]\n\u003e The deployment script [`deploy.ts`](./scripts/deploy.ts) attempts to automatically verify the contract on the target chain after deployment. If you have not configured an API key, the verification will fail.\n\n**Example Sepolia:**\n\n```console\npnpm deploy:sepolia\n```\n\n\u003e The deployment script [`deploy.ts`](./scripts/deploy.ts) includes the `tenderly` Hardhat Runtime Environment (HRE) extension with the `verify` method. Please consider uncommenting and configuring the Tenderly `project`, `username`, `forkNetwork`, `privateVerification`, and `deploymentsDir` attributes in the [`hardhat.config.ts`](./hardhat.config.ts) file before deploying or remove this call. Also, for this plugin to function you need to create a `config.yaml` file at `$HOME/.tenderly/config.yaml` or `%HOMEPATH%\\.tenderly\\config.yaml` and add an `access_key` field to it. For further information, see [here](https://github.com/Tenderly/hardhat-tenderly/tree/master/packages/hre-extender-v2#installing-tenderly-cli).\n\n\u003e For the deployment on the [ZKsync Era](https://docs.zksync.io/) test network, you must add your to-be-deployed contract artifact to [`deploy-zksync.ts`](./deploy/deploy-zksync.ts), enable `zksync` in the [`hardhat.config.ts`](./hardhat.config.ts#L121) file, and then run `pnpm compile` (in case you face any compilation issues, disable all configurations associated with the [`@tenderly/hardhat-tenderly`](https://github.com/Tenderly/hardhat-tenderly) plugin, including the `import` statement itself; see also [here](https://github.com/matter-labs/hardhat-zksync/issues/998) and [here](https://github.com/matter-labs/hardhat-zksync/issues/1174)). Next, fund your deployer account on ZKsync Era Testnet, setup the ZKsync-related configuration variables accordingly, and simply run `pnpm deploy:zksynctestnet`. Eventually, to verify the contract you can invoke: `npx hardhat verify --network zkSyncTestnet --constructor-args arguments.js \u003cYOUR_CONTRACT_ADDRESS\u003e`. The same approach applies if you want to deploy on the production network, except that you need to run `pnpm deploy:zksyncmain` and use `--network zkSyncMain` for the contract verification.\n\n## Running `CREATE2` Deployments\n\n```console\npnpm xdeploy\n```\n\nThis template uses the [`xdeployer`](https://github.com/pcaversaccio/xdeployer) Hardhat plugin. Check out the documentation for more information on the specifics of the deployments.\n\n## Configuration Variables\n\nRun `npx hardhat vars set PRIVATE_KEY` to set the private key of your wallet. This allows secure access to your wallet to use with both testnet and mainnet funds during Hardhat deployments.\n\nYou can also run `npx hardhat vars setup` to see which other [configuration variables](https://v2.hardhat.org/hardhat-runner/docs/guides/configuration-variables) are available.\n\n## Using a Ledger Hardware Wallet\n\nThis template implements the [`hardhat-ledger`](https://v2.hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-ledger) plugin. Run `npx hardhat set LEDGER_ACCOUNT` and enter the address of the Ledger account you want to use.\n\n## Mainnet Forking\n\nYou can start an instance of the Hardhat network that forks the mainnet. This means that it will simulate having the same state as the mainnet, but it will work as a local development network. That way you can interact with deployed protocols and test complex interactions locally. To use this feature, you need to connect to an archive node.\n\nThis template is currently configured via the [`hardhat.config.ts`](./hardhat.config.ts) as follows:\n\n```ts\nforking: {\n  url: vars.get(\"ETH_MAINNET_URL\", ethMainnetUrl),\n  // The Hardhat network will by default fork from the latest mainnet block\n  // To pin the block number, specify it below\n  // You will need access to a node with archival data for this to work!\n  // blockNumber: 14743877,\n  // If you want to do some forking, set `enabled` to true\n  enabled: false,\n},\n```\n\n## Contract Verification\n\nChange the contract address to your contract after the deployment has been successful. This works for both testnet and mainnet. You will need to get an API key from [etherscan](https://etherscan.io), [snowtrace](https://snowtrace.io) etc.\n\n**Example:**\n\n```console\nnpx hardhat verify --network ethMain --constructor-args arguments.js \u003cYOUR_CONTRACT_ADDRESS\u003e\n```\n\n## Contract Interaction\n\nThis template includes an [example script](./scripts/interact.ts) that shows how to interact programmatically with a deployed contract. You must customise it according to your contract's specifications. The script can be simply invoked via:\n\n```console\nnpx hardhat run scripts/interact.ts --network \u003cnetwork_name\u003e\n```\n\n## Foundry\n\nThis template repository also includes the [Foundry](https://github.com/foundry-rs/foundry) toolkit as well as the [`@nomicfoundation/hardhat-foundry`](https://v2.hardhat.org/hardhat-runner/docs/advanced/hardhat-and-foundry) plugin.\n\n\u003e If you need help getting started with Foundry, I recommend reading the [📖 Foundry Book](https://getfoundry.sh).\n\n### Dependencies\n\n```console\nmake update\n```\n\nor\n\n```console\nforge update\n```\n\n### Compilation\n\n```console\nmake build\n```\n\nor\n\n```console\nforge build\n```\n\n### Testing\n\nTo run only TypeScript tests:\n\n```console\npnpm test:hh\n```\n\nTo run only Solidity tests:\n\n```console\npnpm test:forge\n```\n\nor\n\n```console\nmake test-forge\n```\n\nTo additionally display the gas report, you can run:\n\n```console\nmake test-gasreport\n```\n\n### Deployment and Etherscan Verification\n\nInside the [`scripts/`](./scripts) folder are a few preconfigured scripts that can be used to deploy and verify contracts via Foundry. These scripts are required to be _executable_ meaning they must be made executable by running:\n\n```console\nmake scripts\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcaversaccio%2Fhardhat-project-template-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpcaversaccio%2Fhardhat-project-template-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcaversaccio%2Fhardhat-project-template-ts/lists"}