From 4c20821e6d3f343fe19245fc01bb0c4fb9b3dbc5 Mon Sep 17 00:00:00 2001 From: Mohamed Safouen Bouabid Date: Fri, 7 Jan 2022 16:01:13 +0100 Subject: [PATCH] Explaining payable(msg.sender) At this point of the documentation a new Solidity learner will not understand this line without further explanation: if (!payable(msg.sender).send(amount)) { It should explain how msg.sender is of type "address" and not "address payable" so it cannot send or receive Ether. Therefore it must be explicitly converted to payable. --- docs/examples/blind-auction.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/examples/blind-auction.rst b/docs/examples/blind-auction.rst index ad898a9b1..b0a86f248 100644 --- a/docs/examples/blind-auction.rst +++ b/docs/examples/blind-auction.rst @@ -121,6 +121,9 @@ to receive their money - contracts cannot activate themselves. // before `send` returns. pendingReturns[msg.sender] = 0; + // msg.sender is not of type `address payable` and must be + // explicitly converted using `payable(msg.sender)` in order + // use the member function `send()`. if (!payable(msg.sender).send(amount)) { // No need to call throw here, just reset the amount owing pendingReturns[msg.sender] = amount;