Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
To
|
Amount
|
||
|---|---|---|---|---|---|---|---|
| Bulk Exit Valida... | 1391888 | 62 days ago | 0 ETH | ||||
| Client | 1391888 | 62 days ago | 0 ETH | ||||
| Owner | 1391888 | 62 days ago | 0 ETH | ||||
| Operator | 1391888 | 62 days ago | 0 ETH | ||||
| Bulk Exit Valida... | 1391888 | 62 days ago | 0 ETH | ||||
| Bulk Exit Valida... | 1391841 | 62 days ago | 0 ETH | ||||
| Client | 1391841 | 62 days ago | 0 ETH | ||||
| Owner | 1391841 | 62 days ago | 0 ETH | ||||
| Operator | 1391841 | 62 days ago | 0 ETH | ||||
| Bulk Exit Valida... | 1391841 | 62 days ago | 0 ETH | ||||
| Set Fee Recipien... | 1380821 | 64 days ago | 0 ETH | ||||
| Operator | 1380821 | 64 days ago | 0 ETH | ||||
| Owner | 1380821 | 64 days ago | 0 ETH | ||||
| Set Fee Recipien... | 1380821 | 64 days ago | 0 ETH | ||||
| Set Fee Recipien... | 1380821 | 64 days ago | 0 ETH | ||||
| Set Fee Recipien... | 1380821 | 64 days ago | 0 ETH | ||||
| Bulk Register Va... | 1380821 | 64 days ago | 0 ETH | ||||
| Bulk Register Va... | 1380821 | 64 days ago | 0 ETH | ||||
| Bulk Register Va... | 1380821 | 64 days ago | 0 ETH | ||||
| Set Fee Recipien... | 1380779 | 64 days ago | 0 ETH | ||||
| Operator | 1380779 | 64 days ago | 0 ETH | ||||
| Owner | 1380779 | 64 days ago | 0 ETH | ||||
| Set Fee Recipien... | 1380779 | 64 days ago | 0 ETH | ||||
| Set Fee Recipien... | 1380779 | 64 days ago | 0 ETH | ||||
| Set Fee Recipien... | 1380779 | 64 days ago | 0 ETH |
Loading...
Loading
Loading...
Loading
Minimal Proxy Contract for 0xb525d7a9f4477a63f01d772b12eea3ac8cd70716
Contract Name:
P2pSsvProxy
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "../@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "../@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import "../constants/P2pConstants.sol"; import "../interfaces/ssv/ISSVNetwork.sol"; import "../interfaces/IDepositContract.sol"; import "../interfaces/p2p/IFeeDistributorFactory.sol"; import "../access/OwnableWithOperator.sol"; import "../assetRecovering/OwnableAssetRecoverer.sol"; import "../structs/P2pStructs.sol"; import "../p2pSsvProxyFactory/IP2pSsvProxyFactory.sol"; import "./IP2pSsvProxy.sol"; /// @notice _referenceFeeDistributor should implement IFeeDistributor interface /// @param _passedAddress passed address for _referenceFeeDistributor error P2pSsvProxy__NotFeeDistributor(address _passedAddress); /// @notice Should be a P2pSsvProxyFactory contract /// @param _passedAddress passed address that does not support IP2pSsvProxyFactory interface error P2pSsvProxy__NotP2pSsvProxyFactory(address _passedAddress); /// @notice Throws if called by any account other than the client. /// @param _caller address of the caller /// @param _client address of the client error P2pSsvProxy__CallerNotClient(address _caller, address _client); /// @notice The caller was neither operator nor owner /// @param _caller address of the caller /// @param _operator address of the operator /// @param _owner address of the owner error P2pSsvProxy__CallerNeitherOperatorNorOwner(address _caller, address _operator, address _owner); /// @notice The caller was neither operator nor owner nor client /// @param _caller address of the caller error P2pSsvProxy__CallerNeitherOperatorNorOwnerNorClient(address _caller); /// @notice Only factory can call `initialize`. /// @param _msgSender sender address. /// @param _actualFactory the actual factory address that can call `initialize`. error P2pSsvProxy__NotP2pSsvProxyFactoryCalled(address _msgSender, IP2pSsvProxyFactory _actualFactory); /// @notice _pubkeys and _operatorIds arrays should have the same lengths error P2pSsvProxy__AmountOfParametersError(); /// @notice Selector is not allowed for the caller. /// @param _caller caller address /// @param _selector function selector to be called on SSVNetwork error P2pSsvProxy__SelectorNotAllowed(address _caller, bytes4 _selector); /// @title Proxy for SSVNetwork calls. /// @dev Each instance of P2pSsvProxy corresponds to 1 FeeDistributor instance. /// Thus, client to P2pSsvProxy instances is a 1-to-many relation. /// SSV tokens are managed by P2P. /// Clients cover the costs of SSV tokens by EL rewards via FeeDistributor instance. contract P2pSsvProxy is OwnableAssetRecoverer, ERC165, IP2pSsvProxy { /// @notice P2pSsvProxyFactory address IP2pSsvProxyFactory private immutable i_p2pSsvProxyFactory; /// @notice SSVNetwork address ISSVNetwork private immutable i_ssvNetwork; /// @notice SSV token (ERC-20) address IERC20 private immutable i_ssvToken; /// @notice FeeDistributor instance address IFeeDistributor private s_feeDistributor; /// @notice If caller is not client, revert modifier onlyClient() { address clientAddress = getClient(); if (clientAddress != msg.sender) { revert P2pSsvProxy__CallerNotClient(msg.sender, clientAddress); } _; } /// @notice If caller is neither operator nor owner, revert modifier onlyOperatorOrOwner() { address currentOwner = owner(); address currentOperator = operator(); if (currentOperator != msg.sender && currentOwner != msg.sender) { revert P2pSsvProxy__CallerNeitherOperatorNorOwner(msg.sender, currentOperator, currentOwner); } _; } /// @notice If caller is neither operator nor owner nor client, revert modifier onlyOperatorOrOwnerOrClient() { address operator_ = operator(); address owner_ = owner(); address client_ = getClient(); if (operator_ != msg.sender && owner_ != msg.sender && client_ != msg.sender) { revert P2pSsvProxy__CallerNeitherOperatorNorOwnerNorClient(msg.sender); } _; } /// @notice If caller is not factory, revert modifier onlyP2pSsvProxyFactory() { if (msg.sender != address(i_p2pSsvProxyFactory)) { revert P2pSsvProxy__NotP2pSsvProxyFactoryCalled(msg.sender, i_p2pSsvProxyFactory); } _; } /// @dev Set values that are constant, common for all clients, known at the initial deploy time. /// @param _p2pSsvProxyFactory address of P2pSsvProxyFactory constructor( address _p2pSsvProxyFactory ) { if (!ERC165Checker.supportsInterface(_p2pSsvProxyFactory, type(IP2pSsvProxyFactory).interfaceId)) { revert P2pSsvProxy__NotP2pSsvProxyFactory(_p2pSsvProxyFactory); } i_p2pSsvProxyFactory = IP2pSsvProxyFactory(_p2pSsvProxyFactory); i_ssvNetwork = (block.chainid == 1) ? ISSVNetwork(0xDD9BC35aE942eF0cFa76930954a156B3fF30a4E1) : ISSVNetwork(0x58410Bef803ECd7E63B23664C586A6DB72DAf59c); i_ssvToken = (block.chainid == 1) ? IERC20(0x9D65fF81a3c488d585bBfb0Bfe3c7707c7917f54) : IERC20(0x9F5d4Ec84fC4785788aB44F9de973cF34F7A038e); } /// @inheritdoc IP2pSsvProxy function initialize( address _feeDistributor ) external onlyP2pSsvProxyFactory { s_feeDistributor = IFeeDistributor(_feeDistributor); i_ssvToken.approve(address(i_ssvNetwork), type(uint256).max); emit P2pSsvProxy__Initialized(_feeDistributor); } /// @dev Access any SSVNetwork function as cluster owner (this P2pSsvProxy instance) /// Each selector access is managed by P2pSsvProxyFactory roles (owner, operator, client) fallback() external { address caller = msg.sender; bytes4 selector = msg.sig; bool isAllowed = msg.sender == owner() || (msg.sender == operator() && i_p2pSsvProxyFactory.isOperatorSelectorAllowed(selector)) || (msg.sender == getClient() && i_p2pSsvProxyFactory.isClientSelectorAllowed(selector)); if (!isAllowed) { revert P2pSsvProxy__SelectorNotAllowed(caller, selector); } (bool success, bytes memory data) = address(i_ssvNetwork).call(msg.data); if (success) { emit P2pSsvProxy__SuccessfullyCalledViaFallback(caller, selector); assembly ("memory-safe") { return(add(data, 0x20), mload(data)) } } else { // Decode the reason from the error data returned from the call and revert with it. revert(string(data)); } } /// @inheritdoc IP2pSsvProxy function callAnyContract( address _contract, bytes calldata _calldata ) external onlyOwner { (bool success, bytes memory data) = address(_contract).call(_calldata); if (success) { emit P2pSsvProxy__SuccessfullyCalledExternalContract(_contract, bytes4(_calldata)); assembly ("memory-safe") { return(add(data, 0x20), mload(data)) } } else { // Decode the reason from the error data returned from the call and revert with it. revert(string(data)); } } /// @inheritdoc IP2pSsvProxy function registerValidators( SsvPayload calldata _ssvPayload ) external onlyP2pSsvProxyFactory { ( uint64[] memory operatorIds, uint64 clusterIndex ) = _getOperatorIdsAndClusterIndex(_ssvPayload.ssvOperators); uint256 ssvSlot0 = uint256(_ssvPayload.ssvSlot0); // see https://github.com/bloxapp/ssv-network/blob/1e61c35736578d4b03bacbff9da2128ad12a5620/contracts/libraries/ProtocolLib.sol#L15 uint64 currentNetworkFeeIndex = uint64(ssvSlot0 >> 192) + uint64(block.number - uint32(ssvSlot0)) * uint64(ssvSlot0 >> 128); uint256 balance = _getBalance(_ssvPayload.cluster, clusterIndex, currentNetworkFeeIndex, _ssvPayload.tokenAmount); i_ssvNetwork.registerValidator( _ssvPayload.ssvValidators[0].pubkey, operatorIds, _ssvPayload.ssvValidators[0].sharesData, _ssvPayload.tokenAmount, _ssvPayload.cluster ); for (uint256 i = 1; i < _ssvPayload.ssvValidators.length; ++i) { _registerValidator( i, operatorIds, _ssvPayload.cluster, clusterIndex, _ssvPayload.ssvValidators[i].pubkey, _ssvPayload.ssvValidators[i].sharesData, currentNetworkFeeIndex, balance ); } i_ssvNetwork.setFeeRecipientAddress(address(s_feeDistributor)); } /// @inheritdoc IP2pSsvProxy function bulkRegisterValidators( bytes[] calldata publicKeys, uint64[] calldata operatorIds, bytes[] calldata sharesData, uint256 amount, ISSVNetwork.Cluster calldata cluster ) external onlyP2pSsvProxyFactory { i_ssvNetwork.bulkRegisterValidator(publicKeys, operatorIds, sharesData, amount, cluster); i_ssvNetwork.setFeeRecipientAddress(address(s_feeDistributor)); } /// @inheritdoc IP2pSsvProxy function removeValidators( bytes[] calldata _pubkeys, uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) external onlyOperatorOrOwnerOrClient { uint256 validatorCount = _pubkeys.length; if (!( _clusters.length == validatorCount )) { revert P2pSsvProxy__AmountOfParametersError(); } for (uint256 i = 0; i < validatorCount; ++i) { i_ssvNetwork.removeValidator(_pubkeys[i], _operatorIds, _clusters[i]); } } /// @inheritdoc IP2pSsvProxy function liquidate( uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) external onlyOperatorOrOwner { address clusterOwner = address(this); uint256 validatorCount = _clusters.length; for (uint256 i = 0; i < validatorCount; ++i) { i_ssvNetwork.liquidate(clusterOwner, _operatorIds, _clusters[i]); } } /// @inheritdoc IP2pSsvProxy function reactivate( uint256 _tokenAmount, uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) external onlyOperatorOrOwner { uint256 tokenPerValidator = _tokenAmount / _clusters.length; uint256 validatorCount = _clusters.length; for (uint256 i = 0; i < validatorCount; ++i) { i_ssvNetwork.reactivate(_operatorIds, tokenPerValidator, _clusters[i]); } } /// @inheritdoc IP2pSsvProxy function depositToSSV( uint256 _tokenAmount, uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) external { address clusterOwner = address(this); uint256 validatorCount = _clusters.length; uint256 tokenPerValidator = _tokenAmount / validatorCount; for (uint256 i = 0; i < validatorCount; ++i) { i_ssvNetwork.deposit(clusterOwner, _operatorIds, tokenPerValidator, _clusters[i]); } } /// @inheritdoc IP2pSsvProxy function withdrawFromSSV( uint256 _tokenAmount, uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) public onlyOperatorOrOwner { uint256 tokenPerValidator = _tokenAmount / _clusters.length; uint256 validatorCount = _clusters.length; for (uint256 i = 0; i < validatorCount; ++i) { i_ssvNetwork.withdraw(_operatorIds, tokenPerValidator, _clusters[i]); } } /// @inheritdoc IP2pSsvProxy function withdrawSSVTokens( address _to, uint256 _amount ) external onlyOwner { i_ssvToken.transfer(_to, _amount); } /// @inheritdoc IP2pSsvProxy function withdrawAllSSVTokensToFactory() public onlyOperatorOrOwner { uint256 balance = i_ssvToken.balanceOf(address(this)); i_ssvToken.transfer(address(i_p2pSsvProxyFactory), balance); } function withdrawFromSSVToFactory( uint256 _tokenAmount, uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) external { withdrawFromSSV(_tokenAmount, _operatorIds, _clusters); withdrawAllSSVTokensToFactory(); } /// @inheritdoc IP2pSsvProxy function setFeeRecipientAddress( address _feeRecipientAddress ) external onlyOperatorOrOwner { i_ssvNetwork.setFeeRecipientAddress(_feeRecipientAddress); } /// @notice Fires the exit event for a set of validators /// @param publicKeys The public keys of the validators to be exited /// @param operatorIds Array of IDs of operators managing the validators function bulkExitValidator(bytes[] calldata publicKeys, uint64[] calldata operatorIds) external onlyOperatorOrOwnerOrClient { i_ssvNetwork.bulkExitValidator(publicKeys, operatorIds); } /// @notice Extract operatorIds and clusterIndex out of SsvOperator list /// @param _ssvOperators list of SSV operator data /// @return operatorIds list of SSV operator IDs, clusterIndex updated cluster index function _getOperatorIdsAndClusterIndex( SsvOperator[] calldata _ssvOperators ) private view returns( uint64[] memory operatorIds, uint64 clusterIndex ) { // clusterIndex updating logic reflects // https://github.com/bloxapp/ssv-network/blob/fe3b9b178344dd723b19792d01ab5010dfd2dcf9/contracts/modules/SSVClusters.sol#L77 clusterIndex = 0; uint256 operatorCount = _ssvOperators.length; operatorIds = new uint64[](operatorCount); for (uint256 i = 0; i < operatorCount; ++i) { operatorIds[i] = _ssvOperators[i].id; uint256 snapshot = uint256(_ssvOperators[i].snapshot); // see https://github.com/bloxapp/ssv-network/blob/6ae5903a5c99c8d75b59fc0d35574d87f82e5861/contracts/libraries/OperatorLib.sol#L13 clusterIndex += uint64(snapshot >> 32) + (uint32(block.number) - uint32(snapshot)) * uint64(_ssvOperators[i].fee / 10_000_000); } } /// @notice Calculate the balance for the subsequent cluster values in a batch /// @param _cluster cluster value before the 1st validator registration /// @param _newIndex clusterIndex value after the 1st validator registration /// @param _currentNetworkFeeIndex currentNetworkFeeIndex from ssvSlot0 /// @param _tokenAmount amount of SSV tokens deposited along with the 1st validator registration /// @return balance updated balance after the 1st validator registration function _getBalance( ISSVNetwork.Cluster calldata _cluster, uint64 _newIndex, uint64 _currentNetworkFeeIndex, uint256 _tokenAmount ) private pure returns(uint256 balance) { uint256 balanceBefore = _cluster.balance + _tokenAmount; // see https://github.com/bloxapp/ssv-network/blob/1e61c35736578d4b03bacbff9da2128ad12a5620/contracts/libraries/ClusterLib.sol#L16 uint64 networkFee = uint64(_currentNetworkFeeIndex - _cluster.networkFeeIndex) * _cluster.validatorCount; uint64 usage = (_newIndex - _cluster.index) * _cluster.validatorCount + networkFee; uint256 expandedUsage = uint256(usage) * 10_000_000; balance = expandedUsage > balanceBefore? 0 : balanceBefore - expandedUsage; } /// @notice Register subsequent validators after the 1st one /// @param i validator index in calldata /// @param _operatorIds list of SSV operator IDs /// @param _cluster cluster value before the 1st registration /// @param _clusterIndex calculated clusterIndex after the 1st registration /// @param _pubkey validator pubkey /// @param _sharesData validator SSV sharesData /// @param _currentNetworkFeeIndex currentNetworkFeeIndex from ssvSlot0 /// @param _balance cluster balance after the 1st validator registration function _registerValidator( uint256 i, uint64[] memory _operatorIds, ISSVNetwork.Cluster calldata _cluster, uint64 _clusterIndex, bytes calldata _pubkey, bytes calldata _sharesData, uint64 _currentNetworkFeeIndex, uint256 _balance ) private { ISSVNetworkCore.Cluster memory cluster = ISSVNetworkCore.Cluster({ validatorCount: uint32(_cluster.validatorCount + i), networkFeeIndex: _currentNetworkFeeIndex, index: _clusterIndex, active: true, balance: _balance }); i_ssvNetwork.registerValidator( _pubkey, _operatorIds, _sharesData, 0, cluster ); } /// @inheritdoc IP2pSsvProxy function getClient() public view returns (address) { return s_feeDistributor.client(); } /// @inheritdoc IP2pSsvProxy function getFactory() external view returns (address) { return address(i_p2pSsvProxyFactory); } /// @inheritdoc IOwnable function owner() public view override(OwnableBase, IOwnable) returns (address) { return i_p2pSsvProxyFactory.owner(); } /// @inheritdoc IOwnableWithOperator function operator() public view returns (address) { return i_p2pSsvProxyFactory.operator(); } /// @inheritdoc IP2pSsvProxy function getFeeDistributor() external view returns (address) { return address(s_feeDistributor); } /// @inheritdoc ERC165 function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IP2pSsvProxy).interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity 0.8.24;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity 0.8.24;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.2) (utils/introspection/ERC165Checker.sol)
pragma solidity 0.8.24;
import "./IERC165.sol";
/**
* @dev Library used to query support of an interface declared via {IERC165}.
*
* Note that these functions return the actual result of the query: they do not
* `revert` if an interface is not supported. It is up to the caller to decide
* what to do in these cases.
*/
library ERC165Checker {
// As per the EIP-165 spec, no interface should ever match 0xffffffff
bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;
/**
* @dev Returns true if `account` supports the {IERC165} interface,
*/
function supportsERC165(address account) internal view returns (bool) {
// Any contract that implements ERC165 must explicitly indicate support of
// InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
return
_supportsERC165Interface(account, type(IERC165).interfaceId) &&
!_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
}
/**
* @dev Returns true if `account` supports the interface defined by
* `interfaceId`. Support for {IERC165} itself is queried automatically.
*
* See {IERC165-supportsInterface}.
*/
function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
// query support of both ERC165 as per the spec and support of _interfaceId
return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);
}
/**
* @dev Returns a boolean array where each value corresponds to the
* interfaces passed in and whether they're supported or not. This allows
* you to batch check interfaces for a contract where your expectation
* is that some interfaces may not be supported.
*
* See {IERC165-supportsInterface}.
*
* _Available since v3.4._
*/
function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
internal
view
returns (bool[] memory)
{
// an array of booleans corresponding to interfaceIds and whether they're supported or not
bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);
// query support of ERC165 itself
if (supportsERC165(account)) {
// query support of each interface in interfaceIds
for (uint256 i = 0; i < interfaceIds.length; i++) {
interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);
}
}
return interfaceIdsSupported;
}
/**
* @dev Returns true if `account` supports all the interfaces defined in
* `interfaceIds`. Support for {IERC165} itself is queried automatically.
*
* Batch-querying can lead to gas savings by skipping repeated checks for
* {IERC165} support.
*
* See {IERC165-supportsInterface}.
*/
function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
// query support of ERC165 itself
if (!supportsERC165(account)) {
return false;
}
// query support of each interface in _interfaceIds
for (uint256 i = 0; i < interfaceIds.length; i++) {
if (!_supportsERC165Interface(account, interfaceIds[i])) {
return false;
}
}
// all interfaces supported
return true;
}
/**
* @notice Query if a contract implements an interface, does not check ERC165 support
* @param account The address of the contract to query for support of an interface
* @param interfaceId The interface identifier, as specified in ERC-165
* @return true if the contract at account indicates support of the interface with
* identifier interfaceId, false otherwise
* @dev Assumes that account contains a contract that supports ERC165, otherwise
* the behavior of this method is undefined. This precondition can be checked
* with {supportsERC165}.
* Interface identification is specified in ERC-165.
*/
function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
// prepare call
bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);
// perform static call
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
returnSize := returndatasize()
returnValue := mload(0x00)
}
return success && returnSize >= 0x20 && returnValue > 0;
}
}// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> // SPDX-License-Identifier: MIT pragma solidity 0.8.24; /// @dev Collateral size of 1 validator uint256 constant COLLATERAL = 32 ether; /// @dev Maximum number of SSV operator IDs per SSV operator owner address supported simultaniously by P2pSsvProxyFactory uint256 constant MAX_ALLOWED_SSV_OPERATOR_IDS = 24;
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.24;
import {ISSVNetworkCore} from "./ISSVNetworkCore.sol";
import {ISSVOperators} from "./ISSVOperators.sol";
import {ISSVClusters} from "./ISSVClusters.sol";
/// @dev https://github.com/ssvlabs/ssv-network/blob/2e90a0cc44ae2645ea06ef9c0fcd2369bbf3c277/contracts/interfaces/ISSVNetwork.sol
interface ISSVNetwork is ISSVNetworkCore, ISSVOperators, ISSVClusters {
function setFeeRecipientAddress(address feeRecipientAddress) external;
}// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.24;
// This interface is designed to be compatible with the Vyper version.
/// @notice This is the Ethereum 2.0 deposit contract interface.
/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs
interface IDepositContract {
/// @notice Submit a Phase 0 DepositData object.
/// @param pubkey A BLS12-381 public key.
/// @param withdrawal_credentials Commitment to a public key for withdrawals.
/// @param signature A BLS12-381 signature.
/// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.
/// Used as a protection against malformed input.
function deposit(
bytes calldata pubkey,
bytes calldata withdrawal_credentials,
bytes calldata signature,
bytes32 deposit_data_root
) external payable;
}// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "../../@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "../../access/IOwnable.sol"; import "./IFeeDistributor.sol"; import "../../structs/P2pStructs.sol"; /// @dev External interface of FeeDistributorFactory declared to support ERC165 detection. interface IFeeDistributorFactory is IOwnable, IERC165 { /// @notice Emits when a new FeeDistributor instance has been created for a client /// @param _newFeeDistributorAddress address of the newly created FeeDistributor contract instance /// @param _clientAddress address of the client for whom the new instance was created /// @param _referenceFeeDistributor The address of the reference implementation of FeeDistributor used as the basis for clones /// @param _clientBasisPoints client basis points (percent * 100) event FeeDistributorFactory__FeeDistributorCreated( address indexed _newFeeDistributorAddress, address indexed _clientAddress, address indexed _referenceFeeDistributor, uint96 _clientBasisPoints ); /// @notice Emits when a new P2pEth2Depositor contract address has been set. /// @param _p2pEth2Depositor the address of the new P2pEth2Depositor contract event FeeDistributorFactory__P2pEth2DepositorSet( address indexed _p2pEth2Depositor ); /// @notice Emits when a new value of defaultClientBasisPoints has been set. /// @param _defaultClientBasisPoints new value of defaultClientBasisPoints event FeeDistributorFactory__DefaultClientBasisPointsSet( uint96 _defaultClientBasisPoints ); /// @notice Creates a FeeDistributor instance for a client /// @dev _referrerConfig can be zero if there is no referrer. /// /// @param _referenceFeeDistributor The address of the reference implementation of FeeDistributor used as the basis for clones /// @param _clientConfig address and basis points (percent * 100) of the client /// @param _referrerConfig address and basis points (percent * 100) of the referrer. /// @return newFeeDistributorAddress user FeeDistributor instance that has just been deployed function createFeeDistributor( address _referenceFeeDistributor, FeeRecipient calldata _clientConfig, FeeRecipient calldata _referrerConfig ) external returns (address newFeeDistributorAddress); /// @notice Computes the address of a FeeDistributor created by `createFeeDistributor` function /// @dev FeeDistributor instances are guaranteed to have the same address if all of /// 1) referenceFeeDistributor 2) clientConfig 3) referrerConfig /// are the same /// @param _referenceFeeDistributor The address of the reference implementation of FeeDistributor used as the basis for clones /// @param _clientConfig address and basis points (percent * 100) of the client /// @param _referrerConfig address and basis points (percent * 100) of the referrer. /// @return address user FeeDistributor instance that will be or has been deployed function predictFeeDistributorAddress( address _referenceFeeDistributor, FeeRecipient calldata _clientConfig, FeeRecipient calldata _referrerConfig ) external view returns (address); /// @notice Returns an array of client FeeDistributors /// @param _client client address /// @return address[] array of client FeeDistributors function allClientFeeDistributors( address _client ) external view returns (address[] memory); /// @notice Returns an array of all FeeDistributors for all clients /// @return address[] array of all FeeDistributors function allFeeDistributors() external view returns (address[] memory); /// @notice The address of P2pEth2Depositor /// @return address of P2pEth2Depositor function p2pEth2Depositor() external view returns (address); /// @notice Returns default client basis points /// @return default client basis points function defaultClientBasisPoints() external view returns (uint96); /// @notice Returns the current operator /// @return address of the current operator function operator() external view returns (address); /// @notice Reverts if the passed address is neither operator nor owner /// @param _address passed address function checkOperatorOrOwner(address _address) external view; /// @notice Reverts if the passed address is not P2pEth2Depositor /// @param _address passed address function checkP2pEth2Depositor(address _address) external view; /// @notice Reverts if the passed address is neither of: 1) operator 2) owner 3) P2pEth2Depositor /// @param _address passed address function check_Operator_Owner_P2pEth2Depositor(address _address) external view; }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "./Ownable2Step.sol"; import "./IOwnableWithOperator.sol"; /** * @notice newOperator is the zero address */ error Access__ZeroNewOperator(); /** * @notice newOperator is the same as the old one */ error Access__SameOperator(address _operator); /** * @notice caller is neither the operator nor owner */ error Access__CallerNeitherOperatorNorOwner(address _caller, address _operator, address _owner); /** * @notice address is neither the operator nor owner */ error Access__AddressNeitherOperatorNorOwner(address _address, address _operator, address _owner); /** * @dev Ownable with an additional role of operator */ abstract contract OwnableWithOperator is Ownable2Step, IOwnableWithOperator { address private s_operator; /** * @dev Emits when the operator has been changed * @param _previousOperator address of the previous operator * @param _newOperator address of the new operator */ event OperatorChanged( address indexed _previousOperator, address indexed _newOperator ); /** * @dev Throws if called by any account other than the operator or the owner. */ modifier onlyOperatorOrOwner() { address currentOwner = owner(); address currentOperator = s_operator; if (currentOperator != _msgSender() && currentOwner != _msgSender()) { revert Access__CallerNeitherOperatorNorOwner(_msgSender(), currentOperator, currentOwner); } _; } function checkOperatorOrOwner(address _address) public view virtual { address currentOwner = owner(); address currentOperator = s_operator; if (_address == address(0) || (currentOperator != _address && currentOwner != _address)) { revert Access__AddressNeitherOperatorNorOwner(_address, currentOperator, currentOwner); } } /** * @dev Returns the current operator. */ function operator() public view virtual returns (address) { return s_operator; } /** * @dev Transfers operator to a new account (`newOperator`). * Can only be called by the current owner. */ function changeOperator(address _newOperator) external virtual onlyOwner { if (_newOperator == address(0)) { revert Access__ZeroNewOperator(); } if (_newOperator == s_operator) { revert Access__SameOperator(_newOperator); } _changeOperator(_newOperator); } /** * @dev Transfers operator to a new account (`newOperator`). * Internal function without access restriction. */ function _changeOperator(address _newOperator) internal virtual { address oldOperator = s_operator; s_operator = _newOperator; emit OperatorChanged(oldOperator, _newOperator); } /** * @dev Dismisses the old operator without setting a new one. * Can only be called by the current owner. */ function dismissOperator() external virtual onlyOwner { _changeOperator(address(0)); } }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]>, Lido <[email protected]> // SPDX-License-Identifier: MIT // https://github.com/lidofinance/lido-otc-seller/blob/master/contracts/lib/AssetRecoverer.sol pragma solidity 0.8.24; import "./OwnableTokenRecoverer.sol"; import "./AssetRecoverer.sol"; /// @title Public Asset Recoverer with public functions callable by assetAccessingAddress /// @notice Recover ether, ERC20, ERC721 and ERC1155 from a derived contract abstract contract OwnableAssetRecoverer is OwnableTokenRecoverer, AssetRecoverer { // Functions /** * @notice transfers ether from this contract * @dev using `address.call` is safer to transfer to other contracts * @param _recipient address to transfer ether to * @param _amount amount of ether to transfer */ function transferEther(address _recipient, uint256 _amount) external onlyOwner { _transferEther(_recipient, _amount); } }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "../interfaces/ssv/ISSVClusters.sol"; /// @dev 256 bit struct /// @member basisPoints basis points (percent * 100) of EL rewards that should go to the recipient /// @member recipient address of the recipient struct FeeRecipient { uint96 basisPoints; address payable recipient; } /// @member pubkey The public key of the new validator /// @member sharesData Encrypted shares related to the new validator struct SsvValidator { bytes pubkey; bytes sharesData; } /// @member signatures BLS12-381 signatures /// @member depositDataRoots SHA-256 hashes of the SSZ-encoded DepositData objects struct DepositData { bytes[] signatures; bytes32[] depositDataRoots; } /// @dev Data from https://github.com/bloxapp/ssv-network/blob/8c945e82cc063eb8e40c467d314a470121821157/contracts/interfaces/ISSVNetworkCore.sol#L20 /// @member owner SSV operator owner /// @member id SSV operator ID /// @member snapshot SSV operator snapshot (should be retrieved from SSVNetwork storage) /// @member fee SSV operator fee struct SsvOperator { address owner; uint64 id; bytes32 snapshot; uint256 fee; } /// @member ssvOperators SSV operators for the cluster /// @member ssvValidators new SSV validators to be registered in the cluster /// @member cluster SSV cluster /// @member tokenAmount amount of ERC-20 SSV tokens for validator registration /// @member ssvSlot0 Slot # (uint256(keccak256("ssv.network.storage.protocol")) - 1) from SSVNetwork struct SsvPayload { SsvOperator[] ssvOperators; SsvValidator[] ssvValidators; ISSVNetworkCore.Cluster cluster; uint256 tokenAmount; bytes32 ssvSlot0; } /// @dev status of the client deposit /// @member None default status indicating that no ETH is waiting to be forwarded to Beacon DepositContract /// @member EthAdded client added ETH /// @member BeaconDepositInProgress P2P has forwarded some (but not all) ETH to Beacon DepositContract /// If all ETH has been forwarded, the status will be None. /// @member ServiceRejected P2P has rejected the service for a given FeeDistributor instance // The client can get a refund immediately. enum ClientDepositStatus { None, EthAdded, BeaconDepositInProgress, ServiceRejected }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "../@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "../structs/P2pStructs.sol"; import "../constants/P2pConstants.sol"; import "../interfaces/ssv/ISSVNetwork.sol"; import "../interfaces/ssv/external/ISSVWhitelistingContract.sol"; import "../access/IOwnableWithOperator.sol"; /// @dev External interface of P2pSsvProxyFactory interface IP2pSsvProxyFactory is ISSVWhitelistingContract, IOwnableWithOperator, IERC165 { /// @notice Emits when batch registration of validator with SSV is completed /// @param _proxy address of P2pSsvProxy that was used for registration and became the cluster owner event P2pSsvProxyFactory__RegistrationCompleted( address indexed _proxy ); /// @notice Emits when a new P2pSsvProxy instance was deployed and initialized /// @param _p2pSsvProxy newly deployed P2pSsvProxy instance address /// @param _client client address /// @param _feeDistributor FeeDistributor instance address event P2pSsvProxyFactory__P2pSsvProxyCreated( address indexed _p2pSsvProxy, address indexed _client, address indexed _feeDistributor ); /// @notice Emits when a new reference FeeDistributor has been set /// @param _referenceFeeDistributor new reference FeeDistributor address event P2pSsvProxyFactory__ReferenceFeeDistributorSet( address indexed _referenceFeeDistributor ); /// @notice Emits when a new value for ssvPerEthExchangeRateDividedByWei has been set /// @param _ssvPerEthExchangeRateDividedByWei new value for ssvPerEthExchangeRateDividedByWei event P2pSsvProxyFactory__SsvPerEthExchangeRateDividedByWeiSet( uint112 _ssvPerEthExchangeRateDividedByWei ); /// @notice Emits when a new value for maximum amount of SSV tokens per validator has been set /// @param _maxSsvTokenAmountPerValidator new value for maximum amount of SSV tokens per validator event P2pSsvProxyFactory__MaxSsvTokenAmountPerValidatorSet( uint112 _maxSsvTokenAmountPerValidator ); /// @notice Emits when a new reference P2pSsvProxy has been set /// @param _referenceP2pSsvProxy new reference P2pSsvProxy address event P2pSsvProxyFactory__ReferenceP2pSsvProxySet( address indexed _referenceP2pSsvProxy ); /// @notice Emits when new selectors were allowed for clients /// @param _selectors newly allowed selectors event P2pSsvProxyFactory__AllowedSelectorsForClientSet( bytes4[] _selectors ); /// @notice Emits when selectors were disallowed for clients /// @param _selectors disallowed selectors event P2pSsvProxyFactory__AllowedSelectorsForClientRemoved( bytes4[] _selectors ); /// @notice Emits when new selectors were allowed for operator /// @param _selectors newly allowed selectors event P2pSsvProxyFactory__AllowedSelectorsForOperatorSet( bytes4[] _selectors ); /// @notice Emits when selectors were disallowed for operator /// @param _selectors disallowed selectors event P2pSsvProxyFactory__AllowedSelectorsForOperatorRemoved( bytes4[] _selectors ); /// @notice Emits when new SSV operator owner addresses have been allowed /// @param _allowedSsvOperatorOwners newly allowed SSV operator owner addresses event P2pSsvProxyFactory__AllowedSsvOperatorOwnersSet( address[] _allowedSsvOperatorOwners ); /// @notice Emits when some SSV operator owner addresses have been removed from the allowlist /// @param _allowedSsvOperatorOwners disallowed SSV operator owner addresses event P2pSsvProxyFactory__AllowedSsvOperatorOwnersRemoved( address[] _allowedSsvOperatorOwners ); /// @notice Emits when new SSV operator IDs have been set to the given SSV operator owner /// @param _ssvOperatorOwner SSV operator owner event P2pSsvProxyFactory__SsvOperatorIdsSet( address indexed _ssvOperatorOwner, uint64[MAX_ALLOWED_SSV_OPERATOR_IDS] _operatorIds ); /// @notice Emits when operator IDs list has been cleared for the given SSV operator owner /// @param _ssvOperatorOwner SSV operator owner event P2pSsvProxyFactory__SsvOperatorIdsCleared( address indexed _ssvOperatorOwner ); /// @notice Emits when client deposited their ETH for SSV staking /// @param _depositId ID of client deposit (derived from ETH2 WithdrawalCredentials, ETH amount per validator in wei, fee distributor instance address) /// @param _sender address who sent ETH /// @param _p2pSsvProxy address of the client instance of P2pSsvProxy /// @param _feeDistributorInstance address of the client instance of FeeDistributor /// @param _ethAmountInWei amount of deposited ETH in wei event P2pSsvProxyFactory__EthForSsvStakingDeposited( bytes32 indexed _depositId, address indexed _sender, address indexed _p2pSsvProxy, address _feeDistributorInstance, uint256 _ethAmountInWei ); /// @notice Set Exchange rate between SSV and ETH set by P2P. /// @dev (If 1 SSV = 0.007539 ETH, it should be 0.007539 * 10^18 = 7539000000000000). /// @param _ssvPerEthExchangeRateDividedByWei Exchange rate function setSsvPerEthExchangeRateDividedByWei(uint112 _ssvPerEthExchangeRateDividedByWei) external; /// @notice Set Maximum amount of SSV tokens per validator that is allowed for client to deposit during `depositEthAndRegisterValidators` /// @param _maxSsvTokenAmountPerValidator Maximum amount of SSV tokens per validator function setMaxSsvTokenAmountPerValidator(uint112 _maxSsvTokenAmountPerValidator) external; /// @notice Set template to be used for new P2pSsvProxy instances /// @param _referenceP2pSsvProxy template to be used for new P2pSsvProxy instances function setReferenceP2pSsvProxy(address _referenceP2pSsvProxy) external; /// @notice Allow selectors (function signatures) for clients to call on SSVNetwork via P2pSsvProxy /// @param _selectors selectors (function signatures) to allow for clients function setAllowedSelectorsForClient(bytes4[] calldata _selectors) external; /// @notice Disallow selectors (function signatures) for clients to call on SSVNetwork via P2pSsvProxy /// @param _selectors selectors (function signatures) to disallow for clients function removeAllowedSelectorsForClient(bytes4[] calldata _selectors) external; /// @notice Allow selectors (function signatures) for P2P operator to call on SSVNetwork via P2pSsvProxy /// @param _selectors selectors (function signatures) to allow for P2P operator function setAllowedSelectorsForOperator(bytes4[] calldata _selectors) external; /// @notice Disallow selectors (function signatures) for P2P operator to call on SSVNetwork via P2pSsvProxy /// @param _selectors selectors (function signatures) to disallow for P2P operator function removeAllowedSelectorsForOperator(bytes4[] calldata _selectors) external; /// @notice Set template to be used for new FeeDistributor instances /// @param _referenceFeeDistributor template to be used for new FeeDistributor instances function setReferenceFeeDistributor( address _referenceFeeDistributor ) external; /// @notice Allow addresses of SSV operator owners (both P2P and partners) /// @param _allowedSsvOperatorOwners addresses of SSV operator owners to allow function setAllowedSsvOperatorOwners( address[] calldata _allowedSsvOperatorOwners ) external; /// @notice Disallow addresses of SSV operator owners (both P2P and partners) /// @param _allowedSsvOperatorOwnersToRemove addresses of SSV operator owners to disallow function removeAllowedSsvOperatorOwners( address[] calldata _allowedSsvOperatorOwnersToRemove ) external; /// @notice Set own SSV operator IDs list /// @dev To be called by SSV operator owner /// @param _operatorIds SSV operator IDs list function setSsvOperatorIds( uint64[MAX_ALLOWED_SSV_OPERATOR_IDS] calldata _operatorIds ) external; /// @notice Set SSV operator IDs list for a SSV operator owner /// @dev To be called by P2P /// @param _operatorIds SSV operator IDs list /// @param _ssvOperatorOwner SSV operator owner function setSsvOperatorIds( uint64[MAX_ALLOWED_SSV_OPERATOR_IDS] calldata _operatorIds, address _ssvOperatorOwner ) external; /// @notice Clear own SSV operator IDs list /// @dev To be called by SSV operator owner function clearSsvOperatorIds() external; /// @notice Clear SSV operator IDs list for a SSV operator owner /// @dev To be called by P2P /// @param _ssvOperatorOwner SSV operator owner function clearSsvOperatorIds( address _ssvOperatorOwner ) external; /// @notice Computes the address of a P2pSsvProxy created by `_createP2pSsvProxy` function /// @dev P2pSsvProxy instances are guaranteed to have the same address if _feeDistributorInstance is the same /// @param _feeDistributorInstance The address of FeeDistributor instance /// @return address client P2pSsvProxy instance that will be or has been deployed function predictP2pSsvProxyAddress( address _feeDistributorInstance ) external view returns (address); /// @notice Computes the address of a P2pSsvProxy created by `_createP2pSsvProxy` function /// @param _referenceFeeDistributor The address of the reference implementation of FeeDistributor used as the basis for clones /// @param _clientConfig address and basis points (percent * 100) of the client /// @param _referrerConfig address and basis points (percent * 100) of the referrer. /// @return address client P2pSsvProxy instance that will be or has been deployed function predictP2pSsvProxyAddress( address _referenceFeeDistributor, FeeRecipient calldata _clientConfig, FeeRecipient calldata _referrerConfig ) external view returns (address); /// @notice Computes the address of a P2pSsvProxy for the default referenceFeeDistributor /// @param _clientConfig address and basis points (percent * 100) of the client /// @param _referrerConfig address and basis points (percent * 100) of the referrer. /// @return address client P2pSsvProxy instance that will be or has been deployed function predictP2pSsvProxyAddress( FeeRecipient calldata _clientConfig, FeeRecipient calldata _referrerConfig ) external view returns (address); /// @notice Computes the address of a P2pSsvProxy for the default referenceFeeDistributor and referrerConfig /// @param _clientConfig address and basis points (percent * 100) of the client /// @return address client P2pSsvProxy instance that will be or has been deployed function predictP2pSsvProxyAddress( FeeRecipient calldata _clientConfig ) external view returns (address); /// @notice Deploy P2pSsvProxy instance if not deployed before /// @param _feeDistributorInstance The address of FeeDistributor instance /// @return p2pSsvProxyInstance client P2pSsvProxy instance that has been deployed function createP2pSsvProxy( address _feeDistributorInstance ) external returns(address p2pSsvProxyInstance); /// @notice Batch deposit ETH and register validators with SSV (up to 50, calldata size is the limit) /// @param _depositData signatures and depositDataRoots from Beacon deposit data /// @param _withdrawalCredentialsAddress address for 0x01 withdrawal credentials from Beacon deposit data (1 for the batch) /// @param _ssvPayload a stuct with data necessary for SSV registration (see `SsvPayload` struct for details) /// @param _clientConfig address and basis points (percent * 100) of the client (for FeeDistributor) /// @param _referrerConfig address and basis points (percent * 100) of the referrer (for FeeDistributor) /// @return p2pSsvProxy client P2pSsvProxy instance that became the SSV cluster owner function depositEthAndRegisterValidators( DepositData calldata _depositData, address _withdrawalCredentialsAddress, SsvPayload calldata _ssvPayload, FeeRecipient calldata _clientConfig, FeeRecipient calldata _referrerConfig ) external payable returns (address p2pSsvProxy); /// @notice Batch deposit ETH and register validators with SSV (up to 50, calldata size is the limit) /// @param _depositData signatures and depositDataRoots from Beacon deposit data /// @param _withdrawalCredentialsAddress address for 0x01 withdrawal credentials from Beacon deposit data (1 for the batch) /// @param _operatorOwners SSV operator owner addresses /// @param _operatorIds SSV operator IDs /// @param _publicKeys validator public keys /// @param _sharesData encrypted shares related to the validator /// @param _amount amount of ERC-20 SSV tokens to deposit into the cluster /// @param _cluster SSV cluster /// @param _clientConfig address and basis points (percent * 100) of the client (for FeeDistributor) /// @param _referrerConfig address and basis points (percent * 100) of the referrer (for FeeDistributor) /// @return p2pSsvProxy client P2pSsvProxy instance that became the SSV cluster owner function depositEthAndRegisterValidators( DepositData calldata _depositData, address _withdrawalCredentialsAddress, address[] calldata _operatorOwners, uint64[] calldata _operatorIds, bytes[] calldata _publicKeys, bytes[] calldata _sharesData, uint256 _amount, ISSVNetwork.Cluster calldata _cluster, FeeRecipient calldata _clientConfig, FeeRecipient calldata _referrerConfig ) external payable returns (address p2pSsvProxy); /// @notice Deposit unlimited amount of ETH for SSV staking /// @dev Callable by clients /// @param _eth2WithdrawalCredentials ETH2 withdrawal credentials /// @param _ethAmountPerValidatorInWei amount of ETH to deposit per 1 validator (should be >= 32 and <= 2048) /// @param _clientConfig address and basis points (percent * 100) of the client /// @param _referrerConfig address and basis points (percent * 100) of the referrer. /// @param _extraData any other data to pass to the event listener /// @return depositId ID of client deposit (derived from ETH2 WithdrawalCredentials, ETH amount per validator in wei, fee distributor instance address) /// @return feeDistributorInstance client FeeDistributor instance /// @return p2pSsvProxy client P2pSsvProxy instance that became the SSV cluster owner function addEth( bytes32 _eth2WithdrawalCredentials, uint96 _ethAmountPerValidatorInWei, FeeRecipient calldata _clientConfig, FeeRecipient calldata _referrerConfig, bytes calldata _extraData ) external payable returns ( bytes32 depositId, address feeDistributorInstance, address p2pSsvProxy ); /// @notice Register validators with SSV (up to 60, calldata size is the limit) without ETH deposits /// @param _ssvPayload a stuct with data necessary for SSV registration (see `SsvPayload` struct for details) /// @param _clientConfig address and basis points (percent * 100) of the client (for FeeDistributor) /// @param _referrerConfig address and basis points (percent * 100) of the referrer (for FeeDistributor) /// @return p2pSsvProxy client P2pSsvProxy instance that became the SSV cluster owner function registerValidators( SsvPayload calldata _ssvPayload, FeeRecipient calldata _clientConfig, FeeRecipient calldata _referrerConfig ) external payable returns (address p2pSsvProxy); /// @notice Register validators with SSV (up to 60, calldata size is the limit) without ETH deposits /// @param _operatorOwners SSV operator owner addresses /// @param _operatorIds SSV operator IDs /// @param _publicKeys validator public keys /// @param _sharesData encrypted shares related to the validator /// @param _amount amount of ERC-20 SSV tokens to deposit into the cluster /// @param _cluster SSV cluster /// @param _clientConfig address and basis points (percent * 100) of the client (for FeeDistributor) /// @param _referrerConfig address and basis points (percent * 100) of the referrer (for FeeDistributor) /// @return p2pSsvProxy client P2pSsvProxy instance that became the SSV cluster owner function registerValidators( address[] calldata _operatorOwners, uint64[] calldata _operatorIds, bytes[] calldata _publicKeys, bytes[] calldata _sharesData, uint256 _amount, ISSVNetwork.Cluster calldata _cluster, FeeRecipient calldata _clientConfig, FeeRecipient calldata _referrerConfig ) external payable returns (address p2pSsvProxy); /// @notice Send ETH to ETH2 DepositContract on behalf of the client and register validators with SSV (up to 60, calldata size is the limit) /// @dev Callable by P2P only. /// @param _eth2WithdrawalCredentials ETH2 withdrawal credentials /// @param _ethAmountPerValidatorInWei amount of ETH to deposit per 1 validator (should be >= 32 and <= 2048) /// @param _feeDistributorInstance user FeeDistributor instance that determines the terms of staking service /// @param _depositData signatures and depositDataRoots from Beacon deposit data /// @param _operatorIds SSV operator IDs /// @param _publicKeys validator public keys /// @param _sharesData encrypted shares related to the validator /// @param _amount amount of ERC-20 SSV tokens to deposit into the cluster /// @param _cluster SSV cluster /// @return p2pSsvProxy client P2pSsvProxy instance that became the SSV cluster owner function makeBeaconDepositsAndRegisterValidators( bytes32 _eth2WithdrawalCredentials, uint96 _ethAmountPerValidatorInWei, address _feeDistributorInstance, DepositData calldata _depositData, uint64[] calldata _operatorIds, bytes[] calldata _publicKeys, bytes[] calldata _sharesData, uint256 _amount, ISSVNetwork.Cluster calldata _cluster ) external returns (address p2pSsvProxy); /// @notice Deposit SSV tokens from P2pSsvProxyFactory to SSV cluster /// @dev Can only be called by P2pSsvProxyFactory owner /// @param _clusterOwner SSV cluster owner (usually, P2pSsvProxy instance) /// @param _tokenAmount SSV token amount to be deposited /// @param _operatorIds SSV operator IDs /// @param _cluster SSV cluster function depositToSSV( address _clusterOwner, uint256 _tokenAmount, uint64[] calldata _operatorIds, ISSVNetwork.Cluster calldata _cluster ) external; /// @notice Returns the FeeDistributorFactory address /// @return FeeDistributorFactory address function getFeeDistributorFactory() external view returns (address); /// @notice A list of addresses of the deployed client P2pSsvProxy instances by client address /// @param _client client address /// @return A list of addresses of the deployed client P2pSsvProxy instances function getAllClientP2pSsvProxies( address _client ) external view returns (address[] memory); /// @notice Returns a list of all ever deployed client P2pSsvProxy instances /// @return a list of all ever deployed client P2pSsvProxy instances function getAllP2pSsvProxies() external view returns (address[] memory); /// @notice Returns if a certain selector (function signature) is allowed for clients to call on SSVNetwork via P2pSsvProxy /// @return True if allowed function isClientSelectorAllowed(bytes4 _selector) external view returns (bool); /// @notice Returns if a certain selector (function signature) is allowed for a P2P operator to call on SSVNetwork via P2pSsvProxy /// @param _selector selector (function signature) /// @return True if allowed function isOperatorSelectorAllowed(bytes4 _selector) external view returns (bool); /// @notice Returns SSV operator IDs list by operator owner address /// @param _ssvOperatorOwner operator owner address /// @return SSV operator IDs list function getAllowedSsvOperatorIds(address _ssvOperatorOwner) external view returns (uint64[MAX_ALLOWED_SSV_OPERATOR_IDS] memory); /// @notice Returns a set of addresses of SSV operator owners (both P2P and partners) /// @return a set of addresses of SSV operator owners (both P2P and partners) function getAllowedSsvOperatorOwners() external view returns (address[] memory); /// @notice Returns a template set by P2P to be used for new FeeDistributor instances /// @return a template set by P2P to be used for new FeeDistributor instances function getReferenceFeeDistributor() external view returns (address); /// @notice Returns a template set by P2P to be used for new P2pSsvProxy instances /// @return a template set by P2P to be used for new P2pSsvProxy instances function getReferenceP2pSsvProxy() external view returns (address); /// @notice Returns exchange rate between SSV and ETH set by P2P /// @dev (If 1 SSV = 0.007539 ETH, it should be 0.007539 * 10^18 = 7539000000000000). /// Only used during validator registration without ETH deposits to cover SSV token costs with client ETH. /// SSV tokens exchanged with this rate cannot be withdrawn by the client. /// P2P is willing to tolarate potential discrepancies with the market exchange rate for the sake of simplicity. /// The client agrees to this rate when calls `registerValidators` function. /// @return exchange rate between SSV and ETH set by P2P function getSsvPerEthExchangeRateDividedByWei() external view returns (uint112); /// @notice Returns the maximum amount of SSV tokens per validator that is allowed for client to deposit during `depositEthAndRegisterValidators` /// @return maximum amount of SSV tokens per validator function getMaxSsvTokenAmountPerValidator() external view returns (uint112); /// @notice Returns needed amount of ETH to cover SSV fees by SSV token amount /// @param _tokenAmount SSV token amount /// @return needed amount of ETH to cover SSV fees function getNeededAmountOfEtherToCoverSsvFees(uint256 _tokenAmount) external view returns (uint256); }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "../@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "../structs/P2pStructs.sol"; import "../access/IOwnableWithOperator.sol"; import "../interfaces/ssv/ISSVNetwork.sol"; /// @dev External interface of P2pSsvProxy declared to support ERC165 detection. interface IP2pSsvProxy is IOwnableWithOperator, IERC165 { /// @notice Emits when P2pSsvProxy instance is initialized /// @param _feeDistributor FeeDistributor instance that determines the identity of this P2pSsvProxy instance event P2pSsvProxy__Initialized( address indexed _feeDistributor ); /// @notice Emits when the function was called successfully on SSVNetwork via fallback /// @param _caller caller of P2pSsvProxy /// @param _selector selector of the function from SSVNetwork event P2pSsvProxy__SuccessfullyCalledViaFallback( address indexed _caller, bytes4 indexed _selector ); /// @notice Emits when an arbitrary external contract has been called by owner via P2pSsvProxy /// @param _contract external contract address /// @param _selector selector of the called function event P2pSsvProxy__SuccessfullyCalledExternalContract( address indexed _contract, bytes4 indexed _selector ); /// @notice Initialize the P2pSsvProxy instance /// @dev Should only be called by P2pSsvProxyFactory /// @param _feeDistributor FeeDistributor instance that determines the identity of this P2pSsvProxy instance function initialize( address _feeDistributor ) external; /// @notice Call an arbitrary external contract with P2pSsvProxy as a msg.sender /// @dev Should be called by owner only /// @dev This function can help e.g. in claiming airdrops /// @param _contract external contract address /// @param _calldata calldata for the external contract function callAnyContract( address _contract, bytes calldata _calldata ) external; /// @notice Register a batch of validators with SSV /// @dev Should be called by P2pSsvProxyFactory only /// @param _ssvPayload struct with the SSV data required for registration function registerValidators( SsvPayload calldata _ssvPayload ) external; /// @notice Registers new validators on the SSV Network /// @dev Should be called by P2pSsvProxyFactory only /// @param publicKeys The public keys of the new validators /// @param operatorIds Array of IDs of operators managing this validator /// @param sharesData Encrypted shares related to the new validators /// @param amount Amount of SSV tokens to be deposited /// @param cluster Cluster to be used with the new validator function bulkRegisterValidators( bytes[] calldata publicKeys, uint64[] calldata operatorIds, bytes[] calldata sharesData, uint256 amount, ISSVNetwork.Cluster calldata cluster ) external; /// @notice Remove a batch of validators from SSV /// @dev Can be called either by P2P or by the client /// @param _pubkeys validator pubkeys /// @param _operatorIds SSV operator IDs /// @param _clusters SSV clusters, each of which should correspond to pubkey and operator IDs function removeValidators( bytes[] calldata _pubkeys, uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) external; /// @notice Liquidate SSV clusters /// @dev Should be called by P2P only. /// This function is just batching calls for convenience. It's always possible to call the same function on SSVNetwork via fallback /// @param _operatorIds SSV operator IDs /// @param _clusters SSV clusters function liquidate( uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) external; /// @notice Reactivate SSV clusters /// @dev Should be called by P2P only /// This function is just batching calls for convenience. It's always possible to call the same function on SSVNetwork via fallback /// @param _tokenAmount SSV token amount to be deposited for reactivation /// @param _operatorIds SSV operator IDs /// @param _clusters SSV clusters function reactivate( uint256 _tokenAmount, uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) external; /// @notice Deposit SSV tokens to SSV clusters /// @dev Can be called by anyone /// This function is just batching calls for convenience. It's possible to call the same function on SSVNetwork directly /// @param _tokenAmount SSV token amount to be deposited /// @param _operatorIds SSV operator IDs /// @param _clusters SSV clusters function depositToSSV( uint256 _tokenAmount, uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) external; /// @notice Withdraw SSV tokens from SSV clusters to this contract /// @dev Should be called by P2P only /// This function is just batching calls for convenience. It's always possible to call the same function on SSVNetwork via fallback /// @param _tokenAmount SSV token amount to be withdrawn /// @param _operatorIds SSV operator IDs /// @param _clusters SSV clusters function withdrawFromSSV( uint256 _tokenAmount, uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) external; /// @notice Withdraw SSV tokens from this contract to the given address /// @dev Should be called by P2P only /// @param _to destination address /// @param _amount SSV token amount to be withdrawn function withdrawSSVTokens( address _to, uint256 _amount ) external; /// @notice Withdraw all SSV tokens from this contract to P2pSsvProxyFactory /// @dev Should be called by P2P only function withdrawAllSSVTokensToFactory() external; /// @notice Withdraw SSV tokens from SSV clusters to P2pSsvProxyFactory /// @dev Should be called by P2P only /// @param _tokenAmount SSV token amount to be withdrawn /// @param _operatorIds SSV operator IDs /// @param _clusters SSV clusters function withdrawFromSSVToFactory( uint256 _tokenAmount, uint64[] calldata _operatorIds, ISSVNetwork.Cluster[] calldata _clusters ) external; /// @notice Set a new fee recipient address for this contract (cluster owner) /// @dev Should be called by P2P only. /// Another FeeDistributor instance can become the fee recipient (e.g. if service percentages change). /// Client address itself can become the fee recipient (e.g. if service percentage becomes zero due to some promo). /// It's fine for P2P to determine the fee recipient since P2P is paying SSV tokens and EL rewards are a way to compansate for them. /// Other operators are compansated via SSV tokens paid by P2P. /// @param _feeRecipientAddress fee recipient address to set function setFeeRecipientAddress( address _feeRecipientAddress ) external; /// @notice Fires the exit event for a set of validators /// @param publicKeys The public keys of the validators to be exited /// @param operatorIds Array of IDs of operators managing the validators function bulkExitValidator(bytes[] calldata publicKeys, uint64[] calldata operatorIds) external; /// @notice Returns the client address /// @return address client address function getClient() external view returns (address); /// @notice Returns the factory address /// @return address factory address function getFactory() external view returns (address); /// @notice Returns the address of FeeDistributor instance accociated with this contract /// @return FeeDistributor instance address function getFeeDistributor() external view returns (address); }
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity 0.8.24;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.24;
/// @dev https://github.com/ssvlabs/ssv-network/blob/2e90a0cc44ae2645ea06ef9c0fcd2369bbf3c277/contracts/interfaces/ISSVNetworkCore.sol
interface ISSVNetworkCore {
/***********/
/* Structs */
/***********/
/// @notice Represents a snapshot of an operator's or a DAO's state at a certain block
struct Snapshot {
/// @dev The block number when the snapshot was taken
uint32 block;
/// @dev The last index calculated by the formula index += (currentBlock - block) * fee
uint64 index;
/// @dev Total accumulated earnings calculated by the formula accumulated + lastIndex * validatorCount
uint64 balance;
}
/// @notice Represents an SSV operator
struct Operator {
/// @dev The number of validators associated with this operator
uint32 validatorCount;
/// @dev The fee charged by the operator, set to zero for private operators and cannot be increased once set
uint64 fee;
/// @dev The address of the operator's owner
address owner;
/// @dev private flag for this operator
bool whitelisted;
/// @dev The state snapshot of the operator
Snapshot snapshot;
}
/// @notice Represents a request to change an operator's fee
struct OperatorFeeChangeRequest {
/// @dev The new fee proposed by the operator
uint64 fee;
/// @dev The time when the approval period for the fee change begins
uint64 approvalBeginTime;
/// @dev The time when the approval period for the fee change ends
uint64 approvalEndTime;
}
/// @notice Represents a cluster of validators
struct Cluster {
/// @dev The number of validators in the cluster
uint32 validatorCount;
/// @dev The index of network fees related to this cluster
uint64 networkFeeIndex;
/// @dev The last index calculated for the cluster
uint64 index;
/// @dev Flag indicating whether the cluster is active
bool active;
/// @dev The balance of the cluster
uint256 balance;
}
/**********/
/* Errors */
/**********/
error CallerNotOwnerWithData(address caller, address owner); // 0x163678e9
error CallerNotWhitelistedWithData(uint64 operatorId); // 0xb7f529fe
error FeeTooLow(); // 0x732f9413
error FeeExceedsIncreaseLimit(); // 0x958065d9
error NoFeeDeclared(); // 0x1d226c30
error ApprovalNotWithinTimeframe(); // 0x97e4b518
error OperatorDoesNotExist(); // 0x961e3e8c
error InsufficientBalance(); // 0xf4d678b8
error ValidatorDoesNotExist(); // 0xe51315d2
error ClusterNotLiquidatable(); // 0x60300a8d
error InvalidPublicKeyLength(); // 0x637297a4
error InvalidOperatorIdsLength(); // 0x38186224
error ClusterAlreadyEnabled(); // 0x3babafd2
error ClusterIsLiquidated(); // 0x95a0cf33
error ClusterDoesNotExists(); // 0x185e2b16
error IncorrectClusterState(); // 0x12e04c87
error UnsortedOperatorsList(); // 0xdd020e25
error NewBlockPeriodIsBelowMinimum(); // 0x6e6c9cac
error ExceedValidatorLimitWithData(uint64 operatorId); // 0x8ddf7de4
error TokenTransferFailed(); // 0x045c4b02
error SameFeeChangeNotAllowed(); // 0xc81272f8
error FeeIncreaseNotAllowed(); // 0x410a2b6c
error NotAuthorized(); // 0xea8e4eb5
error OperatorsListNotUnique(); // 0xa5a1ff5d
error OperatorAlreadyExists(); // 0x289c9494
error TargetModuleDoesNotExistWithData(uint8 moduleId); // 0x208bb85d
error MaxValueExceeded(); // 0x91aa3017
error FeeTooHigh(); // 0xcd4e6167
error PublicKeysSharesLengthMismatch(); // 0x9ad467b8
error IncorrectValidatorStateWithData(bytes publicKey); // 0x89307938
error ValidatorAlreadyExistsWithData(bytes publicKey); // 0x388e7999
error EmptyPublicKeysList(); // df83e679
error InvalidContractAddress(); // 0xa710429d
error AddressIsWhitelistingContract(address contractAddress); // 0x71cadba7
error InvalidWhitelistingContract(address contractAddress); // 0x886e6a03
error InvalidWhitelistAddressesLength(); // 0xcbb362dc
error ZeroAddressNotAllowed(); // 0x8579befe
// legacy errors
error ValidatorAlreadyExists(); // 0x8d09a73e
error IncorrectValidatorState(); // 0x2feda3c1
error ExceedValidatorLimit(uint64 operatorId); // 0x6df5ab76
error CallerNotOwner(); // 0x5cd83192
error TargetModuleDoesNotExist(); // 0x8f9195fb
error CallerNotWhitelisted(); // 0x8c6e5d71
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.24;
import {ISSVNetworkCore} from "./ISSVNetworkCore.sol";
/// @dev https://github.com/ssvlabs/ssv-network/blob/2e90a0cc44ae2645ea06ef9c0fcd2369bbf3c277/contracts/interfaces/ISSVOperators.sol
interface ISSVOperators is ISSVNetworkCore {
/// @notice Registers a new operator
/// @dev For backward compatibility testing
/// @param publicKey The public key of the operator
/// @param fee The operator's fee (SSV)
function registerOperator(bytes calldata publicKey, uint256 fee) external returns (uint64);
/// @notice Registers a new operator
/// @param publicKey The public key of the operator
/// @param fee The operator's fee (SSV)
/// @param setPrivate Flag indicating whether the operator should be set as private or not
function registerOperator(bytes calldata publicKey, uint256 fee, bool setPrivate) external returns (uint64);
/// @notice Removes an existing operator
/// @param operatorId The ID of the operator to be removed
function removeOperator(uint64 operatorId) external;
/// @notice Sets the whitelist for an operator
/// @dev For backward compatibility testing
/// @param operatorId The ID of the operator
/// @param whitelisted The address to be whitelisted
function setOperatorWhitelist(uint64 operatorId, address whitelisted) external;
/// @notice Declares the operator's fee
/// @param operatorId The ID of the operator
/// @param fee The fee to be declared (SSV)
function declareOperatorFee(uint64 operatorId, uint256 fee) external;
/// @notice Executes the operator's fee
/// @param operatorId The ID of the operator
function executeOperatorFee(uint64 operatorId) external;
/// @notice Cancels the declared operator's fee
/// @param operatorId The ID of the operator
function cancelDeclaredOperatorFee(uint64 operatorId) external;
/// @notice Reduces the operator's fee
/// @param operatorId The ID of the operator
/// @param fee The new Operator's fee (SSV)
function reduceOperatorFee(uint64 operatorId, uint256 fee) external;
/// @notice Withdraws operator earnings
/// @param operatorId The ID of the operator
/// @param tokenAmount The amount of tokens to withdraw (SSV)
function withdrawOperatorEarnings(uint64 operatorId, uint256 tokenAmount) external;
/// @notice Withdraws all operator earnings
/// @param operatorId The ID of the operator
function withdrawAllOperatorEarnings(uint64 operatorId) external;
/// @notice Set the list of operators as private without checking for any whitelisting address
/// @notice The operators are considered private when registering validators
/// @param operatorIds The operator IDs to set as private
function setOperatorsPrivateUnchecked(uint64[] calldata operatorIds) external;
/// @notice Set the list of operators as public without removing any whitelisting address
/// @notice The operators still keep its adresses whitelisted (external contract or EOAs/generic contracts)
/// @notice The operators are considered public when registering validators
/// @param operatorIds The operator IDs to set as public
function setOperatorsPublicUnchecked(uint64[] calldata operatorIds) external;
/**
* @dev Emitted when a new operator has been added.
* @param operatorId operator's ID.
* @param owner Operator's ethereum address that can collect fees.
* @param publicKey Operator's public key. Will be used to encrypt secret shares of validators keys.
* @param fee Operator's fee.
*/
event OperatorAdded(uint64 indexed operatorId, address indexed owner, bytes publicKey, uint256 fee);
/**
* @dev Emitted when operator has been removed.
* @param operatorId operator's ID.
*/
event OperatorRemoved(uint64 indexed operatorId);
event OperatorFeeDeclared(address indexed owner, uint64 indexed operatorId, uint256 blockNumber, uint256 fee);
event OperatorFeeDeclarationCancelled(address indexed owner, uint64 indexed operatorId);
/**
* @dev Emitted when an operator's fee is updated.
* @param owner Operator's owner.
* @param blockNumber from which block number.
* @param fee updated fee value.
*/
event OperatorFeeExecuted(address indexed owner, uint64 indexed operatorId, uint256 blockNumber, uint256 fee);
event OperatorWithdrawn(address indexed owner, uint64 indexed operatorId, uint256 value);
event FeeRecipientAddressUpdated(address indexed owner, address recipientAddress);
/**
* @dev Emitted when the operators changed its privacy status
* @param operatorIds operators' IDs.
* @param toPrivate Flag that indicates if the operators are being set to private (true) or public (false).
*/
event OperatorPrivacyStatusUpdated(uint64[] operatorIds, bool toPrivate);
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.24;
import {ISSVNetworkCore} from "./ISSVNetworkCore.sol";
/// @dev https://github.com/ssvlabs/ssv-network/blob/2e90a0cc44ae2645ea06ef9c0fcd2369bbf3c277/contracts/interfaces/ISSVClusters.sol
interface ISSVClusters is ISSVNetworkCore {
/// @notice Registers a new validator on the SSV Network
/// @param publicKey The public key of the new validator
/// @param operatorIds Array of IDs of operators managing this validator
/// @param sharesData Encrypted shares related to the new validator
/// @param amount Amount of SSV tokens to be deposited
/// @param cluster Cluster to be used with the new validator
function registerValidator(
bytes calldata publicKey,
uint64[] memory operatorIds,
bytes calldata sharesData,
uint256 amount,
Cluster memory cluster
) external;
/// @notice Registers new validators on the SSV Network
/// @param publicKeys The public keys of the new validators
/// @param operatorIds Array of IDs of operators managing this validator
/// @param sharesData Encrypted shares related to the new validators
/// @param amount Amount of SSV tokens to be deposited
/// @param cluster Cluster to be used with the new validator
function bulkRegisterValidator(
bytes[] calldata publicKeys,
uint64[] memory operatorIds,
bytes[] calldata sharesData,
uint256 amount,
Cluster memory cluster
) external;
/// @notice Removes an existing validator from the SSV Network
/// @param publicKey The public key of the validator to be removed
/// @param operatorIds Array of IDs of operators managing the validator
/// @param cluster Cluster associated with the validator
function removeValidator(bytes calldata publicKey, uint64[] memory operatorIds, Cluster memory cluster) external;
/// @notice Bulk removes a set of existing validators in the same cluster from the SSV Network
/// @notice Reverts if publicKeys contains duplicates or non-existent validators
/// @param publicKeys The public keys of the validators to be removed
/// @param operatorIds Array of IDs of operators managing the validator
/// @param cluster Cluster associated with the validator
function bulkRemoveValidator(
bytes[] calldata publicKeys,
uint64[] memory operatorIds,
Cluster memory cluster
) external;
/**************************/
/* Cluster External Functions */
/**************************/
/// @notice Liquidates a cluster
/// @param owner The owner of the cluster
/// @param operatorIds Array of IDs of operators managing the cluster
/// @param cluster Cluster to be liquidated
function liquidate(address owner, uint64[] memory operatorIds, Cluster memory cluster) external;
/// @notice Reactivates a cluster
/// @param operatorIds Array of IDs of operators managing the cluster
/// @param amount Amount of SSV tokens to be deposited for reactivation
/// @param cluster Cluster to be reactivated
function reactivate(uint64[] memory operatorIds, uint256 amount, Cluster memory cluster) external;
/******************************/
/* Balance External Functions */
/******************************/
/// @notice Deposits tokens into a cluster
/// @param owner The owner of the cluster
/// @param operatorIds Array of IDs of operators managing the cluster
/// @param amount Amount of SSV tokens to be deposited
/// @param cluster Cluster where the deposit will be made
function deposit(address owner, uint64[] memory operatorIds, uint256 amount, Cluster memory cluster) external;
/// @notice Withdraws tokens from a cluster
/// @param operatorIds Array of IDs of operators managing the cluster
/// @param tokenAmount Amount of SSV tokens to be withdrawn
/// @param cluster Cluster where the withdrawal will be made
function withdraw(uint64[] memory operatorIds, uint256 tokenAmount, Cluster memory cluster) external;
/// @notice Fires the exit event for a validator
/// @param publicKey The public key of the validator to be exited
/// @param operatorIds Array of IDs of operators managing the validator
function exitValidator(bytes calldata publicKey, uint64[] calldata operatorIds) external;
/// @notice Fires the exit event for a set of validators
/// @param publicKeys The public keys of the validators to be exited
/// @param operatorIds Array of IDs of operators managing the validators
function bulkExitValidator(bytes[] calldata publicKeys, uint64[] calldata operatorIds) external;
/**
* @dev Emitted when the validator has been added.
* @param publicKey The public key of a validator.
* @param operatorIds The operator ids list.
* @param shares snappy compressed shares(a set of encrypted and public shares).
* @param cluster All the cluster data.
*/
event ValidatorAdded(address indexed owner, uint64[] operatorIds, bytes publicKey, bytes shares, Cluster cluster);
/**
* @dev Emitted when the validator is removed.
* @param publicKey The public key of a validator.
* @param operatorIds The operator ids list.
* @param cluster All the cluster data.
*/
event ValidatorRemoved(address indexed owner, uint64[] operatorIds, bytes publicKey, Cluster cluster);
/**
* @dev Emitted when a cluster is liquidated.
* @param owner The owner of the liquidated cluster.
* @param operatorIds The operator IDs managing the cluster.
* @param cluster The liquidated cluster data.
*/
event ClusterLiquidated(address indexed owner, uint64[] operatorIds, Cluster cluster);
/**
* @dev Emitted when a cluster is reactivated.
* @param owner The owner of the reactivated cluster.
* @param operatorIds The operator IDs managing the cluster.
* @param cluster The reactivated cluster data.
*/
event ClusterReactivated(address indexed owner, uint64[] operatorIds, Cluster cluster);
/**
* @dev Emitted when tokens are withdrawn from a cluster.
* @param owner The owner of the cluster.
* @param operatorIds The operator IDs managing the cluster.
* @param value The amount of tokens withdrawn.
* @param cluster The cluster from which tokens were withdrawn.
*/
event ClusterWithdrawn(address indexed owner, uint64[] operatorIds, uint256 value, Cluster cluster);
/**
* @dev Emitted when tokens are deposited into a cluster.
* @param owner The owner of the cluster.
* @param operatorIds The operator IDs managing the cluster.
* @param value The amount of SSV tokens deposited.
* @param cluster The cluster into which SSV tokens were deposited.
*/
event ClusterDeposited(address indexed owner, uint64[] operatorIds, uint256 value, Cluster cluster);
/**
* @dev Emitted when a validator begins the exit process.
* @param owner The owner of the exiting validator.
* @param operatorIds The operator IDs managing the validator.
* @param publicKey The public key of the exiting validator.
*/
event ValidatorExited(address indexed owner, uint64[] operatorIds, bytes publicKey);
}// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> // SPDX-License-Identifier: MIT pragma solidity 0.8.24; /** * @dev External interface of Ownable. */ interface IOwnable { /** * @dev Returns the address of the current owner. */ function owner() external view returns (address); }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "../../@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "../../structs/P2pStructs.sol"; /// @dev External interface of FeeDistributor declared to support ERC165 detection. interface IFeeDistributor is IERC165 { /// @notice Emits once the client and the optional referrer have been set. /// @param _client address of the client. /// @param _clientBasisPoints basis points (percent * 100) of EL rewards that should go to the client /// @param _referrer address of the referrer. /// @param _referrerBasisPoints basis points (percent * 100) of EL rewards that should go to the referrer event FeeDistributor__Initialized( address indexed _client, uint96 _clientBasisPoints, address indexed _referrer, uint96 _referrerBasisPoints ); /// @notice Emits on successful withdrawal /// @param _serviceAmount how much wei service received /// @param _clientAmount how much wei client received /// @param _referrerAmount how much wei referrer received event FeeDistributor__Withdrawn( uint256 _serviceAmount, uint256 _clientAmount, uint256 _referrerAmount ); /// @notice Emits if case there was some ether left after `withdraw` and it has been sent successfully. /// @param _to destination address for ether. /// @param _amount how much wei the destination address received. event FeeDistributor__EtherRecovered( address indexed _to, uint256 _amount ); /// @notice Set client address. /// @dev Could not be in the constructor since it is different for different clients. /// _referrerConfig can be zero if there is no referrer. /// @param _clientConfig address and basis points (percent * 100) of the client /// @param _referrerConfig address and basis points (percent * 100) of the referrer. function initialize( FeeRecipient calldata _clientConfig, FeeRecipient calldata _referrerConfig ) external; /// @notice Returns the factory address /// @return address factory address function factory() external view returns (address); /// @notice Returns the service address /// @return address service address function service() external view returns (address); /// @notice Returns the client address /// @return address client address function client() external view returns (address); /// @notice Returns the client basis points /// @return uint256 client basis points function clientBasisPoints() external view returns (uint256); /// @notice Returns the referrer address /// @return address referrer address function referrer() external view returns (address); /// @notice Returns the referrer basis points /// @return uint256 referrer basis points function referrerBasisPoints() external view returns (uint256); }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]>, OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "./Ownable.sol"; /** * @notice caller must be pendingOwner */ error Ownable2Step__CallerNotNewOwner(); /** * @notice new owner address should be different from the current owner */ error Ownable2Step__NewOwnerShouldNotBeCurrentOwner(); /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2Step is Ownable { address private s_pendingOwner; /** * @dev Emits in transferOwnership (start of the transfer) * @param _previousOwner address of the previous owner * @param _newOwner address of the new owner */ event OwnershipTransferStarted(address indexed _previousOwner, address indexed _newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return s_pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { address currentOwner = owner(); if (newOwner == currentOwner) { revert Ownable2Step__NewOwnerShouldNotBeCurrentOwner(); } s_pendingOwner = newOwner; emit OwnershipTransferStarted(currentOwner, newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete s_pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() external { address sender = _msgSender(); if (pendingOwner() != sender) { revert Ownable2Step__CallerNotNewOwner(); } _transferOwnership(sender); } }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "./IOwnable.sol"; /** * @dev Ownable with an additional role of operator */ interface IOwnableWithOperator is IOwnable { /** * @dev Returns the current operator. */ function operator() external view returns (address); }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]>, Lido <[email protected]> // SPDX-License-Identifier: MIT // https://github.com/lidofinance/lido-otc-seller/blob/master/contracts/lib/AssetRecoverer.sol pragma solidity 0.8.24; import "./TokenRecoverer.sol"; import "../access/OwnableBase.sol"; /// @title Token Recoverer with public functions callable by assetAccessingAddress /// @notice Recover ERC20, ERC721 and ERC1155 from a derived contract abstract contract OwnableTokenRecoverer is TokenRecoverer, OwnableBase { // Functions /** * @notice transfer an ERC20 token from this contract * @dev `SafeERC20.safeTransfer` doesn't always return a bool * as it performs an internal `require` check * @param _token address of the ERC20 token * @param _recipient address to transfer the tokens to * @param _amount amount of tokens to transfer */ function transferERC20( address _token, address _recipient, uint256 _amount ) external onlyOwner { _transferERC20(_token, _recipient, _amount); } /** * @notice transfer an ERC721 token from this contract * @dev `IERC721.safeTransferFrom` doesn't always return a bool * as it performs an internal `require` check * @param _token address of the ERC721 token * @param _recipient address to transfer the token to * @param _tokenId id of the individual token */ function transferERC721( address _token, address _recipient, uint256 _tokenId ) external onlyOwner { _transferERC721(_token, _recipient, _tokenId); } /** * @notice transfer an ERC1155 token from this contract * @dev see `AssetRecoverer` * @param _token address of the ERC1155 token that is being recovered * @param _recipient address to transfer the token to * @param _tokenId id of the individual token to transfer * @param _amount amount of tokens to transfer * @param _data data to transfer along */ function transferERC1155( address _token, address _recipient, uint256 _tokenId, uint256 _amount, bytes calldata _data ) external onlyOwner { _transferERC1155(_token, _recipient, _tokenId, _amount, _data); } }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]>, Lido <[email protected]> // SPDX-License-Identifier: MIT // https://github.com/lidofinance/lido-otc-seller/blob/master/contracts/lib/AssetRecoverer.sol pragma solidity 0.8.24; import "./TokenRecoverer.sol"; /** * @notice could not transfer ether * @param _recipient address to transfer ether to * @param _amount amount of ether to transfer */ error AssetRecoverer__TransferFailed(address _recipient, uint256 _amount); /// @title Asset Recoverer /// @notice Recover ether, ERC20, ERC721 and ERC1155 from a derived contract abstract contract AssetRecoverer is TokenRecoverer { event EtherTransferred(address indexed _recipient, uint256 _amount); /** * @notice transfers ether from this contract * @dev using `address.call` is safer to transfer to other contracts * @param _recipient address to transfer ether to * @param _amount amount of ether to transfer */ function _transferEther(address _recipient, uint256 _amount) internal virtual burnDisallowed(_recipient) { (bool success, ) = _recipient.call{value: _amount}(""); if (!success) { revert AssetRecoverer__TransferFailed(_recipient, _amount); } emit EtherTransferred(_recipient, _amount); } }
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.24;
/// @dev https://github.com/ssvlabs/ssv-network/blob/2e90a0cc44ae2645ea06ef9c0fcd2369bbf3c277/contracts/interfaces/external/ISSVWhitelistingContract.sol
interface ISSVWhitelistingContract {
/// @notice Checks if the caller is whitelisted
/// @param account The account that is being checked for whitelisting
/// @param operatorId The SSV Operator Id which is being checked
function isWhitelisted(address account, uint256 operatorId) external view returns (bool);
}// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]>, OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "./OwnableBase.sol"; /** * @notice _newOwner cannot be a zero address */ error Ownable__NewOwnerIsZeroAddress(); /** * @dev OpenZeppelin's Ownable with modifier onlyOwner extracted to OwnableBase * and removed `renounceOwnership` */ abstract contract Ownable is OwnableBase { /** * @dev Emits when the owner has been changed. * @param _previousOwner address of the previous owner * @param _newOwner address of the new owner */ event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner); address private s_owner; /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual override returns (address) { return s_owner; } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. * @param _newOwner address of the new owner */ function transferOwnership(address _newOwner) external virtual onlyOwner { if (_newOwner == address(0)) { revert Ownable__NewOwnerIsZeroAddress(); } _transferOwnership(_newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. * @param _newOwner address of the new owner */ function _transferOwnership(address _newOwner) internal virtual { address oldOwner = s_owner; s_owner = _newOwner; emit OwnershipTransferred(oldOwner, _newOwner); } }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]>, Lido <[email protected]> // SPDX-License-Identifier: MIT // https://github.com/lidofinance/lido-otc-seller/blob/master/contracts/lib/AssetRecoverer.sol pragma solidity 0.8.24; import {IERC20} from "../@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC721} from "../@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {IERC1155} from "../@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import {SafeERC20} from "../@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /** * @notice prevents burn for transfer functions * @dev _recipient should not be a zero address */ error TokenRecoverer__NoBurn(); /// @title Token Recoverer /// @notice Recover ERC20, ERC721 and ERC1155 from a derived contract abstract contract TokenRecoverer { using SafeERC20 for IERC20; event ERC20Transferred(address indexed _token, address indexed _recipient, uint256 _amount); event ERC721Transferred(address indexed _token, address indexed _recipient, uint256 _tokenId); event ERC1155Transferred(address indexed _token, address indexed _recipient, uint256 _tokenId, uint256 _amount, bytes _data); /** * @notice prevents burn for transfer functions * @dev checks for zero address and reverts if true * @param _recipient address of the transfer recipient */ modifier burnDisallowed(address _recipient) { if (_recipient == address(0)) { revert TokenRecoverer__NoBurn(); } _; } /** * @notice transfer an ERC20 token from this contract * @dev `SafeERC20.safeTransfer` doesn't always return a bool * as it performs an internal `require` check * @param _token address of the ERC20 token * @param _recipient address to transfer the tokens to * @param _amount amount of tokens to transfer */ function _transferERC20( address _token, address _recipient, uint256 _amount ) internal virtual burnDisallowed(_recipient) { IERC20(_token).safeTransfer(_recipient, _amount); emit ERC20Transferred(_token, _recipient, _amount); } /** * @notice transfer an ERC721 token from this contract * @dev `IERC721.safeTransferFrom` doesn't always return a bool * as it performs an internal `require` check * @param _token address of the ERC721 token * @param _recipient address to transfer the token to * @param _tokenId id of the individual token */ function _transferERC721( address _token, address _recipient, uint256 _tokenId ) internal virtual burnDisallowed(_recipient) { IERC721(_token).transferFrom(address(this), _recipient, _tokenId); emit ERC721Transferred(_token, _recipient, _tokenId); } /** * @notice transfer an ERC1155 token from this contract * @dev `IERC1155.safeTransferFrom` doesn't always return a bool * as it performs an internal `require` check * @param _token address of the ERC1155 token that is being recovered * @param _recipient address to transfer the token to * @param _tokenId id of the individual token to transfer * @param _amount amount of tokens to transfer * @param _data data to transfer along */ function _transferERC1155( address _token, address _recipient, uint256 _tokenId, uint256 _amount, bytes calldata _data ) internal virtual burnDisallowed(_recipient) { IERC1155(_token).safeTransferFrom(address(this), _recipient, _tokenId, _amount, _data); emit ERC1155Transferred(_token, _recipient, _tokenId, _amount, _data); } }
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "../@openzeppelin/contracts/utils/Context.sol"; import "./IOwnable.sol"; /** * @notice Throws if called by any account other than the owner. * @param _caller address of the caller * @param _owner address of the owner */ error OwnableBase__CallerNotOwner(address _caller, address _owner); /** * @dev minimalistic version of OpenZeppelin's Ownable. * The owner is abstract and is not persisted in storage. * Needs to be overridden in a child contract. */ abstract contract OwnableBase is Context, IOwnable { /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { address caller = _msgSender(); address currentOwner = owner(); if (currentOwner != caller) { revert OwnableBase__CallerNotOwner(caller, currentOwner); } _; } /** * @dev Returns the address of the current owner. * Needs to be overridden in a child contract. */ function owner() public view virtual override returns (address); }
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)
pragma solidity 0.8.24;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)
pragma solidity 0.8.24;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity 0.8.24;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity 0.8.24;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity 0.8.24;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity 0.8.24;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly ("memory-safe") {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}{
"remappings": [
"forge-std/=lib/forge-std/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": true
}Contract ABI
API[{"inputs":[{"internalType":"address","name":"_p2pSsvProxyFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"AssetRecoverer__TransferFailed","type":"error"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"OwnableBase__CallerNotOwner","type":"error"},{"inputs":[],"name":"P2pSsvProxy__AmountOfParametersError","type":"error"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"P2pSsvProxy__CallerNeitherOperatorNorOwner","type":"error"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"}],"name":"P2pSsvProxy__CallerNeitherOperatorNorOwnerNorClient","type":"error"},{"inputs":[{"internalType":"address","name":"_passedAddress","type":"address"}],"name":"P2pSsvProxy__NotP2pSsvProxyFactory","type":"error"},{"inputs":[{"internalType":"address","name":"_msgSender","type":"address"},{"internalType":"contract IP2pSsvProxyFactory","name":"_actualFactory","type":"address"}],"name":"P2pSsvProxy__NotP2pSsvProxyFactoryCalled","type":"error"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"bytes4","name":"_selector","type":"bytes4"}],"name":"P2pSsvProxy__SelectorNotAllowed","type":"error"},{"inputs":[],"name":"TokenRecoverer__NoBurn","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"_data","type":"bytes"}],"name":"ERC1155Transferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"ERC20Transferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ERC721Transferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"EtherTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_feeDistributor","type":"address"}],"name":"P2pSsvProxy__Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"},{"indexed":true,"internalType":"bytes4","name":"_selector","type":"bytes4"}],"name":"P2pSsvProxy__SuccessfullyCalledExternalContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_caller","type":"address"},{"indexed":true,"internalType":"bytes4","name":"_selector","type":"bytes4"}],"name":"P2pSsvProxy__SuccessfullyCalledViaFallback","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[{"internalType":"bytes[]","name":"publicKeys","type":"bytes[]"},{"internalType":"uint64[]","name":"operatorIds","type":"uint64[]"}],"name":"bulkExitValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"publicKeys","type":"bytes[]"},{"internalType":"uint64[]","name":"operatorIds","type":"uint64[]"},{"internalType":"bytes[]","name":"sharesData","type":"bytes[]"},{"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"uint32","name":"validatorCount","type":"uint32"},{"internalType":"uint64","name":"networkFeeIndex","type":"uint64"},{"internalType":"uint64","name":"index","type":"uint64"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"balance","type":"uint256"}],"internalType":"struct ISSVNetworkCore.Cluster","name":"cluster","type":"tuple"}],"name":"bulkRegisterValidators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"},{"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"callAnyContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenAmount","type":"uint256"},{"internalType":"uint64[]","name":"_operatorIds","type":"uint64[]"},{"components":[{"internalType":"uint32","name":"validatorCount","type":"uint32"},{"internalType":"uint64","name":"networkFeeIndex","type":"uint64"},{"internalType":"uint64","name":"index","type":"uint64"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"balance","type":"uint256"}],"internalType":"struct ISSVNetworkCore.Cluster[]","name":"_clusters","type":"tuple[]"}],"name":"depositToSSV","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getClient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeeDistributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_feeDistributor","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64[]","name":"_operatorIds","type":"uint64[]"},{"components":[{"internalType":"uint32","name":"validatorCount","type":"uint32"},{"internalType":"uint64","name":"networkFeeIndex","type":"uint64"},{"internalType":"uint64","name":"index","type":"uint64"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"balance","type":"uint256"}],"internalType":"struct ISSVNetworkCore.Cluster[]","name":"_clusters","type":"tuple[]"}],"name":"liquidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenAmount","type":"uint256"},{"internalType":"uint64[]","name":"_operatorIds","type":"uint64[]"},{"components":[{"internalType":"uint32","name":"validatorCount","type":"uint32"},{"internalType":"uint64","name":"networkFeeIndex","type":"uint64"},{"internalType":"uint64","name":"index","type":"uint64"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"balance","type":"uint256"}],"internalType":"struct ISSVNetworkCore.Cluster[]","name":"_clusters","type":"tuple[]"}],"name":"reactivate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"bytes32","name":"snapshot","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"}],"internalType":"struct SsvOperator[]","name":"ssvOperators","type":"tuple[]"},{"components":[{"internalType":"bytes","name":"pubkey","type":"bytes"},{"internalType":"bytes","name":"sharesData","type":"bytes"}],"internalType":"struct SsvValidator[]","name":"ssvValidators","type":"tuple[]"},{"components":[{"internalType":"uint32","name":"validatorCount","type":"uint32"},{"internalType":"uint64","name":"networkFeeIndex","type":"uint64"},{"internalType":"uint64","name":"index","type":"uint64"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"balance","type":"uint256"}],"internalType":"struct ISSVNetworkCore.Cluster","name":"cluster","type":"tuple"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"bytes32","name":"ssvSlot0","type":"bytes32"}],"internalType":"struct SsvPayload","name":"_ssvPayload","type":"tuple"}],"name":"registerValidators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"_pubkeys","type":"bytes[]"},{"internalType":"uint64[]","name":"_operatorIds","type":"uint64[]"},{"components":[{"internalType":"uint32","name":"validatorCount","type":"uint32"},{"internalType":"uint64","name":"networkFeeIndex","type":"uint64"},{"internalType":"uint64","name":"index","type":"uint64"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"balance","type":"uint256"}],"internalType":"struct ISSVNetworkCore.Cluster[]","name":"_clusters","type":"tuple[]"}],"name":"removeValidators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeRecipientAddress","type":"address"}],"name":"setFeeRecipientAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"transferERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAllSSVTokensToFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenAmount","type":"uint256"},{"internalType":"uint64[]","name":"_operatorIds","type":"uint64[]"},{"components":[{"internalType":"uint32","name":"validatorCount","type":"uint32"},{"internalType":"uint64","name":"networkFeeIndex","type":"uint64"},{"internalType":"uint64","name":"index","type":"uint64"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"balance","type":"uint256"}],"internalType":"struct ISSVNetworkCore.Cluster[]","name":"_clusters","type":"tuple[]"}],"name":"withdrawFromSSV","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenAmount","type":"uint256"},{"internalType":"uint64[]","name":"_operatorIds","type":"uint64[]"},{"components":[{"internalType":"uint32","name":"validatorCount","type":"uint32"},{"internalType":"uint64","name":"networkFeeIndex","type":"uint64"},{"internalType":"uint64","name":"index","type":"uint64"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"balance","type":"uint256"}],"internalType":"struct ISSVNetworkCore.Cluster[]","name":"_clusters","type":"tuple[]"}],"name":"withdrawFromSSVToFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawSSVTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.