Skip to content

RareSkills/yul-puzzles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yul Puzzles by RareSkills

How to play

Open src/ReturnBool.sol and test/ReturnBool.t.sol. Your goal is to write assembly code in each puzzle that makes the test pass. You may only write assembly code.

Run the test with

forge test --mp test/ReturnBool.t.sol

Now repeat this with the other puzzles.

Suggested order of the Puzzles

Go through the puzzles sequentially

  1. ReturnBool (solved)
  2. SimpleRevert
  3. RevertWithSelector
  4. Return42
  5. RevertWithError
  6. RevertWithSelectorPlusArgs
  7. RevertWithPanic
  8. Double
  9. Calculator
  10. DoubleOrNothing
  11. MaxOfTwoValues
  12. IsPrime
  13. CalldataLength
  14. KeccakX
  15. KeccakFirstCalldata
  16. KeccakSecondCalldata
  17. LengthOfDynamicArray
  18. MaxOfArray
  19. ReadFromStorage
  20. WriteToStorage
  21. ReadFromFixedArray
  22. Tenary
  23. WriteToFixedArray
  24. ReadFromDynamicArray
  25. WriteToDynamicArray
  26. ReadFromMapping
  27. WriteToMapping
  28. PushToDynamicArray
  29. PopFromDynamicArray
  30. ReadFromDoubleMapping
  31. ReadFromDynamicArrayAndRevertOnFailure
  32. WriteToDoubleMapping
  33. WriteDynamicArrayToStorage
  34. WriteTwoDynamicArraysToStorage
  35. ReadFromPacked128
  36. WriteToPacked128
  37. ReadFromPacked64
  38. WriteToPacked64
  39. WriteToPackedDynamicArray64
  40. ReadFromMappingInStruct
  41. EventWithoutData
  42. EventWithData
  43. EventWithIndexedData
  44. EventWithMultipleData
  45. AnonymonusEventWithoutData
  46. AnonymonusEventWithData
  47. AnonymonusEventWithIndexedData
  48. AnonymonusEventWithComplexData
  49. EventWithComplexData
  50. BatchEvents
  51. CalculatorInFallback
  52. ReturnOppositeBool
  53. ReturnTwoBools
  54. ReturnArrayOfUint256
  55. ReturnString
  56. ReturnBytes
  57. FizzBuzz
  58. ReturnTupleOfString
  59. ReturnSimpleStruct
  60. ReturnTupleOfUint256String
  61. ReturnTupleOfStringUnit256
  62. SendEther
  63. SendAllEther
  64. PaymentSplitter
  65. SendBack
  66. BasicBank
  67. SimpleCall
  68. SimpleCallWithValue
  69. Approve
  70. TransferFrom
  71. BalanceOf
  72. CreateSimple
  73. CreateSimplePayable
  74. CreateSimpleCalldata
  75. DeployOneByte
  76. DeployNBytes
  77. SquareRoot
  78. Division
  79. AbsoluteValue
  80. SetBit
  81. Log2

Acknowledgement

This work was funded by a grant from the Ethereum Foundation.

About

A set of exercises to practice Yul

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published