Skip to content

Collection of smart contracts examples and projects in Solidity.

License

Notifications You must be signed in to change notification settings

samnang/solidity-examples

Repository files navigation

Solidity Examples

CI

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

$ npm install
$ npx hardhat test

Getting Started with Solidity

  1. Data types
  2. Constructors
  3. Variables
  4. Functions
  5. Visibility
  6. Pure and View
  7. Function modifiers
  8. Gas
  9. Events
  10. Error handling
  11. Fallback function
  12. For Loop
  13. Array
  14. Mapping
  15. Enum
  16. Struct
  17. Payable modifier
  18. Import into a contract
  19. Contract cleanup
  20. Memory vs storage
  21. Inheritance
  22. If statements
  23. Libraries
  24. Interface

Sample Apps

  1. Sample Contract
  2. Address Book
  3. Hotel Room
  4. Time lock
  5. ERC20 Token
  6. Shared Wallet
  7. Swap Token
  8. ETH Game
  9. Ballot
  10. Vault / Liquidity Pool
  11. Flash Loan. (See more resources)
  12. Uniswap - Simple Swap

Road to Web3

  1. NFT Smart Contract ECR-721
  2. Buy Me A Coffee
  3. NFTs with On-Chain Metadata
  4. NFT Gallery
  5. Connect APIs to your Smart Contracts using Chainlink

Solidity by Examples

  1. Ether Wallet
  2. Multi Sig Wallet
  3. Wrapped ETH (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.

License

The software is available as open source under the terms of the MIT License.