library C {
function a() public returns (uint) {
return 15;
}
}
contract A {
function a() public returns (uint) {
return C.a();
}
}
This is the code I am using. I am trying to figure out how library C ends up in contract A's bytecode.
Question 1) I use remix and I compile contract A. In the bytecode, I can see the following __$de3f906ec3d3531c3d498f8b283d7f02e6$__
. It doesn't matter if I change library C's function a's name or if I change what it returns. In the bytecode, there's always the same __$de3f906ec3d3531c3d498f8b283d7f02e6$__
. Of course, If I use the library's function 2 times, then I will meet that strange string 2 times in the bytecode. What is it ?
Question 2) The answer to the above question could be it's a placeholder
, where in the end, it's library's address that ends up in there. If that's correct, then how does remix link library C
to contract A
? because both library and contract are in the same file, and when I want to deploy, I only deploy contract A
(i don't deploy or link library at all). Any idea ? How do I get the library address in that matter ?