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