Lesson 3 (FundMe): why is withdraw() payable? #1453
Answered
by
cromewar
xavierdmello
asked this question in
Q&A
-
I've tried it both ways, and it doesn't seem to matter if it's payable or not. Just curious why withdraw was payable in the tutorial. Was it just an oversight? |
Beta Was this translation helpful? Give feedback.
Answered by
cromewar
May 1, 2022
Replies: 1 comment 2 replies
-
Hello @xavierdmello |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
cromewar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @xavierdmello
The reason si because you are transferring Ethereum to the msg.sender.
As you are transferring the balance of the contract, the function is payable as you are "paying" to the wallet which si doing the withdraw.