Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LootBox.sol: Some Enhancements #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

0xScratch
Copy link

Basically, this PR works on two changes:

  • For Loops Improvement: Here, uint256 i = 0; is changed to uint256 i; cuz the default values of unsigned integers are usually 0. Also, changing i++ to ++i is a good one to decrease the gas costs. Refer this -> Here we haven't used the unchecked block cuz the pragma version is less than 0.8.0
  • Using internal function for the modifier: Whenever a modifier is used a lot of times inside a contract, it's better to create an internal function regarding it. This avoids the copying of same code again and again. These two links will help -> 1st and 2nd

Thanks! @asselstine @aodhgan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant