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
feat: limit allocations to targeted supply inflation #667
Conversation
The session's limit calculated from the mint curve guarantees allocations will never cross the maximum supply.
# Conflicts: # pallets/allocations/Cargo.toml # pallets/allocations/src/lib.rs # runtimes/eden/Cargo.toml
Codecov Report
@@ Coverage Diff @@
## master #667 +/- ##
==========================================
- Coverage 89.96% 89.60% -0.37%
==========================================
Files 33 33
Lines 6181 6515 +334
==========================================
+ Hits 5561 5838 +277
- Misses 620 677 +57
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
…Nodle's tokenomics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor comment. I am also curious as to when would the fiscal period start (date wise). Would it make sense to make it follow the fiscal quarters? If so, we might need to enforce it when deploying.
@ETeissonniere the very first fiscal period starts at block number 0. With the current configuration it would actually follow the fiscal quarters (takes about 90 days or 648000 blocks). The first time we'd see the event |
@aliXsed so I think we are looking at about a month difference from a chain fiscal quarter VS a company fiscal quarter. Correct? |
@ETeissonniere correct. Now I see your point. Do you want a root level extrinsic to bring the start of a quarter forward? |
@aliXsed yeah, unless we can make it follow our own quarters as we deploy the upgrade |
…mission When the start is not configured yet, the first block after the runtime upgrade is considered the start. When the start is configured to happen in the future, the step 0 of the configured inflation steps is used in calculations.
Also add the `Perbill::from_perthousand(1)` first step back to Eden's configuration. The root can configure the starting block in a way that we start from a different step if we need.
@ETeissonniere I have added a root level extrinsic that allows the root to set the curve starting block number. We should however remember that for Eden the relay chain block number should be used for this purpose. |
@aliXsed after checking the code I am wondering if it wouldn't be cleaner to simply set it during the migration that would be called when we deploy the upgrade? |
@ETeissonniere there is a warning in the doc for
We need to know the block number to set the curve starting block. That made me uncomfortable to take that approach. I think we can do some optimisations later without breaking anything. |
The mint curve limiter is just an upper bound enforced for security and commitment to Nodle's tokenomics. The actual mint depends on the allocation oracles and the community's growth and participation.
Note 1: to find out what does
Perbill::from_perthousand(1)
as an inflation rate step for Eden mean, you need to do the following calculation:Suppose the total issuance at the beginning of that quarter is around 8.4B NODLs. Then the allowed increase on the supply would be as follows
8.4B * 0.001 = 8.4M
. Since the fiscal period for Eden's configuration is based on 90 days. Then 8.4M increase is for that period. The actual limit is applied on a session period which is now configured as 1 day. This means on a 24 hr window, the allocations shouldn't exceed8.4M / 90 = 93,333
Note 2: Time periods are configured based on the relay chain block numbers and an assumption that they come around every 6 seconds.
Note 3: The starting block of the curve will be the relay chain block number right after the runtime upgrade. It means right after the upgrade we will be at the beginning of the fiscal period 0. However with a root permission, it's possible to set the starting block number in a way that the chain fiscal period aligns with an external fiscal period. This also allows the curve to go in a different inflation step. Obviously it's a sensitive config that's only granted to Root.
Note 4: When the curve starting block is configured to a be a block in the future, then the very first inflation step will be used for calculations before that time.
Note 5: Regardless of how we configure the inflation steps, the limiter wouldn't allow the total issuance to exceed 21B coins.
Note 6: The supply inflation rate after the configured steps would simply follow the last step or lower when approaching the 21B maximum supply. which with the current configuration means, we'd approach the 21B maximum supply with a rate equal or lower than 0.1%.