How do you initialize a new Foundry project?

Beginner

Answer

You initialize a new Foundry project using the forge init command:

forge init my-project
cd my-project

This creates a standard project structure with:

  • src/ - Smart contract source files
  • test/ - Test files
  • script/ - Deployment and interaction scripts
  • foundry.toml - Configuration file
  • lib/ - Dependencies/libraries