Open ra9mls opened 3 months ago
Note: additional configuration via extrinsic updateCollateralInfo
required since current format may be not so "human-readable".
Rate per second can be calculated by rate_seconds = (1 + rate_annual)^(1/seconds_per_year) - 1
.
The problem with this formula in computation of n-th root, where n is a number of seconds in year, it is a large number. Substrate pallets are built without rust std
which doesn't allow usage of std math functions. Thus, there is no tool to provide desired functionality in substrate. Implementing such a tool requires additional types that support needed precision, because u128 is not enough. Overall, implementation of the feature requires inadequately large effort and gives very little benefits.
What we can do is to improve precision by changing milliseconds to seconds in computations, it is implemented in PR #1088
"We should have discussed this point deeper during the analysis phase of the MVP" - @Tieumsan cc @Alexey-N-Chernyshov
Not needed to implement it now.
Problem statement
We need to operate with numbers in ms per year, APR 1% in milliseconds is 0.000000000000315303 APR 2% in milliseconds is 0.000000000000627498 APR 5% in milliseconds is 0.000000000001546096 APR 10% in milliseconds is 0.000000000003020250 APR 15% in milliseconds is 0.000000000004428901 APR 20% in milliseconds is 0.000000000005777600
It's hard to manage in future
Description
No response
Definition of Done
stabilityFeeRate sets like simple numbers in percents
Requirements
No response