{"id":27865167,"url":"https://github.com/rajgoesout/hardhat-foundry-starter","last_synced_at":"2025-05-04T21:19:12.213Z","repository":{"id":111618212,"uuid":"463290482","full_name":"rajgoesout/hardhat-foundry-starter","owner":"rajgoesout","description":"Use Hardhat \u0026 Foundry in the same project","archived":false,"fork":false,"pushed_at":"2022-02-25T18:06:54.000Z","size":276,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-03-02T14:17:31.250Z","etag":null,"topics":["dapp","ethereum","foundry","hardhat","solidity","testing"],"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/rajgoesout.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-02-24T20:23:22.000Z","updated_at":"2024-03-02T14:17:32.234Z","dependencies_parsed_at":"2023-05-03T15:02:39.126Z","dependency_job_id":null,"html_url":"https://github.com/rajgoesout/hardhat-foundry-starter","commit_stats":null,"previous_names":["rajgoesout/hardhat-foundry-starter"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajgoesout%2Fhardhat-foundry-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajgoesout%2Fhardhat-foundry-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajgoesout%2Fhardhat-foundry-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajgoesout%2Fhardhat-foundry-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rajgoesout","download_url":"https://codeload.github.com/rajgoesout/hardhat-foundry-starter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252399787,"owners_count":21741710,"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":["dapp","ethereum","foundry","hardhat","solidity","testing"],"created_at":"2025-05-04T21:19:11.588Z","updated_at":"2025-05-04T21:19:12.202Z","avatar_url":"https://github.com/rajgoesout.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hardhat Foundry Starter\n\nThis is a solidity starter template which lets you use both, [Hardhat](https://hardhat.org) and [Foundry](https://github.com/gakonst/foundry).\n\n## Why use both the tools?\n\nFoundry has some awesome testing capabilities, thanks to [cheatcodes](https://onbjerg.github.io/foundry-book/forge/cheatcodes.html), which can manipulate the state of the blockchain. However, I was missing out on some features offered by Hardhat. These include:\n\n- Compatibility by [remix ide](https://remix.ethereum.org): I always use remix for deployment and manually testing contracts. However, I wasn't able to use foundry-style imports in remix (refer [#2096](https://github.com/ethereum/remix-project/issues/2096)). So, I decided to enable imports from node_modules, which are compatible with remix; and add remappings in foundry's config.\n- Ability to run a local node.\n- Writing tests in JS/TS: While writing tests in solidity is a better experience, sometimes we might want to replicate some JS behavior, which is present in dapps.\n\nHence, this template.\n\n## Getting Started\n\n```shell\nnpm install\nforge install\n```\n\n## Foundry Instructions\n\nWrite forge tests in [src/test](./src/test).\n\n```shell\nforge build\nforge test\n```\n\n## Hardhat Instructions\n\nWrite hardhat tests in [test](./test/).\n\n```shell\nnpx hardhat accounts\nnpx hardhat compile\nnpx hardhat clean\nnpx hardhat test\nnpx hardhat node\nnpx hardhat help\nREPORT_GAS=true npx hardhat test\nnpx hardhat coverage\nnpx hardhat run scripts/deploy.ts\nTS_NODE_FILES=true npx ts-node scripts/deploy.ts\nnpx eslint '**/*.{js,ts}'\nnpx eslint '**/*.{js,ts}' --fix\nnpx prettier '**/*.{json,sol,md}' --check\nnpx prettier '**/*.{json,sol,md}' --write\nnpx solhint 'contracts/**/*.sol'\nnpx solhint 'contracts/**/*.sol' --fix\n```\n\n### Etherscan verification\n\nTo try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Ropsten.\n\nIn this project, copy the .env.example file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your Ropsten node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract:\n\n```shell\nhardhat run --network ropsten scripts/sample-script.ts\n```\n\nThen, copy the deployment address and paste it in to replace `DEPLOYED_CONTRACT_ADDRESS` in this command:\n\n```shell\nnpx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS \"Hello, Hardhat!\"\n```\n\n### Performance optimizations\n\nFor faster runs of your tests and scripts, consider skipping ts-node's type checking by setting the environment variable `TS_NODE_TRANSPILE_ONLY` to `1` in hardhat's environment. For more details see [the documentation](https://hardhat.org/guides/typescript.html#performance-optimizations).\n\n## Credits\n\n- https://github.com/EricForgy/foundry-hardhat-sample\n- Hardhat Starter Template\n- [ds-test](https://github.com/dapphub/ds-test)\n- [forge-std](https://github.com/brockelmore/forge-std)\n- [solmate](https://github.com/Rari-Capital/solmate)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajgoesout%2Fhardhat-foundry-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frajgoesout%2Fhardhat-foundry-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajgoesout%2Fhardhat-foundry-starter/lists"}