I have a contract
A, which has an instance of contract
A calls a function of contract
B via the instance, i.e.,
B is stateless, i.e., no global non-constant variables.
I therefore decided to redeclare it as a
After that, when I compile contract
A, I get the following error:
TypeError: Member "func" not found or not visible after argument-dependent lookup in type(library B)
I can resolve the problem by changing the access-level of
However, that prevents me from calling the function via
Can someone please explain this odd behavior, i.e., why do I need to reduce the function's access-level from
internal after I "reduce" the
contract to a
I think I got it:
library code is "embedded" into the
contract which imports it (like a macro in C if you will).
Then, only functions that are either
public can be invoked from inside the contract, while
external functions can be invoked only from outside the contract.
So my question really is:
How can I reconcile the fact that I want these functions to be
internal when used by a contract, and
external when accessed via
Web3 (for testing purpose)?