I'm aware a very similar question exists - but I feel my use case is sufficiently different to warrant a new question.
I have two instances of the following contract Own...
contract Own {
address public owner;
function Own(){
owner = msg.sender;
}
function transfer(address to){
if (msg.sender != owner) throw;
owner = to;
}
}
I want to write another contract that takes the transaction hashes of the above contract, and swaps the owner of the contract with each other through two calls to the Own.transfer(address)
function.
I thought it would be something like the following, but the syntax is incorrect around the o1.transfer(p2,{from:p1});
...
contract Tx {
address public p1;
address public p2;
Own public o1;
Own public o2;
function Tx(address ownAddress){
p1 = msg.sender;
o1 = Own(ownAddress);
}
function participate(address ownAddress){
p2 = msg.sender;
o2 = Own(ownAddress);
o1.transfer(p2,{from:p1});
o2.transfer(p1,{from:p2});
}
}
For note - both Own & Tx contracts are within the same .sol file, so have knowledge about each other.