When you try to specify callback function and it's visibility is external, following error occures:
Error: Undeclared identifier. "testFunction" is not (or not yet) visible at this point.
--> testContract.sol:12:59:
|
12 | CallbackTest(a).thisWillReturnSomething{callback: testFunction}(123);
| ^^^^^^^^^^^^
Test contract:
pragma solidity >= 0.6.0;
import './TestInterface.sol';
contract SetCode {
uint c;
constructor() public {
tvm.accept();
}
function callExternalFunction(address a) external {
CallbackTest(a).thisWillReturnSomething{callback: testFunction}(123);
}
function testFunction(uint b) external {
c = b + b;
}
}
Contract will compile if you change visibility of testFunction to public:
pragma solidity >= 0.6.0;
import './TestInterface.sol';
contract SetCode {
uint c;
constructor() public {
tvm.accept();
}
function callExternalFunction(address a) external {
CallbackTest(a).thisWillReturnSomething{callback: testFunction}(123);
}
function testFunction(uint b) public {
c = b + b;
}
}
When you try to specify callback function and it's visibility is
external
, following error occures:Test contract:
Used test interface:
Contract will compile if you change visibility of
testFunction
topublic
: