Skip to content

Instantly share code, notes, and snippets.

@wissalHaji
Last active October 27, 2020 09:08
Show Gist options
  • Save wissalHaji/423f47bde1df67e3a3ea8a82e957ac0d to your computer and use it in GitHub Desktop.
Save wissalHaji/423f47bde1df67e3a3ea8a82e957ac0d to your computer and use it in GitHub Desktop.
address payable to address conversion
// 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