web3-smart-contracts icon indicating copy to clipboard operation
web3-smart-contracts copied to clipboard

Added modifier to remove duplication

Open Upendra-Jaiswal opened this issue 2 years ago • 3 comments

Description

the hasSufficientFunds modifier is defined at the top of the contract. This modifier checks if the caller has sufficient funds to perform the requested operation, and if not, it will throw an error.

The withdraw and transferAmt functions both use the hasSufficientFunds modifier, which means that they will both check if the caller has sufficient funds before executing any other code in the function. This avoids repeating the same code in multiple places.


Fixes #144

Screenshots of relevant screens

Screenshot 2022-12-15 at 11 09 10 PM

Developer's checklist

  • [X] My PR follows the style guidelines of this project
  • [X] I have performed a self-check

If changes are made in the code:

  • [X] I have followed the coding guidelines
  • [X] My changes in code generate no new warnings
  • [X] I have added relevant screenshots in my PR

Upendra-Jaiswal avatar Dec 15 '22 18:12 Upendra-Jaiswal

Thank you for opening your first pull request in our repository, one of our maintainers will get in touch with you soon.

DO NOT FORGET TO ADD METAMASK WALLET ADDRESS IN THE AUTH FORM We at Metafy have some special rewards and swags for the top contributors in general repos and every contributor in web3 repos For being eligible for that, please authenticate yourself using this link: https://metafy.social/signup

Rewards : T-shirts & NFT ( for blockchain contributions )

Best of luck on your Contributions For further queries you can join our discord for support : https://discord.gg/W6PmEjjQsA

github-actions[bot] avatar Dec 15 '22 18:12 github-actions[bot]

PR is not linked to any issue, please make the corresponding changes in the body.

github-actions[bot] avatar Dec 15 '22 18:12 github-actions[bot]

PR is not linked to any issue, please make the corresponding changes in the body.

github-actions[bot] avatar Dec 15 '22 18:12 github-actions[bot]