Try the Smart Contract¶
Deploy the Smart Contract. Head over to the "Deploy & Run Transactions" Plugin and Deploy it.
- Copy your address into the withdraw money field.
- Enter a number, like 1000, and
- Hit withdrawMoney
You see, the transaction works without any problem. That's not good, because internally nothing happened and the user has the feedback that he just did a withdrawal for 1000 wei. Although nothing happened.
Try yourself first
Before heading to the next page, try yourself first to replace the if/else with a
Require is here for user-input validation and if it evaluates to false, it will throw an exception.
require(1 == 0) will throw an exception. You can optionally add an error message
require(false, "Some Error Message")
Last update: March 28, 2022