Awesome
diamondscaffold
diamondscaffold is a CLI tool that helps developers scaffold an EIP-2535 diamond structure with ease. Users can choose between Hardhat or Foundry as their development environment, and they can select between templates like "ERC20", "ERC721", or a default Diamond template to kickstart their smart contract development.
Features
- Scaffold EIP-2535 Diamond architecture.
- Choose between Hardhat or Foundry frameworks.
- Select from multiple templates: ERC20, ERC721, and a default Diamond template.
- Option to scaffold in JavaScript or TypeScript when using Hardhat.
- Install project dependencies automatically when using Hardhat.
Installation
You can install the package globally via npm to use it as a CLI tool.
npm install -g diamondscaffold
Usage
Once installed, use the diamonds init
command to scaffold an EIP-2535 Diamond structure.
Basic Command
diamonds init
This command will prompt you with several questions to help set up your project. Here's the sequence of questions asked:
- Project Name: The name of your project (default is
my-app
). - Template: Choose a template to scaffold:
Default
,ERC20
, orERC721
. - Framework: Choose between
Foundry
orHardhat
. - Language (only for Hardhat): Choose between
JavaScript
orTypeScript
. - Install Dependencies (only for Hardhat): Option to install dependencies automatically, provided you have an active internet connection.
Example
diamonds init
During the initialization, you will be prompted with questions like:
š What is the name of your project? (default: my-app)
š What Template would you like to scaffold? (choices: Default, ERC20, ERC721)
š§ Which framework would you like to use? (choices: Foundry, Hardhat)
š Which language do you want to use? (choices: JavaScript, TypeScript)
Do you want to install project dependencies? (only for Hardhat)
To scaffold a diamond project using Hardhat, ERC20, and TypeScript with automatic dependency installation:
diamonds init
Available Templates
- ERC20: A diamond contract implementing the ERC20 token standard.
- ERC721: A diamond contract implementing the ERC721 NFT standard.
- Default: A basic diamond structure with no additional functionality, providing a clean slate to start with.
Commands
Hardhat Commands
If you scaffold with Hardhat, these commands will be available:
-
Compile the project:
npx hardhat compile
-
Run tests:
npx hardhat test
-
Deploy the contract:
npx hardhat run scripts/deploy.js
Foundry Commands
If you scaffold with Foundry, these commands will be available:
-
Compile the project:
forge build
-
Run tests:
forge test
-
Deploy the contract:
forge script <script-file> --broadcast
Contribution
Contributions to diamondscaffold are welcome! If you'd like to contribute checkout:
License
This package is licensed under the MIT License. See the LICENSE file for more information.