I am getting above error while transferring money from contract wallet to particular user wallet.
My contract code
pragma solidity ^0.4.17;
contract mypool{
address public manager;
string poolname;
uint256 poolEndDate;
uint256 poolAmount;
constructor () public {
manager = msg.sender;
}
mapping (address => uint256) public balanceOf;
/*Payer information*/
struct Payer {
string name;
address player;
uint256 amount;
}
Payer[] public players;
/*Entering Pool Information*/
function enterPoolInfo(string name,uint256 endDate, uint256 amount) public {
poolname = name;
poolEndDate = endDate;
poolAmount = amount;
}
/*Player information to join pool*/
function enter(string name,uint256 amount) public payable {
Payer memory m;
// players.push(Payer{player:msg.sender,amount:amount});
m.player = msg.sender;
m.amount = amount;
m.name = name;
players.push(m);
}
function getBalance() public view returns (uint) {
return this.balance;
}
function transferd(address _to) payable {
// if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough
// if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
// balanceOf[msg.sender] -= _value; // Subtract from the sender
// balanceOf[_to] += _value;
uint256 balance = this.balance;
_to.transfer(balance);
}
}
I am using web3 method to transfer money here is the code
let contract = new web3.eth.Contract(abi, address);
contract.methods.transferd('0x497fe03ba1dabf3b391079e8f69eb178243a736b')
.send()
.then(console.log)
.catch(console.log)