{"id":13619829,"url":"https://github.com/ethereum/solidity-examples","last_synced_at":"2025-04-04T15:10:49.962Z","repository":{"id":39915790,"uuid":"73497633","full_name":"ethereum/solidity-examples","owner":"ethereum","description":"Loose collection of Solidity example code","archived":false,"fork":false,"pushed_at":"2023-01-03T17:13:31.000Z","size":1143,"stargazers_count":556,"open_issues_count":20,"forks_count":161,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-03-28T14:09:45.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethereum.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}},"created_at":"2016-11-11T17:29:00.000Z","updated_at":"2025-03-17T16:05:34.000Z","dependencies_parsed_at":"2023-02-01T08:00:46.056Z","dependency_job_id":null,"html_url":"https://github.com/ethereum/solidity-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Fsolidity-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Fsolidity-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Fsolidity-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Fsolidity-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethereum","download_url":"https://codeload.github.com/ethereum/solidity-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247198463,"owners_count":20900080,"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","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":[],"created_at":"2024-08-01T21:00:49.297Z","updated_at":"2025-04-04T15:10:49.945Z","avatar_url":"https://github.com/ethereum.png","language":"Solidity","funding_links":[],"categories":["Resources","Solidity","一、官方核心资源（权威基准）"],"sub_categories":[],"readme":"# Standard library (draft) [![CircleCI](https://circleci.com/gh/ethereum/solidity-examples.svg?style=svg)](https://circleci.com/gh/ethereum/solidity-examples)\n\nTemporary storage for a standard library of Solidity contracts.\n\nThe code in this library will only run in metropolis compliant networks, and it will only compile using Solidity version `0.5.0` and later.\n\n## TOC\n\n- [Purpose](#purpose)\n- [Packages](#packages)\n  - [bits](#bits)\n  - [bytes](#bytes)\n  - [math](#math)\n  - [patricia_tree](#patricia_tree)\n  - [strings](#strings)\n  - [token](#token)\n  - [unsafe](#unsafe)\n- [Quality Assurance](#quality-assurance)\n- [Commandline tool](#commandline-tool)\n- [Q\u0026A](qa)\n\n## Purpose\n\nThe standard library should provide Solidity libraries / functions for performing common tasks, such as working with strings, bits, and other common types, and for working with Ethereum and Ethereum related technologies, like for example Patricia Tries.\n\n## Packages\n\nThese are the different packages.\n\n### bits\n\nThe `bits` package is used to work with bitfields (uints).\n\n#### contracts\n\n- [Bits](./docs/bits/Bits.md)\n\n### bytes\n\nThe `bytes` package is used to work with `bytes` in memory, and to convert between `bytes` and other types.\n\n#### contracts\n\n- [Bytes](./docs/bytes/Bytes.md)\n\n### math\n\nThe `math` package is used to do math with signed and unsigned integers.\n\n#### contracts\n\n- [ExactMath](./docs/math/ExactMath.md)\n\n### patricia_tree\n\nThe `patricia_tree` package is used to work with the standard Solidity Patricia tree implementation by @chriseth.\n\n#### contracts\n\n- [PatriciaTree](./docs/patricia_tree/PatriciaTree.md)\n- [Data](./docs/patricia_tree/Data.md)\n\n### strings\n\nThe `strings` package is used to work Solidity `string`s. It only supports UTF-8 validation.\n\n#### contracts\n\n- [Strings](./docs/strings/Strings.md)\n\n### tokens\n\nThe `tokens` package is used to work with Token contracts.\n\n#### contracts\n\n- [ERC20TokenFace](./docs/tokens/ERC20TokenFace.md)\n\n### unsafe\n\nThe `unsafe` package is used to do unsafe operations, like working with memory directly.\n\n#### contracts\n\n- [Memory](./docs/unsafe/Memory.md)\n\n## Quality Assurance\n\nThe standard library has well-documented routines for making sure that code meets the required standards when it comes to:\n\n1. Security\n2. Performance\n3. Style\n4. Documentation\n\nAdditionally, the tools used to guarantee this should be simple and easy to replace when new and better alternatives are made available.\n\n### Testing\n\n`npm test` - runs the contract test-suite, as well as the tests for the typescript code.\n\n`npm run ts-test` - runs the typescript tests.\n\n`npm run contracts-test` - runs the contract test-suite.\n\nThe contract tests requires `solc` and `evm` ([go ethereum](https://github.com/ethereum/go-ethereum)) to be installed and added to the $PATH. Test code is written in Solidity, and is executed directly in the evm.\n\nFor more information about the tests, such as the test file format, read the full [test documentation](./docs/testing.md).\n\nFor running tests with the command-line tool, check the [CLI documentation](./docs/cli.md).\n\n### Performance\n\n`npm run contracts-perf` will run the entire perf suite.\n\nFor more information about perf read the full [perf documentation](./docs/perf.md).\n\nFor running perf with the command-line tool, check the [CLI documentation](./docs/cli.md).\n\n### Style\n\n`npm run ts-lint` - will run TS-lint on the entire library.\n\n`npm run contracts-lint` - will run [solhint](https://github.com/protofire/solhint) on all contracts.\n\nThe standard library should serve as an (or perhaps *the*) example of strict, idiomatic Solidity. This means all code should follow the style guide and the practices and patterns laid out at https://solidity.readthedocs.org.\n\n### Documentation\n\nBriefly: the documentation should specify - in a very clear and concise a way - what the contract of the library/function is, the interfaces / function signatures should reflect that, and the functions should (obviously) behave as described.\n\n### Manual review\n\nCode should be reviewed by at least one person other then the writer. There should also be review of tests, perf, docs, and code examples as well.\n\nThis should be done using the PR system in github.\n\n### Issues and feedback\n\nGithub issues and gitter solidity channel.\n\n### Ranking / categorization of contracts\n\nThe QA only really applies to code that is meant to be used in production, but the library will also include code that has not reached that level.\n\nNode.js has a system of categorizing libraries, experimental, stable, deprecated, and so forth. This library should have something similar.\n\n## Commandline tool\n\nThe library has a commandline tool which can be used to run tests, view documentation, and other things. The full docs can be found in the [commandline tool documentation](./docs/cli.md).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethereum%2Fsolidity-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethereum%2Fsolidity-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethereum%2Fsolidity-examples/lists"}