This repository provides solutions to the code exercises of the Alchemy University course Learn Solidity.
Learn Solidity covers the essentials of the language, starting from basic value types like int, uint, and bool, to more complex features such as address interactions, reference types like arrays, structs, and mappings, and applied practices with real-world contract examples and inheritance. Hands-on IDE practice and engaging video content offer immediate feedback, ensuring a comprehensive understanding. This course is the modern successor to traditional Solidity education, laying the groundwork for future learning in EIPs and community-adopted patterns. It's the ultimate starting point for anyone looking to be effective in the space!
The course leverages Foundry as its primary development framework, a robust toolset that greatly facilitates the compilation of smart contracts and enhances the efficiency of both development and deployment activities within blockchain applications. Foundry includes a set of individual frameworks, among them Forge, a dedicated Ethereum testing framework used within the course to test the solutions provided by the students.
To install Foundry, head over to their documentation: https://book.getfoundry.sh/
Within each chapter, you will find all individual coding challenges with a provided solution. As in other programming languages, multiple solutions are often possible. Consequently, the solutions presented here should not be treated as exclusive or definitive. Alternative approaches may also yield successful test runs.
- Basic Data Types
- Functions
- Sending Ether
- Reverting Transactions
- Calldata
- Code an Escrow contract
- Arrays
- Structs
- Mappings
- Code a Voting contract leveraging the course contents
- Inheritance
Use the command line to compile and test the smart contracts.
$ forge compile
$ forge test
If you'd like to contribute to this repository, please follow these guidelines:
- Fork the repository to your GitHub account.
- Create a new branch for your contributions:
$ git checkout -b feature/new-feature
- Make your changes, whether they are bug fixes, improvements or documentation updates.
- Commit your changes with a descriptive commit messages.
- Push your branch to your forked repository on GitHub:
$ git push origin feature/new-feature
- Open a Pull Request (PR) to the main repository, explaining the purpose of your changes.
Your contributions are greatly appreciated!
This course repository is licensed under the MIT License.
Feel free to use, modify, and distribute the content for educational purposes.