RareSkills / gas-puzzles
- суббота, 29 октября 2022 г. в 00:34:03
A sequence of smart contracts to practice gas optimization. These are used as practice assignments for RareSkills.io and the Udemy Gas Optimization Course
If you want to learn about gas optimization, take the Udemy gas optimization course!
DO NOT COMMIT SOLUTIONS, BE SURE TO PUT ANSWERS IN contracts/contracts_optimized
to ensure they fall into the .gitignore
Your goal is to optimize the contracts such that they reach the target efficiency.
Rules
payable
is a controversial optimization, you do not need to make functions payable
to reach the gas target unless the function needs to be payable to fulfill its business logicAs mentioned above, optimized contracts should be created in their own sub-folder to prevent commiting them publicly.
The file structure should look similar to this:
- GasPuzzles
|_
contracts
|_
contracts_optimized
| |_
| ArraySum.sol
| Distribute.sol
| ..
| ...
|
ArraySum.sol
Distribute.sol
..
...
Within the contracts that are optimized be sure to follow the following naming convention to ensure tests run smoothly:
contract OptimizedArraySum {
...
contract OptimizedDistribute {
...
npx hardhat test
npx hardhat test test/ArraySum
npx prettier --write *