I am having a problem with my smart contract making value transfers. My current environment:
Truffle v5.0.0-beta.2 (core: 5.0.0-beta.2)
Solidity v0.5.0 (solc-js)
Node v8.11.1
I created the following test function to help track down the problem:
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
contract EtherBandBattlesManager is Pausable {
using SafeMath for uint256;
function testPayment(address _payeeAddr)
payable
public
onlyOwner
{
require(_payeeAddr != address(0), "(testPayment) The payee address is not set.");
require(msg.value != 0, "(testPayment) The amount of value accompanying the transaction is zero.");
// Make the payment.
_payeeAddr.transfer(msg.value);
}
}
Before I upgraded to Truffle 5 beta the contract compiled successfully. But when I made a call to testPayment() I did see the balance of the Ganache account I was paying from decrease, but I did not see the balance of the destination account increase.
I then upgraded to Truffle 5.0 beta.
Now I get a fatal compiler error saying:
/ether-band-battles-work/solidity/contracts/EtherBandBattlesManager.sol:1142:9: TypeError: Member "transfer" not found or not visible after argument-dependent lookup in address.
_payeeAddr.transfer(pendingPaymentDetails.paymentAmountGwei);
My understanding is that the transfer() function was introduced in Solidity 4.1 and I am using 4.24 as you can see. Why can't the compiler find the transfer() function? Also, any comments on why I am not seeing the balance on the destination account go up after making the transfer() call would be appreciated.
Also, so what do you do with an address you get back from ecrecover(), which is not "address payable" that you would like to pay?
– Robert Oschler Nov 26 '18 at 20:26