{"id":22364294,"url":"https://github.com/thanhnguyennguyen/smart-contract-practice","last_synced_at":"2025-09-19T18:32:33.420Z","repository":{"id":101364476,"uuid":"136821109","full_name":"thanhnguyennguyen/smart-contract-practice","owner":"thanhnguyennguyen","description":"Practicing with smart contract and Ethereum network using solidity","archived":false,"fork":false,"pushed_at":"2023-03-02T01:47:34.000Z","size":4654,"stargazers_count":9,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-30T16:21:13.300Z","etag":null,"topics":["blockchain","blockchain-demos","erc20","erc20-tokens","ethereum-contract","ethereum-dapp","nguyennguyen","smartcontract-dapp","smartcontracts","thanhnguyennguyen"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thanhnguyennguyen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-06-10T15:32:04.000Z","updated_at":"2023-02-03T09:05:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"b6cf3fad-e43b-4dd5-9178-525cf2055a37","html_url":"https://github.com/thanhnguyennguyen/smart-contract-practice","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/thanhnguyennguyen/smart-contract-practice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thanhnguyennguyen%2Fsmart-contract-practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thanhnguyennguyen%2Fsmart-contract-practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thanhnguyennguyen%2Fsmart-contract-practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thanhnguyennguyen%2Fsmart-contract-practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thanhnguyennguyen","download_url":"https://codeload.github.com/thanhnguyennguyen/smart-contract-practice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thanhnguyennguyen%2Fsmart-contract-practice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275982497,"owners_count":25564149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","blockchain-demos","erc20","erc20-tokens","ethereum-contract","ethereum-dapp","nguyennguyen","smartcontract-dapp","smartcontracts","thanhnguyennguyen"],"created_at":"2024-12-04T17:19:59.206Z","updated_at":"2025-09-19T18:32:33.412Z","avatar_url":"https://github.com/thanhnguyennguyen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/thanhnguyennguyen/smart-contract-practice/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/thanhnguyennguyen/smart-contract-practice/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/thanhnguyennguyen/smart-contract-practice/badges/build.png?b=master)](https://scrutinizer-ci.com/g/thanhnguyennguyen/smart-contract-practice/build-status/master)[![Code Intelligence Status](https://scrutinizer-ci.com/g/thanhnguyennguyen/smart-contract-practice/badges/code-intelligence.svg?b=master)](https://scrutinizer-ci.com/code-intelligence)   [![codecov](https://codecov.io/gh/thanhnguyennguyen/smart-contract-practice/branch/master/graph/badge.svg)](https://codecov.io/gh/thanhnguyennguyen/smart-contract-practice) [![Travis_Build_Status](https://travis-ci.com/thanhnguyennguyen/smart-contract-practice.svg?branch=master)](https://travis-ci.com/thanhnguyennguyen/smart-contract-practice)\n\n# [![Deploy to Docker Cloud](https://files.cloud.docker.com/images/deploy-to-dockercloud.svg)](https://cloud.docker.com/stack/deploy/?repo=https://github.com/thanhnguyennguyen/smart-contract-practice/)\n# Smart Contract practices\n# Copyright © 2018 Nguyen Nguyen\n# Please never write code without tests\n## Lottery game\n### Designs can be found here\nhttps://github.com/thanhnguyennguyen/smart-contract-practice/tree/master/contracts/lottery/design\n### Contract  url\nhttps://rinkeby.etherscan.io/address/0xa0a5566cb16c16384f3b7b3a3a67cbbe0bf2f137\n\n# Solidity basic knowledge\n## Solidity data type\n### ![Solidity data type 1](https://i.imgur.com/2P3XeQR.png)\n### ![Solidity data type 2](https://i.imgur.com/majsyDN.png)\n### ![Solidity data type 3](https://i.imgur.com/Yy9WIXI.png)\n### ![Solidity data type 4](https://i.imgur.com/eL8TkKa.png)\n\n## Memory and storage ![data-location](https://i.imgur.com/7H21p1E.jpg)\n## Array in Solidity\n### avoid nested array ![Solidity note 1](https://i.imgur.com/OkIIVRb.png)\n### static and dynamic array ![dynamic-static](https://i.imgur.com/VohKPct.jpg)\n### Not allowed ![not-allowed](https://i.imgur.com/UKJ8uOM.jpg)\n### bytes and string are special arrays\nbytes32 data; (~ byte[32] data )\nbytes data (~ byte[] data )\nString vss bytes ![string-vs-bytes](https://i.imgur.com/wr8vKTM.jpg)\n## Functions\n![function](https://i.imgur.com/1536CLf.jpg)\n### Function visibilities and modifier ![func-visibilities](https://i.imgur.com/alCH2ma.jpg)\n### Return multiple values ![func-return-multiple-values](https://i.imgur.com/OxoTTjh.jpg)\n### To assign results from multiple returns function to variable, we use tupple ![tupple](https://i.imgur.com/xNsx5MU.jpg)\n### Function overloading ![func-overloading](https://i.imgur.com/rR5LKdh.jpg)\nConstructor overloading is not supported\n\n## Variable initialization\nVariables initialized to defaults at the beginning of functions\n![variable-initialization](https://i.imgur.com/psByqb9.jpg)\n\n## Mapping\n### Difference between mapping and hashtable (of java) or object (of javascript) ![](https://i.imgur.com/1I1oYbCg.jpg)\n### Mapping is defined as state , storage only, not allowed in function\n\n## Enum and struct are not a part of ABI definition, not available for external function call\n\n## Global variable: \n![global-var](https://i.imgur.com/svqPNGK.jpg)\n### ![Solidity global variable 1](https://i.imgur.com/XWEcnzk.png)\n### Difference between msg.sender and tx.origin ![msg-sender-vs-tx-origin](https://i.imgur.com/KfxiPbe.jpg)\n\n## Error handling in Solidity\n### No try-catch in  Solidity\n### What happen if an exception is thrown\n![exception](https://i.imgur.com/nGaxVnb.jpg)\n### Check and handle exception ![handle-exception](https://i.imgur.com/qTfnym5g.jpg)\n![](https://i.imgur.com/i1c8NBy.jpg)\n\n## OOP Support\nNo keyword *abstract contract*, function declared but no body provided. That class can not be deployed\n### Inheritance: multiple inheritance is supported\n### Polimorphism \n### Overloading (except constructor)\n\n## Interface and abstract contract\n![difference-interface-abstrct-contract](https://i.imgur.com/ADqHHyr.jpg)\nto implement an interface, use keywork *is*, similar for extending abstract contract\n\n## Events and Logs\n### Events are part of ABI definition\n### Only indexed event arguments  can be used in Filter, maximum 3 indices are allowed\n![event](https://i.imgur.com/rFD6sC8.jpg)\n\n\n## Contract design patterns\n### Contract destruction ![contract-destruction](https://i.imgur.com/DT2hfD0.jpg)\n#### Sending tracsaction to dead contract: fail\n#### ALl fund send to dead contract will be lost\n### Factory contract\n### Name registry pattern\nUsing a registry Contract to manage all contracts, then using contract name to access instance of a particular contract\n### Mapping iterator pattern\n#### Use another array to keep keys ![mapping-itorator-pattern](https://i.imgur.com/FZPwB1Tg.jpg)\n#### Storage cost goes up\n#### Cost of iteration goes up\n### Withdrawal pattern\n#### Send vs transfer ![send-vs-transfer](https://i.imgur.com/wzaCgxO.jpg)\n#### Withdrawal pattern ![withdrawal-pattern](https://i.imgur.com/0lYuucS.jpg)\n![](https://i.imgur.com/m5wyFD1.jpg)\n\n# ERC-20 specification: 6 functions, 2 events\n## ![ERC-20](https://i.imgur.com/jkLhW5G.jpg)\n## ![ERC-20-2](https://i.imgur.com/IKnmPjT.jpg)\n## ![ERC-20-3](https://i.imgur.com/ZPgaJcO.jpg)\n## ![ERC-20-4](https://i.imgur.com/nJ34JFzg.jpg)\n\nhttps://github.com/thanhnguyennguyen/ERC20-token\n\n# web3 knowledge\n## Send and Call\n### ![Send-vs-call](https://i.imgur.com/m3ji3et.jpg)\n## Filter object: web3.eth.filter\n### ![filter](https://i.imgur.com/sFdgMLV.jpg)\n### Event vs filter ![event-vs-filter](https://i.imgur.com/sb1RVbI.jpg)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthanhnguyennguyen%2Fsmart-contract-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthanhnguyennguyen%2Fsmart-contract-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthanhnguyennguyen%2Fsmart-contract-practice/lists"}