Skip to content

StakingPoolContractsFactory

Mainnet: 0xb79b43dBA821Cb67751276Ce050fF4111445fB99
Bepolia: 0x176c081E95C82CA68DEa20CA419C7506Aa063C24
 | ABI JSON

The StakingPoolContractsFactory is responsible for deploying and managing staking pool contracts for validators. It creates the core contracts (SmartOperator, StakingPool, StakingRewardsVault, and IncentiveCollector) and handles the initial validator deposit to register with the consensus layer.

State Variables

accountingOracle

solidity
address public accountingOracle;

withdrawalVault

solidity
address public withdrawalVault;

Structs

ValidatorData

Data for the validator.

solidity
struct ValidatorData {
    bytes pubkey;
    bytes withdrawalCredentials;
    uint64 initialDepositAmount;
    uint64 validatorIndex;
}

Properties

NameTypeDescription
pubkeybytesThe pubkey of the validator.
withdrawalCredentialsbytesThe withdrawal credentials of the validator.
initialDepositAmountuint64The initial deposit amount of the validator in GWei.
validatorIndexuint64The index of the validator.

ProofData

Data for the proofs.

solidity
struct ProofData {
    bytes32[] pubkeyProof;
    bytes32[] withdrawalCredentialsProof;
    bytes32[] initialDepositProof;
    bytes32 initialDepositProofLeaf;
}

Properties

NameTypeDescription
pubkeyProofbytes32[]The proof of the pubkey.
withdrawalCredentialsProofbytes32[]The proof of the withdrawal credentials.
initialDepositProofbytes32[]The proof of the initial deposit.
initialDepositProofLeafbytes32The leaf of the initial deposit.

View Functions

getCoreContracts

Returns the core contracts for a given pubkey

solidity
function getCoreContracts(bytes memory pubkey) external view returns (CoreContracts memory);

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator

predictStakingPoolContractsAddresses

Predicts the addresses of the staking pool contracts for a given pubkey

solidity
function predictStakingPoolContractsAddresses(bytes memory pubkey) external view returns (CoreContracts memory);

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator

Returns

NameTypeDescription
<none>CoreContractsThe addresses of the staking pool contracts

validatePubkeyProof

Validates the pubkey proof

solidity
function validatePubkeyProof(
    bytes calldata pubkey,
    bytes32[] calldata pubkeyProof,
    uint64 validatorIndex,
    uint64 timestamp
)
    external
    view;

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator
pubkeyProofbytes32[]The proof of the pubkey
validatorIndexuint64The index of the validator
timestampuint64The timestamp of the beacon block

validateBalanceProof

Validates the balance proof

solidity
function validateBalanceProof(
    uint64 balance,
    bytes32 balancesLeaf,
    bytes32[] calldata balanceProof,
    uint64 validatorIndex,
    uint64 timestamp
)
    external
    view;

Parameters

NameTypeDescription
balanceuint64The balance of the validator
balancesLeafbytes32The leaf of the balances
balanceProofbytes32[]The proof of the balance
validatorIndexuint64The index of the validator
timestampuint64The timestamp of the beacon block

Functions

deployStakingPoolContracts

Deploys all staking pool contracts for a validator and performs the initial deposit to register the validator with the consensus layer.

solidity
function deployStakingPoolContracts(
    bytes memory pubkey,
    bytes memory withdrawalCredentials,
    bytes memory signature,
    address validatorAdmin,
    address defaultSharesRecipient
)
    external
    payable
    returns (address, address, address, address);

Parameters

NameTypeDescription
pubkeybytesThe validator's public key (48 bytes)
withdrawalCredentialsbytesThe withdrawal credentials for the validator
signaturebytesThe validator's signature for the deposit
validatorAdminaddressThe address that will have admin privileges over the validator
defaultSharesRecipientaddressThe address that will receive validator fee shares by default

Returns

NameTypeDescription
<none>addressSmartOperator contract address
<none>addressStakingPool contract address
<none>addressStakingRewardsVault contract address
<none>addressIncentiveCollector contract address

Requirements

  • Must send exactly 10,000 BERA with the transaction
  • Validator must not already be registered
  • Withdrawal credentials must match the withdrawal vault address

activateStakingPool

Activates a staking pool by validating proofs and updating the validator's state.

solidity
function activateStakingPool(
    ValidatorData calldata validatorData,
    ProofData calldata proofData,
    uint64 timestamp
)
    external;

Parameters

NameTypeDescription
validatorDataValidatorDataThe validator data including pubkey and withdrawal credentials
proofDataProofDataThe proof data for validation
timestampuint64The timestamp of the beacon block

Events

StakingPoolContractsDeployed

Emitted when staking pool contracts are deployed for a validator.

solidity
event StakingPoolContractsDeployed(
    address smartOperator, address stakingPool, address stakingRewardsVault, address incentiveCollector
);

Parameters

NameTypeDescription
smartOperatoraddressThe address of the deployed SmartOperator contract
stakingPooladdressThe address of the deployed StakingPool contract
stakingRewardsVaultaddressThe address of the deployed StakingRewardsVault contract
incentiveCollectoraddressThe address of the deployed IncentiveCollector contract

StakingPoolActivated

Emitted when a staking pool is activated.

solidity
event StakingPoolActivated(address stakingPool);

Parameters

NameTypeDescription
stakingPooladdressThe address of the activated staking pool

SmartOperatorBeaconImplUpgraded

Emitted when the SmartOperator beacon implementation is upgraded.

solidity
event SmartOperatorBeaconImplUpgraded(address newImplementation);

Parameters

NameTypeDescription
newImplementationaddressThe address of the new implementation

StakingPoolBeaconImplUpgraded

Emitted when the StakingPool beacon implementation is upgraded.

solidity
event StakingPoolBeaconImplUpgraded(address newImplementation);

Parameters

NameTypeDescription
newImplementationaddressThe address of the new implementation

StakingRewardsVaultBeaconImplUpgraded

Emitted when the StakingRewardsVault beacon implementation is upgraded.

solidity
event StakingRewardsVaultBeaconImplUpgraded(address newImplementation);

Parameters

NameTypeDescription
newImplementationaddressThe address of the new implementation

IncentiveCollectorBeaconImplUpgraded

Emitted when the IncentiveCollector beacon implementation is upgraded.

solidity
event IncentiveCollectorBeaconImplUpgraded(address newImplementation);

Parameters

NameTypeDescription
newImplementationaddressThe address of the new implementation

Errors

OperatorAlreadySet

solidity
error OperatorAlreadySet();

InvalidOperator

solidity
error InvalidOperator();

InvalidWithdrawalCredentials

solidity
error InvalidWithdrawalCredentials();

InvalidAddress

solidity
error InvalidAddress();

InvalidFirstDepositAmount

solidity
error InvalidFirstDepositAmount();

InvalidInitialDepositAmount

solidity
error InvalidInitialDepositAmount();

InvalidTimestamp

solidity
error InvalidTimestamp();