2

I've got two contracts, A and B, I set them up in a truffle test separately.

A.new()...
B.new()...

A has a function bar, which sets a public boolean boo to true that is never read anywhere. B has a function, foo, that calls bar on a previously instantiated A.

contract A(){
    bool public boo = false;
    function bar() public {
        boo = true;
    }
}
contract B(){
    A public myA;
    function setA(address addr){
       myA = A(addr);
    }
    function foo() public {
       myA.bar();
    }
}

Now in my truffle test, I call bar two ways, directly, and thru b.foo().

a.bar();
b.setA(a.address);
b.foo();

The first call to bar works fine. The second call thru foo throws out of gas no matter how much gas I give it. What am I doing wrong?

1
  • I should add that I can read A.boo from B, just not write. – syzygy Mar 1 '17 at 21:37
2

Turns out the out of gas exception really was an out of gas exception this time...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.