Skip to content

JSONbored/base-learn

Repository files navigation

🎓 Base Learn Solutions - Complete All 13 Exercises!

Base Solidity Ethereum

Battle-tested smart contracts that successfully pass all Base Learn validations

🚀 Deploy📚 Contracts🏆 Rewards💡 Tips


✨ What You'll Earn

🏅 13 NFTs

Soulbound Tokens
Permanent proof of your smart contract mastery

👑 Guild Roles

5 Achievement Tiers
Newcomer → Acolyte → Consul → Prefect → Supreme

💎 13 Points

TalentProtocol
Build your on-chain developer reputation

🎯 Why This Repository?

After hours of debugging and testing, I've compiled working solutions for all 13 Base Learn exercises. Each contract has been:

  • Deployed and verified on Base Sepolia
  • Successfully minted the corresponding NFT
  • Optimized for gas efficiency
  • Documented for learning

💡 Note: These are meant for learning! Understand the code before deploying.

📁 Contract Solutions

Click to see all 13 exercises with direct links
# Exercise Contract Quest Link Key Concepts
01 Basic Math BasicMath.sol 🔗 Quest Overflow-safe arithmetic, error handling
02 Control Structures ControlStructures.sol 🔗 Quest FizzBuzz, time-based logic, custom errors
03 Storage EmployeeStorage.sol 🔗 Quest Storage optimization, packing, memory vs storage
04 Arrays FavoriteRecords.sol 🔗 Quest Dynamic arrays, array manipulation
05 Mappings FavoriteRecords.sol 🔗 Quest Mapping operations, nested mappings
06 Inheritance InheritanceContracts.sol 🔗 Quest Contract inheritance, virtual/override
07 Structs GarageManager.sol 🔗 Quest Custom data structures, struct arrays
08 Error Triage ErrorTriageExercise.sol 🔗 Quest Debugging, error patterns, assembly
09 New Keyword AddressBookFactory.sol 🔗 Quest Factory pattern, contract deployment
10 Imports ImportsExercise.sol 🔗 Quest Libraries, code reuse, using for
11 ERC-721 HaikuNFT.sol 🔗 Quest NFT standard, OpenZeppelin, minting
12 Minimal Token UnburnableToken.sol 🔗 Quest Basic token mechanics, transfers
13 ERC-20 WeightedVoting.sol 🔗 Quest Governance token, voting mechanics

🚀 Deployment Guide

Prerequisites

# 1. Clone this repository
git clone https://github.com/YOUR_USERNAME/base-learn-solutions.git
cd base-learn-solutions

# 2. Install dependencies
npm install

# 3. Set up your environment
cp .env.example .env

Configure .env

PRIVATE_KEY=your_private_key_here
BASE_SEPOLIA_RPC=https://sepolia.base.org
BASESCAN_API_KEY=your_basescan_api_key

⚠️ Security: Never commit your .env file!

Deploy Contracts

Option 1: Deploy All Contracts
npx hardhat compile
npx hardhat run scripts/deploy-all.ts --network baseSepolia
Option 2: Deploy Individual Contracts
# Compile first
npx hardhat compile

# Then deploy specific contract
npx hardhat run scripts/deploy-01-basicmath.ts --network baseSepolia

📝 Submission Process

graph LR
    A[Deploy Contract] --> B[Copy Address]
    B --> C[Visit Base Learn]
    C --> D[Submit Address]
    D --> E[Mint NFT! 🎉]
Loading
  1. Deploy your contract to Base Sepolia
  2. Copy the contract address from terminal
  3. Navigate to Base Learn
  4. Paste address and submit
  5. Mint your NFT!

💡 Pro Tips

🎯 Common Issues & Solutions

Issue Solution
"Unable to estimate gas" Contract validation failed - check function signatures
"Transaction underpriced" Previous transaction pending - wait or increase gas
Contract not verifying Ensure exact function names and parameters match
Imports failing Deploy library contract first, then main contract

🔥 Speed Run Strategy

  1. Batch Operations: Deploy 3-4 contracts at once
  2. Use Remix: For quick testing before Hardhat deployment
  3. Pre-fund Wallet: Have enough Base Sepolia ETH ready
  4. Keep Tab Open: Stay logged into Base Learn platform

🛡️ Security Best Practices

  • ✅ Use a dedicated testnet wallet
  • ✅ Store keys in .env, never hardcode
  • ✅ Verify contracts on BaseScan after deployment
  • ✅ Test locally with npx hardhat test first

📚 Resources

Official Links

Community

🤝 Contributing

Found a better solution? Contributions are welcome!

# 1. Fork the repository
# 2. Create your feature branch
git checkout -b feature/better-solution

# 3. Commit your changes
git commit -m '✨ Improve Exercise X solution'

# 4. Push and create PR
git push origin feature/better-solution

📜 License

MIT License - Use freely to complete Base Learn!

🙏 Acknowledgments

Special thanks to:

Base Learn Team • OpenZeppelin • Hardhat • The Base Community


🌟 Star this repo if it helped you earn your NFTs!

Made with ❤️ by JSONbored

⬆ back to top

Alt

About

✨ Complete smart contract solutions for all 13 Base Learn exercises - Earn NFTs and unlock Guild.xyz roles!

Topics

Resources

Stars

Watchers

Forks