Last active
October 27, 2020 09:08
-
-
Save wissalHaji/423f47bde1df67e3a3ea8a82e957ac0d to your computer and use it in GitHub Desktop.
address payable to address conversion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.7.0; | |
contract HelloWorldContract { | |
function transferFund(address payable receiver, uint amount) payable external { | |
address newAddress = receiver; | |
receiver.transfer(amount); // OK | |
newAddress.transfer(amount); // shows an error | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment