i have contract which looks like following
pragma solidity ^0.4.8;
contract Rental {
struct PaidRent {
uint id;
uint value;
}
PaidRent[] public paidrents;
event RentPaid(bool Status);
function payRent() public payable returns(bool status) {
if(owner.send(msg.value)) {
RentPaid(true);
return true;
} else {
RentPaid(false);
return false;
}
}
}
i am calling this function from my service using web3 in following way
paymyRent(contractInstance, rent) {
console.log('in paymyrent');
let eventlistenenr = contractInstance.RentPaid();
eventlistenenr.watch(function (error, result) {
if (!error) {
console.log(result.args);
} else {
console.log(error);
}
});
contractInstance.payRent({from: this.web3.eth.accounts[0],
gas:4665270, value: this.web3.toWei(rent, "ether")});
}
but upon sybmitting my transaction from metamask transaction is being failed. here is the screenshot of a transaction detail
any help is really appreciated :)