The title of this issue might seem strange because I can't figure out exactly what the problem is. But here is what is happening:
pragma solidity ^0.4.13;
contract Escrow {
address public owner;
uint public fee;
//Balances temporarily made public for testing; to be removed
mapping (address => mapping (address => uint)) public balances;
function Escrow() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
//Fee should be set in PPM
function setFee(uint price) onlyOwner external {
fee = price;
}
function start(address payee) payable external {
balances[msg.sender][payee] = balances[msg.sender][payee] + msg.value;
}
function end(address payer, address payee) onlyOwner external {
uint value = balances[payer][payee];
//uint paidFee = value / (1000000 / fee);
//uint payment = value - paidFee;
//payee.transfer(payment);
//owner.transfer(paidFee);
//balances[payer][payee] = 0
payee.transfer(value)
}
}
I've commented out a bunch of lines that I would like to get working in the end
function, because I can't get even the other parts working.
Steps:
Creat contract from first address in testRPC
I call start, from the second address in my testRPC, sending 2 ETH, to the last address:
start("0xb631fc401038e191fa38c4ff20dcce8d13eb6ebc" , { from "0x1c34d277b51ec49536fe7843e289933e0f8020ed", value: 2000000000000000000000 })
I check:
balances("0x1c34d277b51ec49536fe7843e289933e0f8020ed", "0xb631fc401038e191fa38c4ff20dcce8d13eb6ebc")
, I see0: uint256: 2000000000000000000
--So far so good.This is where I get into trouble. If I call
end("0x1c34d277b51ec49536fe7843e289933e0f8020ed", "0xb631fc401038e191fa38c4ff20dcce8d13eb6ebc")
, I get:transact to Escrow.end errored: VM Exception while processing transaction: out of gas
If I change end
to just return balances[payer][payee]
, I get 0.
If I change end
to just transfer 1 ETH to payee, I get a gas error.
So I can't figure out what the source of this issue is. Can you give any advice?
pragma ^0.4.13
and your process. I suspect you've got version incompatibilities to sort out. A suggestion is to remove the^
and resolve the resulting complaints by bringing things into strong explicit alignment. Hope it helps.