Skip to content

Commit

Permalink
task: README updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ipapandinas committed Jan 13, 2025
1 parent df12ac8 commit d94b330
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions pallets/dapp-staking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ User's stake on a contract must be equal or greater than the `MinimumStakeAmount

Although user can stake on multiple smart contracts, the amount is limited. To be more precise, amount of database entries that can exist per user is limited.

The protocol keeps track of how much was staked by the user in `voting` and `build&earn` subperiod. This is important for the bonus reward calculation. Only a limited number of _move actions_ are allowed during the `build&earn` subperiod to preserve bonus reward elegibility. _Move actions_ refer either to:

- a 'partial unstake with voting stake decrease',
- a 'stake transfer between two contracts'.
The protocol keeps track of how much was staked by the user in `voting` and `build&earn` subperiod. This is important for the bonus reward calculation.

It is not possible to stake on a dApp that has been unregistered.
However, if dApp is unregistered after user has staked on it, user will keep earning
Expand All @@ -163,7 +160,23 @@ If unstake would reduce the staked amount below `MinimumStakeAmount`, everything

Once period finishes, all stakes are reset back to zero. This means that no unstake operation is needed after period ends to _unstake_ funds - it's done automatically.

If dApp has been unregistered, a special operation to unstake from unregistered contract must be used.
During the `build&earn` subperiod, if unstaking reduces the voting stake, the bonus status will be updated, and the number of allowed _move actions_ for the ongoing period will be reduced.

If dApp has been unregistered, a special operation to unstake from unregistered contract must be used that preserves bonus elegibility.

#### Moving Stake Between Contracts

The moving stake feature allows users to transfer their staked amount between two smart contracts without undergoing the unstake and stake process separately. This feature ensures that the transferred stake remains aligned with the current staking period (effective in the next era), and any bonus eligibility is preserved as long as the conditions for the bonus reward are not violated (move actions are limited by `MaxBonusMovesPerPeriod`).

Key details about moving stake:

- The destination contract must be different from the source contract.
- The user must ensure that unclaimed rewards are claimed before initiating a stake move.
- Only a limited number of move actions (defined by `MaxBonusMovesPerPeriod`) are allowed during the `build&earn` subperiod to preserve bonus reward eligibility (check "Claiming Bonus Reward" section below).
- If the destination contract is newly staked, the user's total staked contracts must not exceed the maximum allowed number of staked contracts.
- The destination contract must not be unregistered, but moving stake away from an unregistered contract is allowed without affecting bonus eligibility.

This feature is particularly useful for stakers who wish to rebalance their stake across multiple contracts (including new registrations) or move their stake to better-performing dApps while retaining the potential for rewards and maintaining bonus eligibility.

#### Claiming Staker Rewards

Expand All @@ -181,7 +194,20 @@ Rewards are calculated using a simple formula: `staker_reward_pool * staker_stak

#### Claiming Bonus Reward

If staker staked on a dApp during the voting subperiod, and didn't reduce their staked amount below what was staked at the end of the voting subperiod, this makes them eligible for the bonus reward.
If a staker has staked on a dApp during the voting subperiod, and the bonus status for the associated staked amount has not been forfeited due to excessive move actions, they remain eligible for the bonus reward.

Only a limited number of _move actions_ are allowed during the `build&earn` subperiod to preserve bonus reward eligibility. Move actions refer to either:

- A 'partial unstake that decreases the voting stake',
- A 'stake transfer between two contracts'. (check previous "Moving Stake Between Contracts" section)

The number of authorized safe move actions is defined by `MaxBonusMovesPerPeriod`. For example:
If 2 safe bonus move actions are allowed for one period, and a user has staked **100** on contract A during the `voting` subperiod and **50** during the `build&earn` subperiod, they can safely:

1. Unstake **70**, reducing the `voting` stake to **80**.
2. Transfer **50** to contract B.

After these actions, the user will still be eligible for bonus rewards (**20** on contract A and **50** on contract B). However, if an additional move action is performed on contract A, the bonus eligibility will be forfeited.

Bonus rewards need to be claimed per contract, unlike staker rewards.

Expand Down

0 comments on commit d94b330

Please sign in to comment.