In a typical split contract, where onlyOwner being the standard zeppelin Ownerable modifier, how can the onlyOwner of A be enforced when it's called from B?
contract I is Ownerable {
function transferAsset(address _from, address _to) public onlyOwner;
}
contract A is I {
address asset;
function transferAsset(address _to) public onlyOwner {
asset = _to;
}
}
contract B is I {
I contractA;
function doTransfer(address _to) public onlyOwner {
contractA = I(A_Deployed_Address);
contractA.transferAsset(_to);
}
}
[edit]
Sorry for not making things clear in my original question. In my case I'm deploying both contract A and B from truffle, so both of their owner will be the deployment account that truffle uses.
Then it seems I have no choice but to change the owner of B to A's deployed address so that A can call B's transferAsset, which is basically Eli Drion's answer. I'm just a bit concerned if I do that, will there be any potential downfall that all future calling of B's onlyOwner modified functions must be initiated from A and not its original deployer?
And if I take the approach of deploying B from A, doesn't that imply import B in A, which would result in a bloated A that defeats the purpose of split contract (and back to the out-of-gas problem I'm having during contract deployment)