Just upgraded truffle to version 5 and having a problem with this new address payable
type.
contract Test {
ERC721Full public tokenAddress;
constructor(address _address) public {
tokenAddress = ERC721Full (_address);
}
function sendToOwner(...) public payable {
address payable owner = tokenAddress.ownerOf(_tokenId);
owner.transfer(msg.value);
}
}
So I'm trying to send ether to owner account, but I'm getting
TypeError: Type address is not implicitly convertible to expected type address payable.
How to fix this?
Best Answer
tokenAddress.ownerOf()
probably returns anaddress
, notaddress payable
. See this thread for a way to do that: Convert contract to payable address