Code Monkey home page Code Monkey logo

solidity-koans's Introduction

Solidity Koans

Inspired by The Ruby Koans, Solidity Koans is an introductory guide to smart contract development in ethereum through testing. In such a critical task like smart contracts programming, writing tests is a must.

Walk through Solidity's path of enlightment with this koans.

Installation

1. Clone the repo

git clone [email protected]:martriay/solidity-koans.git

2. Install the dependencies

npm install

About koans

A koan is a test written in Javascript which needs to be fixed in order to pass. It lives in the tests/ folder and may involve contracts from the contracts/ directory.

About enlightment

In test-driven development (TDD) the mantra has always been red: write a failing test and run it, green: make the test pass, and refactor: look at the code and see if you can make it any better. With the koans, you will need to run the tests and see it fail (red), make the test pass (green), then take a moment and reflect upon the test to see what it is teaching you and improve the code to better communicate its intent (refactor).

To achieve enlightment you have to run the test, see it fail and then fix the corresponding files.

To run tests we use truffle test:

Compiling ./contracts/Cup.sol...
Compiling ./contracts/Migrations.sol...


  Contract: About modifiers
    ✓ Modifiers can be used to easily change the behaviour of functions
    ✓ Modifiers can receive arguments


  2 passing (171ms)

Note: the npx command comes with npm as of [email protected] version.

Koans

About Ethereum

  1. About accounts
  2. About transactions (todo)
  3. About gas (todo)
  4. About data (todo)

About Solidity

  1. About contracts (todo)
  2. About modifiers
  3. About events (todo)
  4. About inheritance (todo)
  5. About visibility (todo)
  6. About interfaces (todo)
  7. About libraries (todo)
  8. About units (todo)
  9. About global variables (todo)
  10. About error handling (todo)

About Security

  1. About overflow (todo)
  2. About reentrancy (todo)
  3. About gassy arrays (todo)

solidity-koans's People

Contributors

martriay avatar

Watchers

Paul Kruger avatar James Cloos avatar

Forkers

omnicoders

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.