NodesManager
Inherits: Ownable2StepUpgradeable ↗, EIP712Upgradeable ↗, UUPSUpgradeable ↗, ReentrancyGuardUpgradeable ↗, Multicall, INodesManager
State Variables
_validatorChangeClaimDelay
uint256 private constant _validatorChangeClaimDelay = 2
_wad
uint256 private constant _wad = 1e18
_maxPercent
uint256 private constant _maxPercent = 10_000
_validatorV2DepositLength
uint256 private constant _validatorV2DepositLength = 184
_signatureLength
uint256 private constant _signatureLength = 65
_fundValidatorsTypeHash
bytes32 private constant _fundValidatorsTypeHash =
keccak256("FundValidators(address operator,uint256 nonce,address vault,bytes validators)")
_registerValidatorsTypeHash
bytes32 private constant _registerValidatorsTypeHash =
keccak256("RegisterValidators(address operator,uint256 nonce,address vault,bytes validators)")
_updateStateTypeHash
bytes32 private constant _updateStateTypeHash =
keccak256("UpdateState(bytes32 stateRoot,string stateIpfsHash,uint64 updateTimestamp,uint256 nonce)")
_keeper
IKeeper private immutable _keeper
vault
The address of the vault the NodesManager is attached to
address public immutable override vault
operatorStates
mapping(address operator => OperatorState state) public override operatorStates
stateData
The state data of the nodes manager
StateData public override stateData
minDepositAssets
The minimum assets required for a deposit request
uint256 public override minDepositAssets
withdrawalsManager
The address of the withdrawals manager
address public override withdrawalsManager
minBalancePercent
The minimum balance percent in BPS (10000 = 100%)
uint16 public override minBalancePercent
operatorNonces
mapping(address operator => mapping(OperatorNonceType nonceType => uint256 nonce)) public override operatorNonces
pendingPenaltyAssets
mapping(address operator => uint256 penaltyAssets) public override pendingPenaltyAssets
validatorsManagers
mapping(address operator => address manager) public override validatorsManagers
_exitPositions
mapping(uint256 positionTicket => address operator) private _exitPositions
__gap
This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
uint256[50] private __gap
Functions
onlyWithdrawalsManager
Modifier to restrict access to the withdrawals manager
modifier onlyWithdrawalsManager() ;
constructor
Constructor sets the immutables
constructor(address vault_, address keeper_) ;
Parameters
| Name | Type | Description |
|---|---|---|
vault_ | address | The address of the vault |
keeper_ | address | The address of the Keeper contract |
__NodesManager_init
Initializes the NodesManager contract
function __NodesManager_init(
address _owner,
uint256 _minDepositAssets,
uint16 _minBalancePercent,
uint256 _stateUpdateDelay
) internal onlyInitializing;
Parameters
| Name | Type | Description |
|---|---|---|
_owner | address | The address of the contract owner |
_minDepositAssets | uint256 | The minimum assets required for a deposit request |
_minBalancePercent | uint16 | The minimum balance percent in BPS |
_stateUpdateDelay | uint256 | The delay in seconds between state updates |
setMinDepositAssets
Updates the minimum deposit assets. Can only be called by the owner.
function setMinDepositAssets(uint256 newMinDepositAssets) external override onlyOwner;
Parameters
| Name | Type | Description |
|---|---|---|
newMinDepositAssets | uint256 | The new minimum deposit assets |
setMinBalancePercent
Updates the minimum balance percent. Can only be called by the owner.
function setMinBalancePercent(uint16 newMinBalancePercent) external override onlyOwner;
Parameters
| Name | Type | Description |
|---|---|---|
newMinBalancePercent | uint16 | The new minimum balance percent |
setWithdrawalsManager
Updates the withdrawals manager address. Can only be called by the owner.
function setWithdrawalsManager(address newWithdrawalsManager) external override onlyOwner;
Parameters
| Name | Type | Description |
|---|---|---|
newWithdrawalsManager | address | The new withdrawals manager address |
setValidatorsManager
Sets the validators manager address for the calling operator
function setValidatorsManager(address validatorsManager) external override;
Parameters
| Name | Type | Description |
|---|---|---|
validatorsManager | address | The new validators manager address |
canUpdateState
Checks whether state can be updated
function canUpdateState() external view override returns (bool);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | true if state can be updated, false otherwise |
updateState
Update state data
function updateState(StateUpdateParams calldata params) external override;
Parameters
| Name | Type | Description |
|---|---|---|
params | StateUpdateParams | The struct containing state update parameters |
setStateUpdateDelay
Updates the state update delay. Can only be called by the owner.
function setStateUpdateDelay(uint256 newStateUpdateDelay) external override onlyOwner;
Parameters
| Name | Type | Description |
|---|---|---|
newStateUpdateDelay | uint256 | The new state update delay in seconds |
updateVaultState
Updates the vault state by harvesting rewards
function updateVaultState(IKeeperRewards.HarvestParams calldata harvestParams) external override;
Parameters
| Name | Type | Description |
|---|---|---|
harvestParams | IKeeperRewards.HarvestParams | The parameters for harvesting Keeper rewards |
updateOperatorState
Updates the operator state by verifying a merkle proof against the current state root
function updateOperatorState(address operator, OperatorStateUpdateParams calldata params) external override;
Parameters
| Name | Type | Description |
|---|---|---|
operator | address | The address of the operator to update |
params | OperatorStateUpdateParams | The parameters for updating the operator state |
registerValidators
Registers validators with oracle-approved signatures. Can only be called by the operator's validators manager.
function registerValidators(
address operator,
IKeeperValidators.ApprovalParams calldata keeperParams,
bytes calldata signatures
) external override;
Parameters
| Name | Type | Description |
|---|---|---|
operator | address | The address of the operator |
keeperParams | IKeeperValidators.ApprovalParams | The keeper approval parameters containing validator data |
signatures | bytes | The concatenation of the oracles' signatures |
fundValidators
Funds validators with oracle-approved signatures. Can only be called by the operator's validators manager.
function fundValidators(address operator, bytes calldata validators, bytes calldata signatures) external override;
Parameters
| Name | Type | Description |
|---|---|---|
operator | address | The address of the operator |
validators | bytes | The concatenation of the validators' data |
signatures | bytes | The concatenation of the oracles' signatures approving the funding |
withdrawValidators
Submits validator withdrawals. Can only be called by the withdrawals manager.
function withdrawValidators(bytes calldata validators)
external
payable
override
nonReentrant
onlyWithdrawalsManager;
Parameters
| Name | Type | Description |
|---|---|---|
validators | bytes | The concatenation of the validators' data |
enterExitQueue
Enters the exit queue by locking operator shares in the vault's exit queue
function enterExitQueue(uint256 shares) external override nonReentrant returns (uint256 positionTicket);
Parameters
| Name | Type | Description |
|---|---|---|
shares | uint256 | The number of shares to lock in the exit queue |
Returns
| Name | Type | Description |
|---|---|---|
positionTicket | uint256 | The position ticket of the exit queue |
claimExitedAssets
Claims exited assets from the vault's exit queue for the operator
function claimExitedAssets(uint256 positionTicket, uint256 timestamp, uint256 exitQueueIndex)
external
override
nonReentrant;
Parameters
| Name | Type | Description |
|---|---|---|
positionTicket | uint256 | The exit queue ticket received after the enterExitQueue call |
timestamp | uint256 | The timestamp when the shares entered the exit queue |
exitQueueIndex | uint256 | The exit queue index at which the shares were burned |
_deposit
Internal function to deposit assets to the vault and update the operator's shares balance
function _deposit(uint256 assets) internal returns (uint256 addedShares);
Parameters
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of assets to deposit |
Returns
| Name | Type | Description |
|---|---|---|
addedShares | uint256 | The amount of shares received with penalty applied if any |
_setMinDepositAssets
Internal function for updating the minimum deposit assets
function _setMinDepositAssets(uint256 newMinDepositAssets) private;
Parameters
| Name | Type | Description |
|---|---|---|
newMinDepositAssets | uint256 | The new minimum deposit assets |
_setStateUpdateDelay
Internal function for updating the state update delay
function _setStateUpdateDelay(uint256 newStateUpdateDelay) private;
Parameters
| Name | Type | Description |
|---|---|---|
newStateUpdateDelay | uint256 | The new state update delay in seconds |
_setMinBalancePercent
Internal function for updating the minimum balance percent
function _setMinBalancePercent(uint16 newMinBalancePercent) private;
Parameters
| Name | Type | Description |
|---|---|---|
newMinBalancePercent | uint16 | The new minimum balance percent |
_useOperatorNonce
Returns the current nonce for an operator and nonce type, then increments it
function _useOperatorNonce(address operator, OperatorNonceType nonceType) private returns (uint256 nonce);
Parameters
| Name | Type | Description |
|---|---|---|
operator | address | The address of the operator |
nonceType | OperatorNonceType | The type of nonce to use |
Returns
| Name | Type | Description |
|---|---|---|
nonce | uint256 | The current nonce before incrementing |
_verifySignatures
Verifies that oracles have approved the action by checking their signatures
function _verifySignatures(bytes32 digest, bytes calldata signatures) private view;
Parameters
| Name | Type | Description |
|---|---|---|
digest | bytes32 | The EIP-712 typed data hash to verify signatures against |
signatures | bytes | The concatenation of the oracles' signatures |
_getValidatorsPublicKeys
Internal function to extract the validators' public keys from the concatenated validators data
function _getValidatorsPublicKeys(bytes calldata validators) internal pure returns (bytes memory publicKeys);
Parameters
| Name | Type | Description |
|---|---|---|
validators | bytes | The concatenation of the validators' data |
Returns
| Name | Type | Description |
|---|---|---|
publicKeys | bytes | The concatenation of the validators' public keys extracted from the validators data |
_authorizeUpgrade
Function that should revert when msg.sender is not authorized to upgrade the contract. Called by
upgradeToAndCall.
Normally, this function will use an access control modifier such as Ownable-onlyOwner.
function _authorizeUpgrade(address) internal onlyOwner {}
function _authorizeUpgrade(address) internal override onlyOwner;
_depositToVault
Deposits assets to the vault and returns the shares received. Must be implemented by network-specific contracts.
function _depositToVault(uint256 assets) internal virtual returns (uint256 shares);
Parameters
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of assets to deposit |
Returns
| Name | Type | Description |
|---|---|---|
shares | uint256 | The vault shares received |
_transferAssets
Transfers assets to the receiver. Must be implemented by network-specific contracts.
function _transferAssets(address receiver, uint256 assets) internal virtual;
Parameters
| Name | Type | Description |
|---|---|---|
receiver | address | The address to transfer assets to |
assets | uint256 | The amount of assets to transfer |
_donateAssets
Donates assets back to the vault. Must be implemented by network-specific contracts.
function _donateAssets(uint256 assets) internal virtual;
Parameters
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of assets to donate |