Provider Boosting implementation
Goal
Implement a Provider Boost feature, whereby token holders may support the network and a specific Provider by means of a custom staking model. Token holders lock up a certain amount of token, and receive a return in Frequency token for this support. The token holder chooses a Provider to receive some Capacity, which the Provider may use to pay for chain transactions.
Token holders may still stake for MaximizedCapacity and receive no token return. As before, the entire benefit for staking would go to the targeted Provider for this type.
Discussion
Support the new staking type, Provider Boost
- The
staketransaction now specifies the Staking Type ofMaximizedCapacitywhich is stored withStakingTargetDetails. - There are 3 new extrinsics:
-
provider_boostwhich specifies ProviderBoost staking type. -
claim_staking_rewardswhich mints and transfers all eligible rewards in token to the staker. -
change_staking_targetwhich basically swaps your Provider Boost staking target from one Provider to another.
-
- The
StakingTypedetermines how much Capacity is generated for the targeted provider. ForProviderBoosttype, 50% of the Capacity forMaximizedCapacityis generated when usingprovider_boost. - The
StakingTypealso determines if there is a periodic return in token to the staker. ForProviderBoosttype, there is a periodic return. ForMaximizedCapacitytype, there isn't.
Issue rewards to Provider Boost accounts
- Rewards are a fixed amount based on the proportion of staked amount to total staked amount, and capped at 10% per year, or to ~0.0385% per Reward Era.
- Individual Rewards are calculated based on the number of complete
RewardErasthat the token holder has staked. - A
RewardErais approximately two weeks of blocks. - Reward Pool size is a constant.
- Rewards are are not compounded.
- Rewards are minted when they are claimed. All available Rewards are paid out when the
claim_staking_rewardsextrinsic succeeds. - Rewards expire after 30 Reward Eras. This is the limit of the Reward Pool History storage and the limit of the individual Provider Boost History storage, so rewards cannot be claimed for earlier eras. With that said, if for example you ProviderBoost 10,000 FRQCY, and did nothing else for say 50 Reward Eras ("set and forget"), you would not lose everything. You would simply would not be paid out except for the last 30 Eras. Only the potential earnings for the 20 eras before that would be lost.
Allow a staking 'retarget'
A staker may change some or all of their staked token to target a different provider up to 16 times in a RewardEra without penalty. Otherwise, they must wait until the next RewardEra.
For more details, please see the Capacity Staking Rewards Implementation design doc, which links to the economic model for this feature.
Checklist
- [ ] Chain spec updated
- [x] 6 SECOND BLOCK TIMES: length of constants adjusted as necessary
- [x] Custom RPC OR Runtime API added/changed? Updated js/api-augment.
- [x] Design doc(s) updated
- [x] Tests added
- [x] Benchmarks added
- [x] Weights updated
Codecov Report
Attention: Patch coverage is 92.82511% with 32 lines in your changes missing coverage. Please review.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| common/primitives/src/capacity.rs | 75.00% <100.00%> (+75.00%) |
:arrow_up: |
| pallets/capacity/src/types.rs | 96.37% <95.07%> (+0.79%) |
:arrow_up: |
| ...lets/capacity/src/migration/provider_boost_init.rs | 0.00% <0.00%> (ø) |
|
| pallets/capacity/src/lib.rs | 94.82% <94.79%> (-0.53%) |
:arrow_down: |