This project implements an ERC721 NFT contract with a Merkle distributor for whitelisted addresses using the Diamond Standard (EIP-2535). It's built using the Diamond Standard, Foundry framework and includes a presale mechanism.
- ERC721 NFT implementation
- Merkle-based whitelist distribution
- Presale functionality
- Diamond Standard (EIP-2535) for upgradeable contracts
- Foundry for testing and deployment
-
Clone the repository:
git clone https://github.com/DonGuillotine/ERC721_merkle_diamond_standard.git cd ERC721_merkle_diamond_standard
-
Install Node.js dependencies:
npm install
-
Install Foundry dependencies:
forge install
To generate the Merkle tree and proofs:
npx ts-node scripts/generateMerkleTree.ts
This will create a merkleData.json
file in the root directory.
To run the Foundry tests:
forge test
For more detailed output:
forge test -vv
All Tests Passed
To deploy the contracts (make sure to set up your .env file first):
forge script script/deploy.s.sol:DeployDiamond --rpc-url <YOUR_RPC_URL> --broadcast --verify
contracts/
: Solidity smart contractsfacets/
: Diamond facets (ERC721Facet, MerkleFacet, PresaleFacet)interfaces/
: Contract interfaceslibraries/
: Helper libraries
scripts/
: TypeScript and deployment scriptstest/
: Foundry test files
- Diamond.sol: The main contract implementing the Diamond Standard.
- ERC721Facet.sol: Implements the ERC721 standard.
- MerkleFacet.sol: Handles the Merkle-based whitelist distribution.
- PresaleFacet.sol: Manages the presale functionality.
- generateMerkleTree.ts: Script to generate Merkle tree and proofs.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.