Vikash-8090-Yadav / Solidity-Pathshala

One place for the smart contract developer. This repo will have all the smart contract written in the remix ide .It contains all the source code with the screen shot.
MIT License
42 stars 55 forks source link

Fixed banking.sol and Enhanced the modifier #308

Open 0xScratch opened 9 months ago

0xScratch commented 9 months ago

🛠️ Fixes Issue

  1. Invalid modifier: The modifier name used in the code is 'onlyonwner' where it's used 'onlyowner' within the functions. This will just create a damn error. Looks like someone pasted this code without even compiling it down...
  2. Gas consumption could be enhanced: That single is modifier is used frequently, thus taking more gas. Need to find a way we can resolve this...
  3. Some Typos and grammatical errors down in the comments: heading self-defines the issue. won't be a big deal

👨‍💻 Changes proposed

  1. changed the name of modifier onlyonwner to onlyOwner in all sections of code wherever it is used.
  2. Enhanced the gas optimizations using an internal function. Refer this -> https://gist.github.com/grGred/9bab8b9bad0cd42fc23d4e31e7347144#use-internal-view-functions-in-modifiers-to-save-bytecode (Must refer the links provided inside) Note: This type of enhancement is always advised whenever a modifier is used several times within the code. If it is used just once or twice, no need of any change.
  3. Fixed typing and grammatical mistakes.

✔️ Check List (Check all the applicable boxes)

📄 Note to reviewers

Well, this was a pure buggy code, like a single typo mistake just made the contract go in vain. It's advised that these smart contracts must be checked thoroughly before merging them in the repo. Try pasting them in remix or some IDE before letting them be presented within this repository. Although, I am going to check and go through the whole codebase..Maybe making some enhancements if possible!

github-actions[bot] commented 9 months ago

Our team will soon review your PR. Thanks @Aryan9592 :)