How to determine type when using a library. #163
-
Thanks for this wonderful video, @PatrickAlphaC. In the PriceConverter library, I noticed all the functions and arguments are uint256. So I guessed that's why When I checked solidity by example, two different types are used in the function library. And My question now is how do I know which type to use? And Instead of specifying |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you have all functions inside the library that return the same data type, then in the parent contract you will only use using LibraryName for data_type; But if you have multiple functions with the different return types, then you use them separately for each data type you want in the parent contract. like this using LibraryName for uint256; //example
using LibraryName for string; // example hope it clears you answer. |
Beta Was this translation helpful? Give feedback.
@Olaleye-Blessing
If you have all functions inside the library that return the same data type, then in the parent contract you will only use
But if you have multiple functions with the different return types, then you use them separately for each data type you want in the parent contract. like this
hope it clears you answer.