Decide on interest rates being in library or contract (for V3) #1564
Replies: 2 comments 6 replies
-
I present the arguments for both solutions as I understand them. First we can establish some things that we agree on how things should be implemented.
For using libraries:
For keeping the logic in the contracts (Please add to this if I'm not getting all the arguments) :
My personal arguments: It is much more natural in a library to componentize small calculations and procedures. This would improve testing, as each component can be tested much more thoroughly rather than our current paradigm which I would argue is mostly integration testing. Integration testing is important, but it is not sufficient. Also, using libraries does not eliminate the possibility to have only one contract to update. Even if we don't plan on sharing the functionality between contracts, I still believe in using libraries for the reasons listed above. It allows us to completely separate the logic of the interest rates from any side effects, and is therefore much more ideal to develop and test in this paradigm. We use this principle with the data structures, so I'm not entirely sure why there is skepticism to do this with interest rates, as it seems clear to me that interest rates are a concept that can be separated from the rest of the logic. |
Beta Was this translation helpful? Give feedback.
-
If I'm not mistaken then, writing the logic into a library, used inside a single contract, exposed by public functions, is a middleground? |
Beta Was this translation helpful? Give feedback.
-
I created this topic to discuss the two potential solutions we have for interest rate models that I think is unresolved.
Beta Was this translation helpful? Give feedback.
All reactions