Swell 백서

Swell

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 9쪽 중 9쪽

controlling address of an operator in the registry.* ### Parameters | Name | Type | Description | | -------------------- | ------- | -------------------------------- | | \_operatorAddress | address | Current address of the operator. | | \_newOperatorAddress | address | New address of the operator. | ## updateOperatorRewardAddress ```solidity function updateOperatorRewardAddress(address _operatorAddress, address _newRewardAddress) external ``` Throws NoOperatorFound if the operator address is not found in the registry *Updates the reward address of an operator in the registry.* ### Parameters | Name | Type | Description | | ------------------ | ------- | ------------------------------------ | | \_operatorAddress | address | Address of the operator to update. | | \_newRewardAddress | address | New reward address for the operator. | ## updateOperatorName ```solidity function updateOperatorName(address _operatorAddress, string _name) external ``` Throws NoOperatorFound if the operator address is not found in the registry *Updates the name of an operator in the registry* ### Parameters | Name | Type | Description | | ----------------- | ------- | ------------------------------------- | | \_operatorAddress | address | The address of the operator to update | | \_name | string | The new name for the operator | ## deletePendingValidators ```solidity function deletePendingValidators(bytes[] _pubKeys) external ``` Throws InvalidArrayLengthOfZero if the length of \_pubKeys is 0 Throws NoPubKeyFound if any of the provided pubKeys is not found in the pending validators set *Allows the PLATFORM\_ADMIN to delete validators that are pending. This is likely to be called via an admin if a public key fails the front-running checks* ### Parameters | Name | Type | Description | | --------- | -------- | --------------------------------------------------- | | \_pubKeys | bytes\[] | The public keys of the pending validators to delete | ## deleteActiveValidators ```solidity function deleteActiveValidators(bytes[] _pubKeys) external ``` Throws NoPubKeyFound if any of the provided pubKeys is not found in the active validators set Throws InvalidArrayLengthOfZero if the length of \_pubKeys is 0 *Allows the PLATFORM\_ADMIN to delete validator public keys that have been used to setup a validator and that validator has now exited* ### Parameters | Name | Type | Description | | --------- | -------- | -------------------------------------------------- | | \_pubKeys | bytes\[] | The public keys of the active validators to delete | ## getPoRAddressListLength ```solidity function getPoRAddressListLength() external view returns (uint256) ``` Get total number of addresses in the list. ### Return Values | Name | Type | Description | | ---- | ------- | ---------------- | | \[0] | uint256 | The array length | ## \_parsePubKeyToString ```solidity function _parsePubKeyToString(bytes pubKey) internal pure returns (string) ``` *This method parses a pure bytes array into it's string equivalent. We must loop through the pubKey to safely convert each byte into its string equivalent, if we cast it directly it causes the response to be corrupted* ### Parameters | Name | Type | Description | | ------ | ----- | ------------------- | | pubKey | bytes | The pubKey to parse | ### Return Values | Name | Type | Description | | ---- | ------ | --------------------- | | \[0] | string | The string equivalent | ## getPoRAddressList ```solidity function getPoRAddressList(uint256 _startIndex, uint256 _endIndex) external view returns (string[]) ``` ## \_getOperatorSafe ```solidity function _getOperatorSafe(address _operatorAddress) internal view returns (struct INodeOperatorRegistry.Operator operator) ``` Throws if an operator cannot be found for the provided address. \_This method safely returns an Operator struct from the provided *operatorAddress.* ### Parameters | Name | Type | Description | | ----------------- | ------- | --------------------------------------------- | | \_operatorAddress | address | The controlling address of the given operator | ### Return Values | Name | Type | Description | | -------- | ------------------------------------- | ------------------- | | operator | struct INodeOperatorRegistry.Operator | The Operator struct | ## \_getOperatorIdSafe ```solidity function _getOperatorIdSafe(address _operatorAddress) internal view returns (uint128 operatorId) ``` Throws an error if the given \_operatorAddress doesn't exist \_This method safely returns the operatorId of the given *operatorAddress* ### Parameters | Name | Type | Description | | ----------------- | ------- | --------------------------------------------- | | \_operatorAddress | address | The controlling address of the given operator | ### Return Values | Name | Type | Description | | ---------- | ------- | ----------------- | | operatorId | uint128 | The operator's ID | ## \_getOperatorIdForPubKeySafe ```solidity function _getOperatorIdForPubKeySafe(bytes _pubKey) internal view returns (uint128 operatorId) ``` Throws if there is no found operatorId for the given \_pubKey \_This method safely returns the operatorId of the given *pubKey* ### Parameters | Name | Type | Description | | -------- | ----- | --------------------------------------- | | \_pubKey | bytes | The public key to find an operator with | ### Return Values | Name | Type | Description | | ---------- | ------- | ---------------------------------------------- | | operatorId | uint128 | The operator ID that controls the given pubKey | ## \_encodeOperatorIdAndKeyIndex ```solidity function _encodeOperatorIdAndKeyIndex(uint128 operatorId, uint128 nextKey) internal pure returns (bytes32) ``` *This method encodes the provided operatorId and nextKey into a single bytes32 variable. This is used in the activeValidatorIndexes array* ### Parameters | Name | Type | Description | | ---------- | ------- | ------------------------- | | operatorId | uint128 | The operator id to encode | | nextKey | uint128 | The key index to encode | ### Return Values | Name | Type | Description | | ---- | ------- | ---------------------------- | | \[0] | bytes32 | The encoded bytes32 variable | ## getOperator ```solidity function getOperator(address _operatorAddress) external view returns (struct INodeOperatorRegistry.Operator operator, uint128 totalValidatorDetails, uint128 operatorId) ``` Throws NoOperatorFound if the operator address is not found in the registry *Returns the operator details for a given operator address* ### Parameters | Name | Type | Description | | ----------------- | ------- | --------------------------------------- | | \_operatorAddress | address | The address of the operator to retrieve | ### Return Values | Name | Type | Description | | --------------------- | ------------------------------------- | ------------------------------------------------------------------------ | | operator | struct INodeOperatorRegistry.Operator | The operator details, including name, reward address, and enabled status | | totalValidatorDetails | uint128 | The total amount of validator details for an operator | | operatorId | uint128 | The operator's Id | ## getOperatorsPendingValidatorDetails ```solidity function getOperatorsPendingValidatorDetails(address _operatorAddress) external view returns (struct INodeOperatorRegistry.ValidatorDetails[] validatorDetails) ``` Throws NoOperatorFound if the operator address is not found in the registry *Returns the pending validator details for a given operator address* ### Parameters | Name | Type | Description | | ----------------- | ------- | --------------------------------------------------------------------- | | \_operatorAddress | address | The address of the operator to retrieve pending validator details for | ### Return Values | Name | Type | Description | | ---------------- | ------------------------------------------------ | --------------------------------------------------------------------- | | validatorDetails | struct INodeOperatorRegistry.ValidatorDetails\[] | validatorDetails The pending validator details for the given operator | ## getRewardDetailsForOperatorId ```solidity function getRewardDetailsForOperatorId(uint128 _operatorId) external view returns (address rewardAddress, uint128 activeValidators) ``` *Returns the reward details for a given operator Id, this method is used in the swETH contract when paying swETH rewards* ### Parameters | Name | Type | Description | | ------------ | ------- | --------------------------------------------- | | \_operatorId | uint128 | The operator Id to get the reward details for | ### Return Values | Name | Type | Description | | ---------------- | ------- | ------------------------------------------------ | | rewardAddress | address | The reward address of the operator | | activeValidators | uint128 | The amount of active validators for the operator | ## getOperatorsActiveValidatorDetails ```solidity function getOperatorsActiveValidatorDetails(address _operatorAddress) external view returns (struct INodeOperatorRegistry.ValidatorDetails[] validatorDetails) ``` Throws NoOperatorFound if the operator address is not found in the registry *Returns the active validator details for a given operator address* ### Parameters | Name | Type | Description | | ----------------- | ------- | -------------------------------------------------------------------- | | \_operatorAddress | address | The address of the operator to retrieve active validator details for | ### Return Values | Name | Type | Description | | ---------------- | ------------------------------------------------ | --------------------------------------------------- | | validatorDetails | struct INodeOperatorRegistry.ValidatorDetails\[] | The active validator details for the given operator | # DepositManager This contract will hold the ETH while awaiting new validator setup. This contract will also be used as the withdrawal\_credentials when setting up new validators, so that any exited validator ETH and rewards will be sent here. ## AccessControlManager ```solidity contract IAccessControlManager AccessControlManager ``` ## DepositContract ```solidity contract IDepositContract DepositContract ``` ## constructor ```solidity constructor() public ``` ## checkRole ```solidity modifier checkRole(bytes32 role) ``` ## checkZeroAddress ```solidity modifier checkZeroAddress(address _address) ``` *Modifier to check for empty addresses* ### Parameters | Name | Type | Description | | --------- | ------- | -------------------- | | \_address | address | The address to check | ## fallback ```solidity fallback() external ``` ## receive ```solidity receive() external payable ``` ## initialize ```solidity function initialize(contract IAccessControlManager _accessControlManager) external ``` ## withdrawERC20 ```solidity function withdrawERC20(contract IERC20 _token) external ``` \_This method withdraws contract's *token balance to a platform admin* ### Parameters | Name | Type | Description | | ------- | --------------- | --------------------------------------------- | | \_token | contract IERC20 | The ERC20 token to withdraw from the contract | ## setupValidators ```solidity function setupValidators(bytes[] _pubKeys, bytes32 _depositDataRoot) external ``` It also provides protection against front-running by operators, it does this by ensuring that the depositDataRoot provided matches the onchain beacon deposit contract's deposit data root, more details on the vulnerability here: <https://research.lido.fi/t/mitigations-for-deposit-front-running-vulnerability/1239> *This method allows setting up of new validators in the beacon deposit contract, it ensures the provided pubKeys are unused by calling the NO registry* ### Parameters | Name | Type | Description | | ----------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | \_pubKeys | bytes\[] | The pubKeys to setup | | \_depositDataRoot | bytes32 | The deposit contracts deposit root which MUST match the current beacon deposit contract deposit data root otherwise the contract will revert due to the risk of the front-running vulnerability. | ## getWithdrawalCredentials ```solidity function getWithdrawalCredentials() public view returns (bytes withdrawalCredentials) ``` *Formats ETH1 the withdrawal credentials according to the following standard: <https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/validator.md#eth1\\_address\\_withdrawal\\_prefix> It doesn't outline the withdrawal prefixes, they can be found here: <https://eth2book.info/altair/part3/config/constants#withdrawal-prefixes> As the DepositManager on the execution layer is going to be the withdrawal contract, we will be doing ETH1 withdrawals. The standard for this is a 32 byte response where; the first byte stores the withdrawal prefix (0x01), the following 11 bytes are empty and the last 20 bytes are the address* # rswETH | LRT Refer to the [LRT Github](https://github.com/SwellNetwork/v3-core-public/tree/dab410f4c4ea4f70f5ed3563eb1bf433a4d22bdf/contracts/lrt) for detailed information about the contracts. --- [Next Page](https://docs.swellnetwork.io/llms-full.txt/1)
프로젝트로 돌아가기