I've been trying to find a way to reference an already deployed library via address IN Solidity code, and couldn't find one, nor could find any explanation on whether this is even possible.
For example think of this scenario:
- Alice deploys LibraryAlice at address X. The library has a function called
- Bob writes a contract that makes use of LibraryAlice, but instead of re-writing the code Bob simply points to the address X.
Basically Bob wants to do:
LibraryAlice lib = LibraryAlice(<addressX>)
How do I achieve this? It feels like an obvious feature that everybody could use to save gas, for example you could just call libraries like SafeMath by inline-instantiating them directly in the solidity code.
All the examples I see keep reusing the same library code and I am confused.