Scaffold-ETH 2 Docs | Scaffold-ETH 2 Website
An open-source toolkit for building dapps on Ethereum.
Powers the Regen Bazaar platform frontend (Next.js, TypeScript, Wagmi/Viem) and smart contracts (Foundry).
- Node.js ≥ 18.18
- Yarn (v1 or v2+)
- Git
- Foundry (Forge, Cast, Anvil)
# Clone using SSH (recommended)
git clone https://github.com/trudransh/regenbazaar-monorepo.git
# Or with HTTPS
# git clone https://github.com/Regen-Bazaar/regenbazaar-monorepo.git
cd regenbazaar-monorepo
npm install# Launch Anvil via Foundry
anvilcd regenbazaar/packages/foundry
# Clean and install dependencies (if you encounter issues)
rm -rf lib/forge-std/ lib/openzeppelin-contracts/
forge install foundry-rs/forge-std --no-commit
forge install OpenZeppelin/openzeppelin-contracts --no-commit
# Build contracts
forge compileThere are several ways to deploy the contracts:
This is the easiest way to deploy all contracts with proper nonce sequencing:
cd packages/foundry
# Clean up any previous deployments (optional)
rm -f addresses.json
rm -rf broadcast/
# Deploy all contracts with a local anvil instance
./script/deploy_with_anvil.shThis script will:
- Start a local Anvil blockchain
- Deploy all contracts in sequence with proper nonce management
- Display the deployed addresses
- Save addresses to
addresses.json - Shut down Anvil when done
If you need more control, you can deploy contracts individually:
cd packages/foundry
# Deploy specific contracts (1-5)
./script/deploy/deploy.sh 1 # Deploy REBAZ Token
./script/deploy/deploy.sh 2 # Deploy Impact NFT
./script/deploy/deploy.sh 3 # Deploy Staking
./script/deploy/deploy.sh 4 # Deploy Marketplace
./script/deploy/deploy.sh 5 # Deploy Factory
# Or deploy all contracts in sequence
./script/deploy/deploy.sh allcd packages/foundry
# Deploy all contracts to a testnet (e.g., Sepolia)
./script/deploy/deploy.sh --rpc=https://sepolia.infura.io/v3/YOUR_API_KEY all
# Or deploy individual contracts
./script/deploy/deploy.sh --rpc=https://sepolia.infura.io/v3/YOUR_API_KEY 1After deployment, you can verify success by:
- Check the
addresses.jsonfile for unique contract addresses - Ensure each contract has a different address
- Verify the addresses match the logs shown during deployment
The deployment is successful if all contracts have unique addresses and no errors occurred.
Inside packages/foundry/contracts you'll find:
- tokens/REBAZToken.sol
ERC20 governance & utility token - tokens/ImpactProductNFT.sol
ERC721 NFT for real-world impact projects - factory/ImpactProductFactory.sol
Factory to mint new ImpactProductNFTs - marketplace/RegenBazaarMarketplace.sol
Listing and trading of impact NFTs - staking/ImpactProductStaking.sol
Staking logic for REBAZ tokens & NFTs - interfaces/
All contract interfaces (IREBAZ, IImpactProductNFT, IImpactProductFactory, IImpactProductNFT, IImpactProductStaking)
If you encounter authentication errors with GitHub:
# Configure Git to use SSH instead of HTTPS for GitHub (if you have SSH set up)
git config --global url."git@github.com:".insteadOf "https://github.com/"- If you see errors about missing files, ensure all dependencies are properly installed:
# Reinstall forge standard libraries
rm -rf lib/forge-std
forge install foundry-rs/forge-std --no-commit
# Reinstall OpenZeppelin
rm -rf lib/openzeppelin-contracts
forge install OpenZeppelin/openzeppelin-contracts --no-commit- Ensure remappings in
packages/foundry/remappings.txtorfoundry.tomlinclude:@openzeppelin/=lib/openzeppelin-contracts/ forge-std/=lib/forge-std/src/
- Same contract addresses: This happens when nonces aren't properly sequenced. Use the
deploy_with_anvil.shscript ordeploy.sh allto ensure proper sequencing. - Anvil connection errors: Check if Anvil is running on port 8545 and not being used by another process.
- Missing addresses.json: Make sure you have write permissions in the directory.
When using multiple ERC721 extensions, put the more-specific contract first in the is list:
contract MyNFT is ERC721URIStorage, ERC721Enumerable { … }© 2024 Regen Bazaar · Built on Scaffold-ETH 2 · MIT License