I have a smart contract deployed (Setup.sol), and it imports another smart contract "Model.sol" which has some functions that I need to call. Now, I only have contract address of the deployment of Setup.sol, and therefore am confused with how to call functions of its member variable model.
For reference, here is the code of Setup.sol :
pragma solidity 0.8.19;
import "./Model.sol";
contract Setup {
Model public model;
constructor() payable {
model = new Model();
}
function isSolved() public view returns (bool) {
return magic.solved();
}
}
I am getting the setup_contract using setup_contract = w3.eth.contract(address = address, abi = setup_abi)
but, can't find a way to use the public member variable model from the setup_contract.
Thanks!
Consider the following scenario.
Your Setup contract:
Your model contract:
As far as I understand, you would like to call functions of "its member variable" Model contract referenced in your Setup contract.
Firstly,
Model public model
in Setup contract stores the address of the Model contract. So instantiate Setup contract and call public member variable (reading state).Now, having the address of Model contract, instantiate Model contract and call any function you like.