Replies: 1 comment
-
Hello @nikola755, Don't we still have to import the library using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Solidity Library Changes (2023-2024)
Recent Solidity updates (v0.8.25+) have introduced changes to how libraries work:
What Changed
using for
directive is recommended over direct importsExample
// Old way (pre-2023)
import "./PriceConverter.sol";
contract MyContract {
function someFunction() public {
PriceConverter converter;
converter.someFunction();
}
}
// New way (2023+)
library PriceConverter {
function someFunction() internal view returns (uint256) {
}
contract MyContract {
using PriceConverter for uint256;
function someFunction() public {
uint256 value;
value.someFunction();
}
}
Beta Was this translation helpful? Give feedback.
All reactions