0

I currently have a local chain with Ganache. Say I have two contracts written in Solidity:

Foo_v0_0_1.sol
Bar_v0_0_1.sol

In the code for my smart contract Foo_v0_0_1, I have the following:

import "./Bar_v0_0_1.sol";

Bar_v0_0_1 private _bar;

...

function callBar() external {
    _bar.func(msg.sender); // <-- EXECUTION FAILS HERE
}

I deploy these contracts and attempt the callBar RPC call. This transaction fails on the internal call to the _bar contract. I open this transaction with truffle debug <tx_hash>, and step to the line where the transaction fails. When I print out the state and local variables, I see this in the output:

Contract variables:
    _bar: 0x0000000000000000000000000000000000000000 of unknown class

My question: Why is this variable coming up as all zeroes? Is it an issue with how I deployed my contracts? Is it an issue with the truffle debugger not being able to correctly find the contract?

Any insight is greatly appreciated.

2
  • 2
    Bar_v0_0_1 private _bar; - where is this variable initialized? Did you expect it to automatically attain some value??? – goodvibration Nov 4 '20 at 19:57
  • The fact that Truffle keeps record of all the contracts that you deploy, doesn't mean that these deployed contracts have any knowledge of each other. – goodvibration Nov 4 '20 at 20:00

Your Answer

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

Browse other questions tagged or ask your own question.