i have two contracts the first one has a function which must be called only by the second contract :
contract A {
address contractBAddress;
uint256 number;
modifier onlyB() {
require(msg.sender == contractBAddress, "caller must be contruct B");
_;
}
constructor(address _contractBAddress) {
contractBAddress= _contractBAddress;
}
function setNumber(uint256 _number) public onlyB {
number = _number;
}
contract B {
A a;
constructor(address _contractAaddress) {
a = A(_contractAaddress);
}
function setNumber(uint256 _number) public {
a.setNumber(_number);
}
So, the contract A needs contract B address for the modifier and the contract B needs the contract A for calling setNumber function . does that cause a recursive dependency problem ? is the any other alternative to implement this ? Thank you and happy christmas .