1

print

I want to understand when (and why) it's necessary to use this statement : require(sent, "failed to send ether")

i could just do somethink like this instead:

enter image description here

2 Answers 2

2

You could, but it would not be safe because call() won't revert if the external contract execution does. It's highly discouraged and generally unsafe.

1

With call() if the function reverts your function calling it will not revert unless you have the require(success) line. I've encountered situations where you do not want to revert if the contract you are calling reverts, but most of the time you will want to revert.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.