Skip to Content

Staking Precompile

Address: 0x0000000000000000000000000000000000001005

This precompile allows EVM contracts to interact with Sei’s staking module, enabling functionalities such as delegating tokens, creating and managing validators, querying validators, and more.

Functions

Transactions

  • delegate: Allows a user to delegate a specified amount of tokens to a validator. This function will truncate the msg.value to 6 decimals.

    /// Delegates Sei to the specified validator. /// @dev This function truncates msg.value to 6 decimal places for interaction with the staking module /// @param valAddress The Sei address of the validator. /// @return Whether the delegation was successful. function delegate( string memory valAddress, ) payable external returns (bool success);
  • redelegate: Enables the redelegation of tokens from one validator to another.

    /// Redelegates Sei from one validator to another. /// @dev The amount should be in 6 decimal precision, not 18. 1 SEI = 1_000_000 uSEI /// @param srcAddress The Sei address of the validator to move delegations from. /// @param dstAddress The Sei address of the validator to move delegations to. /// @param amount The amount of Sei to move from srcAddress to dstAddress. /// @return Whether the redelegation was successful. function redelegate( string memory srcAddress, string memory dstAddress, uint256 amount ) external returns (bool success);
  • undelegate: Provides the functionality for a user to withdraw a specified amount of tokens from a validator.

    /// Undelegates Sei from the specified validator. /// @dev The amount should be in 6 decimal precision, not 18. 1 SEI = 1_000_000 uSEI /// @param valAddress The Sei address of the validator to undelegate from. /// @param amount The amount of Sei to undelegate. /// @return Whether the undelegation was successful. function undelegate( string memory valAddress, uint256 amount ) external returns (bool success);
  • createValidator: Creates a new validator on the Sei network.

    /// Creates a new validator. Delegation amount must be provided as value in wei /// @param pubKeyHex Ed25519 public key in hex format (64 characters) /// @param moniker Validator display name /// @param commissionRate Initial commission rate (e.g. "0.05" for 5%) /// @param commissionMaxRate Maximum commission rate (e.g. "0.20" for 20%) /// @param commissionMaxChangeRate Maximum commission change rate per day (e.g. "0.01" for 1%) /// @param minSelfDelegation Minimum self-delegation amount in base units /// @return success True if validator creation was successful function createValidator( string memory pubKeyHex, string memory moniker, string memory commissionRate, string memory commissionMaxRate, string memory commissionMaxChangeRate, uint256 minSelfDelegation ) payable external returns (bool success);
  • editValidator: Modifies an existing validator’s parameters.

    /// Edit an existing validator's parameters /// @param moniker New validator display name /// @param commissionRate New commission rate (e.g. "0.10" for 10%) /// Pass empty string "" to not change commission rate /// Note: Commission can only be changed once per 24 hours /// @param minSelfDelegation New minimum self-delegation amount in base units /// Pass 0 to not change minimum self-delegation /// Note: Can only increase, cannot decrease below current value /// @return success True if validator edit was successful function editValidator( string memory moniker, string memory commissionRate, uint256 minSelfDelegation ) external returns (bool success);

Queries

  • delegation: Queries delegation for a given delegator and validator address.

    struct Delegation { Balance balance; DelegationDetails delegation; } struct Balance { uint256 amount; string denom; } struct DelegationDetails { string delegator_address; uint256 shares; uint256 decimals; string validator_address; } /// Queries delegation for a given delegator and validator address. /// @param delegatorAddress The x0 or Sei address of the delegator. /// @param valAddress The Sei address of the validator. /// @return The delegation information. Shares in DelegationDetails are usually returned as decimals. /// To calculate the actual amount, divide the shares by decimals. function delegation( address delegator, string memory valAddress ) external view returns (Delegation delegation);
View the Staking precompile source code and the contract ABI here.
Last updated on