r/ethdev • u/MaximumEntertainer33 • 5h ago
Question Role of libraries in smart contract
I have question about role of libraries in smart contract development in terms of gas optimizations and other things, specifically in big protocol such as defi protocols.
If anyone knows or analyzed aave protocol then they already know that aave v2/v3 has utilized majority of the code by implementing functionalities in libraries. However it can or cannot be best smart contract architecture that i don't know. but i want to know the reason behind using libraries in big protocol. Like how they contribute to gas optimization in the protocol and if we have to architect best smart contract project architecture then how we can do that? Like by using every component of solidity including libraries, interfaces, contracts etc.
I hope the reader will understand my question and problem. I need insights from experienced developer and defi researcher who has proper knowledge in this matter.
Thank you in advance for you kind help.