I'm trying to call the following function from another contract:
//This is the other contract
pragma solidity 0.8.0;
contract OtherContract{
function add(address account, uint256 number) external {
_add(addr, number);
}
}
But the abi.encodeWithSignature
of the calling contract doesn't work. I've tried everything, I've been trying for days.
function callAdd() public
addressOtherContract.call(abi.encodeWithSignature("add(address,uint256)",account,number));
}
The above function call transaction is successfully completed, but it displays the error:
Although one or more Error Occurred [execution reverted] Contract Execution Completed
I also tried the syntax below in an old version of solidity, but despite compiling, it gives the same error when the function is called:
addressOtherContract.call(bytes4(keccak256("add(address,uint256)")),account,number);
I've read many reports of the same problem, the function simply not working as expected.