Skip to content

Instantly share code, notes, and snippets.

@RareSkills
Created October 19, 2024 12:23
Show Gist options
  • Select an option

  • Save RareSkills/6b280c67fa61c097fb62ce968ab8d841 to your computer and use it in GitHub Desktop.

Select an option

Save RareSkills/6b280c67fa61c097fb62ce968ab8d841 to your computer and use it in GitHub Desktop.
1. Revert with no data
2. Revert with 4 bytes
3. Revert with 4 bytes + argument
4. Revert with Panic
5. Revert with Error
6. Return 42
7. Calldata length
8. Double calldata
9. Calculator
10. max of two values
11. ternary
12. IsPrime
13. Return from storage
14. Set storage
15. Read from fixed array
16. Write to fixed array
17. Return keccak256 of calldata
18. Return keccak256 of second argument in calldata
19. Read from dynamic array
20. Read from dynamic array and revert with Solidity panic on failure
21. Push to dynamic array
22. Pop from dynamic array
23. Read from mapping
24. Set mapping
25. Read from double mapping
26. Set double mapping
27. Return length of a dynamic array
28. Unpack and read data from uint128
29. Unpack and read data from uint64
30. Write to packed uint128
31. Write to packed uint64
32. Simulate uint64 dynamic array
33. Read from a mapping in a struct
34. Maximum value from array
35. Write dynamic calldata array to storage
36. Write two dynamic arrays to storage
37. Calculator in the fallback
Environment variables
1. block timestamp
2. msg.value return
3. nonpayable
4. caller
5. gasprice
6. basefee
7. gasleft
ABI encoding in memory
1. Hash two uint 128
2. Hash a variable length string
3. Hash a uint array
4. Hash a simple struct
5. Hash a struct with dynamic data
Logs (6)
1. emit a uint
2. emit two uints
3. emit a string
4. emit uint and string
5. emit address and uint array
6. emit two uint arrays
7. emit two strings
codesize
1. balance of address
2. balance of this
3. is contract
external calls and return data parsing
1. send ETH
2. get balanceOf (static call)
3. approve
4. transfer ERC-20 tokens
5. transferFrom
6. call with list
challenges
1. eth distributor
2. FizzBuzz
3. donation leaderboard
4. clone
5. clone factory
6. escrow
7. square root
8. Nonpayable
9. Fibonacci
10. Sum of triple nested array
11. Refund gas spent
12. ERC-20
13. Partial ERC-721
proxy patterns
1. erc-1967 proxy
2. nodelegatecall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment