Standard library (draft)
Temporary storage for a standard library of Solidity contracts.
The code in this library will only run in metropolis compliant networks, and it will only compile using Solidity version
0.5.0 and later.
- Quality Assurance
- Commandline tool
The 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.
These are the different packages.
bits package is used to work with bitfields (uints).
bytes package is used to work with
bytes in memory, and to convert between
bytes and other types.
math package is used to do math with signed and unsigned integers.
patricia_tree package is used to work with the standard Solidity Patricia tree implementation by @chriseth.
strings package is used to work Solidity
strings. It only supports UTF-8 validation.
tokens package is used to work with Token contracts.
unsafe package is used to do unsafe operations, like working with memory directly.
The standard library has well-documented routines for making sure that code meets the required standards when it comes to:
Additionally, the tools used to guarantee this should be simple and easy to replace when new and better alternatives are made available.
npm test - runs the contract test-suite, as well as the tests for the typescript code.
npm ts-test - runs the typescript tests.
npm contracts-test - runs the contract test-suite.
The contract tests requires
evm (go ethereum) to be installed and added to the $PATH. Test code is written in Solidity, and is executed directly in the evm.
For more information about the tests, such as the test file format, read the full test documentation.
For running tests with the command-line tool, check the CLI documentation.
npm contracts-perf will run the entire perf suite.
For more information about perf read the full perf documentation.
For running perf with the command-line tool, check the CLI documentation.
npm ts-lint - will run TS-lint on the entire library.
npm contracts-lint - will run solhint on all contracts.
The 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.
Briefly: 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.
Code 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.
This should be done using the PR system in github.
Issues and feedback
Github issues and gitter solidity channel.
Ranking / categorization of contracts
The 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.
Node.js has a system of categorizing libraries, experimental, stable, deprecated, and so forth. This library should have something similar.
The 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.