This project demonstrates a comprehensive use case of Hardhat, including an ERC20 token contract (CryptoClash
), an upgradable ERC721 NFT contract (CryptoClashCat
), IPFS integration, and a frontend application built with Next.js. The project showcases minting, token approval, and a simple battle game mechanic using NFTs.
- Node.js
- npm or yarn
- Hardhat
- Alchemy (for Ethereum node)
- Metamask (for interacting with the deployed contracts)
- IPFS (for decentralized storage)
-
Clone the repository:
git clone https://github.com/Leroux63/CryptoClash.git cd CryptoClash
-
Install the dependencies:
npm install # or yarn install
-
Set up environment variables: Create a
.env
file in the root directory and add the following:SEPOLIA_URL=https://eth-sepolia.alchemyapi.io/v2/your-alchemy-key SEPOLIA_URL_2=https://eth-sepolia.alchemyapi.io/v2/your-second-alchemy-key PRIVATE_KEY=your-wallet-private-key TOKEN_CONTRACT_ADDRESS=your-deployed-token-contract-address CONTRACT_NFT_ADDRESS=your-deployed-nft-contract-address
-
Set up frontend environment variables: Create a
.env.local
file in thecrypto-clash-frontend
directory and add the following:NEXT_PUBLIC_TOKEN_CONTRACT_ADDRESS=your-deployed-token-contract-address NEXT_PUBLIC_NFT_CONTRACT_ADDRESS=your-deployed-nft-contract-address NEXT_PUBLIC_RPC_URL=https://eth-sepolia.alchemyapi.io/v2/your-alchemy-key NEXT_PUBLIC_SEPOLIA_URL_2=https://eth-sepolia.alchemyapi.io/v2/your-second-alchemy-key
npx hardhat compile
To deploy the CryptoClash
contract:
npx hardhat run scripts/deploy.js --network sepolia
To deploy the CryptoClashCat
contract:
npx hardhat run scripts/deployNFTContract.js --network sepolia2
Make sure to update the deployment scripts to reflect the correct initialization parameters and contract addresses.
To run the tests, ensure that your contracts are compiled and then run:
npx hardhat test
-
Navigate to the frontend directory:
cd crypto-clash-frontend
-
Install frontend dependencies:
npm install # or yarn install
-
Start the frontend application:
npm run dev
Copy the generated artifacts from the artifacts directory to the public directory in the frontend:
cp -r artifacts/contracts/* crypto-clash-frontend/public/
contracts/
: Contains the Solidity smart contracts.scripts/
: Contains the deployment scripts.test/
: Contains the test scripts.artifacts/
: Generated files from compiling the smart contracts.crypto-clash-frontend/
: Contains the frontend application built with Next.js.hardhat.config.js
: Hardhat configuration file.
This project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries or support, please contact us at dleroux63160@gmail.com.
If you like this project, consider buying me a coffee!