-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
leverage: Move complex leverage calculations from keeper to separate package #1168
Comments
We should not do that. |
Do you think taking the approach I mentioned but with a package like In the meantime, I'll move back the stuff in #1118 |
|
I've moved them back to keeper in the PR now by the way - The functions I'm interested in moving are the ones with pure math or financial logic but strictly
There would also be internal pure mathematical functions, like the Overall, whether it ends up in its own package or not, I would like to get the module's unique math in one place, separate from the keeper's operations. The |
ACK. Let's think about the package name. Can you update the description of the task? These functions are strictly related to the state machine, so I think package nested inside |
In #1118 I tried moving parts of function
ComputeLiquidation
to thex/leverage/types
package. The result was a more pure function which did not read or write state and was much more efficient to write tests for.However (see discussion),
types
was the wrong place to put it.Instead, a sub-package for example
x/leverage/math
orx/leverage/keeper/math
might be created forComputeLiquidation
and other leverage computations which are sufficiently complex, especially if theysdk.Int
andsdk.Dec
with noctx
,keeper
,coin
,err
, oraddress
involvement.The text was updated successfully, but these errors were encountered: