项目
在 GitHub 查看
RareSkills/huff-puzzles
关于
These exercises were created for our Advanced Solidity Bootcamp and open sourced. Learn EVM bytecode with the Huff Language.
编程语言与运行时实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- -2
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文huff-puzzles by RareSkills
A series of puzzles that go from very easy to more difficult so that you can have a hands-on introduction to the huff language and learn EVM bytecode while doing it.
Pre-requisites
Make sure you've installed the Huff Compiler as outlined in the Huff Docs.
TLDR:
curl -L get.huff.sh | bash
then:
huffup
To verify your installation, run huffc --help. This should print a list of available commands for the huff compiler cli.
Installation
To install dependencies, run:
forge install
How to play
Go to Return1.huff in the src folder and edit it as follows
#define macro MAIN() = takes(0) returns(0) {
// store 1 in memory at offset 0
0x01 // [1]
0x00 // [0, 1]
mstore // []
// return 1
// return 32 bytes of memory starting at offset 0
0x20 // [32]
0x00 // [0, 32]
return // []
}
Then run the test with
forge test -vvv --mc Return1Test
You should see something like this
Running 1 test for test/Return1.t.sol:Return1Test
[PASS] testReturn1() (gas: 5358)
Test result: ok. 1 passed; 0 failed; finished in 4.56s
Suggested order for other exercises
- CallValue
- CalldataLength
- TimeAndBlock
- MyEtherBalance
- Add1
- Multiply
- CountTime
- NonPayable
- FooBar
- MyCreator
- SimpleStore
- RevertCustom
- RevertString
- SumArray
- Keccak
- MaxOfArray
- Create
- Emitter
- Donations
- SendEther
- BasicBank
- Distribute
- SimulateArray
More resources
Contributors
探索相关项目
加载中…