Exiting the Staking Protocol (WIP) ๐Ÿšง

Exiting the staking protocol involves either unstaking your STRK tokens as a validator or undelegating your stake as a delegator. Both processes require you to first signal your intent to exit, followed by an action to finalize the process after a waiting period.

Unstaking as a Validator

Validators can unstake their STRK tokens, which involves pausing rewards and exiting the staking contract.

Prerequisites
  • The validator must not currently be in the unstake process.

Procedure
  1. Signal Unstake Intent:

    1. Using a Starknet block explorer, navigate to the staking contract.

    2. In the contract interface, locate and select the unstake_intent function.

    3. Submit the transaction to initiate the unstake process. This will record the unstake intent, pause rewards collection, and set a waiting period.

  2. Finalize Unstake:

    1. After the waiting period has passed, return to the staking contract.

    2. In the contract interface, locate and select the unstake_action function.

    3. Enter the following parameters:

      • In staker_address, enter the validator’s address.

    4. Submit the transaction to finalize the unstaking process and transfer the staked STRK tokens back to the validator’s account.

Any address can initiate the unstake_action function once the waiting period has passed.

Ensure that enough time has passed since signaling your unstake intent. If the waiting period has not expired, the unstake_action function will fail.

Undelegating as a Delegator

Delegators can undelegate their stake from a validator’s delegation pool by following a similar process.

Prerequisites
  • A Starknet-compatible block explorer or CLI tool.

  • The delegator must not currently be in the undelegation process.

  • The contract address of the delegation pooling contract. (TODO: Check if this really needs to be mentioned.)

Procedure
  1. Signal Undelegation Intent:

    1. Using a Starknet block explorer, navigate to the delegation pooling contract.

    2. In the contract interface, locate and select the exit_delegation_pool_intent function.

    3. Submit the transaction to initiate the undelegation process. This will record the undelegation intent, pause rewards collection, and set a waiting period.

  2. Finalize Undelegation:

    1. After the waiting period has passed, return to the delegation pooling contract.

    2. In the contract interface, locate and select the exit_delegation_pool_action function.

    3. Enter the following parameters:

      • In pool_member, enter the delegator’s address.

    4. Submit the transaction to finalize the undelegation process and transfer the undelegated STRK tokens back to the delegator’s account.

Any address can initiate the exit_delegation_pool_action function once the waiting period has passed.

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.

Additional Notes

  • When a validator unstakes, any unclaimed rewards are automatically transferred to the reward address before the stake is returned.

  • Similarly, when a delegator undelegates, any unclaimed rewards are automatically transferred to the delegatorโ€™s reward address.

For more details on the staking and delegation processes, see Staking Contract Architecture.