Skip to main content

DepositDataRegistry

Git Source

Inherits: Multicall, IDepositDataRegistry

Author: StakeWise

Defines the functionality for the Vault's deposit data management

State Variables

_vaultsRegistry

IVaultsRegistry private immutable _vaultsRegistry;

depositDataIndexes

The vault deposit data index

mapping(address => uint256) public override depositDataIndexes;

depositDataRoots

The vault deposit data root

mapping(address => bytes32) public override depositDataRoots;

_depositDataManagers

mapping(address => address) private _depositDataManagers;

_migrated

mapping(address => bool) private _migrated;

Functions

onlyValidVault

Modifier to check if the caller is a valid vault

modifier onlyValidVault(address vault);

Parameters

NameTypeDescription
vaultaddressThe address of the vault

constructor

Constructor

constructor(address vaultsRegistry);

Parameters

NameTypeDescription
vaultsRegistryaddressThe address of the vaults registry contract

getDepositDataManager

The vault deposit data manager. Defaults to the vault admin if not set.

function getDepositDataManager(address vault) public view override returns (address);

Parameters

NameTypeDescription
vaultaddressThe address of the vault

Returns

NameTypeDescription
<none>addressdepositDataManager The address of the deposit data manager

setDepositDataManager

Function for setting the deposit data manager for the vault. Can only be called by the vault admin.

function setDepositDataManager(address vault, address depositDataManager) external override onlyValidVault(vault);

Parameters

NameTypeDescription
vaultaddressThe address of the vault
depositDataManageraddressThe address of the new deposit data manager

setDepositDataRoot

Function for setting the deposit data root for the vault. Can only be called by the deposit data manager.

function setDepositDataRoot(address vault, bytes32 depositDataRoot) external override onlyValidVault(vault);

Parameters

NameTypeDescription
vaultaddressThe address of the vault
depositDataRootbytes32The new deposit data Merkle tree root

updateVaultState

Updates the vault state. Can be used in multicall to update state and register validator(s).

function updateVaultState(address vault, IKeeperRewards.HarvestParams calldata harvestParams) external override;

Parameters

NameTypeDescription
vaultaddressThe address of the vault
harvestParamsIKeeperRewards.HarvestParamsThe harvest params to use for updating the vault state

registerValidator

Function for registering single validator

function registerValidator(
address vault,
IKeeperValidators.ApprovalParams calldata keeperParams,
bytes32[] calldata proof
) external override onlyValidVault(vault);

Parameters

NameTypeDescription
vaultaddressThe address of the vault
keeperParamsIKeeperValidators.ApprovalParamsThe parameters for getting approval from Keeper oracles
proofbytes32[]The proof used to verify that the validator is part of the deposit data merkle tree

registerValidators

Function for registering multiple validators

function registerValidators(
address vault,
IKeeperValidators.ApprovalParams calldata keeperParams,
uint256[] calldata indexes,
bool[] calldata proofFlags,
bytes32[] calldata proof
) external override onlyValidVault(vault);

Parameters

NameTypeDescription
vaultaddressThe address of the vault
keeperParamsIKeeperValidators.ApprovalParamsThe parameters for getting approval from Keeper oracles
indexesuint256[]The indexes of the leaves for the merkle tree multi proof verification
proofFlagsbool[]The multi proof flags for the merkle tree verification
proofbytes32[]The proof used for the merkle tree verification

migrate

Function for migrating the deposit data of the Vault. Can only be called once by a vault during an upgrade.

function migrate(bytes32 depositDataRoot, uint256 validatorIndex, address depositDataManager)
external
override
onlyValidVault(msg.sender);

Parameters

NameTypeDescription
depositDataRootbytes32The current deposit data root
validatorIndexuint256The current index of the next validator to be registered
depositDataManageraddressThe address of the deposit data manager