• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

nczhu/solidity-koans: Learn Ethereum Solidity programming through test driven de ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

nczhu/solidity-koans

开源软件地址:

https://github.com/nczhu/solidity-koans

开源编程语言:

JavaScript 95.9%

开源软件介绍:

This is an intermediate series for learning Solidity and smart contract development. You will explore technicalities from syntax edgecases, to assembly in the EVM, to smart contract coding conventions, all through test driven development.

“If your mind is empty, it is always ready for anything, it is open to everything. In the beginner’s mind there are many possibilities, but in the expert’s mind there are few.”

Learning Path


Standard data types

  1. Asserts
  2. Numbers
  3. Bytes
  4. Arrays
  5. Mappings
  6. Structs
  7. Storage

Function types (in progress)

  • variable modifers: public private
  • Visbility modifiers: public, private, external, etc.
  • Getter modifiers: view, pure, constant

Transactions details (in progress)

  • address & how its computed
  • data types: sender, value, gas, this
  • async return values

Javascript client (in progress)

  • events
  • error handling: require, asserts
  • free getter functions
  • constructing send / call fns

Design patterns (in progress)

  • interfaces
  • libraries, ERC libs
  • factory patterns

Security (in progress)

  • ownership
  • overflow, underflow
  • re-entry
  • tx.origin
  • delegatecall: scope
  • storage hacks

Solidity Assembly (in progress)

  • bytecode & opcodes

Directions


How to Setup

  • Clone the repo: git clone https://github.com/nczhu/solidity-koans.git
  • Install dependencies:
npm install -g truffle ganache-cli
  • Start Ganache: ganache-cli
  • In a new tab, check out the /test directory, where each test represents a koan. To get started with the easiest (and first) Koan, run: truffle test ./test/Test_assert_1.sol

How to Tackle Each Koan

  1. Each test is initially incomplete, e.g.:
function test_should_return_true() public {
   Assert.isTrue(__, "should return true");
}
  1. Run each level with: truffle test ./test/Test_FILENAME Tests will fail with error messages, e.g.:
2) Test_Assert_1
   test_should_return_true::
   Error: should return true
  1. In your editor, replace __ with the correct values or code, e.g.:
function test_should_return_true() public {
   Assert.isTrue(true, "should return true");
}
  1. To pass each level, make sure:
  • All tests are passing

  • All compiler warnings and errors are fixed

  • Hint: Use Remix IDE to test potential solutions

Troubleshooting


  • Member "..." not unique after argument-dependent lookup in type(library Assert). Solution: try typecasting your answer to solve compiler issues.

Contributing


  1. Fork it the project
  2. Create your feature branch using issue #: git checkout -b issue#-feature
  3. Commit your changes: git commit -am 'Fix/Add/Change: commit msg'
  4. Push to the branch: git push origin issue#-feature
  5. Create a new Pull Request

See full list of outstanding issues here.

Design Decisions


  • Rewrote Assert.sol to accommodate for additional data types. Modifications are signed inline with @nczhu

License


MIT License




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap