|
| 1 | +# Base Learn Solutions 🎓 |
| 2 | + |
| 3 | +Complete, working smart contract solutions for all 13 Base Learn exercises. Earn your NFTs and unlock Guild.xyz roles! 🏆 |
| 4 | + |
| 5 | +## 🚀 Overview |
| 6 | + |
| 7 | +This repository contains battle-tested smart contracts that successfully pass all Base Learn validations. Each contract has been deployed and verified to mint the corresponding NFT on Base Sepolia testnet. |
| 8 | + |
| 9 | +### What you'll earn: |
| 10 | +- ✅ **13 Soulbound NFTs** - Proof of your smart contract mastery |
| 11 | +- 🏅 **Guild.xyz Roles** - Newcomer, Acolyte, Consul, Prefect, Supreme |
| 12 | +- 💎 **13 TalentProtocol Points** - Build your on-chain reputation |
| 13 | + |
| 14 | +## 📋 Prerequisites |
| 15 | + |
| 16 | +- Node.js v18+ and npm |
| 17 | +- MetaMask or Coinbase Wallet |
| 18 | +- Base Sepolia ETH (get from [faucet](https://www.coinbase.com/faucets/base-ethereum-goerli-faucet)) |
| 19 | +- Basic understanding of Solidity and smart contracts |
| 20 | + |
| 21 | +## 🛠 Installation |
| 22 | + |
| 23 | +```bash |
| 24 | +# Clone the repository |
| 25 | +git clone https://github.com/YOUR_USERNAME/base-learn-solutions.git |
| 26 | +cd base-learn-solutions |
| 27 | + |
| 28 | +# Install dependencies |
| 29 | +npm install |
| 30 | + |
| 31 | +# Set up environment variables |
| 32 | +cp .env.example .env |
| 33 | +# Edit .env and add your private key (NEVER commit this!) |
| 34 | +``` |
| 35 | + |
| 36 | +## 📁 Contract Solutions |
| 37 | + |
| 38 | +Each exercise is in its own directory with the exact contract name Base Learn expects: |
| 39 | + |
| 40 | +| Exercise | Contract | Description | |
| 41 | +|----------|----------|-------------| |
| 42 | +| 01 | `BasicMath.sol` | Overflow-safe arithmetic operations | |
| 43 | +| 02 | `ControlStructures.sol` | FizzBuzz and time-based logic | |
| 44 | +| 03 | `EmployeeStorage.sol` | Optimized storage patterns | |
| 45 | +| 04 | `FavoriteRecords.sol` | Array manipulation | |
| 46 | +| 05 | `FavoriteRecords.sol` | Mapping operations | |
| 47 | +| 06 | `InheritanceContracts.sol` | Contract inheritance patterns | |
| 48 | +| 07 | `GarageManager.sol` | Struct management | |
| 49 | +| 08 | `ErrorTriageExercise.sol` | Error handling and debugging | |
| 50 | +| 09 | `AddressBookFactory.sol` | Factory pattern with `new` keyword | |
| 51 | +| 10 | `ImportsExercise.sol` | Library imports and usage | |
| 52 | +| 11 | `HaikuNFT.sol` | ERC-721 NFT implementation | |
| 53 | +| 12 | `UnburnableToken.sol` | Minimal token implementation | |
| 54 | +| 13 | `WeightedVoting.sol` | ERC-20 governance token | |
| 55 | + |
| 56 | +## 🚀 Deployment Guide |
| 57 | + |
| 58 | +### Deploy All Contracts |
| 59 | + |
| 60 | +```bash |
| 61 | +# Compile all contracts |
| 62 | +npx hardhat compile |
| 63 | + |
| 64 | +# Deploy to Base Sepolia |
| 65 | +npx hardhat run scripts/deploy-all.ts --network baseSepolia |
| 66 | +``` |
| 67 | + |
| 68 | +### Deploy Individual Contracts |
| 69 | + |
| 70 | +```bash |
| 71 | +# Deploy specific exercise (replace XX with exercise number) |
| 72 | +npx hardhat run scripts/deploy-XX.ts --network baseSepolia |
| 73 | +``` |
| 74 | + |
| 75 | +## ✅ Submission Process |
| 76 | + |
| 77 | +1. **Deploy your contracts** to Base Sepolia testnet |
| 78 | +2. **Copy the deployed contract address** from the terminal |
| 79 | +3. **Visit [Base Learn](https://docs.base.org/base-learn/docs/welcome)** |
| 80 | +4. **Navigate to the exercise** you want to submit |
| 81 | +5. **Paste your contract address** and click submit |
| 82 | +6. **Mint your NFT** after successful validation |
| 83 | + |
| 84 | +## 🔑 Important Notes |
| 85 | + |
| 86 | +### Security |
| 87 | +- **NEVER** commit your `.env` file or private keys |
| 88 | +- Use a dedicated wallet for testnet deployments |
| 89 | +- Keep your private keys secure |
| 90 | + |
| 91 | +### Validation Tips |
| 92 | +- Base Learn expects **exact** function signatures |
| 93 | +- Don't modify function names or parameters |
| 94 | +- Some exercises require specific Solidity versions |
| 95 | +- If validation fails, check gas estimation errors |
| 96 | + |
| 97 | +### Common Issues |
| 98 | +- **"Unable to estimate network fee"** - Contract validation failed |
| 99 | +- **"Transaction underpriced"** - Wait for pending transactions to clear |
| 100 | +- **Validation failures** - Ensure exact function signatures match |
| 101 | + |
| 102 | +## 📚 Resources |
| 103 | + |
| 104 | +- [Base Learn Platform](https://docs.base.org/base-learn/docs/welcome) |
| 105 | +- [Base Documentation](https://docs.base.org/) |
| 106 | +- [Base Sepolia Faucet](https://www.coinbase.com/faucets/base-ethereum-goerli-faucet) |
| 107 | +- [Base Sepolia Explorer](https://sepolia.basescan.org) |
| 108 | +- [Guild.xyz Base Learn](https://guild.xyz/base-learn) |
| 109 | + |
| 110 | +## 🤝 Contributing |
| 111 | + |
| 112 | +Found an issue or have an improvement? Contributions are welcome! |
| 113 | + |
| 114 | +1. Fork the repository |
| 115 | +2. Create your feature branch (`git checkout -b feature/improvement`) |
| 116 | +3. Commit your changes (`git commit -m 'Add improvement'`) |
| 117 | +4. Push to the branch (`git push origin feature/improvement`) |
| 118 | +5. Open a Pull Request |
| 119 | + |
| 120 | +## 📜 License |
| 121 | + |
| 122 | +MIT License - feel free to use these solutions to complete Base Learn! |
| 123 | + |
| 124 | +## 🙏 Acknowledgments |
| 125 | + |
| 126 | +- Base Learn team for creating this educational platform |
| 127 | +- OpenZeppelin for secure contract libraries |
| 128 | +- The Base ecosystem community |
| 129 | + |
| 130 | +--- |
| 131 | + |
| 132 | +**⚡ Ready to become a Base Learn graduate?** Deploy these contracts and earn your NFTs! |
| 133 | + |
| 134 | +Remember: Learning by doing is the best way to master smart contracts. Use these solutions to understand the patterns, then try building your own variations! 🚀 |
0 commit comments