Complete guide for deploying BaseLytics contracts to Base network.
-
Environment Setup
# Add to .env file PRIVATE_KEY=your_private_key_here BASESCAN_API_KEY=your_basescan_api_key_here -
Install Dependencies
npm install
-
Compile Contracts
npx hardhat compile
Before deployment, estimate gas costs:
npx hardhat run scripts/gas-estimate.js --network baseSepoliaDeploy all contracts at once:
npx hardhat run scripts/deploy.js --network baseSepoliaDeploy contracts in organized batches:
# Deploy core contracts (BaseToken, BaseNFT)
npx hardhat run scripts/deploy-batch.js --network baseSepolia core
# Deploy DeFi contracts (BaseStaking, BaseDEX, BaseVesting)
npx hardhat run scripts/deploy-batch.js --network baseSepolia defi
# Deploy governance contracts
npx hardhat run scripts/deploy-batch.js --network baseSepolia governance
# Deploy utility contracts
npx hardhat run scripts/deploy-batch.js --network baseSepolia utilitiesDeploy single contracts:
# Deploy BaseToken
npx hardhat run scripts/deploy-individual.js --network baseSepolia BaseToken
# Deploy BaseNFT
npx hardhat run scripts/deploy-individual.js --network baseSepolia BaseNFT
# Deploy BaseStaking (requires BaseToken)
npx hardhat run scripts/deploy-individual.js --network baseSepolia BaseStakingnpx hardhat run scripts/verify.js --network baseSepolianpx hardhat run scripts/verify.js --network baseSepolia BaseTokenAll deployments are automatically saved to deployments/ folder:
- Format:
{network}-{timestamp}.json - Contains contract addresses and deployment info
- Used by verification scripts
--network baseSepolia--network base- BaseToken: ERC20 token with minting
- BaseNFT: ERC721 NFT collection
- BaseStaking: Token staking with rewards
- BaseDEX: Decentralized exchange
- BaseVesting: Token vesting schedules
- BaseGovernance: DAO governance system
- BalanceManager: Balance management
- BalanceTracker: Multi-token tracking
- BaseMarketplace: NFT marketplace
-
Insufficient Gas
- Check gas estimation first
- Increase gas limit in hardhat.config.js
-
Missing Dependencies
- Deploy BaseToken before dependent contracts
- Use batch deployment for proper order
-
Verification Failures
- Ensure contract is deployed
- Check constructor arguments match
- Deploy in batches to spread costs
- Use gas estimation to plan deployment
- Deploy during low network activity
For deployment issues:
- Check deployment logs in
deployments/folder - Verify network configuration
- Ensure sufficient ETH balance
- Open GitHub issue if problems persist