I want to rewrite
- bool ok = msg.sender.call.value(amount)(); - emit WithdrawalEther(msg.sender, amount, ok);
- (bool ok, bytes memory returnData) = msg.sender.call(abi.encodeWithSignature(???,amount)); - emit WithdrawalEther(msg.sender, amount, ok);
But I am not sure what a signature string must be given for the part of the three question marks. The original statement is simply a sending of money amounting 'amount', and so if the receiver account is a contract, its fallback function must be called. This is my understanding. Then, my question seems to be what is a signature for fallback function.
The example needs a boolean value to check if sending money succeeds or not. In case it fails, an event with false must be created in the next statement.
The reason for the rewriting is because of this.
I have a solc compiler version 0.5.7 but the Solidity example program that I try to compile has a declaration of pragma 0.4.8.
If I simply change the version number, I will get a compilation error for
- bool ok = msg.sender.call.value(amount).()
because the style of the statement seems to be old and it is not supported by the solidity compiler version 0.5.7.
Can you please help me out to resolve this issue?
Thanks in advance.