Giter Site home page Giter Site logo

solidity-examples's Introduction

Standard library (draft) CircleCI

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.

TOC

Purpose

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.

Packages

These are the different packages.

bits

The bits package is used to work with bitfields (uints).

contracts

bytes

The bytes package is used to work with bytes in memory, and to convert between bytes and other types.

contracts

math

The math package is used to do math with signed and unsigned integers.

contracts

patricia_tree

The patricia_tree package is used to work with the standard Solidity Patricia tree implementation by @chriseth.

contracts

strings

The strings package is used to work Solidity strings. It only supports UTF-8 validation.

contracts

tokens

The tokens package is used to work with Token contracts.

contracts

unsafe

The unsafe package is used to do unsafe operations, like working with memory directly.

contracts

Quality Assurance

The standard library has well-documented routines for making sure that code meets the required standards when it comes to:

  1. Security
  2. Performance
  3. Style
  4. Documentation

Additionally, the tools used to guarantee this should be simple and easy to replace when new and better alternatives are made available.

Testing

npm test - runs the contract test-suite, as well as the tests for the typescript code.

npm run ts-test - runs the typescript tests.

npm run contracts-test - runs the contract test-suite.

The contract tests requires solc and 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.

Performance

npm run 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.

Style

npm run ts-lint - will run TS-lint on the entire library.

npm run 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.

Documentation

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.

Manual review

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.

Commandline tool

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.

solidity-examples's People

Contributors

androlo avatar chriseth avatar gorgos avatar lokst avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.