I have a simple contract that I built a small webapplication with. The contract is as follows:
contract MyContract {
address public creator;
function MyContract() {
creator = msg.sender;
}
function reject() {
selfdestruct(creator);
}
function send(address target, uint256 amount) {
if (!target.send(amount)) throw;
}
function destroy(address target) {
selfdestruct(0x0000000000000000000000000000000000000000);
}
}
This always worked - I'm using MetaMask to sign the payments and inintiate the contracts. Since a week or something, I'm getting an error in my console from Web3: Cannot send value to non-payable constructor
I then started to Google around, and found out about a function needed to be payable and that there should be a fallback function in my contract. So I customized my contract a bit, this is what I have now:
pragma solidity ^0.4.9;
contract Oursurance {
address public creator;
uint x;
function() payable { x = 1; }
function Oursurance() payable {
creator = msg.sender;
}
function reject() payable {
selfdestruct(creator);
}
function send(address target, uint256 amount) payable {
if (!target.send(amount)) throw;
}
function destroy(address target) payable {
selfdestruct(0x0000000000000000000000000000000000000000);
}
}
I know not every function should be payable, but just to be sure I have added it to everything. Just need it to be working again.
I am still getting this error with the above (edited) contract.