Skip to content

Commit b0985d6

Browse files
authored
dAppStaking: move extrinsic (#732)
* add move documentation * Add Governance proxy type * Update dapp-staking-faq.md * Update protocol-parameters.md
1 parent 9c1419f commit b0985d6

File tree

4 files changed

+47
-4
lines changed

4 files changed

+47
-4
lines changed

docs/learn/Proxies.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ To see complete list of functionality, checkout the source code in Astar repo.
2525

2626
7. **DappsStaking** - This proxy type allows delegate account to perform DappStaking related transactions such as register, unregister contracts, claim rewards etc.
2727

28+
8. **Governance** - This proxy type allows delegate account to perform Governance related transactions such as voting on a proposal, reserve funds to create preimages, proposals or treasury requests, etc.
29+
2830

2931
**Extrinsics**
3032
---

docs/learn/dapp-staking/dapp-staking-faq.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ Generally, it’s recommended to claim your rewards once a week.
104104

105105
If a staker staked on a dApp during the `Voting` Subperiod and **keeps the same staked amount or higher** on a dApp through the whole `Build&Earn` Subperiod, they are eligible for the bonus rewards.
106106

107+
Bonus eligibility can be safely transferred between projects, preserving it for a limited number of moves, as defined by `MaxBonusSafeMovesPerPeriod`. Exceeding this limit results in bonus forfeiture for the affected stake.
108+
107109
### Q: Can my rewards expire?
108110

109111
Unclaimed rewards will eventually expire, so it's important to claim them in time or they'll miss out on earnings.

docs/learn/dapp-staking/dapp-staking-protocol.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,26 @@ If unstake would reduce the staked amount below `MinimumStakeAmount`, everything
191191

192192
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.
193193

194+
#### Moving Stake Between Contracts
195+
196+
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, but the moved stake is 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 `MaxBonusSafeMovesPerPeriod` from the protocol configuration.
197+
198+
Key details about moving stake:
199+
200+
- The destination contract must be different from the source contract.
201+
- The user must ensure that unclaimed rewards are claimed before initiating a stake move.
202+
- Only a limited number of move actions (defined by `MaxBonusSafeMovesPerPeriod`) are considered _safe_ during a single period to preserve bonus reward eligibility. Additional moves actions are feasable but forfeit the bonus reward.
203+
- If the destination contract is newly staked, the user's total staked contracts must not exceed the maximum allowed number of staked contracts (same as the staking operation).
204+
- The destination contract must not be unregistered, but moving stake away from an unregistered contract is allowed **without affecting bonus eligibility**.
205+
206+
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.
207+
208+
#### Bonus Status Handling in Moves
209+
210+
When moving stake, if the destination contract has no existing bonus eligibility, it inherits the incoming bonus status from the source contract. If both the source and destination have nonzero bonus statuses, they are merged by averaging their values. This prevents unintended bonus gains or losses while ensuring fairness in bonus distribution.
211+
212+
For example, if the configuration allows **2** _safe moves_, if the source conctract as already be moved once and if the destination contract as not consumed move actions, the resulting merged for the remaining _safe moves_ of teh destination stake will be **1** ((2+0) / 2 = 1).
213+
194214
#### Claiming Staker Rewards
195215

196216
Stakers can claim rewards for passed eras during which they were staked for the entire duration of the era.
@@ -206,11 +226,19 @@ $staker\_reward = \frac{staker\_reward\_pool * staker\_staked\_amount}{total\_st
206226

207227
#### Claiming Bonus Reward
208228

209-
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.
229+
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.
230+
231+
Only a limited number of _safe move actions_ are allowed during the `build&earn` subperiod to preserve bonus reward eligibility. Move actions refer to either:
232+
- A 'partial unstake that decreases the voting stake',
233+
- A 'stake transfer between two contracts'. (check previous "Moving Stake Between Contracts" section)
210234

211-
E.g. if staker had staked **10 ASTR** during the `Voting` subperiod, once `Build&Earn` subperiod starts, they can stake & unstake as much as they want as long as they don't reduce the `Voting` subperiod stake below **10 ASTR**.
212-
It is ok to stake an additional **30 ASTR**, and then unstake **5 ASTR**, because such order of operations would leave the staker with **10 ASTR** staked in the `Voting` subperiod & **25 ASTR** staked in the `Build&Earn` subperiod.
213-
However, if user was to stake an additional **30 ASTR** in the `Build&Earn` subperiod, but would unstake **31 ASTR**, this would put the stake amount in `Build&Earn` subperiod to **zero**, and reduce `Voting` subperiod stake amount to **9 ASTR**. This would mean user is no longer eligible for the bonus rewards.
235+
The number of authorized safe move actions is defined by `MaxBonusSafeMovesPerPeriod`. For example:
236+
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:
237+
238+
1. Unstake **70**, reducing the `voting` stake to **80**.
239+
2. Transfer **50** to contract B.
240+
241+
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.
214242

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

@@ -343,6 +371,8 @@ For example, if the tier thresholds are [100, 500, 1000] and the dApp has 300 AS
343371
The maximum rank is **10**, regardless of the staked amount.
344372
:::
345373

374+
The `set_static_tier_params` call allows dynamic modification of tier-related dApp staking parameters and requires governance privileges.
375+
346376
#### Rank reward
347377

348378
Each rank provides up to a **10%** extra reward on top of the tier reward. To respect inflation, each rank reward comes from empty slots within the same tier. Each tier has its own portion of rewards to distribute. If all tier slots are occupied, the tier reward is distributed equally to each dApp in that tier, leaving no remaining reward for ranks. If there is a remaining reward, it goes towards rewarding the ranks. Depending on the availability, the rank reward can go up to **10%** of the tier reward. For example, if you are in tier **2** with a rank of **5** and the tier reward is **1000 ASTR**, then rank reward will be **rank_reward = 0.1 * 1000 ASTR = 100 ASTR**. Therefore given formula

docs/learn/dapp-staking/protocol-parameters.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ This is again a technical bound, to provide additional security to the pallet.
4949
Similar to the _minimum lock amount_, but refers to the _stake_ amount.
5050
It's suggested to keep this value same as the _minimum locked amount_.
5151

52+
### Max Bonus Safe Moves Per Period
53+
54+
The number of authorized safe move actions of the amount staked during the Voting subperiod to remain eligible for the bonus reward.
55+
Only a limited number of _safe move actions_ are allowed during the `build&earn` subperiod to preserve bonus reward eligibility. Move actions refer to either:
56+
57+
- A 'partial unstake that decreases the voting stake',
58+
- A 'stake transfer between two contracts'. (check previous "Moving Stake Between Contracts" section)
59+
5260
### Number Of Tiers
5361

5462
Number of distinct tiers in the protocol.
@@ -91,6 +99,7 @@ Length of the circular buffer used to implement the _moving-average_ solution.
9199
| Unlocking Period | 9 | 4 | 4 |
92100
| Max Number Of Staked Contracts | 16 | 16 | 8 |
93101
| Minimum Stake Amount | 500 ASTR | 50 SDN | 5 SBY |
102+
| Max Bonus Safe Moves Per Period | 2 | 2 | 2 |
94103
| Baseline Native Currency Price | 0.05 USD | 0.05 USD | 0.05 USD (mock) |
95104
| Number Of Tiers | 4 | 4 | 4 |
96105
| Reward Distribution | [25%, 47%, 25%, 3%] | [25%, 47%, 25%, 3%] | [40%, 30%, 20%, 10%] |

0 commit comments

Comments
 (0)