0

I have two contract files A.sol and B.sol, and a test file B.test.sol.

Here is my current approach (reverts):

//A.sol

mapping (bytes32 => myStruct) public myStructs;

Struct myStruct {
  uint256 a;
  uint256 b;
  uint256 c;
}

//B.sol

interface I_A {
  function myStructs(bytes32) returns (uint, uint, uint) public;
}
contract B {
  A a;
  constructor(address a_address) { a = I_A(a) };

  function exb(bytes32 _structaddr){
    //REACHES HERE
    a.myStructs(_structaddr); //<REVERTS>
  }
}

//B.test.sol
import {A} from "./contracts/A.sol";
import {B} from "./contractsB.sol";

contract TestB {
  B testb;
  A testa;

   function beforeAll() {
     testa = new A();
     testB = new B(testa);
   }

  function test_exb() {
    b.exb();
  }
}
0

Change this:

A a;
constructor(address a_address) { a = I_A(a) };

To this:

I_A a;
constructor(I_A a_address) { a = a_address; }
| improve this answer | |

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.