Thanks to visit codestin.com
Credit goes to github.com

Skip to content

difof/sheft

Repository files navigation

SHEFT - Solidity + Hardhat + Ethers + Foundry + Taskfile

Solidity Scaffold Template (SHEFT)

This is a scaffold template for initializing a SHEFT (Solidity + Hardhat + Ethers v6 + Foundry + Taskfile) stack.

There is an article on SHEFT stack here which explains the why's and what's.

Quickstart

Make sure you have the following installed:

Scaffold a new project (you will be prompted):

scaffold new --run-hooks always https://github.com/difof/sheft

And you will have your new project ready to work with.

What You Get

  • Foundry and Hardhat configured to the same src/contracts and test layout
  • OpenZeppelin and Solady pre-installed
  • Ethers v6 with TypeChain output in typechain/
  • Bun for TypeScript runner and package manager
  • ESLint + Prettier (TS), Forge lint/fmt (Solidity)
  • Conventional Commits via commitlint (optional)
  • Taskfile-powered workflows for build/test/deploy/verify/docs
  • Optional package/ sub-package exporting TypeChain + TS utils
  • Example ERC20 and Merkle airdrop contracts with full coverage

Project Structure

<project>/
  foundry.toml
  hardhat.config.ts
  remappings.txt
  Taskfile.yaml
  src/
    contracts/
    ts/
  script/
    foundry/
      deploy/
  test/
    foundry/
    hardhat/
    ts/
  package/
  lib/

If enabled, package/ re-exports typechain and utilities from src/ts and builds an ESM bundle via esbuild.

Contributing

We follow Conventional Commits style. Note that commitlint is NOT used in this template repository; it is only included in projects generated from this template (when selected during scaffolding). Please format commits accordingly.

  • Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
  • Examples:
    • feat(token): add permit support
    • fix(airdrop): prevent double-claim

Template development workflow

Since this is a template project, apply changes directly to the templates under {{ .Project }} and validate them by generating a sandbox project.

  1. Edit templates in {{ .Project }}/....
  2. From repo root, generate the default sandbox project under sandbox/:
task clean:sandbox   
task sandbox         # generates sandbox/
cd sandbox
  1. Run checks inside the sandbox (the generated project):
task fmt && task lint && task test:all

Iterate: adjust files in {{ .Project }}, re-run task sandbox, and repeat checks in sandbox/.

Tips:

  • Use task sandbox:prompt to run the scaffold with prompts when you need non-default answers.
  • Use task clean:sandbox to remove the sandbox/ directory.

Template best practices

  • Keep templates DRY: avoid duplicating large snippets across files; prefer central helpers where possible.
  • Validate output early and often: regenerate the sandbox frequently after small edits.
  • Rely on the sandbox for IDE support: use IntelliSense, lint, and format in sandbox/, not in the template files.
  • Prefer simple, explicit placeholders over clever generation logic; favor readability of the produced code.
  • Make changes composable and incremental; avoid sweeping refactors without a sandbox build in between.
  • Add and run tests in the generated project (test/) to guard template changes.
  • Keep formatting consistent by letting the generated project’s linters/formatters rewrite files.

TODO

  • src/ts docs
  • move inline JS from taskfile:wallet:import:mnemonic to dedicated file in src/ts
  • FIX: .env with RPC_URL, passed to commands
  • add 0x prefix to keccak hash of src/ts/keccak.ts
  • Allow usage of either node/npm or bun, instead of just bun
  • Add viem
  • Start empty without airdrop and token
  • Use proper internal tasks and sh execution for {{.Project}}/Taskfile.yaml
  • Document the utility tasks such as ensure-var
  • Proper empty string defaults for internal utility tasks such as ensure-var
  • Required vars for ensure-var
  • Custom cursor rules and commands
  • Support Optimism (In Hardhat) and other EVM variants
  • Github actions
  • Dedicated project contribution guideline file
  • Smart contract and test templates

License

MIT