The Staking Manager is the primary contract for validator-related activities in Shibarium, including stake management, reward distribution, and signature verification. All proof verification and staking operations are executed on Ethereum, while computation-heavy tasks are handled on L2.

Roles in Staking

  • Validator: Stakes BONE, validates blocks, can accept delegation.
  • Delegator: Delegates BONE to validators for a share of rewards.
  • Watcher: Reports fraud.
A single Ethereum address can only be a validator or a delegator, not both.

Key Concepts

  • NFT Ownership: Each stake mints a unique NFT (ERC721) representing validator ownership. Ownership changes do not impact system integrity.
  • Validator Threshold: Maximum number of validators (slots) allowed.
  • AccountStateRoot: Used for accounting and reward claims; submitted with each checkpoint.

Staking Functions

function stake(uint256 amount, uint256 heimdallFee, bool acceptDelegation, bytes calldata signerPubkey) public;
function stakeFor(address user, uint256 amount, uint256 heimdallFee, bool acceptDelegation, bytes memory signerPubkey) public;
  • Stake BONE to become a validator (if below threshold).
  • Transfers amount + heimdallFee.
  • Mints a unique NFT for each new stake.
  • acceptDelegation deploys a ValidatorShare contract for delegation.
  • Unstake: Removes validator from set in next epoch; updates timeline and locks delegation contract.
  • UnstakeClaim:
function unstakeClaim(uint256 validatorId) public;
  • After withdrawal delay, allows settlement (rewards, staked tokens, NFT burn).
function restake(uint256 validatorId, uint256 amount, bool stakeRewards) public;
  • Increase stake with new amount or rewards.
  • Updates timeline for active stake.
function withdrawRewards(uint256 validatorId) public;
  • Withdraw accumulated rewards (including from delegation contract if applicable).
function updateSigner(uint256 validatorId, bytes memory signerPubkey) public;
  • Update validator’s signer address for block and checkpoint validation.
  • Top Up Heimdall Fee:
function topUpForFee(uint256 validatorId, uint256 heimdallFee) public;
  • Claim Fee:
function claimFee(uint256 validatorId, uint256 accumSlashedAmount, uint256 accumFeeAmount, uint256 index, bytes memory proof) public;
  • Withdraw fee from Heimdall using proof of inclusion in accountStateRoot.
  • startAuction:
function startAuction(uint256 validatorId, uint256 amount) external;
  • confirmAuctionBid:
function confirmAuctionBid(uint256 validatorId, uint256 heimdallFee, bool acceptDelegation, bytes calldata signerPubkey) external;
  • Periodic auctions allow replacement of poor-performing validators.
  • Bidding and confirmation logic ensures dynamic security and fair validator selection.
function checkSignatures(uint256 blockInterval, bytes32 voteHash, bytes32 stateRoot, bytes memory sigs) public;
  • Validates checkpoint signatures (BFT 2/3+1 agreement).
  • Ensures rewards are distributed proportionally to stake.
struct State { int256 amount; int256 stakerCount; }
mapping(uint256 => State) public validatorState;
  • Tracks active validators and staking per epoch/checkpoint.
  • StakingInfo: Centralized logging contract for validator and delegation events.
  • ValidatorShareFactory: Deploys ValidatorShare contracts for validators accepting delegation.

Notes & Additional Info

  • NFT is standard ERC721 with restrictions (one per user, sequential minting).
  • jail, unJail, and slash functions are not currently used.
  • Some mechanisms are inspired by Polygon’s open-source design.
I