According to the documentation If a library has only internal functions then the library is included in the contract that uses it. There is no need to deploy a separate contract for the library. But I a have public function in a library that's deploying automatically with the contract. But it supposed to be deployed separately cause I was accessing a public function.
Here is my code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
library math{
function max(uint x, uint y) public pure returns (uint)
{
return x >= y ? x : y;
}
}
contract test{
function testMax(uint x,uint y) external pure returns (uint) {
return math.max(x,y);
}
}
Here I can access the max function without deploying the math library. What's the reason behind it? Note: I am using remix IDE