Skip to content

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

Notifications You must be signed in to change notification settings

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