Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/samnang/solidity-examples

Collection of smart contracts examples and projects in Solidity.
https://github.com/samnang/solidity-examples

ethereum excercises road-to-web3 smart-contracts solidity solidity-by-examples solidity-contracts solidity-examples web3

Last synced: 3 months ago
JSON representation

Collection of smart contracts examples and projects in Solidity.

Awesome Lists containing this project

README

        

# Solidity Examples

[![CI](https://github.com/samnang/solidity-examples/actions/workflows/build.yml/badge.svg)](https://github.com/samnang/solidity-examples/actions/workflows/build.yml)

This is a collection of solidity examples that I practiced while I was learning about Solidity and writing smart contracts.

Almost all smart contracts have tests with them, so feel free to play around with them to understand more about Solidity programming language or business logic in the contract itself.

## How to Run

```sh
$ npm install
$ npx hardhat test
```

## Getting Started with Solidity

1. [Data types](contracts/getting_started_with_solidity/01_data_types/)
2. [Constructors](contracts/getting_started_with_solidity/02_constructors/)
3. [Variables](contracts/getting_started_with_solidity/03_variables/)
4. [Functions](contracts/getting_started_with_solidity/04_functions/)
5. [Visibility](contracts/getting_started_with_solidity/05_visibility/)
6. [Pure and View](contracts/getting_started_with_solidity/06_pure_and_view_functions/)
7. [Function modifiers](contracts/getting_started_with_solidity/07_function_modifiers/)
8. Gas
9. [Events](contracts/getting_started_with_solidity/09_events/)
10. [Error handling](contracts/getting_started_with_solidity/10_error_handling/)
11. [Fallback function](contracts/getting_started_with_solidity/11_fallback_function/)
12. [For Loop](contracts/getting_started_with_solidity/12_for_loop/)
13. [Array](contracts/getting_started_with_solidity/13_array/)
14. [Mapping](contracts/getting_started_with_solidity/14_mapping/)
15. [Enum](contracts/getting_started_with_solidity/15_enum/)
16. [Struct](contracts/getting_started_with_solidity/16_struct/)
17. [Payable modifier](contracts/getting_started_with_solidity/17_payable_modifier/)
18. [Import into a contract](contracts/getting_started_with_solidity/18_imports/)
19. [Contract cleanup](contracts/getting_started_with_solidity/19_contract_cleanup/)
20. [Memory vs storage](contracts/getting_started_with_solidity/20_memory_and_storage/)
21. [Inheritance](contracts/getting_started_with_solidity/21_inheritance/)
22. [If statements](contracts/getting_started_with_solidity/22_if_statement/)
23. [Libraries](contracts/getting_started_with_solidity/23_libraries/)
24. [Interface](contracts/getting_started_with_solidity/24_interface/)

## Sample Apps

1. [Sample Contract](contracts/sample_apps/01_sample_contract/)
2. [Address Book](contracts/sample_apps/02_address_book/)
3. [Hotel Room](contracts/sample_apps/03_hotel/)
4. [Time lock](contracts/sample_apps/04_time_lock/)
5. [ERC20 Token](contracts/sample_apps/05_ERC20_token/)
6. [Shared Wallet](contracts/sample_apps/06_shared_wallet/)
7. [Swap Token](contracts/sample_apps/07_token_swap/)
8. [ETH Game](contracts/sample_apps/08_eth_game/)
9. [Ballot](contracts/sample_apps/09_ballot/)
10. [Vault / Liquidity Pool](contracts/sample_apps/10_vault/)
11. [Flash Loan](contracts/sample_apps/11_flash_loan/). (See more [resources](https://github.com/samnang/flash-loan-examples))
12. [Uniswap - Simple Swap](contracts/sample_apps/12_uniswap_simple_swap/)

## Road to Web3

1. [NFT Smart Contract ECR-721](contracts/road_to_web3/week_01/)
2. [Buy Me A Coffee](contracts/road_to_web3/week_02/)
3. [NFTs with On-Chain Metadata](contracts/road_to_web3/week_03/)
4. [NFT Gallery](contracts/road_to_web3/week_04/nft_gallery/)
5. [Connect APIs to your Smart Contracts using Chainlink](contracts/road_to_web3/week_05/)

## Solidity by Examples

1. [Ether Wallet](contracts/solidity_by_examples/01_ether_wallet/)
2. [Multi Sig Wallet](contracts/solidity_by_examples/02_multi_sig_wallet/)
3. [Wrapped ETH (WETH)](contracts/solidity_by_examples/03_WETH/)

## Contributors

We love pull requests from everyone. By participating in submitting examples, we believe other people will find them useful when they getting started with Solidity.

- [Samnang Chhun](https://twitter.com/samnangchhun)
- [Web3 Together](https://twitter.com/web3together)

## License

The software is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).