Staking Events and Read Functions

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 (Starknet Staking Repo) and the spec file (spec.md).

Staking Events

Staking events provide a way to track the state and actions of the staking process in real time. The following are the relevant events:

  • StakeBalanceChanged: Emitted when a staker’s balance changes, either through direct staking or delegation.

  • NewDelegationPool: Emitted when a new delegation pool is created by a validator, marking the pool’s deployment.

  • StakerExitIntent: Emitted when a staker signals their intent to unstake, setting a future timestamp for exit.

  • StakerRewardAddressChanged: Emitted when a staker changes their reward address.

  • OperationalAddressChanged: Emitted when a staker changes their operational address.

  • GlobalIndexUpdated: Emitted when the global index used to calculate staking rewards is updated.

  • NewStaker: Emitted when a new staker joins the protocol and locks their tokens in the staking contract.

  • CommissionChanged: Emitted when a validator updates the commission rate for their delegation pool.

  • StakerRewardClaimed: Emitted when a staker or delegation pool claims their rewards.

  • DeleteStaker: Emitted when a staker is removed from the protocol.

  • RewardsSuppliedToDelegationPool: Emitted when rewards are supplied to a validator’s delegation pool.

  • Paused: Emitted when the staking contract is paused.

  • Unpaused: Emitted when the staking contract is unpaused.

These events help to track changes and facilitate automations or actions based on the state of the staking contract.

Read Functions

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.

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

  2. In the contract interface, locate and select the relevant read function.

  3. Enter the required parameters (if applicable).

  4. Submit the query to retrieve the requested information.

The following read functions are available:

  • state_of: Retrieves the staking details of a given staker, including their balance and reward address. Enter the following parameter:

    • staker_address - The address of the staker whose details you want to query.

  • contract_parameters: Retrieves the parameters of the staking contract, including the minimum stake amount and the reward supplier contract.

  • get_total_stake: Returns the total amount of STRK tokens currently staked in the protocol.

  • is_paused: Checks whether the staking contract is currently paused.