Skip to content

Commit 407dd71

Browse files
Staking branch (#1360)
* First staking draft * deleted some of the procedures outdated content * Refined and updated all staking and delegation-related docs. * Deleted unnecessary sentence in entering-staking.adoc * Deleted some of the prerequisites in the procedures
1 parent e42dbdf commit 407dd71

12 files changed

+97
-59
lines changed

components/Starknet/modules/staking/pages/architecture.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[id="staking_architecture"]
2-
= Staking Architecture (WIP) 🚧
2+
= Staking Architecture
33

44
Staking on Starknet is designed to enhance network security and decentralization by allowing users to stake their STRK tokens directly or delegate them to other validators. The architecture is modular, with different contracts handling specific responsibilities to ensure flexibility, security, and ease of upgrades. For more details on the staking architecture, visit the following link: https://github.com/starkware-libs/starknet-staking[Starknet Staking Repository].
55

components/Starknet/modules/staking/pages/claiming-rewards.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[id="claiming-rewards"]
2-
= Claiming Rewards (WIP) 🚧
2+
= Claiming Rewards
33

44
:description: How to claim your staking rewards on Starknet by directly interacting with the staking or delegation pooling contracts.
55

components/Starknet/modules/staking/pages/delegating-stake.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[id="delegating-stake"]
2-
= Delegating Stake (WIP) 🚧
2+
= Delegating Stake
33

44
:description: How to delegate your stake to a validator on Starknet by interacting directly with the staking and delegation pooling contracts.
55

components/Starknet/modules/staking/pages/entering-staking.adoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[id="entering-staking"]
2-
= Becoming a Validator (WIP) 🚧
2+
= Becoming a Validator
33

44
:description: How to enter the staking protocol on Starknet by interacting directly with the staking contract.
55

@@ -38,5 +38,7 @@ on Starknet for the transfer of tokens from your address to the staking contract
3838

3939
.Secured hardware wallets:
4040
Ledger hardware wallet is supported through:
41-
* link:https://braavos.app/wallet-features/ledger-on-braavos/[Braavos] wallet
42-
* link:https://www.argent.xyz/blog/how-to-use-your-hardware-wallet-with-argent/[Argent] wallet
41+
42+
* link:https://braavos.app/wallet-features/ledger-on-braavos/[Braavos wallet]
43+
44+
* link:https://www.argent.xyz/blog/how-to-use-your-hardware-wallet-with-argent/[Argent wallet]

components/Starknet/modules/staking/pages/exiting-staking.adoc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[id="exiting-staking"]
2-
= Exiting the Staking Protocol (WIP) 🚧
2+
= Exiting the Staking Protocol
33

44
:description: How to exit the staking protocol on Starknet by unstaking as a validator or undelegating as a delegator through direct interaction with the staking or delegation pooling contracts.
55

@@ -40,7 +40,7 @@ Ensure that enough time has passed since signaling your unstake intent. If the w
4040

4141
== Undelegating as a Delegator
4242

43-
Delegators can undelegate their stake from a validator's delegation pool by following a similar process.
43+
Delegators can undelegate part or all of their stake from a validator's delegation pool by following a similar process. The `amount` parameter determines how much of the stake will be undelegated, and it must be less than or equal to the total delegated amount.
4444

4545
.Prerequisites
4646

@@ -53,15 +53,16 @@ Delegators can undelegate their stake from a validator's delegation pool by foll
5353
1. **Signal Undelegation Intent:**
5454
. Using a Starknet block explorer, navigate to the delegation pooling contract.
5555
. In the contract interface, locate and select the `exit_delegation_pool_intent` function.
56-
. Submit the transaction to initiate the undelegation process. This will record the undelegation intent, pause rewards collection, and set a waiting period.
56+
. Enter the `amount` parameter, which determines the size of the undelegation. The amount must be less than or equal to your total delegated amount.
57+
. Submit the transaction to initiate the undelegation process. This will record the undelegation intent for the specified amount, pause rewards collection, and set a waiting period.
5758

5859
2. **Finalize Undelegation:**
5960
. After the waiting period has passed, return to the delegation pooling contract.
6061
. In the contract interface, locate and select the `exit_delegation_pool_action` function.
6162
. Enter the following parameters:
6263
+
6364
* In *`pool_member`*, enter the delegator's address.
64-
. Submit the transaction to finalize the undelegation process and transfer the undelegated STRK tokens back to the delegator's account.
65+
. Submit the transaction to finalize the undelegation process and transfer the undelegated STRK tokens (based on the amount previously specified) back to the delegator's account.
6566

6667
[NOTE]
6768
====
@@ -70,7 +71,7 @@ Any address can initiate the `exit_delegation_pool_action` function once the wai
7071

7172
[NOTE]
7273
====
73-
Ensure that enough time has passed since signaling your undelegation intent. If the waiting period has not expired, the `exit_delegation_pool_action` function will fail.
74+
Ensure that enough time has passed since signaling your undelegation intent. If the waiting period has not expired, the `exit_delegation_pool_action` function will fail. Additionally, ensure the `amount` provided in the initial intent matches the intended undelegation size.
7475
====
7576

7677
== Additional Notes

components/Starknet/modules/staking/pages/handling_staking_events.adoc

Lines changed: 0 additions & 6 deletions
This file was deleted.

components/Starknet/modules/staking/pages/increasing-staking.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[id="increasing-stake"]
2-
= Increasing Stake (WIP) 🚧
2+
= Increasing Stake
33

44
:description: How to increase your stake on Starknet by interacting directly with the staking or delegation pooling contracts.
55

components/Starknet/modules/staking/pages/managing-staking-and-delegation-operations.adoc

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[id="managing-staking-and-delegation-operations"]
2-
= Managing Staking and Delegation Operations (WIP) 🚧
2+
= Managing Staking and Delegation Operations
33

44
:description: How validators and delegators can manage staking and delegation settings on Starknet by interacting directly with the staking and delegation pooling contracts.
55

6-
This guide outlines how both **validators** and **delegators** can manage various aspects of their staking and delegation activities on Starknet. Validators can perform operations such as opening delegation pools, updating commission rates, and changing operational and reward addresses. Delegators can manage their participation by changing their reward addresses associated with delegation pools.
6+
This guide outlines how both validators and delegators can manage various aspects of their staking and delegation activities on Starknet. Validators can perform operations such as opening delegation pools and updating commission rates. Delegators can manage their participation by changing their reward addresses associated with delegation pools.
77

88
== Managing Staking Operations as a Validator
99

@@ -42,7 +42,11 @@ Validators can update the commission rate of their delegation pool using the `up
4242
* **`commission`**: Enter the new commission rate, which must be equal to or less than the current rate, expressed as a percentage with precision (where 10000 represents 100%). For example, to set a 5% commission, enter `500`.
4343
. Submit the transaction to update the commission rate.
4444

45-
=== Changing the Operational Address
45+
== Address Management
46+
47+
Both validators and delegators can update their associated addresses within their staking and delegation contracts. This section outlines how to change the operational and reward addresses.
48+
49+
=== Changing the Operational Address (Validators)
4650

4751
Validators can change their operational address by interacting with the `change_operational_address` function.
4852

@@ -55,28 +59,16 @@ Validators can change their operational address by interacting with the `change_
5559
* **`operational_address`**: Enter the new operational address.
5660
. Submit the transaction to update the operational address.
5761

58-
=== Changing the Reward Address
62+
=== Changing the Reward Address (Validators and Delegators)
5963

60-
Validators can update the reward address associated with their staking contract using the `change_reward_address` function.
64+
Both validators and delegators can update their reward address using the `change_reward_address` function.
6165

6266
.Procedure
6367

64-
. Using a Starknet block explorer, navigate to the **staking contract**.
65-
. In the contract interface, locate and select the `change_reward_address` function.
66-
. Enter the following parameter:
68+
. Using a Starknet block explorer, navigate to the appropriate contract:
6769
+
68-
* **`reward_address`**: Enter the new reward address.
69-
. Submit the transaction to change the reward address.
70-
71-
== Managing Delegation Settings as a Delegator
72-
73-
=== Changing the Reward Address
74-
75-
Delegators can change their reward address by interacting with the `change_reward_address` function in the delegation pooling contract.
76-
77-
.Procedure
78-
79-
. Using a Starknet block explorer, navigate to the delegation pooling contract associated with your delegation.
70+
* For validators: Navigate to the **staking contract**.
71+
* For delegators: Navigate to the **delegation pooling contract**.
8072
. In the contract interface, locate and select the `change_reward_address` function.
8173
. Enter the following parameter:
8274
+
@@ -85,4 +77,4 @@ Delegators can change their reward address by interacting with the `change_rewar
8577

8678
== Additional Information
8779

88-
For more information on how the staking and delegation pooling systems work, refer to the xref:architecture.adoc#staking-contract[Staking Contract Architecture].
80+
For more information on how the staking and delegation pooling systems work, refer to the xref:architecture.adoc#staking-contract[Staking Contract Architecture].

components/Starknet/modules/staking/pages/overview.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[id="staking_overview"]
2-
= Staking Overview (WIP) 🚧
2+
= Staking Overview
33

44

55

@@ -28,8 +28,8 @@ STRK tokens never leave the Starknet protocol during these operations.
2828

2929
The staking protocol features two main options:
3030

31-
* _Staking_: Users can stake any amount of STRK, with a minimum threshold set at 20,000 STRK. Validators are expected to run full nodes and eventually handle additional responsibilities as the protocol evolves.
32-
* _Stake Delegation_: Users can delegate their STRK to validators without running their own nodes. Delegators share in the rewards earned by the validators they choose.
31+
* _Staking_: Users can stake any amount of STRK, with a minimum threshold set at 20,000 STRK. Validators are expected to run full nodes and eventually handle additional responsibilities as the protocol evolves. Validators can choose whether to allow delegation.
32+
* _Stake Delegation_: Users can delegate their STRK to validators without running their own nodes, if the validator allows delegation. Delegators share in the rewards earned by the validators they choose.
3333

3434
Validators and delegators can both unstake their funds, subject to network-defined latencies for security.
3535

@@ -67,8 +67,8 @@ For the first stage, stem:[C] is proposed to be 1.6%.
6767

6868
=== Latencies
6969

70-
* **Current Version**: Immediate entry and exit from the staking protocol. However, funds are subject to a 21-day security lockup after withdrawal.
71-
* **Future Versions**: Introduction of epochs to determine entry/exit latencies and continued 21-day lockup after withdrawal.
70+
* **Current Version**: Immediate entry and exit from the staking protocol. However, funds are subject to a 21-day security lockup after signaling unstake intent.
71+
* **Future Versions**: Introduction of epochs to determine entry/exit latencies and continued 21-day lockup after signaling unstake intent.
7272

7373
[NOTE]
7474
====
@@ -82,6 +82,6 @@ The proposed economic parameters are:
8282
* **Minimum STRK for Staking:** 20,000 STRK
8383
* **Withdrawal Security Lockup:** 21 days
8484
* **Minting Curve Yearly Inflation Cap (stem:[C]):** 1.6% (see link:https://community.starknet.io/t/staking-on-starknet-voting-proposal/114442/[here] for the relevant voting proposal)
85-
* **Commission Policy Parameter (stem:[CP]):** Set by the validator (0 - 1)
85+
* **Commission Policy Parameter (stem:[CP]):** Set by the validator (0 - 1), and can only be lowered once set.
8686

8787
These values are our proposed starting points for this version of the protocol. As part of the rationale behind this version, they are subject to change and may be adjusted to better suit the protocol’s needs under the proper governance procedures.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[id="staking-events-and-read-functions"]
2+
= Staking Events and Read Functions
3+
4+
:description: How to manage and respond to events emitted by the Starknet staking protocol.
5+
6+
Staking events provide critical information about changes in the staking process, such as balance updates, delegation pool creation, and exit intents. Read functions allow you to query important staking details. For a complete list of events and read functions, including keys and data, please refer to the official Starknet staking repository (link:https://github.com/starkware-libs/starknet-staking[Starknet Staking Repo]) and the spec file (link:https://github.com/starkware-libs/starknet-staking/blob/main/docs/spec.md[spec.md]).
7+
8+
== Staking Events
9+
10+
Staking events provide a way to track the state and actions of the staking process in real time. The following are the relevant events:
11+
12+
- `StakeBalanceChanged`: Emitted when a staker’s balance changes, either through direct staking or delegation.
13+
- `NewDelegationPool`: Emitted when a new delegation pool is created by a validator, marking the pool’s deployment.
14+
- `StakerExitIntent`: Emitted when a staker signals their intent to unstake, setting a future timestamp for exit.
15+
- `StakerRewardAddressChanged`: Emitted when a staker changes their reward address.
16+
- `OperationalAddressChanged`: Emitted when a staker changes their operational address.
17+
- `GlobalIndexUpdated`: Emitted when the global index used to calculate staking rewards is updated.
18+
- `NewStaker`: Emitted when a new staker joins the protocol and locks their tokens in the staking contract.
19+
- `CommissionChanged`: Emitted when a validator updates the commission rate for their delegation pool.
20+
- `StakerRewardClaimed`: Emitted when a staker or delegation pool claims their rewards.
21+
- `DeleteStaker`: Emitted when a staker is removed from the protocol.
22+
- `RewardsSuppliedToDelegationPool`: Emitted when rewards are supplied to a validator's delegation pool.
23+
- `Paused`: Emitted when the staking contract is paused.
24+
- `Unpaused`: Emitted when the staking contract is unpaused.
25+
26+
These events help to track changes and facilitate automations or actions based on the state of the staking contract.
27+
28+
== Read Functions
29+
30+
These read functions allow you to query essential information from the staking contract. Use these functions to retrieve details about stakers, staking parameters, and the total amount staked.
31+
32+
.Procedure
33+
34+
. Using a Starknet block explorer, navigate to the staking.
35+
. In the contract interface, locate and select the relevant read function.
36+
. Enter the required parameters (if applicable).
37+
. Submit the query to retrieve the requested information.
38+
39+
The following read functions are available:
40+
41+
- `state_of`: Retrieves the staking details of a given staker, including their balance and reward address.
42+
Enter the following parameter:
43+
* `staker_address` - The address of the staker whose details you want to query.
44+
45+
- `contract_parameters`: Retrieves the parameters of the staking contract, including the minimum stake amount and the reward supplier contract.
46+
47+
- `get_total_stake`: Returns the total amount of STRK tokens currently staked in the protocol.
48+
49+
- `is_paused`: Checks whether the staking contract is currently paused.

0 commit comments

Comments
 (0)