In the Eris Solidity tutorial, a system of a Bank
and a FundManager
contract are developed. In the fund manager constructor
contract Bank {
[Bank contract details]
function setOwner(address newOwner) returns (bool res) {
if (owner != 0x0 && msg.sender != owner){
return false;
}
owner = newOwner;
return true;
}
}
contract FundManager {
address bank;
// Constructor
function FundManager(){
owner = msg.sender;
bank = new Bank();
Bank(bank).setOwner(address(this));
}
}
one sets a reference to a Bank
.
When I deploy the contract and mine it in a private net and then check for the bank
reference of the FundManager
, no reference is found (so I can't deposit, because depositing requires a bank to be set).
Here's how I deploy:
var fm_arg = "fm";
var fm = contract_fm.new(fm_arg,
{
from: eth.accounts[0],
data: compiled_fm.FundManager.code,
gas: 1000000
}, callback);
I would think, I should now be able to call the bank
variable:
> fm.bank
undefined
Why is the bank not set when I construct the FundManager
?