Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
RewardsCoordinator
Compiler Version
v0.8.12+commit.f00d7308
Optimization Enabled:
Yes with 200 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.12; import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol"; import "@openzeppelin-upgrades/contracts/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../libraries/Merkle.sol"; import "../permissions/Pausable.sol"; import "./RewardsCoordinatorStorage.sol"; /** * @title RewardsCoordinator * @author Eigen Labs Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice This is the contract for rewards in EigenLayer. The main functionalities of this contract are * - enabling any ERC20 rewards from AVSs to their operators and stakers for a given time range * - allowing stakers and operators to claim their earnings including a commission bips for operators * - allowing the protocol to provide ERC20 tokens to stakers over a specified time range */ contract RewardsCoordinator is Initializable, OwnableUpgradeable, Pausable, ReentrancyGuardUpgradeable, RewardsCoordinatorStorage { using SafeERC20 for IERC20; /// @notice The EIP-712 typehash for the contract's domain bytes32 internal constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); /// @dev Chain ID at the time of contract deployment uint256 internal immutable ORIGINAL_CHAIN_ID; /// @notice The maximum rewards token amount for a single rewards submission, constrained by off-chain calculation uint256 internal constant MAX_REWARDS_AMOUNT = 1e38 - 1; /// @dev Index for flag that pauses calling createAVSRewardsSubmission uint8 internal constant PAUSED_AVS_REWARDS_SUBMISSION = 0; /// @dev Index for flag that pauses calling createRewardsForAllSubmission uint8 internal constant PAUSED_REWARDS_FOR_ALL_SUBMISSION = 1; /// @dev Index for flag that pauses calling processClaim uint8 internal constant PAUSED_PROCESS_CLAIM = 2; /// @dev Index for flag that pauses submitRoots and disableRoot uint8 internal constant PAUSED_SUBMIT_DISABLE_ROOTS = 3; /// @dev Salt for the earner leaf, meant to distinguish from tokenLeaf since they have the same sized data uint8 internal constant EARNER_LEAF_SALT = 0; /// @dev Salt for the token leaf, meant to distinguish from earnerLeaf since they have the same sized data uint8 internal constant TOKEN_LEAF_SALT = 1; /// @notice Canonical, virtual beacon chain ETH strategy IStrategy public constant beaconChainETHStrategy = IStrategy(0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0); modifier onlyRewardsUpdater() { require(msg.sender == rewardsUpdater, "RewardsCoordinator: caller is not the rewardsUpdater"); _; } modifier onlyRewardsForAllSubmitter() { require( isRewardsForAllSubmitter[msg.sender], "RewardsCoordinator: caller is not a valid createRewardsForAllSubmission submitter" ); _; } /// @dev Sets the immutable variables for the contract constructor( IDelegationManager _delegationManager, IStrategyManager _strategyManager, uint32 _CALCULATION_INTERVAL_SECONDS, uint32 _MAX_REWARDS_DURATION, uint32 _MAX_RETROACTIVE_LENGTH, uint32 _MAX_FUTURE_LENGTH, uint32 __GENESIS_REWARDS_TIMESTAMP ) RewardsCoordinatorStorage( _delegationManager, _strategyManager, _CALCULATION_INTERVAL_SECONDS, _MAX_REWARDS_DURATION, _MAX_RETROACTIVE_LENGTH, _MAX_FUTURE_LENGTH, __GENESIS_REWARDS_TIMESTAMP ) { _disableInitializers(); ORIGINAL_CHAIN_ID = block.chainid; } /** * @dev Initializes the addresses of the initial owner, pauser registry, rewardsUpdater and * configures the initial paused status, activationDelay, and globalOperatorCommissionBips. */ function initialize( address initialOwner, IPauserRegistry _pauserRegistry, uint256 initialPausedStatus, address _rewardsUpdater, uint32 _activationDelay, uint16 _globalCommissionBips ) external initializer { _DOMAIN_SEPARATOR = _calculateDomainSeparator(); _initializePauser(_pauserRegistry, initialPausedStatus); _transferOwnership(initialOwner); _setRewardsUpdater(_rewardsUpdater); _setActivationDelay(_activationDelay); _setGlobalOperatorCommission(_globalCommissionBips); } /** * * EXTERNAL FUNCTIONS * */ /** * @notice Creates a new rewards submission on behalf of an AVS, to be split amongst the * set of stakers delegated to operators who are registered to the `avs` * @param rewardsSubmissions The rewards submissions being created * @dev Expected to be called by the ServiceManager of the AVS on behalf of which the submission is being made * @dev The duration of the `rewardsSubmission` cannot exceed `MAX_REWARDS_DURATION` * @dev The tokens are sent to the `RewardsCoordinator` contract * @dev Strategies must be in ascending order of addresses to check for duplicates * @dev This function will revert if the `rewardsSubmission` is malformed, * e.g. if the `strategies` and `weights` arrays are of non-equal lengths */ function createAVSRewardsSubmission(RewardsSubmission[] calldata rewardsSubmissions) external onlyWhenNotPaused(PAUSED_AVS_REWARDS_SUBMISSION) nonReentrant { for (uint256 i = 0; i < rewardsSubmissions.length; i++) { RewardsSubmission calldata rewardsSubmission = rewardsSubmissions[i]; uint256 nonce = submissionNonce[msg.sender]; bytes32 rewardsSubmissionHash = keccak256(abi.encode(msg.sender, nonce, rewardsSubmission)); _validateRewardsSubmission(rewardsSubmission); isAVSRewardsSubmissionHash[msg.sender][rewardsSubmissionHash] = true; submissionNonce[msg.sender] = nonce + 1; emit AVSRewardsSubmissionCreated(msg.sender, nonce, rewardsSubmissionHash, rewardsSubmission); rewardsSubmission.token.safeTransferFrom(msg.sender, address(this), rewardsSubmission.amount); } } /** * @notice similar to `createAVSRewardsSubmission` except the rewards are split amongst *all* stakers * rather than just those delegated to operators who are registered to a single avs and is * a permissioned call based on isRewardsForAllSubmitter mapping. * @param rewardsSubmissions The rewards submissions being created */ function createRewardsForAllSubmission(RewardsSubmission[] calldata rewardsSubmissions) external onlyWhenNotPaused(PAUSED_REWARDS_FOR_ALL_SUBMISSION) onlyRewardsForAllSubmitter nonReentrant { for (uint256 i = 0; i < rewardsSubmissions.length; i++) { RewardsSubmission calldata rewardsSubmission = rewardsSubmissions[i]; uint256 nonce = submissionNonce[msg.sender]; bytes32 rewardsSubmissionForAllHash = keccak256(abi.encode(msg.sender, nonce, rewardsSubmission)); _validateRewardsSubmission(rewardsSubmission); isRewardsSubmissionForAllHash[msg.sender][rewardsSubmissionForAllHash] = true; submissionNonce[msg.sender] = nonce + 1; emit RewardsSubmissionForAllCreated(msg.sender, nonce, rewardsSubmissionForAllHash, rewardsSubmission); rewardsSubmission.token.safeTransferFrom(msg.sender, address(this), rewardsSubmission.amount); } } /** * @notice Claim rewards against a given root (read from _distributionRoots[claim.rootIndex]). * Earnings are cumulative so earners don't have to claim against all distribution roots they have earnings for, * they can simply claim against the latest root and the contract will calculate the difference between * their cumulativeEarnings and cumulativeClaimed. This difference is then transferred to recipient address. * @param claim The RewardsMerkleClaim to be processed. * Contains the root index, earner, token leaves, and required proofs * @param recipient The address recipient that receives the ERC20 rewards * @dev only callable by the valid claimer, that is * if claimerFor[claim.earner] is address(0) then only the earner can claim, otherwise only * claimerFor[claim.earner] can claim the rewards. */ function processClaim( RewardsMerkleClaim calldata claim, address recipient ) external onlyWhenNotPaused(PAUSED_PROCESS_CLAIM) nonReentrant { DistributionRoot memory root = _distributionRoots[claim.rootIndex]; _checkClaim(claim, root); // If claimerFor earner is not set, claimer is by default the earner. Else set to claimerFor address earner = claim.earnerLeaf.earner; address claimer = claimerFor[earner]; if (claimer == address(0)) { claimer = earner; } require(msg.sender == claimer, "RewardsCoordinator.processClaim: caller is not valid claimer"); for (uint256 i = 0; i < claim.tokenIndices.length; i++) { TokenTreeMerkleLeaf calldata tokenLeaf = claim.tokenLeaves[i]; uint256 currCumulativeClaimed = cumulativeClaimed[earner][tokenLeaf.token]; require( tokenLeaf.cumulativeEarnings > currCumulativeClaimed, "RewardsCoordinator.processClaim: cumulativeEarnings must be gt than cumulativeClaimed" ); // Calculate amount to claim and update cumulativeClaimed uint256 claimAmount = tokenLeaf.cumulativeEarnings - currCumulativeClaimed; cumulativeClaimed[earner][tokenLeaf.token] = tokenLeaf.cumulativeEarnings; tokenLeaf.token.safeTransfer(recipient, claimAmount); emit RewardsClaimed(root.root, earner, claimer, recipient, tokenLeaf.token, claimAmount); } } /** * @notice Creates a new distribution root. activatedAt is set to block.timestamp + activationDelay * @param root The merkle root of the distribution * @param rewardsCalculationEndTimestamp The timestamp until which rewards have been calculated * @dev Only callable by the rewardsUpdater */ function submitRoot( bytes32 root, uint32 rewardsCalculationEndTimestamp ) external onlyWhenNotPaused(PAUSED_SUBMIT_DISABLE_ROOTS) onlyRewardsUpdater { require( rewardsCalculationEndTimestamp > currRewardsCalculationEndTimestamp, "RewardsCoordinator.submitRoot: new root must be for newer calculated period" ); require( rewardsCalculationEndTimestamp < block.timestamp, "RewardsCoordinator.submitRoot: rewardsCalculationEndTimestamp cannot be in the future" ); uint32 rootIndex = uint32(_distributionRoots.length); uint32 activatedAt = uint32(block.timestamp) + activationDelay; _distributionRoots.push( DistributionRoot({ root: root, activatedAt: activatedAt, rewardsCalculationEndTimestamp: rewardsCalculationEndTimestamp, disabled: false }) ); currRewardsCalculationEndTimestamp = rewardsCalculationEndTimestamp; emit DistributionRootSubmitted(rootIndex, root, rewardsCalculationEndTimestamp, activatedAt); } /** * @notice allow the rewardsUpdater to disable/cancel a pending root submission in case of an error * @param rootIndex The index of the root to be disabled */ function disableRoot(uint32 rootIndex) external onlyWhenNotPaused(PAUSED_SUBMIT_DISABLE_ROOTS) onlyRewardsUpdater { require(rootIndex < _distributionRoots.length, "RewardsCoordinator.disableRoot: invalid rootIndex"); DistributionRoot storage root = _distributionRoots[rootIndex]; require(!root.disabled, "RewardsCoordinator.disableRoot: root already disabled"); require(block.timestamp < root.activatedAt, "RewardsCoordinator.disableRoot: root already activated"); root.disabled = true; emit DistributionRootDisabled(rootIndex); } /** * @notice Sets the address of the entity that can call `processClaim` on behalf of the earner (msg.sender) * @param claimer The address of the entity that can call `processClaim` on behalf of the earner * @dev Only callable by the `earner` */ function setClaimerFor(address claimer) external { address earner = msg.sender; address prevClaimer = claimerFor[earner]; claimerFor[earner] = claimer; emit ClaimerForSet(earner, prevClaimer, claimer); } /** * @notice Sets the delay in timestamp before a posted root can be claimed against * @dev Only callable by the contract owner * @param _activationDelay The new value for activationDelay */ function setActivationDelay(uint32 _activationDelay) external onlyOwner { _setActivationDelay(_activationDelay); } /** * @notice Sets the global commission for all operators across all avss * @dev Only callable by the contract owner * @param _globalCommissionBips The commission for all operators across all avss */ function setGlobalOperatorCommission(uint16 _globalCommissionBips) external onlyOwner { _setGlobalOperatorCommission(_globalCommissionBips); } /** * @notice Sets the permissioned `rewardsUpdater` address which can post new roots * @dev Only callable by the contract owner * @param _rewardsUpdater The address of the new rewardsUpdater */ function setRewardsUpdater(address _rewardsUpdater) external onlyOwner { _setRewardsUpdater(_rewardsUpdater); } /** * @notice Sets the permissioned `rewardsForAllSubmitter` address which can submit createRewardsForAllSubmission * @dev Only callable by the contract owner * @param _submitter The address of the rewardsForAllSubmitter * @param _newValue The new value for isRewardsForAllSubmitter */ function setRewardsForAllSubmitter(address _submitter, bool _newValue) external onlyOwner { bool prevValue = isRewardsForAllSubmitter[_submitter]; emit RewardsForAllSubmitterSet(_submitter, prevValue, _newValue); isRewardsForAllSubmitter[_submitter] = _newValue; } /** * * INTERNAL FUNCTIONS * */ /** * @notice Validate a RewardsSubmission. Called from both `createAVSRewardsSubmission` and `createRewardsForAllSubmission` */ function _validateRewardsSubmission(RewardsSubmission calldata rewardsSubmission) internal view { require( rewardsSubmission.strategiesAndMultipliers.length > 0, "RewardsCoordinator._validateRewardsSubmission: no strategies set" ); require(rewardsSubmission.amount > 0, "RewardsCoordinator._validateRewardsSubmission: amount cannot be 0"); require( rewardsSubmission.amount <= MAX_REWARDS_AMOUNT, "RewardsCoordinator._validateRewardsSubmission: amount too large" ); require( rewardsSubmission.duration <= MAX_REWARDS_DURATION, "RewardsCoordinator._validateRewardsSubmission: duration exceeds MAX_REWARDS_DURATION" ); require( rewardsSubmission.duration % CALCULATION_INTERVAL_SECONDS == 0, "RewardsCoordinator._validateRewardsSubmission: duration must be a multiple of CALCULATION_INTERVAL_SECONDS" ); require( rewardsSubmission.startTimestamp % CALCULATION_INTERVAL_SECONDS == 0, "RewardsCoordinator._validateRewardsSubmission: startTimestamp must be a multiple of CALCULATION_INTERVAL_SECONDS" ); require( block.timestamp - MAX_RETROACTIVE_LENGTH <= rewardsSubmission.startTimestamp && GENESIS_REWARDS_TIMESTAMP <= rewardsSubmission.startTimestamp, "RewardsCoordinator._validateRewardsSubmission: startTimestamp too far in the past" ); require( rewardsSubmission.startTimestamp <= block.timestamp + MAX_FUTURE_LENGTH, "RewardsCoordinator._validateRewardsSubmission: startTimestamp too far in the future" ); // Require rewardsSubmission is for whitelisted strategy or beaconChainETHStrategy address currAddress = address(0); for (uint256 i = 0; i < rewardsSubmission.strategiesAndMultipliers.length; ++i) { IStrategy strategy = rewardsSubmission.strategiesAndMultipliers[i].strategy; require( strategyManager.strategyIsWhitelistedForDeposit(strategy) || strategy == beaconChainETHStrategy, "RewardsCoordinator._validateRewardsSubmission: invalid strategy considered" ); require( currAddress < address(strategy), "RewardsCoordinator._validateRewardsSubmission: strategies must be in ascending order to handle duplicates" ); currAddress = address(strategy); } } function _checkClaim(RewardsMerkleClaim calldata claim, DistributionRoot memory root) internal view { require(!root.disabled, "RewardsCoordinator._checkClaim: root is disabled"); require(block.timestamp >= root.activatedAt, "RewardsCoordinator._checkClaim: root not activated yet"); require( claim.tokenIndices.length == claim.tokenTreeProofs.length, "RewardsCoordinator._checkClaim: tokenIndices and tokenProofs length mismatch" ); require( claim.tokenTreeProofs.length == claim.tokenLeaves.length, "RewardsCoordinator._checkClaim: tokenTreeProofs and leaves length mismatch" ); // Verify inclusion of earners leaf (earner, earnerTokenRoot) in the distribution root _verifyEarnerClaimProof({ root: root.root, earnerLeafIndex: claim.earnerIndex, earnerProof: claim.earnerTreeProof, earnerLeaf: claim.earnerLeaf }); // For each of the tokenLeaf proofs, verify inclusion of token tree leaf again the earnerTokenRoot for (uint256 i = 0; i < claim.tokenIndices.length; ++i) { _verifyTokenClaimProof({ earnerTokenRoot: claim.earnerLeaf.earnerTokenRoot, tokenLeafIndex: claim.tokenIndices[i], tokenProof: claim.tokenTreeProofs[i], tokenLeaf: claim.tokenLeaves[i] }); } } /** * @notice verify inclusion of the token claim proof in the earner token root hash (earnerTokenRoot). * The token leaf comprises of the IERC20 token and cumulativeAmount of earnings. * @param earnerTokenRoot root hash of the earner token subtree * @param tokenLeafIndex index of the token leaf * @param tokenProof proof of the token leaf in the earner token subtree * @param tokenLeaf token leaf to be verified */ function _verifyTokenClaimProof( bytes32 earnerTokenRoot, uint32 tokenLeafIndex, bytes calldata tokenProof, TokenTreeMerkleLeaf calldata tokenLeaf ) internal pure { // Validate index size so that there aren't multiple valid indices for the given proof // index can't be greater than 2**(tokenProof/32) require( tokenLeafIndex < (1 << (tokenProof.length / 32)), "RewardsCoordinator._verifyTokenClaim: invalid tokenLeafIndex" ); // Verify inclusion of token leaf bytes32 tokenLeafHash = calculateTokenLeafHash(tokenLeaf); require( Merkle.verifyInclusionKeccak({ root: earnerTokenRoot, index: tokenLeafIndex, proof: tokenProof, leaf: tokenLeafHash }), "RewardsCoordinator._verifyTokenClaim: invalid token claim proof" ); } /** * @notice verify inclusion of earner claim proof in the distribution root. This verifies * the inclusion of the earner and earnerTokenRoot hash in the tree. The token claims are proven separately * against the earnerTokenRoot hash (see _verifyTokenClaimProof). The earner leaf comprises of (earner, earnerTokenRoot) * @param root distribution root that should be read from storage * @param earnerLeafIndex index of the earner leaf * @param earnerProof proof of the earners account root in the merkle tree * @param earnerLeaf leaf of earner merkle tree containing the earner address and earner's token root hash */ function _verifyEarnerClaimProof( bytes32 root, uint32 earnerLeafIndex, bytes calldata earnerProof, EarnerTreeMerkleLeaf calldata earnerLeaf ) internal pure { // Validate index size so that there aren't multiple valid indices for the given proof // index can't be greater than 2**(earnerProof/32) require( earnerLeafIndex < (1 << (earnerProof.length / 32)), "RewardsCoordinator._verifyEarnerClaimProof: invalid earnerLeafIndex" ); // Verify inclusion of earner leaf bytes32 earnerLeafHash = calculateEarnerLeafHash(earnerLeaf); // forgefmt: disable-next-item require( Merkle.verifyInclusionKeccak({ root: root, index: earnerLeafIndex, proof: earnerProof, leaf: earnerLeafHash }), "RewardsCoordinator._verifyEarnerClaimProof: invalid earner claim proof" ); } function _setActivationDelay(uint32 _activationDelay) internal { emit ActivationDelaySet(activationDelay, _activationDelay); activationDelay = _activationDelay; } function _setGlobalOperatorCommission(uint16 _globalCommissionBips) internal { emit GlobalCommissionBipsSet(globalOperatorCommissionBips, _globalCommissionBips); globalOperatorCommissionBips = _globalCommissionBips; } function _setRewardsUpdater(address _rewardsUpdater) internal { emit RewardsUpdaterSet(rewardsUpdater, _rewardsUpdater); rewardsUpdater = _rewardsUpdater; } /** * * VIEW FUNCTIONS * */ /// @notice return the hash of the earner's leaf function calculateEarnerLeafHash(EarnerTreeMerkleLeaf calldata leaf) public pure returns (bytes32) { return keccak256(abi.encodePacked(EARNER_LEAF_SALT, leaf.earner, leaf.earnerTokenRoot)); } /// @notice returns the hash of the earner's token leaf function calculateTokenLeafHash(TokenTreeMerkleLeaf calldata leaf) public pure returns (bytes32) { return keccak256(abi.encodePacked(TOKEN_LEAF_SALT, leaf.token, leaf.cumulativeEarnings)); } /// @notice returns 'true' if the claim would currently pass the check in `processClaims` /// but will revert if not valid function checkClaim(RewardsMerkleClaim calldata claim) public view returns (bool) { _checkClaim(claim, _distributionRoots[claim.rootIndex]); return true; } /// @notice the commission for a specific operator for a specific avs /// NOTE: Currently unused and simply returns the globalOperatorCommissionBips value but will be used in future release function operatorCommissionBips(address operator, address avs) external view returns (uint16) { return globalOperatorCommissionBips; } function getDistributionRootsLength() public view returns (uint256) { return _distributionRoots.length; } function getDistributionRootAtIndex(uint256 index) external view returns (DistributionRoot memory) { return _distributionRoots[index]; } /// @notice loop through the distribution roots from reverse and get latest root that is not disabled function getCurrentDistributionRoot() external view returns (DistributionRoot memory) { return _distributionRoots[_distributionRoots.length - 1]; } /// @notice loop through the distribution roots from reverse and get latest root that is not disabled and activated /// i.e. a root that can be claimed against function getCurrentClaimableDistributionRoot() external view returns (DistributionRoot memory) { for (uint256 i = _distributionRoots.length; i > 0; i--) { DistributionRoot memory root = _distributionRoots[i - 1]; if (!root.disabled && block.timestamp >= root.activatedAt) { return root; } } } /// @notice loop through distribution roots from reverse and return hash function getRootIndexFromHash(bytes32 rootHash) public view returns (uint32) { for (uint32 i = uint32(_distributionRoots.length); i > 0; i--) { if (_distributionRoots[i - 1].root == rootHash) { return i - 1; } } revert("RewardsCoordinator.getRootIndexFromHash: root not found"); } /** * @notice Getter function for the current EIP-712 domain separator for this contract. * * @dev The domain separator will change in the event of a fork that changes the ChainID. * @dev By introducing a domain separator the DApp developers are guaranteed that there can be no signature collision. * for more detailed information please read EIP-712. */ function domainSeparator() public view returns (bytes32) { if (block.chainid == ORIGINAL_CHAIN_ID) { return _DOMAIN_SEPARATOR; } else { return _calculateDomainSeparator(); } } /** * @dev Recalculates the domain separator when the chainid changes due to a fork. */ function _calculateDomainSeparator() internal view returns (bytes32) { return keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes("EigenLayer")), block.chainid, address(this))); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic 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}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; 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 // Adapted from OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library Merkle { /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * * Note this is for a Merkle tree using the keccak/sha3 hash function */ function verifyInclusionKeccak( bytes memory proof, bytes32 root, bytes32 leaf, uint256 index ) internal pure returns (bool) { return processInclusionProofKeccak(proof, leaf, index) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * @dev If the proof length is 0 then the leaf hash is returned. * * _Available since v4.4._ * * Note this is for a Merkle tree using the keccak/sha3 hash function */ function processInclusionProofKeccak( bytes memory proof, bytes32 leaf, uint256 index ) internal pure returns (bytes32) { require(proof.length % 32 == 0, "Merkle.processInclusionProofKeccak: proof length should be a multiple of 32"); bytes32 computedHash = leaf; for (uint256 i = 32; i <= proof.length; i += 32) { if (index % 2 == 0) { // if ith bit of index is 0, then computedHash is a left sibling assembly { mstore(0x00, computedHash) mstore(0x20, mload(add(proof, i))) computedHash := keccak256(0x00, 0x40) index := div(index, 2) } } else { // if ith bit of index is 1, then computedHash is a right sibling assembly { mstore(0x00, mload(add(proof, i))) mstore(0x20, computedHash) computedHash := keccak256(0x00, 0x40) index := div(index, 2) } } } return computedHash; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * * Note this is for a Merkle tree using the sha256 hash function */ function verifyInclusionSha256( bytes memory proof, bytes32 root, bytes32 leaf, uint256 index ) internal view returns (bool) { return processInclusionProofSha256(proof, leaf, index) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * * _Available since v4.4._ * * Note this is for a Merkle tree using the sha256 hash function */ function processInclusionProofSha256( bytes memory proof, bytes32 leaf, uint256 index ) internal view returns (bytes32) { require( proof.length != 0 && proof.length % 32 == 0, "Merkle.processInclusionProofSha256: proof length should be a non-zero multiple of 32" ); bytes32[1] memory computedHash = [leaf]; for (uint256 i = 32; i <= proof.length; i += 32) { if (index % 2 == 0) { // if ith bit of index is 0, then computedHash is a left sibling assembly { mstore(0x00, mload(computedHash)) mstore(0x20, mload(add(proof, i))) if iszero(staticcall(sub(gas(), 2000), 2, 0x00, 0x40, computedHash, 0x20)) { revert(0, 0) } index := div(index, 2) } } else { // if ith bit of index is 1, then computedHash is a right sibling assembly { mstore(0x00, mload(add(proof, i))) mstore(0x20, mload(computedHash)) if iszero(staticcall(sub(gas(), 2000), 2, 0x00, 0x40, computedHash, 0x20)) { revert(0, 0) } index := div(index, 2) } } } return computedHash[0]; } /** * @notice this function returns the merkle root of a tree created from a set of leaves using sha256 as its hash function * @param leaves the leaves of the merkle tree * @return The computed Merkle root of the tree. * @dev A pre-condition to this function is that leaves.length is a power of two. If not, the function will merkleize the inputs incorrectly. */ function merkleizeSha256(bytes32[] memory leaves) internal pure returns (bytes32) { //there are half as many nodes in the layer above the leaves uint256 numNodesInLayer = leaves.length / 2; //create a layer to store the internal nodes bytes32[] memory layer = new bytes32[](numNodesInLayer); //fill the layer with the pairwise hashes of the leaves for (uint256 i = 0; i < numNodesInLayer; i++) { layer[i] = sha256(abi.encodePacked(leaves[2 * i], leaves[2 * i + 1])); } //the next layer above has half as many nodes numNodesInLayer /= 2; //while we haven't computed the root while (numNodesInLayer != 0) { //overwrite the first numNodesInLayer nodes in layer with the pairwise hashes of their children for (uint256 i = 0; i < numNodesInLayer; i++) { layer[i] = sha256(abi.encodePacked(layer[2 * i], layer[2 * i + 1])); } //the next layer above has half as many nodes numNodesInLayer /= 2; } //the first node in the layer is the root return layer[0]; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.12; import "../interfaces/IPausable.sol"; /** * @title Adds pausability to a contract, with pausing & unpausing controlled by the `pauser` and `unpauser` of a PauserRegistry contract. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice Contracts that inherit from this contract may define their own `pause` and `unpause` (and/or related) functions. * These functions should be permissioned as "onlyPauser" which defers to a `PauserRegistry` for determining access control. * @dev Pausability is implemented using a uint256, which allows up to 256 different single bit-flags; each bit can potentially pause different functionality. * Inspiration for this was taken from the NearBridge design here https://etherscan.io/address/0x3FEFc5A4B1c02f21cBc8D3613643ba0635b9a873#code. * For the `pause` and `unpause` functions we've implemented, if you pause, you can only flip (any number of) switches to on/1 (aka "paused"), and if you unpause, * you can only flip (any number of) switches to off/0 (aka "paused"). * If you want a pauseXYZ function that just flips a single bit / "pausing flag", it will: * 1) 'bit-wise and' (aka `&`) a flag with the current paused state (as a uint256) * 2) update the paused state to this new value * @dev We note as well that we have chosen to identify flags by their *bit index* as opposed to their numerical value, so, e.g. defining `DEPOSITS_PAUSED = 3` * indicates specifically that if the *third bit* of `_paused` is flipped -- i.e. it is a '1' -- then deposits should be paused */ contract Pausable is IPausable { /// @notice Address of the `PauserRegistry` contract that this contract defers to for determining access control (for pausing). IPauserRegistry public pauserRegistry; /// @dev whether or not the contract is currently paused uint256 private _paused; uint256 internal constant UNPAUSE_ALL = 0; uint256 internal constant PAUSE_ALL = type(uint256).max; /// @notice modifier onlyPauser() { require(pauserRegistry.isPauser(msg.sender), "msg.sender is not permissioned as pauser"); _; } modifier onlyUnpauser() { require(msg.sender == pauserRegistry.unpauser(), "msg.sender is not permissioned as unpauser"); _; } /// @notice Throws if the contract is paused, i.e. if any of the bits in `_paused` is flipped to 1. modifier whenNotPaused() { require(_paused == 0, "Pausable: contract is paused"); _; } /// @notice Throws if the `indexed`th bit of `_paused` is 1, i.e. if the `index`th pause switch is flipped. modifier onlyWhenNotPaused(uint8 index) { require(!paused(index), "Pausable: index is paused"); _; } /// @notice One-time function for setting the `pauserRegistry` and initializing the value of `_paused`. function _initializePauser(IPauserRegistry _pauserRegistry, uint256 initPausedStatus) internal { require( address(pauserRegistry) == address(0) && address(_pauserRegistry) != address(0), "Pausable._initializePauser: _initializePauser() can only be called once" ); _paused = initPausedStatus; emit Paused(msg.sender, initPausedStatus); _setPauserRegistry(_pauserRegistry); } /** * @notice This function is used to pause an EigenLayer contract's functionality. * It is permissioned to the `pauser` address, which is expected to be a low threshold multisig. * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once. * @dev This function can only pause functionality, and thus cannot 'unflip' any bit in `_paused` from 1 to 0. */ function pause(uint256 newPausedStatus) external onlyPauser { // verify that the `newPausedStatus` does not *unflip* any bits (i.e. doesn't unpause anything, all 1 bits remain) require((_paused & newPausedStatus) == _paused, "Pausable.pause: invalid attempt to unpause functionality"); _paused = newPausedStatus; emit Paused(msg.sender, newPausedStatus); } /** * @notice Alias for `pause(type(uint256).max)`. */ function pauseAll() external onlyPauser { _paused = type(uint256).max; emit Paused(msg.sender, type(uint256).max); } /** * @notice This function is used to unpause an EigenLayer contract's functionality. * It is permissioned to the `unpauser` address, which is expected to be a high threshold multisig or governance contract. * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once. * @dev This function can only unpause functionality, and thus cannot 'flip' any bit in `_paused` from 0 to 1. */ function unpause(uint256 newPausedStatus) external onlyUnpauser { // verify that the `newPausedStatus` does not *flip* any bits (i.e. doesn't pause anything, all 0 bits remain) require( ((~_paused) & (~newPausedStatus)) == (~_paused), "Pausable.unpause: invalid attempt to pause functionality" ); _paused = newPausedStatus; emit Unpaused(msg.sender, newPausedStatus); } /// @notice Returns the current paused status as a uint256. function paused() public view virtual returns (uint256) { return _paused; } /// @notice Returns 'true' if the `indexed`th bit of `_paused` is 1, and 'false' otherwise function paused(uint8 index) public view virtual returns (bool) { uint256 mask = 1 << index; return ((_paused & mask) == mask); } /// @notice Allows the unpauser to set a new pauser registry function setPauserRegistry(IPauserRegistry newPauserRegistry) external onlyUnpauser { _setPauserRegistry(newPauserRegistry); } /// internal function for setting pauser registry function _setPauserRegistry(IPauserRegistry newPauserRegistry) internal { require( address(newPauserRegistry) != address(0), "Pausable._setPauserRegistry: newPauserRegistry cannot be the zero address" ); emit PauserRegistrySet(pauserRegistry, newPauserRegistry); pauserRegistry = newPauserRegistry; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[48] private __gap; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.12; import "../interfaces/IStrategyManager.sol"; import "../interfaces/IDelegationManager.sol"; import "../interfaces/IRewardsCoordinator.sol"; /** * @title Storage variables for the `RewardsCoordinator` contract. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice This storage contract is separate from the logic to simplify the upgrade process. */ abstract contract RewardsCoordinatorStorage is IRewardsCoordinator { /** * * CONSTANTS AND IMMUTABLES * */ /// @notice The interval in seconds at which the calculation for rewards distribution is done. /// @dev RewardsSubmission durations must be multiples of this interval. This is going to be configured to 1 week uint32 public immutable CALCULATION_INTERVAL_SECONDS; /// @notice The maximum amount of time (seconds) that a rewards submission can span over uint32 public immutable MAX_REWARDS_DURATION; /// @notice max amount of time (seconds) that a rewards submission can start in the past uint32 public immutable MAX_RETROACTIVE_LENGTH; /// @notice max amount of time (seconds) that a rewards submission can start in the future uint32 public immutable MAX_FUTURE_LENGTH; /// @notice absolute min timestamp (seconds) that a rewards submission can start at uint32 public immutable GENESIS_REWARDS_TIMESTAMP; /// @notice The cadence at which a snapshot is taken offchain for calculating rewards distributions uint32 internal constant SNAPSHOT_CADENCE = 1 days; /// @notice The DelegationManager contract for EigenLayer IDelegationManager public immutable delegationManager; /// @notice The StrategyManager contract for EigenLayer IStrategyManager public immutable strategyManager; /** * * STORAGE * */ /** * @notice Original EIP-712 Domain separator for this contract. * @dev The domain separator may change in the event of a fork that modifies the ChainID. * Use the getter function `domainSeparator` to get the current domain separator for this contract. */ bytes32 internal _DOMAIN_SEPARATOR; /** * @notice List of roots submited by the rewardsUpdater * @dev Array is internal with an external getter so we can return a `DistributionRoot[] memory` object */ DistributionRoot[] internal _distributionRoots; /// Slot 3 /// @notice The address of the entity that can update the contract with new merkle roots address public rewardsUpdater; /// @notice Delay in timestamp (seconds) before a posted root can be claimed against uint32 public activationDelay; /// @notice Timestamp for last submitted DistributionRoot uint32 public currRewardsCalculationEndTimestamp; /// Slot 4 /// @notice the commission for all operators across all avss uint16 public globalOperatorCommissionBips; /// @notice Mapping: earner => the address of the entity who can call `processClaim` on behalf of the earner mapping(address => address) public claimerFor; /// @notice Mapping: earner => token => total amount claimed mapping(address => mapping(IERC20 => uint256)) public cumulativeClaimed; /// @notice Used for unique rewardsSubmissionHashes per AVS and for RewardsForAllSubmitters mapping(address => uint256) public submissionNonce; /// @notice Mapping: avs => avsRewardsSubmissionHash => bool to check if rewards submission hash has been submitted mapping(address => mapping(bytes32 => bool)) public isAVSRewardsSubmissionHash; /// @notice Mapping: avs => rewardsSubmissionForALlHash => bool to check if rewards submission hash for all has been submitted mapping(address => mapping(bytes32 => bool)) public isRewardsSubmissionForAllHash; /// @notice Mapping: address => bool to check if the address is permissioned to call createRewardsForAllSubmission mapping(address => bool) public isRewardsForAllSubmitter; constructor( IDelegationManager _delegationManager, IStrategyManager _strategyManager, uint32 _CALCULATION_INTERVAL_SECONDS, uint32 _MAX_REWARDS_DURATION, uint32 _MAX_RETROACTIVE_LENGTH, uint32 _MAX_FUTURE_LENGTH, uint32 _GENESIS_REWARDS_TIMESTAMP ) { require( _GENESIS_REWARDS_TIMESTAMP % _CALCULATION_INTERVAL_SECONDS == 0, "RewardsCoordinator: GENESIS_REWARDS_TIMESTAMP must be a multiple of CALCULATION_INTERVAL_SECONDS" ); require( _CALCULATION_INTERVAL_SECONDS % SNAPSHOT_CADENCE == 0, "RewardsCoordinator: CALCULATION_INTERVAL_SECONDS must be a multiple of SNAPSHOT_CADENCE" ); delegationManager = _delegationManager; strategyManager = _strategyManager; CALCULATION_INTERVAL_SECONDS = _CALCULATION_INTERVAL_SECONDS; MAX_REWARDS_DURATION = _MAX_REWARDS_DURATION; MAX_RETROACTIVE_LENGTH = _MAX_RETROACTIVE_LENGTH; MAX_FUTURE_LENGTH = _MAX_FUTURE_LENGTH; GENESIS_REWARDS_TIMESTAMP = _GENESIS_REWARDS_TIMESTAMP; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[40] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @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.1; /** * @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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "../interfaces/IPauserRegistry.sol"; /** * @title Adds pausability to a contract, with pausing & unpausing controlled by the `pauser` and `unpauser` of a PauserRegistry contract. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice Contracts that inherit from this contract may define their own `pause` and `unpause` (and/or related) functions. * These functions should be permissioned as "onlyPauser" which defers to a `PauserRegistry` for determining access control. * @dev Pausability is implemented using a uint256, which allows up to 256 different single bit-flags; each bit can potentially pause different functionality. * Inspiration for this was taken from the NearBridge design here https://etherscan.io/address/0x3FEFc5A4B1c02f21cBc8D3613643ba0635b9a873#code. * For the `pause` and `unpause` functions we've implemented, if you pause, you can only flip (any number of) switches to on/1 (aka "paused"), and if you unpause, * you can only flip (any number of) switches to off/0 (aka "paused"). * If you want a pauseXYZ function that just flips a single bit / "pausing flag", it will: * 1) 'bit-wise and' (aka `&`) a flag with the current paused state (as a uint256) * 2) update the paused state to this new value * @dev We note as well that we have chosen to identify flags by their *bit index* as opposed to their numerical value, so, e.g. defining `DEPOSITS_PAUSED = 3` * indicates specifically that if the *third bit* of `_paused` is flipped -- i.e. it is a '1' -- then deposits should be paused */ interface IPausable { /// @notice Emitted when the `pauserRegistry` is set to `newPauserRegistry`. event PauserRegistrySet(IPauserRegistry pauserRegistry, IPauserRegistry newPauserRegistry); /// @notice Emitted when the pause is triggered by `account`, and changed to `newPausedStatus`. event Paused(address indexed account, uint256 newPausedStatus); /// @notice Emitted when the pause is lifted by `account`, and changed to `newPausedStatus`. event Unpaused(address indexed account, uint256 newPausedStatus); /// @notice Address of the `PauserRegistry` contract that this contract defers to for determining access control (for pausing). function pauserRegistry() external view returns (IPauserRegistry); /** * @notice This function is used to pause an EigenLayer contract's functionality. * It is permissioned to the `pauser` address, which is expected to be a low threshold multisig. * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once. * @dev This function can only pause functionality, and thus cannot 'unflip' any bit in `_paused` from 1 to 0. */ function pause(uint256 newPausedStatus) external; /** * @notice Alias for `pause(type(uint256).max)`. */ function pauseAll() external; /** * @notice This function is used to unpause an EigenLayer contract's functionality. * It is permissioned to the `unpauser` address, which is expected to be a high threshold multisig or governance contract. * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once. * @dev This function can only unpause functionality, and thus cannot 'flip' any bit in `_paused` from 0 to 1. */ function unpause(uint256 newPausedStatus) external; /// @notice Returns the current paused status as a uint256. function paused() external view returns (uint256); /// @notice Returns 'true' if the `indexed`th bit of `_paused` is 1, and 'false' otherwise function paused(uint8 index) external view returns (bool); /// @notice Allows the unpauser to set a new pauser registry function setPauserRegistry(IPauserRegistry newPauserRegistry) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "./IStrategy.sol"; import "./ISlasher.sol"; import "./IDelegationManager.sol"; import "./IEigenPodManager.sol"; /** * @title Interface for the primary entrypoint for funds into EigenLayer. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice See the `StrategyManager` contract itself for implementation details. */ interface IStrategyManager { /** * @notice Emitted when a new deposit occurs on behalf of `staker`. * @param staker Is the staker who is depositing funds into EigenLayer. * @param strategy Is the strategy that `staker` has deposited into. * @param token Is the token that `staker` deposited. * @param shares Is the number of new shares `staker` has been granted in `strategy`. */ event Deposit(address staker, IERC20 token, IStrategy strategy, uint256 shares); /// @notice Emitted when `thirdPartyTransfersForbidden` is updated for a strategy and value by the owner event UpdatedThirdPartyTransfersForbidden(IStrategy strategy, bool value); /// @notice Emitted when the `strategyWhitelister` is changed event StrategyWhitelisterChanged(address previousAddress, address newAddress); /// @notice Emitted when a strategy is added to the approved list of strategies for deposit event StrategyAddedToDepositWhitelist(IStrategy strategy); /// @notice Emitted when a strategy is removed from the approved list of strategies for deposit event StrategyRemovedFromDepositWhitelist(IStrategy strategy); /** * @notice Deposits `amount` of `token` into the specified `strategy`, with the resultant shares credited to `msg.sender` * @param strategy is the specified strategy where deposit is to be made, * @param token is the denomination in which the deposit is to be made, * @param amount is the amount of token to be deposited in the strategy by the staker * @return shares The amount of new shares in the `strategy` created as part of the action. * @dev The `msg.sender` must have previously approved this contract to transfer at least `amount` of `token` on their behalf. * @dev Cannot be called by an address that is 'frozen' (this function will revert if the `msg.sender` is frozen). * * WARNING: Depositing tokens that allow reentrancy (eg. ERC-777) into a strategy is not recommended. This can lead to attack vectors * where the token balance and corresponding strategy shares are not in sync upon reentrancy. */ function depositIntoStrategy(IStrategy strategy, IERC20 token, uint256 amount) external returns (uint256 shares); /** * @notice Used for depositing an asset into the specified strategy with the resultant shares credited to `staker`, * who must sign off on the action. * Note that the assets are transferred out/from the `msg.sender`, not from the `staker`; this function is explicitly designed * purely to help one address deposit 'for' another. * @param strategy is the specified strategy where deposit is to be made, * @param token is the denomination in which the deposit is to be made, * @param amount is the amount of token to be deposited in the strategy by the staker * @param staker the staker that the deposited assets will be credited to * @param expiry the timestamp at which the signature expires * @param signature is a valid signature from the `staker`. either an ECDSA signature if the `staker` is an EOA, or data to forward * following EIP-1271 if the `staker` is a contract * @return shares The amount of new shares in the `strategy` created as part of the action. * @dev The `msg.sender` must have previously approved this contract to transfer at least `amount` of `token` on their behalf. * @dev A signature is required for this function to eliminate the possibility of griefing attacks, specifically those * targeting stakers who may be attempting to undelegate. * @dev Cannot be called if thirdPartyTransfersForbidden is set to true for this strategy * * WARNING: Depositing tokens that allow reentrancy (eg. ERC-777) into a strategy is not recommended. This can lead to attack vectors * where the token balance and corresponding strategy shares are not in sync upon reentrancy */ function depositIntoStrategyWithSignature( IStrategy strategy, IERC20 token, uint256 amount, address staker, uint256 expiry, bytes memory signature ) external returns (uint256 shares); /// @notice Used by the DelegationManager to remove a Staker's shares from a particular strategy when entering the withdrawal queue function removeShares(address staker, IStrategy strategy, uint256 shares) external; /// @notice Used by the DelegationManager to award a Staker some shares that have passed through the withdrawal queue function addShares(address staker, IERC20 token, IStrategy strategy, uint256 shares) external; /// @notice Used by the DelegationManager to convert withdrawn shares to tokens and send them to a recipient function withdrawSharesAsTokens(address recipient, IStrategy strategy, uint256 shares, IERC20 token) external; /// @notice Returns the current shares of `user` in `strategy` function stakerStrategyShares(address user, IStrategy strategy) external view returns (uint256 shares); /** * @notice Get all details on the staker's deposits and corresponding shares * @return (staker's strategies, shares in these strategies) */ function getDeposits(address staker) external view returns (IStrategy[] memory, uint256[] memory); /// @notice Simple getter function that returns `stakerStrategyList[staker].length`. function stakerStrategyListLength(address staker) external view returns (uint256); /** * @notice Owner-only function that adds the provided Strategies to the 'whitelist' of strategies that stakers can deposit into * @param strategiesToWhitelist Strategies that will be added to the `strategyIsWhitelistedForDeposit` mapping (if they aren't in it already) * @param thirdPartyTransfersForbiddenValues bool values to set `thirdPartyTransfersForbidden` to for each strategy */ function addStrategiesToDepositWhitelist( IStrategy[] calldata strategiesToWhitelist, bool[] calldata thirdPartyTransfersForbiddenValues ) external; /** * @notice Owner-only function that removes the provided Strategies from the 'whitelist' of strategies that stakers can deposit into * @param strategiesToRemoveFromWhitelist Strategies that will be removed to the `strategyIsWhitelistedForDeposit` mapping (if they are in it) */ function removeStrategiesFromDepositWhitelist(IStrategy[] calldata strategiesToRemoveFromWhitelist) external; /// @notice Returns the single, central Delegation contract of EigenLayer function delegation() external view returns (IDelegationManager); /// @notice Returns the single, central Slasher contract of EigenLayer function slasher() external view returns (ISlasher); /// @notice Returns the EigenPodManager contract of EigenLayer function eigenPodManager() external view returns (IEigenPodManager); /// @notice Returns the address of the `strategyWhitelister` function strategyWhitelister() external view returns (address); /// @notice Returns bool for whether or not `strategy` is whitelisted for deposit function strategyIsWhitelistedForDeposit(IStrategy strategy) external view returns (bool); /** * @notice Returns bool for whether or not `strategy` enables credit transfers. i.e enabling * depositIntoStrategyWithSignature calls or queueing withdrawals to a different address than the staker. */ function thirdPartyTransfersForbidden(IStrategy strategy) external view returns (bool); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "./IStrategy.sol"; import "./ISignatureUtils.sol"; /** * @title DelegationManager * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice This is the contract for delegation in EigenLayer. The main functionalities of this contract are * - enabling anyone to register as an operator in EigenLayer * - allowing operators to specify parameters related to stakers who delegate to them * - enabling any staker to delegate its stake to the operator of its choice (a given staker can only delegate to a single operator at a time) * - enabling a staker to undelegate its assets from the operator it is delegated to (performed as part of the withdrawal process, initiated through the StrategyManager) */ interface IDelegationManager is ISignatureUtils { // @notice Struct used for storing information about a single operator who has registered with EigenLayer struct OperatorDetails { /// @notice DEPRECATED -- this field is no longer used, payments are handled in PaymentCoordinator.sol address __deprecated_earningsReceiver; /** * @notice Address to verify signatures when a staker wishes to delegate to the operator, as well as controlling "forced undelegations". * @dev Signature verification follows these rules: * 1) If this address is left as address(0), then any staker will be free to delegate to the operator, i.e. no signature verification will be performed. * 2) If this address is an EOA (i.e. it has no code), then we follow standard ECDSA signature verification for delegations to the operator. * 3) If this address is a contract (i.e. it has code) then we forward a call to the contract and verify that it returns the correct EIP-1271 "magic value". */ address delegationApprover; /** * @notice A minimum delay -- measured in blocks -- enforced between: * 1) the operator signalling their intent to register for a service, via calling `Slasher.optIntoSlashing` * and * 2) the operator completing registration for the service, via the service ultimately calling `Slasher.recordFirstStakeUpdate` * @dev note that for a specific operator, this value *cannot decrease*, i.e. if the operator wishes to modify their OperatorDetails, * then they are only allowed to either increase this value or keep it the same. */ uint32 stakerOptOutWindowBlocks; } /** * @notice Abstract struct used in calculating an EIP712 signature for a staker to approve that they (the staker themselves) delegate to a specific operator. * @dev Used in computing the `STAKER_DELEGATION_TYPEHASH` and as a reference in the computation of the stakerDigestHash in the `delegateToBySignature` function. */ struct StakerDelegation { // the staker who is delegating address staker; // the operator being delegated to address operator; // the staker's nonce uint256 nonce; // the expiration timestamp (UTC) of the signature uint256 expiry; } /** * @notice Abstract struct used in calculating an EIP712 signature for an operator's delegationApprover to approve that a specific staker delegate to the operator. * @dev Used in computing the `DELEGATION_APPROVAL_TYPEHASH` and as a reference in the computation of the approverDigestHash in the `_delegate` function. */ struct DelegationApproval { // the staker who is delegating address staker; // the operator being delegated to address operator; // the operator's provided salt bytes32 salt; // the expiration timestamp (UTC) of the signature uint256 expiry; } /** * Struct type used to specify an existing queued withdrawal. Rather than storing the entire struct, only a hash is stored. * In functions that operate on existing queued withdrawals -- e.g. completeQueuedWithdrawal`, the data is resubmitted and the hash of the submitted * data is computed by `calculateWithdrawalRoot` and checked against the stored hash in order to confirm the integrity of the submitted data. */ struct Withdrawal { // The address that originated the Withdrawal address staker; // The address that the staker was delegated to at the time that the Withdrawal was created address delegatedTo; // The address that can complete the Withdrawal + will receive funds when completing the withdrawal address withdrawer; // Nonce used to guarantee that otherwise identical withdrawals have unique hashes uint256 nonce; // Block number when the Withdrawal was created uint32 startBlock; // Array of strategies that the Withdrawal contains IStrategy[] strategies; // Array containing the amount of shares in each Strategy in the `strategies` array uint256[] shares; } struct QueuedWithdrawalParams { // Array of strategies that the QueuedWithdrawal contains IStrategy[] strategies; // Array containing the amount of shares in each Strategy in the `strategies` array uint256[] shares; // The address of the withdrawer address withdrawer; } // @notice Emitted when a new operator registers in EigenLayer and provides their OperatorDetails. event OperatorRegistered(address indexed operator, OperatorDetails operatorDetails); /// @notice Emitted when an operator updates their OperatorDetails to @param newOperatorDetails event OperatorDetailsModified(address indexed operator, OperatorDetails newOperatorDetails); /** * @notice Emitted when @param operator indicates that they are updating their MetadataURI string * @dev Note that these strings are *never stored in storage* and are instead purely emitted in events for off-chain indexing */ event OperatorMetadataURIUpdated(address indexed operator, string metadataURI); /// @notice Emitted whenever an operator's shares are increased for a given strategy. Note that shares is the delta in the operator's shares. event OperatorSharesIncreased(address indexed operator, address staker, IStrategy strategy, uint256 shares); /// @notice Emitted whenever an operator's shares are decreased for a given strategy. Note that shares is the delta in the operator's shares. event OperatorSharesDecreased(address indexed operator, address staker, IStrategy strategy, uint256 shares); /// @notice Emitted when @param staker delegates to @param operator. event StakerDelegated(address indexed staker, address indexed operator); /// @notice Emitted when @param staker undelegates from @param operator. event StakerUndelegated(address indexed staker, address indexed operator); /// @notice Emitted when @param staker is undelegated via a call not originating from the staker themself event StakerForceUndelegated(address indexed staker, address indexed operator); /** * @notice Emitted when a new withdrawal is queued. * @param withdrawalRoot Is the hash of the `withdrawal`. * @param withdrawal Is the withdrawal itself. */ event WithdrawalQueued(bytes32 withdrawalRoot, Withdrawal withdrawal); /// @notice Emitted when a queued withdrawal is completed event WithdrawalCompleted(bytes32 withdrawalRoot); /// @notice Emitted when the `minWithdrawalDelayBlocks` variable is modified from `previousValue` to `newValue`. event MinWithdrawalDelayBlocksSet(uint256 previousValue, uint256 newValue); /// @notice Emitted when the `strategyWithdrawalDelayBlocks` variable is modified from `previousValue` to `newValue`. event StrategyWithdrawalDelayBlocksSet(IStrategy strategy, uint256 previousValue, uint256 newValue); /** * @notice Registers the caller as an operator in EigenLayer. * @param registeringOperatorDetails is the `OperatorDetails` for the operator. * @param metadataURI is a URI for the operator's metadata, i.e. a link providing more details on the operator. * * @dev Once an operator is registered, they cannot 'deregister' as an operator, and they will forever be considered "delegated to themself". * @dev Note that the `metadataURI` is *never stored * and is only emitted in the `OperatorMetadataURIUpdated` event */ function registerAsOperator( OperatorDetails calldata registeringOperatorDetails, string calldata metadataURI ) external; /** * @notice Updates an operator's stored `OperatorDetails`. * @param newOperatorDetails is the updated `OperatorDetails` for the operator, to replace their current OperatorDetails`. * * @dev The caller must have previously registered as an operator in EigenLayer. */ function modifyOperatorDetails(OperatorDetails calldata newOperatorDetails) external; /** * @notice Called by an operator to emit an `OperatorMetadataURIUpdated` event indicating the information has updated. * @param metadataURI The URI for metadata associated with an operator * @dev Note that the `metadataURI` is *never stored * and is only emitted in the `OperatorMetadataURIUpdated` event */ function updateOperatorMetadataURI(string calldata metadataURI) external; /** * @notice Caller delegates their stake to an operator. * @param operator The account (`msg.sender`) is delegating its assets to for use in serving applications built on EigenLayer. * @param approverSignatureAndExpiry Verifies the operator approves of this delegation * @param approverSalt A unique single use value tied to an individual signature. * @dev The approverSignatureAndExpiry is used in the event that: * 1) the operator's `delegationApprover` address is set to a non-zero value. * AND * 2) neither the operator nor their `delegationApprover` is the `msg.sender`, since in the event that the operator * or their delegationApprover is the `msg.sender`, then approval is assumed. * @dev In the event that `approverSignatureAndExpiry` is not checked, its content is ignored entirely; it's recommended to use an empty input * in this case to save on complexity + gas costs */ function delegateTo( address operator, SignatureWithExpiry memory approverSignatureAndExpiry, bytes32 approverSalt ) external; /** * @notice Caller delegates a staker's stake to an operator with valid signatures from both parties. * @param staker The account delegating stake to an `operator` account * @param operator The account (`staker`) is delegating its assets to for use in serving applications built on EigenLayer. * @param stakerSignatureAndExpiry Signed data from the staker authorizing delegating stake to an operator * @param approverSignatureAndExpiry is a parameter that will be used for verifying that the operator approves of this delegation action in the event that: * @param approverSalt Is a salt used to help guarantee signature uniqueness. Each salt can only be used once by a given approver. * * @dev If `staker` is an EOA, then `stakerSignature` is verified to be a valid ECDSA stakerSignature from `staker`, indicating their intention for this action. * @dev If `staker` is a contract, then `stakerSignature` will be checked according to EIP-1271. * @dev the operator's `delegationApprover` address is set to a non-zero value. * @dev neither the operator nor their `delegationApprover` is the `msg.sender`, since in the event that the operator or their delegationApprover * is the `msg.sender`, then approval is assumed. * @dev This function will revert if the current `block.timestamp` is equal to or exceeds the expiry * @dev In the case that `approverSignatureAndExpiry` is not checked, its content is ignored entirely; it's recommended to use an empty input * in this case to save on complexity + gas costs */ function delegateToBySignature( address staker, address operator, SignatureWithExpiry memory stakerSignatureAndExpiry, SignatureWithExpiry memory approverSignatureAndExpiry, bytes32 approverSalt ) external; /** * @notice Undelegates the staker from the operator who they are delegated to. Puts the staker into the "undelegation limbo" mode of the EigenPodManager * and queues a withdrawal of all of the staker's shares in the StrategyManager (to the staker), if necessary. * @param staker The account to be undelegated. * @return withdrawalRoot The root of the newly queued withdrawal, if a withdrawal was queued. Otherwise just bytes32(0). * * @dev Reverts if the `staker` is also an operator, since operators are not allowed to undelegate from themselves. * @dev Reverts if the caller is not the staker, nor the operator who the staker is delegated to, nor the operator's specified "delegationApprover" * @dev Reverts if the `staker` is already undelegated. */ function undelegate(address staker) external returns (bytes32[] memory withdrawalRoot); /** * Allows a staker to withdraw some shares. Withdrawn shares/strategies are immediately removed * from the staker. If the staker is delegated, withdrawn shares/strategies are also removed from * their operator. * * All withdrawn shares/strategies are placed in a queue and can be fully withdrawn after a delay. */ function queueWithdrawals(QueuedWithdrawalParams[] calldata queuedWithdrawalParams) external returns (bytes32[] memory); /** * @notice Used to complete the specified `withdrawal`. The caller must match `withdrawal.withdrawer` * @param withdrawal The Withdrawal to complete. * @param tokens Array in which the i-th entry specifies the `token` input to the 'withdraw' function of the i-th Strategy in the `withdrawal.strategies` array. * This input can be provided with zero length if `receiveAsTokens` is set to 'false' (since in that case, this input will be unused) * @param middlewareTimesIndex is the index in the operator that the staker who triggered the withdrawal was delegated to's middleware times array * @param receiveAsTokens If true, the shares specified in the withdrawal will be withdrawn from the specified strategies themselves * and sent to the caller, through calls to `withdrawal.strategies[i].withdraw`. If false, then the shares in the specified strategies * will simply be transferred to the caller directly. * @dev middlewareTimesIndex should be calculated off chain before calling this function by finding the first index that satisfies `slasher.canWithdraw` * @dev beaconChainETHStrategy shares are non-transferrable, so if `receiveAsTokens = false` and `withdrawal.withdrawer != withdrawal.staker`, note that * any beaconChainETHStrategy shares in the `withdrawal` will be _returned to the staker_, rather than transferred to the withdrawer, unlike shares in * any other strategies, which will be transferred to the withdrawer. */ function completeQueuedWithdrawal( Withdrawal calldata withdrawal, IERC20[] calldata tokens, uint256 middlewareTimesIndex, bool receiveAsTokens ) external; /** * @notice Array-ified version of `completeQueuedWithdrawal`. * Used to complete the specified `withdrawals`. The function caller must match `withdrawals[...].withdrawer` * @param withdrawals The Withdrawals to complete. * @param tokens Array of tokens for each Withdrawal. See `completeQueuedWithdrawal` for the usage of a single array. * @param middlewareTimesIndexes One index to reference per Withdrawal. See `completeQueuedWithdrawal` for the usage of a single index. * @param receiveAsTokens Whether or not to complete each withdrawal as tokens. See `completeQueuedWithdrawal` for the usage of a single boolean. * @dev See `completeQueuedWithdrawal` for relevant dev tags */ function completeQueuedWithdrawals( Withdrawal[] calldata withdrawals, IERC20[][] calldata tokens, uint256[] calldata middlewareTimesIndexes, bool[] calldata receiveAsTokens ) external; /** * @notice Increases a staker's delegated share balance in a strategy. * @param staker The address to increase the delegated shares for their operator. * @param strategy The strategy in which to increase the delegated shares. * @param shares The number of shares to increase. * * @dev *If the staker is actively delegated*, then increases the `staker`'s delegated shares in `strategy` by `shares`. Otherwise does nothing. * @dev Callable only by the StrategyManager or EigenPodManager. */ function increaseDelegatedShares(address staker, IStrategy strategy, uint256 shares) external; /** * @notice Decreases a staker's delegated share balance in a strategy. * @param staker The address to increase the delegated shares for their operator. * @param strategy The strategy in which to decrease the delegated shares. * @param shares The number of shares to decrease. * * @dev *If the staker is actively delegated*, then decreases the `staker`'s delegated shares in `strategy` by `shares`. Otherwise does nothing. * @dev Callable only by the StrategyManager or EigenPodManager. */ function decreaseDelegatedShares(address staker, IStrategy strategy, uint256 shares) external; /** * @notice returns the address of the operator that `staker` is delegated to. * @notice Mapping: staker => operator whom the staker is currently delegated to. * @dev Note that returning address(0) indicates that the staker is not actively delegated to any operator. */ function delegatedTo(address staker) external view returns (address); /** * @notice Returns the OperatorDetails struct associated with an `operator`. */ function operatorDetails(address operator) external view returns (OperatorDetails memory); /** * @notice Returns the delegationApprover account for an operator */ function delegationApprover(address operator) external view returns (address); /** * @notice Returns the stakerOptOutWindowBlocks for an operator */ function stakerOptOutWindowBlocks(address operator) external view returns (uint256); /** * @notice Given array of strategies, returns array of shares for the operator */ function getOperatorShares( address operator, IStrategy[] memory strategies ) external view returns (uint256[] memory); /** * @notice Given a list of strategies, return the minimum number of blocks that must pass to withdraw * from all the inputted strategies. Return value is >= minWithdrawalDelayBlocks as this is the global min withdrawal delay. * @param strategies The strategies to check withdrawal delays for */ function getWithdrawalDelay(IStrategy[] calldata strategies) external view returns (uint256); /** * @notice returns the total number of shares in `strategy` that are delegated to `operator`. * @notice Mapping: operator => strategy => total number of shares in the strategy delegated to the operator. * @dev By design, the following invariant should hold for each Strategy: * (operator's shares in delegation manager) = sum (shares above zero of all stakers delegated to operator) * = sum (delegateable shares of all stakers delegated to the operator) */ function operatorShares(address operator, IStrategy strategy) external view returns (uint256); /** * @notice Returns 'true' if `staker` *is* actively delegated, and 'false' otherwise. */ function isDelegated(address staker) external view returns (bool); /** * @notice Returns true is an operator has previously registered for delegation. */ function isOperator(address operator) external view returns (bool); /// @notice Mapping: staker => number of signed delegation nonces (used in `delegateToBySignature`) from the staker that the contract has already checked function stakerNonce(address staker) external view returns (uint256); /** * @notice Mapping: delegationApprover => 32-byte salt => whether or not the salt has already been used by the delegationApprover. * @dev Salts are used in the `delegateTo` and `delegateToBySignature` functions. Note that these functions only process the delegationApprover's * signature + the provided salt if the operator being delegated to has specified a nonzero address as their `delegationApprover`. */ function delegationApproverSaltIsSpent(address _delegationApprover, bytes32 salt) external view returns (bool); /** * @notice Minimum delay enforced by this contract for completing queued withdrawals. Measured in blocks, and adjustable by this contract's owner, * up to a maximum of `MAX_WITHDRAWAL_DELAY_BLOCKS`. Minimum value is 0 (i.e. no delay enforced). * Note that strategies each have a separate withdrawal delay, which can be greater than this value. So the minimum number of blocks that must pass * to withdraw a strategy is MAX(minWithdrawalDelayBlocks, strategyWithdrawalDelayBlocks[strategy]) */ function minWithdrawalDelayBlocks() external view returns (uint256); /** * @notice Minimum delay enforced by this contract per Strategy for completing queued withdrawals. Measured in blocks, and adjustable by this contract's owner, * up to a maximum of `MAX_WITHDRAWAL_DELAY_BLOCKS`. Minimum value is 0 (i.e. no delay enforced). */ function strategyWithdrawalDelayBlocks(IStrategy strategy) external view returns (uint256); /// @notice return address of the beaconChainETHStrategy function beaconChainETHStrategy() external view returns (IStrategy); /** * @notice Calculates the digestHash for a `staker` to sign to delegate to an `operator` * @param staker The signing staker * @param operator The operator who is being delegated to * @param expiry The desired expiry time of the staker's signature */ function calculateCurrentStakerDelegationDigestHash( address staker, address operator, uint256 expiry ) external view returns (bytes32); /** * @notice Calculates the digest hash to be signed and used in the `delegateToBySignature` function * @param staker The signing staker * @param _stakerNonce The nonce of the staker. In practice we use the staker's current nonce, stored at `stakerNonce[staker]` * @param operator The operator who is being delegated to * @param expiry The desired expiry time of the staker's signature */ function calculateStakerDelegationDigestHash( address staker, uint256 _stakerNonce, address operator, uint256 expiry ) external view returns (bytes32); /** * @notice Calculates the digest hash to be signed by the operator's delegationApprove and used in the `delegateTo` and `delegateToBySignature` functions. * @param staker The account delegating their stake * @param operator The account receiving delegated stake * @param _delegationApprover the operator's `delegationApprover` who will be signing the delegationHash (in general) * @param approverSalt A unique and single use value associated with the approver signature. * @param expiry Time after which the approver's signature becomes invalid */ function calculateDelegationApprovalDigestHash( address staker, address operator, address _delegationApprover, bytes32 approverSalt, uint256 expiry ) external view returns (bytes32); /// @notice The EIP-712 typehash for the contract's domain function DOMAIN_TYPEHASH() external view returns (bytes32); /// @notice The EIP-712 typehash for the StakerDelegation struct used by the contract function STAKER_DELEGATION_TYPEHASH() external view returns (bytes32); /// @notice The EIP-712 typehash for the DelegationApproval struct used by the contract function DELEGATION_APPROVAL_TYPEHASH() external view returns (bytes32); /** * @notice Getter function for the current EIP-712 domain separator for this contract. * * @dev The domain separator will change in the event of a fork that changes the ChainID. * @dev By introducing a domain separator the DApp developers are guaranteed that there can be no signature collision. * for more detailed information please read EIP-712. */ function domainSeparator() external view returns (bytes32); /// @notice Mapping: staker => cumulative number of queued withdrawals they have ever initiated. /// @dev This only increments (doesn't decrement), and is used to help ensure that otherwise identical withdrawals have unique hashes. function cumulativeWithdrawalsQueued(address staker) external view returns (uint256); /// @notice Returns the keccak256 hash of `withdrawal`. function calculateWithdrawalRoot(Withdrawal memory withdrawal) external pure returns (bytes32); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IStrategy.sol"; /** * @title Interface for the `IRewardsCoordinator` contract. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice Allows AVSs to make "Rewards Submissions", which get distributed amongst the AVSs' confirmed * Operators and the Stakers delegated to those Operators. * Calculations are performed based on the completed RewardsSubmission, with the results posted in * a Merkle root against which Stakers & Operators can make claims. */ interface IRewardsCoordinator { /// STRUCTS /// /** * @notice A linear combination of strategies and multipliers for AVSs to weigh * EigenLayer strategies. * @param strategy The EigenLayer strategy to be used for the rewards submission * @param multiplier The weight of the strategy in the rewards submission */ struct StrategyAndMultiplier { IStrategy strategy; uint96 multiplier; } /** * Sliding Window for valid RewardsSubmission startTimestamp * * Scenario A: GENESIS_REWARDS_TIMESTAMP IS WITHIN RANGE * <-----MAX_RETROACTIVE_LENGTH-----> t (block.timestamp) <---MAX_FUTURE_LENGTH---> * <--------------------valid range for startTimestamp------------------------> * ^ * GENESIS_REWARDS_TIMESTAMP * * * Scenario B: GENESIS_REWARDS_TIMESTAMP IS OUT OF RANGE * <-----MAX_RETROACTIVE_LENGTH-----> t (block.timestamp) <---MAX_FUTURE_LENGTH---> * <------------------------valid range for startTimestamp------------------------> * ^ * GENESIS_REWARDS_TIMESTAMP * @notice RewardsSubmission struct submitted by AVSs when making rewards for their operators and stakers * RewardsSubmission can be for a time range within the valid window for startTimestamp and must be within max duration. * See `createAVSRewardsSubmission()` for more details. * @param strategiesAndMultipliers The strategies and their relative weights * cannot have duplicate strategies and need to be sorted in ascending address order * @param token The rewards token to be distributed * @param amount The total amount of tokens to be distributed * @param startTimestamp The timestamp (seconds) at which the submission range is considered for distribution * could start in the past or in the future but within a valid range. See the diagram above. * @param duration The duration of the submission range in seconds. Must be <= MAX_REWARDS_DURATION */ struct RewardsSubmission { StrategyAndMultiplier[] strategiesAndMultipliers; IERC20 token; uint256 amount; uint32 startTimestamp; uint32 duration; } /** * @notice A distribution root is a merkle root of the distribution of earnings for a given period. * The RewardsCoordinator stores all historical distribution roots so that earners can claim their earnings against older roots * if they wish but the merkle tree contains the cumulative earnings of all earners and tokens for a given period so earners (or their claimers if set) * only need to claim against the latest root to claim all available earnings. * @param root The merkle root of the distribution * @param rewardsCalculationEndTimestamp The timestamp (seconds) until which rewards have been calculated * @param activatedAt The timestamp (seconds) at which the root can be claimed against */ struct DistributionRoot { bytes32 root; uint32 rewardsCalculationEndTimestamp; uint32 activatedAt; bool disabled; } /** * @notice Internal leaf in the merkle tree for the earner's account leaf * @param earner The address of the earner * @param earnerTokenRoot The merkle root of the earner's token subtree * Each leaf in the earner's token subtree is a TokenTreeMerkleLeaf */ struct EarnerTreeMerkleLeaf { address earner; bytes32 earnerTokenRoot; } /** * @notice The actual leaves in the distribution merkle tree specifying the token earnings * for the respective earner's subtree. Each leaf is a claimable amount of a token for an earner. * @param token The token for which the earnings are being claimed * @param cumulativeEarnings The cumulative earnings of the earner for the token */ struct TokenTreeMerkleLeaf { IERC20 token; uint256 cumulativeEarnings; } /** * @notice A claim against a distribution root called by an * earners claimer (could be the earner themselves). Each token claim will claim the difference * between the cumulativeEarnings of the earner and the cumulativeClaimed of the claimer. * Each claim can specify which of the earner's earned tokens they want to claim. * See `processClaim()` for more details. * @param rootIndex The index of the root in the list of DistributionRoots * @param earnerIndex The index of the earner's account root in the merkle tree * @param earnerTreeProof The proof of the earner's EarnerTreeMerkleLeaf against the merkle root * @param earnerLeaf The earner's EarnerTreeMerkleLeaf struct, providing the earner address and earnerTokenRoot * @param tokenIndices The indices of the token leaves in the earner's subtree * @param tokenTreeProofs The proofs of the token leaves against the earner's earnerTokenRoot * @param tokenLeaves The token leaves to be claimed * @dev The merkle tree is structured with the merkle root at the top and EarnerTreeMerkleLeaf as internal leaves * in the tree. Each earner leaf has its own subtree with TokenTreeMerkleLeaf as leaves in the subtree. * To prove a claim against a specified rootIndex(which specifies the distributionRoot being used), * the claim will first verify inclusion of the earner leaf in the tree against _distributionRoots[rootIndex].root. * Then for each token, it will verify inclusion of the token leaf in the earner's subtree against the earner's earnerTokenRoot. */ struct RewardsMerkleClaim { uint32 rootIndex; uint32 earnerIndex; bytes earnerTreeProof; EarnerTreeMerkleLeaf earnerLeaf; uint32[] tokenIndices; bytes[] tokenTreeProofs; TokenTreeMerkleLeaf[] tokenLeaves; } /// EVENTS /// /// @notice emitted when an AVS creates a valid RewardsSubmission event AVSRewardsSubmissionCreated( address indexed avs, uint256 indexed submissionNonce, bytes32 indexed rewardsSubmissionHash, RewardsSubmission rewardsSubmission ); /// @notice emitted when a valid RewardsSubmission is created for all stakers by a valid submitter event RewardsSubmissionForAllCreated( address indexed submitter, uint256 indexed submissionNonce, bytes32 indexed rewardsSubmissionHash, RewardsSubmission rewardsSubmission ); /// @notice rewardsUpdater is responsible for submiting DistributionRoots, only owner can set rewardsUpdater event RewardsUpdaterSet(address indexed oldRewardsUpdater, address indexed newRewardsUpdater); event RewardsForAllSubmitterSet( address indexed rewardsForAllSubmitter, bool indexed oldValue, bool indexed newValue ); event ActivationDelaySet(uint32 oldActivationDelay, uint32 newActivationDelay); event GlobalCommissionBipsSet(uint16 oldGlobalCommissionBips, uint16 newGlobalCommissionBips); event ClaimerForSet(address indexed earner, address indexed oldClaimer, address indexed claimer); /// @notice rootIndex is the specific array index of the newly created root in the storage array event DistributionRootSubmitted( uint32 indexed rootIndex, bytes32 indexed root, uint32 indexed rewardsCalculationEndTimestamp, uint32 activatedAt ); event DistributionRootDisabled(uint32 indexed rootIndex); /// @notice root is one of the submitted distribution roots that was claimed against event RewardsClaimed( bytes32 root, address indexed earner, address indexed claimer, address indexed recipient, IERC20 token, uint256 claimedAmount ); /** * * VIEW FUNCTIONS * */ /// @notice The address of the entity that can update the contract with new merkle roots function rewardsUpdater() external view returns (address); /** * @notice The interval in seconds at which the calculation for a RewardsSubmission distribution is done. * @dev Rewards Submission durations must be multiples of this interval. */ function CALCULATION_INTERVAL_SECONDS() external view returns (uint32); /// @notice The maximum amount of time (seconds) that a RewardsSubmission can span over function MAX_REWARDS_DURATION() external view returns (uint32); /// @notice max amount of time (seconds) that a submission can start in the past function MAX_RETROACTIVE_LENGTH() external view returns (uint32); /// @notice max amount of time (seconds) that a submission can start in the future function MAX_FUTURE_LENGTH() external view returns (uint32); /// @notice absolute min timestamp (seconds) that a submission can start at function GENESIS_REWARDS_TIMESTAMP() external view returns (uint32); /// @notice Delay in timestamp (seconds) before a posted root can be claimed against function activationDelay() external view returns (uint32); /// @notice Mapping: earner => the address of the entity who can call `processClaim` on behalf of the earner function claimerFor(address earner) external view returns (address); /// @notice Mapping: claimer => token => total amount claimed function cumulativeClaimed(address claimer, IERC20 token) external view returns (uint256); /// @notice the commission for all operators across all avss function globalOperatorCommissionBips() external view returns (uint16); /// @notice the commission for a specific operator for a specific avs /// NOTE: Currently unused and simply returns the globalOperatorCommissionBips value but will be used in future release function operatorCommissionBips(address operator, address avs) external view returns (uint16); /// @notice return the hash of the earner's leaf function calculateEarnerLeafHash(EarnerTreeMerkleLeaf calldata leaf) external pure returns (bytes32); /// @notice returns the hash of the earner's token leaf function calculateTokenLeafHash(TokenTreeMerkleLeaf calldata leaf) external pure returns (bytes32); /// @notice returns 'true' if the claim would currently pass the check in `processClaims` /// but will revert if not valid function checkClaim(RewardsMerkleClaim calldata claim) external view returns (bool); /// @notice The timestamp until which RewardsSubmissions have been calculated function currRewardsCalculationEndTimestamp() external view returns (uint32); /// @notice loop through distribution roots from reverse and return hash function getRootIndexFromHash(bytes32 rootHash) external view returns (uint32); /// @notice returns the number of distribution roots posted function getDistributionRootsLength() external view returns (uint256); /// @notice returns the distributionRoot at the specified index function getDistributionRootAtIndex(uint256 index) external view returns (DistributionRoot memory); /// @notice returns the current distributionRoot function getCurrentDistributionRoot() external view returns (DistributionRoot memory); /** * * EXTERNAL FUNCTIONS * */ /** * @notice Creates a new rewards submission on behalf of an AVS, to be split amongst the * set of stakers delegated to operators who are registered to the `avs` * @param rewardsSubmissions The rewards submissions being created * @dev Expected to be called by the ServiceManager of the AVS on behalf of which the submission is being made * @dev The duration of the `rewardsSubmission` cannot exceed `MAX_REWARDS_DURATION` * @dev The tokens are sent to the `RewardsCoordinator` contract * @dev Strategies must be in ascending order of addresses to check for duplicates * @dev This function will revert if the `rewardsSubmission` is malformed, * e.g. if the `strategies` and `weights` arrays are of non-equal lengths */ function createAVSRewardsSubmission(RewardsSubmission[] calldata rewardsSubmissions) external; /** * @notice similar to `createAVSRewardsSubmission` except the rewards are split amongst *all* stakers * rather than just those delegated to operators who are registered to a single avs and is * a permissioned call based on isRewardsForAllSubmitter mapping. */ function createRewardsForAllSubmission(RewardsSubmission[] calldata rewardsSubmission) external; /** * @notice Claim rewards against a given root (read from _distributionRoots[claim.rootIndex]). * Earnings are cumulative so earners don't have to claim against all distribution roots they have earnings for, * they can simply claim against the latest root and the contract will calculate the difference between * their cumulativeEarnings and cumulativeClaimed. This difference is then transferred to recipient address. * @param claim The RewardsMerkleClaim to be processed. * Contains the root index, earner, token leaves, and required proofs * @param recipient The address recipient that receives the ERC20 rewards * @dev only callable by the valid claimer, that is * if claimerFor[claim.earner] is address(0) then only the earner can claim, otherwise only * claimerFor[claim.earner] can claim the rewards. */ function processClaim(RewardsMerkleClaim calldata claim, address recipient) external; /** * @notice Creates a new distribution root. activatedAt is set to block.timestamp + activationDelay * @param root The merkle root of the distribution * @param rewardsCalculationEndTimestamp The timestamp (seconds) until which rewards have been calculated * @dev Only callable by the rewardsUpdater */ function submitRoot(bytes32 root, uint32 rewardsCalculationEndTimestamp) external; /** * @notice allow the rewardsUpdater to disable/cancel a pending root submission in case of an error * @param rootIndex The index of the root to be disabled */ function disableRoot(uint32 rootIndex) external; /** * @notice Sets the address of the entity that can call `processClaim` on behalf of the earner (msg.sender) * @param claimer The address of the entity that can claim rewards on behalf of the earner * @dev Only callable by the `earner` */ function setClaimerFor(address claimer) external; /** * @notice Sets the delay in timestamp before a posted root can be claimed against * @param _activationDelay Delay in timestamp (seconds) before a posted root can be claimed against * @dev Only callable by the contract owner */ function setActivationDelay(uint32 _activationDelay) external; /** * @notice Sets the global commission for all operators across all avss * @param _globalCommissionBips The commission for all operators across all avss * @dev Only callable by the contract owner */ function setGlobalOperatorCommission(uint16 _globalCommissionBips) external; /** * @notice Sets the permissioned `rewardsUpdater` address which can post new roots * @dev Only callable by the contract owner */ function setRewardsUpdater(address _rewardsUpdater) external; /** * @notice Sets the permissioned `rewardsForAllSubmitter` address which can submit createRewardsForAllSubmission * @dev Only callable by the contract owner * @param _submitter The address of the rewardsForAllSubmitter * @param _newValue The new value for isRewardsForAllSubmitter */ function setRewardsForAllSubmitter(address _submitter, bool _newValue) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; /** * @title Interface for the `PauserRegistry` contract. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service */ interface IPauserRegistry { event PauserStatusChanged(address pauser, bool canPause); event UnpauserChanged(address previousUnpauser, address newUnpauser); /// @notice Mapping of addresses to whether they hold the pauser role. function isPauser(address pauser) external view returns (bool); /// @notice Unique address that holds the unpauser role. Capable of changing *both* the pauser and unpauser addresses. function unpauser() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title Minimal interface for an `Strategy` contract. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice Custom `Strategy` implementations may expand extensively on this interface. */ interface IStrategy { /** * @notice Used to deposit tokens into this Strategy * @param token is the ERC20 token being deposited * @param amount is the amount of token being deposited * @dev This function is only callable by the strategyManager contract. It is invoked inside of the strategyManager's * `depositIntoStrategy` function, and individual share balances are recorded in the strategyManager as well. * @return newShares is the number of new shares issued at the current exchange ratio. */ function deposit(IERC20 token, uint256 amount) external returns (uint256); /** * @notice Used to withdraw tokens from this Strategy, to the `recipient`'s address * @param recipient is the address to receive the withdrawn funds * @param token is the ERC20 token being transferred out * @param amountShares is the amount of shares being withdrawn * @dev This function is only callable by the strategyManager contract. It is invoked inside of the strategyManager's * other functions, and individual share balances are recorded in the strategyManager as well. */ function withdraw(address recipient, IERC20 token, uint256 amountShares) external; /** * @notice Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy. * @notice In contrast to `sharesToUnderlyingView`, this function **may** make state modifications * @param amountShares is the amount of shares to calculate its conversion into the underlying token * @return The amount of underlying tokens corresponding to the input `amountShares` * @dev Implementation for these functions in particular may vary significantly for different strategies */ function sharesToUnderlying(uint256 amountShares) external returns (uint256); /** * @notice Used to convert an amount of underlying tokens to the equivalent amount of shares in this strategy. * @notice In contrast to `underlyingToSharesView`, this function **may** make state modifications * @param amountUnderlying is the amount of `underlyingToken` to calculate its conversion into strategy shares * @return The amount of underlying tokens corresponding to the input `amountShares` * @dev Implementation for these functions in particular may vary significantly for different strategies */ function underlyingToShares(uint256 amountUnderlying) external returns (uint256); /** * @notice convenience function for fetching the current underlying value of all of the `user`'s shares in * this strategy. In contrast to `userUnderlyingView`, this function **may** make state modifications */ function userUnderlying(address user) external returns (uint256); /** * @notice convenience function for fetching the current total shares of `user` in this strategy, by * querying the `strategyManager` contract */ function shares(address user) external view returns (uint256); /** * @notice Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy. * @notice In contrast to `sharesToUnderlying`, this function guarantees no state modifications * @param amountShares is the amount of shares to calculate its conversion into the underlying token * @return The amount of shares corresponding to the input `amountUnderlying` * @dev Implementation for these functions in particular may vary significantly for different strategies */ function sharesToUnderlyingView(uint256 amountShares) external view returns (uint256); /** * @notice Used to convert an amount of underlying tokens to the equivalent amount of shares in this strategy. * @notice In contrast to `underlyingToShares`, this function guarantees no state modifications * @param amountUnderlying is the amount of `underlyingToken` to calculate its conversion into strategy shares * @return The amount of shares corresponding to the input `amountUnderlying` * @dev Implementation for these functions in particular may vary significantly for different strategies */ function underlyingToSharesView(uint256 amountUnderlying) external view returns (uint256); /** * @notice convenience function for fetching the current underlying value of all of the `user`'s shares in * this strategy. In contrast to `userUnderlying`, this function guarantees no state modifications */ function userUnderlyingView(address user) external view returns (uint256); /// @notice The underlying token for shares in this Strategy function underlyingToken() external view returns (IERC20); /// @notice The total number of extant shares in this Strategy function totalShares() external view returns (uint256); /// @notice Returns either a brief string explaining the strategy's goal & purpose, or a link to metadata that explains in more detail. function explanation() external view returns (string memory); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "./IStrategyManager.sol"; import "./IDelegationManager.sol"; /** * @title Interface for the primary 'slashing' contract for EigenLayer. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice See the `Slasher` contract itself for implementation details. */ interface ISlasher { // struct used to store information about the current state of an operator's obligations to middlewares they are serving struct MiddlewareTimes { // The update block for the middleware whose most recent update was earliest, i.e. the 'stalest' update out of all middlewares the operator is serving uint32 stalestUpdateBlock; // The latest 'serveUntilBlock' from all of the middleware that the operator is serving uint32 latestServeUntilBlock; } // struct used to store details relevant to a single middleware that an operator has opted-in to serving struct MiddlewareDetails { // the block at which the contract begins being able to finalize the operator's registration with the service via calling `recordFirstStakeUpdate` uint32 registrationMayBeginAtBlock; // the block before which the contract is allowed to slash the user uint32 contractCanSlashOperatorUntilBlock; // the block at which the middleware's view of the operator's stake was most recently updated uint32 latestUpdateBlock; } /// @notice Emitted when a middleware times is added to `operator`'s array. event MiddlewareTimesAdded( address operator, uint256 index, uint32 stalestUpdateBlock, uint32 latestServeUntilBlock ); /// @notice Emitted when `operator` begins to allow `contractAddress` to slash them. event OptedIntoSlashing(address indexed operator, address indexed contractAddress); /// @notice Emitted when `contractAddress` signals that it will no longer be able to slash `operator` after the `contractCanSlashOperatorUntilBlock`. event SlashingAbilityRevoked( address indexed operator, address indexed contractAddress, uint32 contractCanSlashOperatorUntilBlock ); /** * @notice Emitted when `slashingContract` 'freezes' the `slashedOperator`. * @dev The `slashingContract` must have permission to slash the `slashedOperator`, i.e. `canSlash(slasherOperator, slashingContract)` must return 'true'. */ event OperatorFrozen(address indexed slashedOperator, address indexed slashingContract); /// @notice Emitted when `previouslySlashedAddress` is 'unfrozen', allowing them to again move deposited funds within EigenLayer. event FrozenStatusReset(address indexed previouslySlashedAddress); /** * @notice Gives the `contractAddress` permission to slash the funds of the caller. * @dev Typically, this function must be called prior to registering for a middleware. */ function optIntoSlashing(address contractAddress) external; /** * @notice Used for 'slashing' a certain operator. * @param toBeFrozen The operator to be frozen. * @dev Technically the operator is 'frozen' (hence the name of this function), and then subject to slashing pending a decision by a human-in-the-loop. * @dev The operator must have previously given the caller (which should be a contract) the ability to slash them, through a call to `optIntoSlashing`. */ function freezeOperator(address toBeFrozen) external; /** * @notice Removes the 'frozen' status from each of the `frozenAddresses` * @dev Callable only by the contract owner (i.e. governance). */ function resetFrozenStatus(address[] calldata frozenAddresses) external; /** * @notice this function is a called by middlewares during an operator's registration to make sure the operator's stake at registration * is slashable until serveUntil * @param operator the operator whose stake update is being recorded * @param serveUntilBlock the block until which the operator's stake at the current block is slashable * @dev adds the middleware's slashing contract to the operator's linked list */ function recordFirstStakeUpdate(address operator, uint32 serveUntilBlock) external; /** * @notice this function is a called by middlewares during a stake update for an operator (perhaps to free pending withdrawals) * to make sure the operator's stake at updateBlock is slashable until serveUntil * @param operator the operator whose stake update is being recorded * @param updateBlock the block for which the stake update is being recorded * @param serveUntilBlock the block until which the operator's stake at updateBlock is slashable * @param insertAfter the element of the operators linked list that the currently updating middleware should be inserted after * @dev insertAfter should be calculated offchain before making the transaction that calls this. this is subject to race conditions, * but it is anticipated to be rare and not detrimental. */ function recordStakeUpdate( address operator, uint32 updateBlock, uint32 serveUntilBlock, uint256 insertAfter ) external; /** * @notice this function is a called by middlewares during an operator's deregistration to make sure the operator's stake at deregistration * is slashable until serveUntil * @param operator the operator whose stake update is being recorded * @param serveUntilBlock the block until which the operator's stake at the current block is slashable * @dev removes the middleware's slashing contract to the operator's linked list and revokes the middleware's (i.e. caller's) ability to * slash `operator` once `serveUntil` is reached */ function recordLastStakeUpdateAndRevokeSlashingAbility(address operator, uint32 serveUntilBlock) external; /// @notice The StrategyManager contract of EigenLayer function strategyManager() external view returns (IStrategyManager); /// @notice The DelegationManager contract of EigenLayer function delegation() external view returns (IDelegationManager); /** * @notice Used to determine whether `staker` is actively 'frozen'. If a staker is frozen, then they are potentially subject to * slashing of their funds, and cannot cannot deposit or withdraw from the strategyManager until the slashing process is completed * and the staker's status is reset (to 'unfrozen'). * @param staker The staker of interest. * @return Returns 'true' if `staker` themselves has their status set to frozen, OR if the staker is delegated * to an operator who has their status set to frozen. Otherwise returns 'false'. */ function isFrozen(address staker) external view returns (bool); /// @notice Returns true if `slashingContract` is currently allowed to slash `toBeSlashed`. function canSlash(address toBeSlashed, address slashingContract) external view returns (bool); /// @notice Returns the block until which `serviceContract` is allowed to slash the `operator`. function contractCanSlashOperatorUntilBlock( address operator, address serviceContract ) external view returns (uint32); /// @notice Returns the block at which the `serviceContract` last updated its view of the `operator`'s stake function latestUpdateBlock(address operator, address serviceContract) external view returns (uint32); /// @notice A search routine for finding the correct input value of `insertAfter` to `recordStakeUpdate` / `_updateMiddlewareList`. function getCorrectValueForInsertAfter(address operator, uint32 updateBlock) external view returns (uint256); /** * @notice Returns 'true' if `operator` can currently complete a withdrawal started at the `withdrawalStartBlock`, with `middlewareTimesIndex` used * to specify the index of a `MiddlewareTimes` struct in the operator's list (i.e. an index in `operatorToMiddlewareTimes[operator]`). The specified * struct is consulted as proof of the `operator`'s ability (or lack thereof) to complete the withdrawal. * This function will return 'false' if the operator cannot currently complete a withdrawal started at the `withdrawalStartBlock`, *or* in the event * that an incorrect `middlewareTimesIndex` is supplied, even if one or more correct inputs exist. * @param operator Either the operator who queued the withdrawal themselves, or if the withdrawing party is a staker who delegated to an operator, * this address is the operator *who the staker was delegated to* at the time of the `withdrawalStartBlock`. * @param withdrawalStartBlock The block number at which the withdrawal was initiated. * @param middlewareTimesIndex Indicates an index in `operatorToMiddlewareTimes[operator]` to consult as proof of the `operator`'s ability to withdraw * @dev The correct `middlewareTimesIndex` input should be computable off-chain. */ function canWithdraw( address operator, uint32 withdrawalStartBlock, uint256 middlewareTimesIndex ) external returns (bool); /** * operator => * [ * ( * the least recent update block of all of the middlewares it's serving/served, * latest time that the stake bonded at that update needed to serve until * ) * ] */ function operatorToMiddlewareTimes( address operator, uint256 arrayIndex ) external view returns (MiddlewareTimes memory); /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator].length` function middlewareTimesLength(address operator) external view returns (uint256); /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator][index].stalestUpdateBlock`. function getMiddlewareTimesIndexStalestUpdateBlock(address operator, uint32 index) external view returns (uint32); /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator][index].latestServeUntil`. function getMiddlewareTimesIndexServeUntilBlock(address operator, uint32 index) external view returns (uint32); /// @notice Getter function for fetching `_operatorToWhitelistedContractsByUpdate[operator].size`. function operatorWhitelistedContractsLinkedListSize(address operator) external view returns (uint256); /// @notice Getter function for fetching a single node in the operator's linked list (`_operatorToWhitelistedContractsByUpdate[operator]`). function operatorWhitelistedContractsLinkedListEntry( address operator, address node ) external view returns (bool, uint256, uint256); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol"; import "./IETHPOSDeposit.sol"; import "./IStrategyManager.sol"; import "./IEigenPod.sol"; import "./IBeaconChainOracle.sol"; import "./IPausable.sol"; import "./ISlasher.sol"; import "./IStrategy.sol"; /** * @title Interface for factory that creates and manages solo staking pods that have their withdrawal credentials pointed to EigenLayer. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service */ interface IEigenPodManager is IPausable { /// @notice Emitted to notify the update of the beaconChainOracle address event BeaconOracleUpdated(address indexed newOracleAddress); /// @notice Emitted to notify the deployment of an EigenPod event PodDeployed(address indexed eigenPod, address indexed podOwner); /// @notice Emitted to notify a deposit of beacon chain ETH recorded in the strategy manager event BeaconChainETHDeposited(address indexed podOwner, uint256 amount); /// @notice Emitted when the balance of an EigenPod is updated event PodSharesUpdated(address indexed podOwner, int256 sharesDelta); /// @notice Emitted when a withdrawal of beacon chain ETH is completed event BeaconChainETHWithdrawalCompleted( address indexed podOwner, uint256 shares, uint96 nonce, address delegatedAddress, address withdrawer, bytes32 withdrawalRoot ); event DenebForkTimestampUpdated(uint64 newValue); /** * @notice Creates an EigenPod for the sender. * @dev Function will revert if the `msg.sender` already has an EigenPod. * @dev Returns EigenPod address */ function createPod() external returns (address); /** * @notice Stakes for a new beacon chain validator on the sender's EigenPod. * Also creates an EigenPod for the sender if they don't have one already. * @param pubkey The 48 bytes public key of the beacon chain validator. * @param signature The validator's signature of the deposit data. * @param depositDataRoot The root/hash of the deposit data for the validator's deposit. */ function stake(bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot) external payable; /** * @notice Changes the `podOwner`'s shares by `sharesDelta` and performs a call to the DelegationManager * to ensure that delegated shares are also tracked correctly * @param podOwner is the pod owner whose balance is being updated. * @param sharesDelta is the change in podOwner's beaconChainETHStrategy shares * @dev Callable only by the podOwner's EigenPod contract. * @dev Reverts if `sharesDelta` is not a whole Gwei amount */ function recordBeaconChainETHBalanceUpdate(address podOwner, int256 sharesDelta) external; /** * @notice Updates the oracle contract that provides the beacon chain state root * @param newBeaconChainOracle is the new oracle contract being pointed to * @dev Callable only by the owner of this contract (i.e. governance) */ function updateBeaconChainOracle(IBeaconChainOracle newBeaconChainOracle) external; /// @notice Returns the address of the `podOwner`'s EigenPod if it has been deployed. function ownerToPod(address podOwner) external view returns (IEigenPod); /// @notice Returns the address of the `podOwner`'s EigenPod (whether it is deployed yet or not). function getPod(address podOwner) external view returns (IEigenPod); /// @notice The ETH2 Deposit Contract function ethPOS() external view returns (IETHPOSDeposit); /// @notice Beacon proxy to which the EigenPods point function eigenPodBeacon() external view returns (IBeacon); /// @notice Oracle contract that provides updates to the beacon chain's state function beaconChainOracle() external view returns (IBeaconChainOracle); /// @notice Returns the beacon block root at `timestamp`. Reverts if the Beacon block root at `timestamp` has not yet been finalized. function getBlockRootAtTimestamp(uint64 timestamp) external view returns (bytes32); /// @notice EigenLayer's StrategyManager contract function strategyManager() external view returns (IStrategyManager); /// @notice EigenLayer's Slasher contract function slasher() external view returns (ISlasher); /// @notice Returns 'true' if the `podOwner` has created an EigenPod, and 'false' otherwise. function hasPod(address podOwner) external view returns (bool); /// @notice Returns the number of EigenPods that have been created function numPods() external view returns (uint256); /** * @notice Mapping from Pod owner owner to the number of shares they have in the virtual beacon chain ETH strategy. * @dev The share amount can become negative. This is necessary to accommodate the fact that a pod owner's virtual beacon chain ETH shares can * decrease between the pod owner queuing and completing a withdrawal. * When the pod owner's shares would otherwise increase, this "deficit" is decreased first _instead_. * Likewise, when a withdrawal is completed, this "deficit" is decreased and the withdrawal amount is decreased; We can think of this * as the withdrawal "paying off the deficit". */ function podOwnerShares(address podOwner) external view returns (int256); /// @notice returns canonical, virtual beaconChainETH strategy function beaconChainETHStrategy() external view returns (IStrategy); /** * @notice Used by the DelegationManager to remove a pod owner's shares while they're in the withdrawal queue. * Simply decreases the `podOwner`'s shares by `shares`, down to a minimum of zero. * @dev This function reverts if it would result in `podOwnerShares[podOwner]` being less than zero, i.e. it is forbidden for this function to * result in the `podOwner` incurring a "share deficit". This behavior prevents a Staker from queuing a withdrawal which improperly removes excessive * shares from the operator to whom the staker is delegated. * @dev Reverts if `shares` is not a whole Gwei amount */ function removeShares(address podOwner, uint256 shares) external; /** * @notice Increases the `podOwner`'s shares by `shares`, paying off deficit if possible. * Used by the DelegationManager to award a pod owner shares on exiting the withdrawal queue * @dev Returns the number of shares added to `podOwnerShares[podOwner]` above zero, which will be less than the `shares` input * in the event that the podOwner has an existing shares deficit (i.e. `podOwnerShares[podOwner]` starts below zero) * @dev Reverts if `shares` is not a whole Gwei amount */ function addShares(address podOwner, uint256 shares) external returns (uint256); /** * @notice Used by the DelegationManager to complete a withdrawal, sending tokens to some destination address * @dev Prioritizes decreasing the podOwner's share deficit, if they have one * @dev Reverts if `shares` is not a whole Gwei amount */ function withdrawSharesAsTokens(address podOwner, address destination, uint256 shares) external; /** * @notice the deneb hard fork timestamp used to determine which proof path to use for proving a withdrawal */ function denebForkTimestamp() external view returns (uint64); /** * setting the deneb hard fork timestamp by the eigenPodManager owner * @dev this function is designed to be called twice. Once, it is set to type(uint64).max * prior to the actual deneb fork timestamp being set, and then the second time it is set * to the actual deneb fork timestamp. */ function setDenebForkTimestamp(uint64 newDenebForkTimestamp) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; /** * @title The interface for common signature utilities. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service */ interface ISignatureUtils { // @notice Struct that bundles together a signature and an expiration time for the signature. Used primarily for stack management. struct SignatureWithExpiry { // the signature itself, formatted as a single bytes object bytes signature; // the expiration timestamp (UTC) of the signature uint256 expiry; } // @notice Struct that bundles together a signature, a salt for uniqueness, and an expiration time for the signature. Used primarily for stack management. struct SignatureWithSaltAndExpiry { // the signature itself, formatted as a single bytes object bytes signature; // the salt used to generate the signature bytes32 salt; // the expiration timestamp (UTC) of the signature uint256 expiry; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━ // ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓ // ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛ // ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━ // ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓ // ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // SPDX-License-Identifier: CC0-1.0 pragma solidity >=0.5.0; // 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 IETHPOSDeposit { /// @notice A processed deposit event. event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index); /// @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; /// @notice Query the current deposit root hash. /// @return The deposit root hash. function get_deposit_root() external view returns (bytes32); /// @notice Query the current deposit count. /// @return The deposit count encoded as a little endian 64-bit number. function get_deposit_count() external view returns (bytes memory); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "../libraries/BeaconChainProofs.sol"; import "./IEigenPodManager.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title The implementation contract used for restaking beacon chain ETH on EigenLayer * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice The main functionalities are: * - creating new ETH validators with their withdrawal credentials pointed to this contract * - proving from beacon chain state roots that withdrawal credentials are pointed to this contract * - proving from beacon chain state roots the balances of ETH validators with their withdrawal credentials * pointed to this contract * - updating aggregate balances in the EigenPodManager * - withdrawing eth when withdrawals are initiated * @dev Note that all beacon chain balances are stored as gwei within the beacon chain datastructures. We choose * to account balances in terms of gwei in the EigenPod contract and convert to wei when making calls to other contracts */ interface IEigenPod { enum VALIDATOR_STATUS { INACTIVE, // doesnt exist ACTIVE, // staked on ethpos and withdrawal credentials are pointed to the EigenPod WITHDRAWN // withdrawn from the Beacon Chain } struct ValidatorInfo { // index of the validator in the beacon chain uint64 validatorIndex; // amount of beacon chain ETH restaked on EigenLayer in gwei uint64 restakedBalanceGwei; //timestamp of the validator's most recent balance update uint64 mostRecentBalanceUpdateTimestamp; // status of the validator VALIDATOR_STATUS status; } /** * @notice struct used to store amounts related to proven withdrawals in memory. Used to help * manage stack depth and optimize the number of external calls, when batching withdrawal operations. */ struct VerifiedWithdrawal { // amount to send to a podOwner from a proven withdrawal uint256 amountToSendGwei; // difference in shares to be recorded in the eigenPodManager, as a result of the withdrawal int256 sharesDeltaGwei; } enum PARTIAL_WITHDRAWAL_CLAIM_STATUS { REDEEMED, PENDING, FAILED } /// @notice Emitted when an ETH validator stakes via this eigenPod event EigenPodStaked(bytes pubkey); /// @notice Emitted when an ETH validator's withdrawal credentials are successfully verified to be pointed to this eigenPod event ValidatorRestaked(uint40 validatorIndex); /// @notice Emitted when an ETH validator's balance is proven to be updated. Here newValidatorBalanceGwei // is the validator's balance that is credited on EigenLayer. event ValidatorBalanceUpdated(uint40 validatorIndex, uint64 balanceTimestamp, uint64 newValidatorBalanceGwei); /// @notice Emitted when an ETH validator is prove to have withdrawn from the beacon chain event FullWithdrawalRedeemed( uint40 validatorIndex, uint64 withdrawalTimestamp, address indexed recipient, uint64 withdrawalAmountGwei ); /// @notice Emitted when a partial withdrawal claim is successfully redeemed event PartialWithdrawalRedeemed( uint40 validatorIndex, uint64 withdrawalTimestamp, address indexed recipient, uint64 partialWithdrawalAmountGwei ); /// @notice Emitted when restaked beacon chain ETH is withdrawn from the eigenPod. event RestakedBeaconChainETHWithdrawn(address indexed recipient, uint256 amount); /// @notice Emitted when podOwner enables restaking event RestakingActivated(address indexed podOwner); /// @notice Emitted when ETH is received via the `receive` fallback event NonBeaconChainETHReceived(uint256 amountReceived); /// @notice Emitted when ETH that was previously received via the `receive` fallback is withdrawn event NonBeaconChainETHWithdrawn(address indexed recipient, uint256 amountWithdrawn); /// @notice The max amount of eth, in gwei, that can be restaked per validator function MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR() external view returns (uint64); /// @notice the amount of execution layer ETH in this contract that is staked in EigenLayer (i.e. withdrawn from beaconchain but not EigenLayer), function withdrawableRestakedExecutionLayerGwei() external view returns (uint64); /// @notice any ETH deposited into the EigenPod contract via the `receive` fallback function function nonBeaconChainETHBalanceWei() external view returns (uint256); /// @notice Used to initialize the pointers to contracts crucial to the pod's functionality, in beacon proxy construction from EigenPodManager function initialize(address owner) external; /// @notice Called by EigenPodManager when the owner wants to create another ETH validator. function stake(bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot) external payable; /** * @notice Transfers `amountWei` in ether from this contract to the specified `recipient` address * @notice Called by EigenPodManager to withdrawBeaconChainETH that has been added to the EigenPod's balance due to a withdrawal from the beacon chain. * @dev The podOwner must have already proved sufficient withdrawals, so that this pod's `withdrawableRestakedExecutionLayerGwei` exceeds the * `amountWei` input (when converted to GWEI). * @dev Reverts if `amountWei` is not a whole Gwei amount */ function withdrawRestakedBeaconChainETH(address recipient, uint256 amount) external; /// @notice The single EigenPodManager for EigenLayer function eigenPodManager() external view returns (IEigenPodManager); /// @notice The owner of this EigenPod function podOwner() external view returns (address); /// @notice an indicator of whether or not the podOwner has ever "fully restaked" by successfully calling `verifyCorrectWithdrawalCredentials`. function hasRestaked() external view returns (bool); /** * @notice The latest timestamp at which the pod owner withdrew the balance of the pod, via calling `withdrawBeforeRestaking`. * @dev This variable is only updated when the `withdrawBeforeRestaking` function is called, which can only occur before `hasRestaked` is set to true for this pod. * Proofs for this pod are only valid against Beacon Chain state roots corresponding to timestamps after the stored `mostRecentWithdrawalTimestamp`. */ function mostRecentWithdrawalTimestamp() external view returns (uint64); /// @notice Returns the validatorInfo struct for the provided pubkeyHash function validatorPubkeyHashToInfo(bytes32 validatorPubkeyHash) external view returns (ValidatorInfo memory); /// @notice Returns the validatorInfo struct for the provided pubkey function validatorPubkeyToInfo(bytes calldata validatorPubkey) external view returns (ValidatorInfo memory); ///@notice mapping that tracks proven withdrawals function provenWithdrawal(bytes32 validatorPubkeyHash, uint64 slot) external view returns (bool); /// @notice This returns the status of a given validator function validatorStatus(bytes32 pubkeyHash) external view returns (VALIDATOR_STATUS); /// @notice This returns the status of a given validator pubkey function validatorStatus(bytes calldata validatorPubkey) external view returns (VALIDATOR_STATUS); /** * @notice This function verifies that the withdrawal credentials of validator(s) owned by the podOwner are pointed to * this contract. It also verifies the effective balance of the validator. It verifies the provided proof of the ETH validator against the beacon chain state * root, marks the validator as 'active' in EigenLayer, and credits the restaked ETH in Eigenlayer. * @param oracleTimestamp is the Beacon Chain timestamp whose state root the `proof` will be proven against. * @param validatorIndices is the list of indices of the validators being proven, refer to consensus specs * @param withdrawalCredentialProofs is an array of proofs, where each proof proves each ETH validator's balance and withdrawal credentials * against a beacon chain state root * @param validatorFields are the fields of the "Validator Container", refer to consensus specs * for details: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator */ function verifyWithdrawalCredentials( uint64 oracleTimestamp, BeaconChainProofs.StateRootProof calldata stateRootProof, uint40[] calldata validatorIndices, bytes[] calldata withdrawalCredentialProofs, bytes32[][] calldata validatorFields ) external; /** * @notice This function records an update (either increase or decrease) in the pod's balance in the StrategyManager. * It also verifies a merkle proof of the validator's current beacon chain balance. * @param oracleTimestamp The oracleTimestamp whose state root the `proof` will be proven against. * Must be within `VERIFY_BALANCE_UPDATE_WINDOW_SECONDS` of the current block. * @param validatorIndices is the list of indices of the validators being proven, refer to consensus specs * @param validatorFieldsProofs proofs against the `beaconStateRoot` for each validator in `validatorFields` * @param validatorFields are the fields of the "Validator Container", refer to consensus specs * @dev For more details on the Beacon Chain spec, see: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator */ function verifyBalanceUpdates( uint64 oracleTimestamp, uint40[] calldata validatorIndices, BeaconChainProofs.StateRootProof calldata stateRootProof, bytes[] calldata validatorFieldsProofs, bytes32[][] calldata validatorFields ) external; /** * @notice This function records full and partial withdrawals on behalf of one of the Ethereum validators for this EigenPod * @param oracleTimestamp is the timestamp of the oracle slot that the withdrawal is being proven against * @param withdrawalProofs is the information needed to check the veracity of the block numbers and withdrawals being proven * @param validatorFieldsProofs is the proof of the validator's fields' in the validator tree * @param withdrawalFields are the fields of the withdrawals being proven * @param validatorFields are the fields of the validators being proven */ function verifyAndProcessWithdrawals( uint64 oracleTimestamp, BeaconChainProofs.StateRootProof calldata stateRootProof, BeaconChainProofs.WithdrawalProof[] calldata withdrawalProofs, bytes[] calldata validatorFieldsProofs, bytes32[][] calldata validatorFields, bytes32[][] calldata withdrawalFields ) external; /** * @notice Called by the pod owner to activate restaking by withdrawing * all existing ETH from the pod and preventing further withdrawals via * "withdrawBeforeRestaking()" */ function activateRestaking() external; /// @notice Called by the pod owner to withdraw the balance of the pod when `hasRestaked` is set to false function withdrawBeforeRestaking() external; /// @notice Called by the pod owner to withdraw the nonBeaconChainETHBalanceWei function withdrawNonBeaconChainETHBalanceWei(address recipient, uint256 amountToWithdraw) external; /// @notice called by owner of a pod to remove any ERC20s deposited in the pod function recoverTokens(IERC20[] memory tokenList, uint256[] memory amountsToWithdraw, address recipient) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; /** * @title Interface for the BeaconStateOracle contract. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service */ interface IBeaconChainOracle { /// @notice The block number to state root mapping. function timestampToBlockRoot(uint256 timestamp) external view returns (bytes32); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import "./Merkle.sol"; import "../libraries/Endian.sol"; //Utility library for parsing and PHASE0 beacon chain block headers //SSZ Spec: https://github.com/ethereum/consensus-specs/blob/dev/ssz/simple-serialize.md#merkleization //BeaconBlockHeader Spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconblockheader //BeaconState Spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconstate library BeaconChainProofs { // constants are the number of fields and the heights of the different merkle trees used in merkleizing beacon chain containers uint256 internal constant BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT = 3; uint256 internal constant BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT = 4; uint256 internal constant BEACON_STATE_FIELD_TREE_HEIGHT = 5; uint256 internal constant VALIDATOR_FIELD_TREE_HEIGHT = 3; //Note: changed in the deneb hard fork from 4->5 uint256 internal constant EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_DENEB = 5; uint256 internal constant EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_CAPELLA = 4; // SLOTS_PER_HISTORICAL_ROOT = 2**13, so tree height is 13 uint256 internal constant BLOCK_ROOTS_TREE_HEIGHT = 13; //HISTORICAL_ROOTS_LIMIT = 2**24, so tree height is 24 uint256 internal constant HISTORICAL_SUMMARIES_TREE_HEIGHT = 24; //Index of block_summary_root in historical_summary container uint256 internal constant BLOCK_SUMMARY_ROOT_INDEX = 0; // tree height for hash tree of an individual withdrawal container uint256 internal constant WITHDRAWAL_FIELD_TREE_HEIGHT = 2; uint256 internal constant VALIDATOR_TREE_HEIGHT = 40; // MAX_WITHDRAWALS_PER_PAYLOAD = 2**4, making tree height = 4 uint256 internal constant WITHDRAWALS_TREE_HEIGHT = 4; //in beacon block body https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#beaconblockbody uint256 internal constant EXECUTION_PAYLOAD_INDEX = 9; // in beacon block header https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconblockheader uint256 internal constant SLOT_INDEX = 0; uint256 internal constant STATE_ROOT_INDEX = 3; uint256 internal constant BODY_ROOT_INDEX = 4; // in beacon state https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#beaconstate uint256 internal constant VALIDATOR_TREE_ROOT_INDEX = 11; uint256 internal constant HISTORICAL_SUMMARIES_INDEX = 27; // in validator https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator uint256 internal constant VALIDATOR_PUBKEY_INDEX = 0; uint256 internal constant VALIDATOR_WITHDRAWAL_CREDENTIALS_INDEX = 1; uint256 internal constant VALIDATOR_BALANCE_INDEX = 2; uint256 internal constant VALIDATOR_WITHDRAWABLE_EPOCH_INDEX = 7; // in execution payload header uint256 internal constant TIMESTAMP_INDEX = 9; //in execution payload uint256 internal constant WITHDRAWALS_INDEX = 14; // in withdrawal uint256 internal constant WITHDRAWAL_VALIDATOR_INDEX_INDEX = 1; uint256 internal constant WITHDRAWAL_VALIDATOR_AMOUNT_INDEX = 3; //Misc Constants /// @notice The number of slots each epoch in the beacon chain uint64 internal constant SLOTS_PER_EPOCH = 32; /// @notice The number of seconds in a slot in the beacon chain uint64 internal constant SECONDS_PER_SLOT = 12; /// @notice Number of seconds per epoch: 384 == 32 slots/epoch * 12 seconds/slot uint64 internal constant SECONDS_PER_EPOCH = SLOTS_PER_EPOCH * SECONDS_PER_SLOT; bytes8 internal constant UINT64_MASK = 0xffffffffffffffff; /// @notice This struct contains the merkle proofs and leaves needed to verify a partial/full withdrawal struct WithdrawalProof { bytes withdrawalProof; bytes slotProof; bytes executionPayloadProof; bytes timestampProof; bytes historicalSummaryBlockRootProof; uint64 blockRootIndex; uint64 historicalSummaryIndex; uint64 withdrawalIndex; bytes32 blockRoot; bytes32 slotRoot; bytes32 timestampRoot; bytes32 executionPayloadRoot; } /// @notice This struct contains the root and proof for verifying the state root against the oracle block root struct StateRootProof { bytes32 beaconStateRoot; bytes proof; } /** * @notice This function verifies merkle proofs of the fields of a certain validator against a beacon chain state root * @param validatorIndex the index of the proven validator * @param beaconStateRoot is the beacon chain state root to be proven against. * @param validatorFieldsProof is the data used in proving the validator's fields * @param validatorFields the claimed fields of the validator */ function verifyValidatorFields( bytes32 beaconStateRoot, bytes32[] calldata validatorFields, bytes calldata validatorFieldsProof, uint40 validatorIndex ) internal view { require( validatorFields.length == 2 ** VALIDATOR_FIELD_TREE_HEIGHT, "BeaconChainProofs.verifyValidatorFields: Validator fields has incorrect length" ); /** * Note: the length of the validator merkle proof is BeaconChainProofs.VALIDATOR_TREE_HEIGHT + 1. * There is an additional layer added by hashing the root with the length of the validator list */ require( validatorFieldsProof.length == 32 * ((VALIDATOR_TREE_HEIGHT + 1) + BEACON_STATE_FIELD_TREE_HEIGHT), "BeaconChainProofs.verifyValidatorFields: Proof has incorrect length" ); uint256 index = (VALIDATOR_TREE_ROOT_INDEX << (VALIDATOR_TREE_HEIGHT + 1)) | uint256(validatorIndex); // merkleize the validatorFields to get the leaf to prove bytes32 validatorRoot = Merkle.merkleizeSha256(validatorFields); // verify the proof of the validatorRoot against the beaconStateRoot require( Merkle.verifyInclusionSha256({ proof: validatorFieldsProof, root: beaconStateRoot, leaf: validatorRoot, index: index }), "BeaconChainProofs.verifyValidatorFields: Invalid merkle proof" ); } /** * @notice This function verifies the latestBlockHeader against the state root. the latestBlockHeader is * a tracked in the beacon state. * @param beaconStateRoot is the beacon chain state root to be proven against. * @param stateRootProof is the provided merkle proof * @param latestBlockRoot is hashtree root of the latest block header in the beacon state */ function verifyStateRootAgainstLatestBlockRoot( bytes32 latestBlockRoot, bytes32 beaconStateRoot, bytes calldata stateRootProof ) internal view { require( stateRootProof.length == 32 * (BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT), "BeaconChainProofs.verifyStateRootAgainstLatestBlockRoot: Proof has incorrect length" ); //Next we verify the slot against the blockRoot require( Merkle.verifyInclusionSha256({ proof: stateRootProof, root: latestBlockRoot, leaf: beaconStateRoot, index: STATE_ROOT_INDEX }), "BeaconChainProofs.verifyStateRootAgainstLatestBlockRoot: Invalid latest block header root merkle proof" ); } /** * @notice This function verifies the slot and the withdrawal fields for a given withdrawal * @param withdrawalProof is the provided set of merkle proofs * @param withdrawalFields is the serialized withdrawal container to be proven */ function verifyWithdrawal( bytes32 beaconStateRoot, bytes32[] calldata withdrawalFields, WithdrawalProof calldata withdrawalProof, uint64 denebForkTimestamp ) internal view { require( withdrawalFields.length == 2 ** WITHDRAWAL_FIELD_TREE_HEIGHT, "BeaconChainProofs.verifyWithdrawal: withdrawalFields has incorrect length" ); require( withdrawalProof.blockRootIndex < 2 ** BLOCK_ROOTS_TREE_HEIGHT, "BeaconChainProofs.verifyWithdrawal: blockRootIndex is too large" ); require( withdrawalProof.withdrawalIndex < 2 ** WITHDRAWALS_TREE_HEIGHT, "BeaconChainProofs.verifyWithdrawal: withdrawalIndex is too large" ); require( withdrawalProof.historicalSummaryIndex < 2 ** HISTORICAL_SUMMARIES_TREE_HEIGHT, "BeaconChainProofs.verifyWithdrawal: historicalSummaryIndex is too large" ); //Note: post deneb hard fork, the number of exection payload header fields increased from 15->17, adding an extra level to the tree height uint256 executionPayloadHeaderFieldTreeHeight = (getWithdrawalTimestamp(withdrawalProof) < denebForkTimestamp) ? EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_CAPELLA : EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_DENEB; require( withdrawalProof.withdrawalProof.length == 32 * (executionPayloadHeaderFieldTreeHeight + WITHDRAWALS_TREE_HEIGHT + 1), "BeaconChainProofs.verifyWithdrawal: withdrawalProof has incorrect length" ); require( withdrawalProof.executionPayloadProof.length == 32 * (BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT + BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT), "BeaconChainProofs.verifyWithdrawal: executionPayloadProof has incorrect length" ); require( withdrawalProof.slotProof.length == 32 * (BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT), "BeaconChainProofs.verifyWithdrawal: slotProof has incorrect length" ); require( withdrawalProof.timestampProof.length == 32 * (executionPayloadHeaderFieldTreeHeight), "BeaconChainProofs.verifyWithdrawal: timestampProof has incorrect length" ); require( withdrawalProof.historicalSummaryBlockRootProof.length == 32 * (BEACON_STATE_FIELD_TREE_HEIGHT + (HISTORICAL_SUMMARIES_TREE_HEIGHT + 1) + 1 + (BLOCK_ROOTS_TREE_HEIGHT)), "BeaconChainProofs.verifyWithdrawal: historicalSummaryBlockRootProof has incorrect length" ); /** * Note: Here, the "1" in "1 + (BLOCK_ROOTS_TREE_HEIGHT)" signifies that extra step of choosing the "block_root_summary" within the individual * "historical_summary". Everywhere else it signifies merkelize_with_mixin, where the length of an array is hashed with the root of the array, * but not here. */ uint256 historicalBlockHeaderIndex = ( HISTORICAL_SUMMARIES_INDEX << ((HISTORICAL_SUMMARIES_TREE_HEIGHT + 1) + 1 + (BLOCK_ROOTS_TREE_HEIGHT)) ) | (uint256(withdrawalProof.historicalSummaryIndex) << (1 + (BLOCK_ROOTS_TREE_HEIGHT))) | (BLOCK_SUMMARY_ROOT_INDEX << (BLOCK_ROOTS_TREE_HEIGHT)) | uint256(withdrawalProof.blockRootIndex); require( Merkle.verifyInclusionSha256({ proof: withdrawalProof.historicalSummaryBlockRootProof, root: beaconStateRoot, leaf: withdrawalProof.blockRoot, index: historicalBlockHeaderIndex }), "BeaconChainProofs.verifyWithdrawal: Invalid historicalsummary merkle proof" ); //Next we verify the slot against the blockRoot require( Merkle.verifyInclusionSha256({ proof: withdrawalProof.slotProof, root: withdrawalProof.blockRoot, leaf: withdrawalProof.slotRoot, index: SLOT_INDEX }), "BeaconChainProofs.verifyWithdrawal: Invalid slot merkle proof" ); { // Next we verify the executionPayloadRoot against the blockRoot uint256 executionPayloadIndex = (BODY_ROOT_INDEX << (BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT)) | EXECUTION_PAYLOAD_INDEX; require( Merkle.verifyInclusionSha256({ proof: withdrawalProof.executionPayloadProof, root: withdrawalProof.blockRoot, leaf: withdrawalProof.executionPayloadRoot, index: executionPayloadIndex }), "BeaconChainProofs.verifyWithdrawal: Invalid executionPayload merkle proof" ); } // Next we verify the timestampRoot against the executionPayload root require( Merkle.verifyInclusionSha256({ proof: withdrawalProof.timestampProof, root: withdrawalProof.executionPayloadRoot, leaf: withdrawalProof.timestampRoot, index: TIMESTAMP_INDEX }), "BeaconChainProofs.verifyWithdrawal: Invalid timestamp merkle proof" ); { /** * Next we verify the withdrawal fields against the executionPayloadRoot: * First we compute the withdrawal_index, then we merkleize the * withdrawalFields container to calculate the withdrawalRoot. * * Note: Merkleization of the withdrawals root tree uses MerkleizeWithMixin, i.e., the length of the array is hashed with the root of * the array. Thus we shift the WITHDRAWALS_INDEX over by WITHDRAWALS_TREE_HEIGHT + 1 and not just WITHDRAWALS_TREE_HEIGHT. */ uint256 withdrawalIndex = (WITHDRAWALS_INDEX << (WITHDRAWALS_TREE_HEIGHT + 1)) | uint256(withdrawalProof.withdrawalIndex); bytes32 withdrawalRoot = Merkle.merkleizeSha256(withdrawalFields); require( Merkle.verifyInclusionSha256({ proof: withdrawalProof.withdrawalProof, root: withdrawalProof.executionPayloadRoot, leaf: withdrawalRoot, index: withdrawalIndex }), "BeaconChainProofs.verifyWithdrawal: Invalid withdrawal merkle proof" ); } } /** * @notice This function replicates the ssz hashing of a validator's pubkey, outlined below: * hh := ssz.NewHasher() * hh.PutBytes(validatorPubkey[:]) * validatorPubkeyHash := hh.Hash() * hh.Reset() */ function hashValidatorBLSPubkey(bytes memory validatorPubkey) internal pure returns (bytes32 pubkeyHash) { require(validatorPubkey.length == 48, "Input should be 48 bytes in length"); return sha256(abi.encodePacked(validatorPubkey, bytes16(0))); } /** * @dev Retrieve the withdrawal timestamp */ function getWithdrawalTimestamp(WithdrawalProof memory withdrawalProof) internal pure returns (uint64) { return Endian.fromLittleEndianUint64(withdrawalProof.timestampRoot); } /** * @dev Converts the withdrawal's slot to an epoch */ function getWithdrawalEpoch(WithdrawalProof memory withdrawalProof) internal pure returns (uint64) { return Endian.fromLittleEndianUint64(withdrawalProof.slotRoot) / SLOTS_PER_EPOCH; } /** * Indices for validator fields (refer to consensus specs): * 0: pubkey * 1: withdrawal credentials * 2: effective balance * 3: slashed? * 4: activation elligibility epoch * 5: activation epoch * 6: exit epoch * 7: withdrawable epoch */ /** * @dev Retrieves a validator's pubkey hash */ function getPubkeyHash(bytes32[] memory validatorFields) internal pure returns (bytes32) { return validatorFields[VALIDATOR_PUBKEY_INDEX]; } function getWithdrawalCredentials(bytes32[] memory validatorFields) internal pure returns (bytes32) { return validatorFields[VALIDATOR_WITHDRAWAL_CREDENTIALS_INDEX]; } /** * @dev Retrieves a validator's effective balance (in gwei) */ function getEffectiveBalanceGwei(bytes32[] memory validatorFields) internal pure returns (uint64) { return Endian.fromLittleEndianUint64(validatorFields[VALIDATOR_BALANCE_INDEX]); } /** * @dev Retrieves a validator's withdrawable epoch */ function getWithdrawableEpoch(bytes32[] memory validatorFields) internal pure returns (uint64) { return Endian.fromLittleEndianUint64(validatorFields[VALIDATOR_WITHDRAWABLE_EPOCH_INDEX]); } /** * Indices for withdrawal fields (refer to consensus specs): * 0: withdrawal index * 1: validator index * 2: execution address * 3: withdrawal amount */ /** * @dev Retrieves a withdrawal's validator index */ function getValidatorIndex(bytes32[] memory withdrawalFields) internal pure returns (uint40) { return uint40(Endian.fromLittleEndianUint64(withdrawalFields[WITHDRAWAL_VALIDATOR_INDEX_INDEX])); } /** * @dev Retrieves a withdrawal's withdrawal amount (in gwei) */ function getWithdrawalAmountGwei(bytes32[] memory withdrawalFields) internal pure returns (uint64) { return Endian.fromLittleEndianUint64(withdrawalFields[WITHDRAWAL_VALIDATOR_AMOUNT_INDEX]); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; library Endian { /** * @notice Converts a little endian-formatted uint64 to a big endian-formatted uint64 * @param lenum little endian-formatted uint64 input, provided as 'bytes32' type * @return n The big endian-formatted uint64 * @dev Note that the input is formatted as a 'bytes32' type (i.e. 256 bits), but it is immediately truncated to a uint64 (i.e. 64 bits) * through a right-shift/shr operation. */ function fromLittleEndianUint64(bytes32 lenum) internal pure returns (uint64 n) { // the number needs to be stored in little-endian encoding (ie in bytes 0-8) n = uint64(uint256(lenum >> 192)); // forgefmt: disable-next-item return (n >> 56) | ((0x00FF000000000000 & n) >> 40) | ((0x0000FF0000000000 & n) >> 24) | ((0x000000FF00000000 & n) >> 8) | ((0x00000000FF000000 & n) << 8) | ((0x0000000000FF0000 & n) << 24) | ((0x000000000000FF00 & n) << 40) | ((0x00000000000000FF & n) << 56); } }
{ "remappings": [ "@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable/", "@openzeppelin/=lib/openzeppelin-contracts/", "@openzeppelin-v4.9.0/=lib/openzeppelin-contracts-v4.9.0/", "@openzeppelin-upgrades-v4.9.0/=lib/openzeppelin-contracts-upgradeable-v4.9.0/", "ds-test/=lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable-v4.9.0/lib/erc4626-tests/", "openzeppelin-contracts-upgradeable-v4.9.0/=lib/openzeppelin-contracts-upgradeable-v4.9.0/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts-v4.9.0/=lib/openzeppelin-contracts-v4.9.0/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts-upgradeable-v4.9.0/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IDelegationManager","name":"_delegationManager","type":"address"},{"internalType":"contract IStrategyManager","name":"_strategyManager","type":"address"},{"internalType":"uint32","name":"_CALCULATION_INTERVAL_SECONDS","type":"uint32"},{"internalType":"uint32","name":"_MAX_REWARDS_DURATION","type":"uint32"},{"internalType":"uint32","name":"_MAX_RETROACTIVE_LENGTH","type":"uint32"},{"internalType":"uint32","name":"_MAX_FUTURE_LENGTH","type":"uint32"},{"internalType":"uint32","name":"__GENESIS_REWARDS_TIMESTAMP","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"avs","type":"address"},{"indexed":true,"internalType":"uint256","name":"submissionNonce","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"rewardsSubmissionHash","type":"bytes32"},{"components":[{"components":[{"internalType":"contract IStrategy","name":"strategy","type":"address"},{"internalType":"uint96","name":"multiplier","type":"uint96"}],"internalType":"struct IRewardsCoordinator.StrategyAndMultiplier[]","name":"strategiesAndMultipliers","type":"tuple[]"},{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"startTimestamp","type":"uint32"},{"internalType":"uint32","name":"duration","type":"uint32"}],"indexed":false,"internalType":"struct IRewardsCoordinator.RewardsSubmission","name":"rewardsSubmission","type":"tuple"}],"name":"AVSRewardsSubmissionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"oldActivationDelay","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"newActivationDelay","type":"uint32"}],"name":"ActivationDelaySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"earner","type":"address"},{"indexed":true,"internalType":"address","name":"oldClaimer","type":"address"},{"indexed":true,"internalType":"address","name":"claimer","type":"address"}],"name":"ClaimerForSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"rootIndex","type":"uint32"}],"name":"DistributionRootDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"rootIndex","type":"uint32"},{"indexed":true,"internalType":"bytes32","name":"root","type":"bytes32"},{"indexed":true,"internalType":"uint32","name":"rewardsCalculationEndTimestamp","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"activatedAt","type":"uint32"}],"name":"DistributionRootSubmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"oldGlobalCommissionBips","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"newGlobalCommissionBips","type":"uint16"}],"name":"GlobalCommissionBipsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"newPausedStatus","type":"uint256"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IPauserRegistry","name":"pauserRegistry","type":"address"},{"indexed":false,"internalType":"contract IPauserRegistry","name":"newPauserRegistry","type":"address"}],"name":"PauserRegistrySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"root","type":"bytes32"},{"indexed":true,"internalType":"address","name":"earner","type":"address"},{"indexed":true,"internalType":"address","name":"claimer","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"claimedAmount","type":"uint256"}],"name":"RewardsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rewardsForAllSubmitter","type":"address"},{"indexed":true,"internalType":"bool","name":"oldValue","type":"bool"},{"indexed":true,"internalType":"bool","name":"newValue","type":"bool"}],"name":"RewardsForAllSubmitterSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"submitter","type":"address"},{"indexed":true,"internalType":"uint256","name":"submissionNonce","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"rewardsSubmissionHash","type":"bytes32"},{"components":[{"components":[{"internalType":"contract IStrategy","name":"strategy","type":"address"},{"internalType":"uint96","name":"multiplier","type":"uint96"}],"internalType":"struct IRewardsCoordinator.StrategyAndMultiplier[]","name":"strategiesAndMultipliers","type":"tuple[]"},{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"startTimestamp","type":"uint32"},{"internalType":"uint32","name":"duration","type":"uint32"}],"indexed":false,"internalType":"struct IRewardsCoordinator.RewardsSubmission","name":"rewardsSubmission","type":"tuple"}],"name":"RewardsSubmissionForAllCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldRewardsUpdater","type":"address"},{"indexed":true,"internalType":"address","name":"newRewardsUpdater","type":"address"}],"name":"RewardsUpdaterSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"newPausedStatus","type":"uint256"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"CALCULATION_INTERVAL_SECONDS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GENESIS_REWARDS_TIMESTAMP","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_FUTURE_LENGTH","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_RETROACTIVE_LENGTH","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_REWARDS_DURATION","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activationDelay","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beaconChainETHStrategy","outputs":[{"internalType":"contract IStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"earner","type":"address"},{"internalType":"bytes32","name":"earnerTokenRoot","type":"bytes32"}],"internalType":"struct IRewardsCoordinator.EarnerTreeMerkleLeaf","name":"leaf","type":"tuple"}],"name":"calculateEarnerLeafHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"cumulativeEarnings","type":"uint256"}],"internalType":"struct IRewardsCoordinator.TokenTreeMerkleLeaf","name":"leaf","type":"tuple"}],"name":"calculateTokenLeafHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"rootIndex","type":"uint32"},{"internalType":"uint32","name":"earnerIndex","type":"uint32"},{"internalType":"bytes","name":"earnerTreeProof","type":"bytes"},{"components":[{"internalType":"address","name":"earner","type":"address"},{"internalType":"bytes32","name":"earnerTokenRoot","type":"bytes32"}],"internalType":"struct IRewardsCoordinator.EarnerTreeMerkleLeaf","name":"earnerLeaf","type":"tuple"},{"internalType":"uint32[]","name":"tokenIndices","type":"uint32[]"},{"internalType":"bytes[]","name":"tokenTreeProofs","type":"bytes[]"},{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"cumulativeEarnings","type":"uint256"}],"internalType":"struct IRewardsCoordinator.TokenTreeMerkleLeaf[]","name":"tokenLeaves","type":"tuple[]"}],"internalType":"struct IRewardsCoordinator.RewardsMerkleClaim","name":"claim","type":"tuple"}],"name":"checkClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimerFor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"contract IStrategy","name":"strategy","type":"address"},{"internalType":"uint96","name":"multiplier","type":"uint96"}],"internalType":"struct IRewardsCoordinator.StrategyAndMultiplier[]","name":"strategiesAndMultipliers","type":"tuple[]"},{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"startTimestamp","type":"uint32"},{"internalType":"uint32","name":"duration","type":"uint32"}],"internalType":"struct IRewardsCoordinator.RewardsSubmission[]","name":"rewardsSubmissions","type":"tuple[]"}],"name":"createAVSRewardsSubmission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"contract IStrategy","name":"strategy","type":"address"},{"internalType":"uint96","name":"multiplier","type":"uint96"}],"internalType":"struct IRewardsCoordinator.StrategyAndMultiplier[]","name":"strategiesAndMultipliers","type":"tuple[]"},{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"startTimestamp","type":"uint32"},{"internalType":"uint32","name":"duration","type":"uint32"}],"internalType":"struct IRewardsCoordinator.RewardsSubmission[]","name":"rewardsSubmissions","type":"tuple[]"}],"name":"createRewardsForAllSubmission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"contract IERC20","name":"","type":"address"}],"name":"cumulativeClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currRewardsCalculationEndTimestamp","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"delegationManager","outputs":[{"internalType":"contract IDelegationManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"rootIndex","type":"uint32"}],"name":"disableRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"domainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentClaimableDistributionRoot","outputs":[{"components":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint32","name":"rewardsCalculationEndTimestamp","type":"uint32"},{"internalType":"uint32","name":"activatedAt","type":"uint32"},{"internalType":"bool","name":"disabled","type":"bool"}],"internalType":"struct IRewardsCoordinator.DistributionRoot","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentDistributionRoot","outputs":[{"components":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint32","name":"rewardsCalculationEndTimestamp","type":"uint32"},{"internalType":"uint32","name":"activatedAt","type":"uint32"},{"internalType":"bool","name":"disabled","type":"bool"}],"internalType":"struct IRewardsCoordinator.DistributionRoot","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getDistributionRootAtIndex","outputs":[{"components":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint32","name":"rewardsCalculationEndTimestamp","type":"uint32"},{"internalType":"uint32","name":"activatedAt","type":"uint32"},{"internalType":"bool","name":"disabled","type":"bool"}],"internalType":"struct IRewardsCoordinator.DistributionRoot","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDistributionRootsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"rootHash","type":"bytes32"}],"name":"getRootIndexFromHash","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalOperatorCommissionBips","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"},{"internalType":"contract IPauserRegistry","name":"_pauserRegistry","type":"address"},{"internalType":"uint256","name":"initialPausedStatus","type":"uint256"},{"internalType":"address","name":"_rewardsUpdater","type":"address"},{"internalType":"uint32","name":"_activationDelay","type":"uint32"},{"internalType":"uint16","name":"_globalCommissionBips","type":"uint16"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"isAVSRewardsSubmissionHash","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isRewardsForAllSubmitter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"isRewardsSubmissionForAllHash","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"avs","type":"address"}],"name":"operatorCommissionBips","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPausedStatus","type":"uint256"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pauseAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"index","type":"uint8"}],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauserRegistry","outputs":[{"internalType":"contract IPauserRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"rootIndex","type":"uint32"},{"internalType":"uint32","name":"earnerIndex","type":"uint32"},{"internalType":"bytes","name":"earnerTreeProof","type":"bytes"},{"components":[{"internalType":"address","name":"earner","type":"address"},{"internalType":"bytes32","name":"earnerTokenRoot","type":"bytes32"}],"internalType":"struct IRewardsCoordinator.EarnerTreeMerkleLeaf","name":"earnerLeaf","type":"tuple"},{"internalType":"uint32[]","name":"tokenIndices","type":"uint32[]"},{"internalType":"bytes[]","name":"tokenTreeProofs","type":"bytes[]"},{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"cumulativeEarnings","type":"uint256"}],"internalType":"struct IRewardsCoordinator.TokenTreeMerkleLeaf[]","name":"tokenLeaves","type":"tuple[]"}],"internalType":"struct IRewardsCoordinator.RewardsMerkleClaim","name":"claim","type":"tuple"},{"internalType":"address","name":"recipient","type":"address"}],"name":"processClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardsUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_activationDelay","type":"uint32"}],"name":"setActivationDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"claimer","type":"address"}],"name":"setClaimerFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_globalCommissionBips","type":"uint16"}],"name":"setGlobalOperatorCommission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPauserRegistry","name":"newPauserRegistry","type":"address"}],"name":"setPauserRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_submitter","type":"address"},{"internalType":"bool","name":"_newValue","type":"bool"}],"name":"setRewardsForAllSubmitter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsUpdater","type":"address"}],"name":"setRewardsUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategyManager","outputs":[{"internalType":"contract IStrategyManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"submissionNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint32","name":"rewardsCalculationEndTimestamp","type":"uint32"}],"name":"submitRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPausedStatus","type":"uint256"}],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101806040523480156200001257600080fd5b5060405162004367380380620043678339810160408190526200003591620002e4565b868686868686866200004885826200037e565b63ffffffff1615620000ed5760405162461bcd60e51b815260206004820152606060248201527f52657761726473436f6f7264696e61746f723a2047454e455349535f5245574160448201527f5244535f54494d455354414d50206d7573742062652061206d756c7469706c6560648201527f206f662043414c43554c4154494f4e5f494e54455256414c5f5345434f4e4453608482015260a4015b60405180910390fd5b620000fc62015180866200037e565b63ffffffff16156200019d5760405162461bcd60e51b815260206004820152605760248201527f52657761726473436f6f7264696e61746f723a2043414c43554c4154494f4e5f60448201527f494e54455256414c5f5345434f4e4453206d7573742062652061206d756c746960648201527f706c65206f6620534e415053484f545f434144454e4345000000000000000000608482015260a401620000e4565b6001600160a01b0396871661012052949095166101405263ffffffff92831660805290821660a052811660c05291821660e0521661010052620001df620001f2565b5050466101605250620003b09350505050565b600054610100900460ff16156200025c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608401620000e4565b60005460ff9081161015620002af576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6001600160a01b0381168114620002c757600080fd5b50565b805163ffffffff81168114620002df57600080fd5b919050565b600080600080600080600060e0888a0312156200030057600080fd5b87516200030d81620002b1565b60208901519097506200032081620002b1565b95506200033060408901620002ca565b94506200034060608901620002ca565b93506200035060808901620002ca565b92506200036060a08901620002ca565b91506200037060c08901620002ca565b905092959891949750929550565b600063ffffffff80841680620003a457634e487b7160e01b600052601260045260246000fd5b92169190910692915050565b60805160a05160c05160e05161010051610120516101405161016051613f20620004476000396000611a640152600081816104c7015261271e015260006107590152600081816103d0015261254d0152600081816102fc01526125f90152600081816104a001526124fc0152600081816106b8015261227301526000818161065e0152818161232a01526124050152613f206000f3fe608060405234801561001057600080fd5b50600436106102ba5760003560e01c8063715018a611610182578063c46db606116100e9578063f2fde38b116100a2578063f96abf2e1161007c578063f96abf2e146107a9578063fabc1cbc146107bc578063fbf1e2c1146107cf578063fce36c7d146107e257600080fd5b8063f2fde38b1461077b578063f698da251461078e578063f8cd84481461079657600080fd5b8063c46db606146106da578063d4540a5514610708578063de02e5031461071b578063e221b2451461072e578063e810ce2114610741578063ea4d3c9b1461075457600080fd5b80639104c3191161013b5780639104c319146106365780639be3d4e4146106515780639d45c28114610659578063a0169ddd14610680578063bb7e451f14610693578063bf21a8aa146106b357600080fd5b8063715018a6146105c45780637b8f8b05146105cc578063863cb9a9146105d4578063865c6953146105e7578063886f1195146106125780638da5cb5b1461062557600080fd5b806337838ed01161022657806358baaa3e116101df57806358baaa3e1461053d578063595c6a67146105505780635ac86ab7146105585780635c975abb1461057b5780635e9d8348146105835780636d21117e1461059657600080fd5b806337838ed01461049b57806339b70e38146104c25780633a8c0786146104e95780633ccc861d146105005780633efe1db6146105135780634d18cc351461052657600080fd5b8063131433b411610278578063131433b4146103cb578063136439dd146103f2578063149bc8721461040557806322f19a64146104265780632b9f64a41461044757806336af41fa1461048857600080fd5b806218572c146102bf57806304a0c502146102f7578063092db007146103335780630e9a53cf1461035b5780630eb38345146103a357806310d67a2f146103b8575b600080fd5b6102e26102cd3660046135a9565b60d16020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61031e7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016102ee565b60cb5461034890600160e01b900461ffff1681565b60405161ffff90911681526020016102ee565b6103636107f5565b604080518251815260208084015163ffffffff908116918301919091528383015116918101919091526060918201511515918101919091526080016102ee565b6103b66103b13660046135d4565b6108d4565b005b6103b66103c63660046135a9565b610956565b61031e7f000000000000000000000000000000000000000000000000000000000000000081565b6103b661040036600461360d565b610a12565b61041861041336600461363e565b610b51565b6040519081526020016102ee565b61034861043436600461365a565b505060cb54600160e01b900461ffff1690565b6104706104553660046135a9565b60cc602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102ee565b6103b6610496366004613688565b610bc7565b61031e7f000000000000000000000000000000000000000000000000000000000000000081565b6104707f000000000000000000000000000000000000000000000000000000000000000081565b60cb5461031e90600160a01b900463ffffffff1681565b6103b661050e366004613710565b610e01565b6103b6610521366004613770565b6111c5565b60cb5461031e90600160c01b900463ffffffff1681565b6103b661054b36600461379c565b611496565b6103b66114a7565b6102e26105663660046137b7565b606654600160ff9092169190911b9081161490565b606654610418565b6102e26105913660046137da565b61156e565b6102e26105a436600461380f565b60cf60209081526000928352604080842090915290825290205460ff1681565b6103b66115fb565b60ca54610418565b6103b66105e23660046135a9565b61160f565b6104186105f536600461365a565b60cd60209081526000928352604080842090915290825290205481565b606554610470906001600160a01b031681565b6033546001600160a01b0316610470565b61047073beac0eeeeeeeeeeeeeeeeeeeeeeeeeeeeeebeac081565b610363611620565b61031e7f000000000000000000000000000000000000000000000000000000000000000081565b6103b661068e3660046135a9565b6116be565b6104186106a13660046135a9565b60ce6020526000908152604090205481565b61031e7f000000000000000000000000000000000000000000000000000000000000000081565b6102e26106e836600461380f565b60d060209081526000928352604080842090915290825290205460ff1681565b6103b6610716366004613858565b61171d565b61036361072936600461360d565b611865565b6103b661073c3660046138cb565b6118f7565b61031e61074f36600461360d565b611908565b6104707f000000000000000000000000000000000000000000000000000000000000000081565b6103b66107893660046135a9565b6119ea565b610418611a60565b6104186107a436600461363e565b611a9e565b6103b66107b736600461379c565b611aaf565b6103b66107ca36600461360d565b611ce5565b60cb54610470906001600160a01b031681565b6103b66107f0366004613688565b611e41565b60408051608081018252600080825260208201819052918101829052606081019190915260ca545b80156108d057600060ca6108326001846138fc565b8154811061084257610842613913565b600091825260209182902060408051608081018252600293909302909101805483526001015463ffffffff80821694840194909452600160201b810490931690820152600160401b90910460ff1615801560608301819052919250906108b25750806040015163ffffffff164210155b156108bd5792915050565b50806108c881613929565b91505061081d565b5090565b6108dc611fc0565b6001600160a01b038216600081815260d1602052604080822054905160ff9091169284151592841515927f4de6293e668df1398422e1def12118052c1539a03cbfedc145895d48d7685f1c9190a4506001600160a01b0391909116600090815260d160205260409020805460ff1916911515919091179055565b606560009054906101000a90046001600160a01b03166001600160a01b031663eab66d7a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cd9190613940565b6001600160a01b0316336001600160a01b031614610a065760405162461bcd60e51b81526004016109fd9061395d565b60405180910390fd5b610a0f8161201a565b50565b60655460405163237dfb4760e11b81523360048201526001600160a01b03909116906346fbf68e90602401602060405180830381865afa158015610a5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7e91906139a7565b610a9a5760405162461bcd60e51b81526004016109fd906139c4565b60665481811614610b135760405162461bcd60e51b815260206004820152603860248201527f5061757361626c652e70617573653a20696e76616c696420617474656d70742060448201527f746f20756e70617573652066756e6374696f6e616c697479000000000000000060648201526084016109fd565b606681905560405181815233907fab40a374bc51de372200a8bc981af8c9ecdc08dfdaef0bb6e09f88f3c616ef3d906020015b60405180910390a250565b600080610b6160208401846135a9565b8360200135604051602001610baa9392919060f89390931b6001600160f81b031916835260609190911b6bffffffffffffffffffffffff19166001830152601582015260350190565b604051602081830303815290604052805190602001209050919050565b60665460019060029081161415610bf05760405162461bcd60e51b81526004016109fd90613a0c565b33600090815260d1602052604090205460ff16610c8f5760405162461bcd60e51b815260206004820152605160248201527f52657761726473436f6f7264696e61746f723a2063616c6c6572206973206e6f60448201527f7420612076616c69642063726561746552657761726473466f72416c6c53756260648201527036b4b9b9b4b7b71039bab136b4ba3a32b960791b608482015260a4016109fd565b60026097541415610cb25760405162461bcd60e51b81526004016109fd90613a43565b600260975560005b82811015610df65736848483818110610cd557610cd5613913565b9050602002810190610ce79190613a7a565b33600081815260ce60209081526040808320549051949550939192610d129290918591879101613bbf565b604051602081830303815290604052805190602001209050610d3383612111565b33600090815260d0602090815260408083208484529091529020805460ff19166001908117909155610d66908390613bef565b33600081815260ce602052604090819020929092559051829184917f51088b8c89628df3a8174002c2a034d0152fce6af8415d651b2a4734bf27048290610dae908890613c07565b60405180910390a4610de0333060408601803590610dcf90602089016135a9565b6001600160a01b03169291906128e9565b5050508080610dee90613c1a565b915050610cba565b505060016097555050565b60665460029060049081161415610e2a5760405162461bcd60e51b81526004016109fd90613a0c565b60026097541415610e4d5760405162461bcd60e51b81526004016109fd90613a43565b6002609755600060ca610e63602086018661379c565b63ffffffff1681548110610e7957610e79613913565b600091825260209182902060408051608081018252600293909302909101805483526001015463ffffffff80821694840194909452600160201b810490931690820152600160401b90910460ff16151560608201529050610eda848261295a565b6000610eec60808601606087016135a9565b6001600160a01b03808216600090815260cc60205260409020549192501680610f125750805b336001600160a01b03821614610f905760405162461bcd60e51b815260206004820152603c60248201527f52657761726473436f6f7264696e61746f722e70726f63657373436c61696d3a60448201527f2063616c6c6572206973206e6f742076616c696420636c61696d65720000000060648201526084016109fd565b60005b610fa060a0880188613c35565b90508110156111b75736610fb760e0890189613c86565b83818110610fc757610fc7613913565b6001600160a01b038716600090815260cd602090815260408083209302949094019450929091508290610ffc908501856135a9565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050808260200135116110b65760405162461bcd60e51b815260206004820152605560248201527f52657761726473436f6f7264696e61746f722e70726f63657373436c61696d3a60448201527f2063756d756c61746976654561726e696e6773206d75737420626520677420746064820152741a185b8818dd5b5d5b185d1a5d9950db185a5b5959605a1b608482015260a4016109fd565b60006110c68260208501356138fc565b6001600160a01b038716600090815260cd602090815260408220929350850180359291906110f490876135a9565b6001600160a01b0316815260208082019290925260400160002091909155611136908a908390611126908701876135a9565b6001600160a01b03169190612c26565b86516001600160a01b03808b1691878216918916907f9543dbd55580842586a951f0386e24d68a5df99ae29e3b216588b45fd684ce319061117a60208901896135a9565b604080519283526001600160a01b039091166020830152810186905260600160405180910390a450505080806111af90613c1a565b915050610f93565b505060016097555050505050565b606654600390600890811614156111ee5760405162461bcd60e51b81526004016109fd90613a0c565b60cb546001600160a01b031633146112185760405162461bcd60e51b81526004016109fd90613cd0565b60cb5463ffffffff600160c01b9091048116908316116112b45760405162461bcd60e51b815260206004820152604b60248201527f52657761726473436f6f7264696e61746f722e7375626d6974526f6f743a206e60448201527f657720726f6f74206d75737420626520666f72206e657765722063616c63756c60648201526a185d1959081c195c9a5bd960aa1b608482015260a4016109fd565b428263ffffffff161061134d5760405162461bcd60e51b815260206004820152605560248201527f52657761726473436f6f7264696e61746f722e7375626d6974526f6f743a207260448201527f65776172647343616c63756c6174696f6e456e6454696d657374616d702063616064820152746e6e6f7420626520696e207468652066757475726560581b608482015260a4016109fd565b60ca5460cb5460009061136d90600160a01b900463ffffffff1642613d24565b6040805160808101825287815263ffffffff878116602080840182815286841685870181815260006060880181815260ca8054600181018255925297517f42d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee160029092029182015592517f42d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee290930180549151975193871667ffffffffffffffff1990921691909117600160201b978716979097029690961760ff60401b1916600160401b921515929092029190911790945560cb805463ffffffff60c01b1916600160c01b840217905593519283529394508892908616917fecd866c3c158fa00bf34d803d5f6023000b57080bcb48af004c2b4b46b3afd08910160405180910390a45050505050565b61149e611fc0565b610a0f81612c56565b60655460405163237dfb4760e11b81523360048201526001600160a01b03909116906346fbf68e90602401602060405180830381865afa1580156114ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151391906139a7565b61152f5760405162461bcd60e51b81526004016109fd906139c4565b600019606681905560405190815233907fab40a374bc51de372200a8bc981af8c9ecdc08dfdaef0bb6e09f88f3c616ef3d9060200160405180910390a2565b60006115f38260ca611583602083018361379c565b63ffffffff168154811061159957611599613913565b600091825260209182902060408051608081018252600293909302909101805483526001015463ffffffff80821694840194909452600160201b810490931690820152600160401b90910460ff161515606082015261295a565b506001919050565b611603611fc0565b61160d6000612cc7565b565b611617611fc0565b610a0f81612d19565b60408051608081018252600080825260208201819052918101829052606081019190915260ca8054611654906001906138fc565b8154811061166457611664613913565b600091825260209182902060408051608081018252600293909302909101805483526001015463ffffffff80821694840194909452600160201b810490931690820152600160401b90910460ff1615156060820152919050565b33600081815260cc602052604080822080546001600160a01b031981166001600160a01b038781169182179093559251911692839185917fbab947934d42e0ad206f25c9cab18b5bb6ae144acfb00f40b4e3aa59590ca31291a4505050565b600054610100900460ff161580801561173d5750600054600160ff909116105b806117575750303b158015611757575060005460ff166001145b6117ba5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109fd565b6000805460ff1916600117905580156117dd576000805461ff0019166101001790555b6117e5612d75565b60c9556117f28686612e0c565b6117fb87612cc7565b61180484612d19565b61180d83612c56565b61181682612ef6565b801561185c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b60408051608081018252600080825260208201819052918101829052606081019190915260ca828154811061189c5761189c613913565b600091825260209182902060408051608081018252600293909302909101805483526001015463ffffffff80821694840194909452600160201b810490931690820152600160401b90910460ff161515606082015292915050565b6118ff611fc0565b610a0f81612ef6565b60ca546000905b63ffffffff81161561197b578260ca611929600184613d4c565b63ffffffff168154811061193f5761193f613913565b906000526020600020906002020160000154141561196957611962600182613d4c565b9392505050565b8061197381613d71565b91505061190f565b5060405162461bcd60e51b815260206004820152603760248201527f52657761726473436f6f7264696e61746f722e676574526f6f74496e6465784660448201527f726f6d486173683a20726f6f74206e6f7420666f756e6400000000000000000060648201526084016109fd565b6119f2611fc0565b6001600160a01b038116611a575760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109fd565b610a0f81612cc7565b60007f0000000000000000000000000000000000000000000000000000000000000000461415611a91575060c95490565b611a99612d75565b905090565b60006001610b6160208401846135a9565b60665460039060089081161415611ad85760405162461bcd60e51b81526004016109fd90613a0c565b60cb546001600160a01b03163314611b025760405162461bcd60e51b81526004016109fd90613cd0565b60ca5463ffffffff831610611b735760405162461bcd60e51b815260206004820152603160248201527f52657761726473436f6f7264696e61746f722e64697361626c65526f6f743a206044820152700d2dcecc2d8d2c840e4dedee892dcc8caf607b1b60648201526084016109fd565b600060ca8363ffffffff1681548110611b8e57611b8e613913565b906000526020600020906002020190508060010160089054906101000a900460ff1615611c1b5760405162461bcd60e51b815260206004820152603560248201527f52657761726473436f6f7264696e61746f722e64697361626c65526f6f743a206044820152741c9bdbdd08185b1c9958591e48191a5cd8589b1959605a1b60648201526084016109fd565b6001810154600160201b900463ffffffff164210611c9a5760405162461bcd60e51b815260206004820152603660248201527f52657761726473436f6f7264696e61746f722e64697361626c65526f6f743a206044820152751c9bdbdd08185b1c9958591e481858dd1a5d985d195960521b60648201526084016109fd565b60018101805460ff60401b1916600160401b17905560405163ffffffff8416907fd850e6e5dfa497b72661fa73df2923464eaed9dc2ff1d3cb82bccbfeabe5c41e90600090a2505050565b606560009054906101000a90046001600160a01b03166001600160a01b031663eab66d7a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5c9190613940565b6001600160a01b0316336001600160a01b031614611d8c5760405162461bcd60e51b81526004016109fd9061395d565b606654198119606654191614611e0a5760405162461bcd60e51b815260206004820152603860248201527f5061757361626c652e756e70617573653a20696e76616c696420617474656d7060448201527f7420746f2070617573652066756e6374696f6e616c697479000000000000000060648201526084016109fd565b606681905560405181815233907f3582d1828e26bf56bd801502bc021ac0bc8afb57c826e4986b45593c8fad389c90602001610b46565b60665460009060019081161415611e6a5760405162461bcd60e51b81526004016109fd90613a0c565b60026097541415611e8d5760405162461bcd60e51b81526004016109fd90613a43565b600260975560005b82811015610df65736848483818110611eb057611eb0613913565b9050602002810190611ec29190613a7a565b33600081815260ce60209081526040808320549051949550939192611eed9290918591879101613bbf565b604051602081830303815290604052805190602001209050611f0e83612111565b33600090815260cf602090815260408083208484529091529020805460ff19166001908117909155611f41908390613bef565b33600081815260ce602052604090819020929092559051829184917f450a367a380c4e339e5ae7340c8464ef27af7781ad9945cfe8abd828f89e628190611f89908890613c07565b60405180910390a4611faa333060408601803590610dcf90602089016135a9565b5050508080611fb890613c1a565b915050611e95565b6033546001600160a01b0316331461160d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109fd565b6001600160a01b0381166120a85760405162461bcd60e51b815260206004820152604960248201527f5061757361626c652e5f73657450617573657252656769737472793a206e657760448201527f50617573657252656769737472792063616e6e6f7420626520746865207a65726064820152686f206164647265737360b81b608482015260a4016109fd565b606554604080516001600160a01b03928316815291831660208301527f6e9fcd539896fca60e8b0f01dd580233e48a6b0f7df013b89ba7f565869acdb6910160405180910390a1606580546001600160a01b0319166001600160a01b0392909216919091179055565b600061211d8280613c86565b905011612182576040805162461bcd60e51b8152602060048201526024810191909152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a206e6f20737472617465676965732073657460648201526084016109fd565b60008160400135116121f45760405162461bcd60e51b81526020600482015260416024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20616d6f756e742063616e6e6f74206265206064820152600360fc1b608482015260a4016109fd565b6f4b3b4ca85a86c47a098a223fffffffff8160400135111561226c5760405162461bcd60e51b815260206004820152603f6024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20616d6f756e7420746f6f206c617267650060648201526084016109fd565b63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000166122a360a083016080840161379c565b63ffffffff1611156123285760405162461bcd60e51b81526020600482015260546024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a206475726174696f6e20657863656564732060648201527326a0ac2fa922aba0a92229afa22aa920aa24a7a760611b608482015260a4016109fd565b7f000000000000000000000000000000000000000000000000000000000000000061235960a083016080840161379c565b6123639190613da7565b63ffffffff16156124035760405162461bcd60e51b815260206004820152606a6024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a206475726174696f6e206d7573742062652060648201527f61206d756c7469706c65206f662043414c43554c4154494f4e5f494e54455256608482015269414c5f5345434f4e445360b01b60a482015260c4016109fd565b7f0000000000000000000000000000000000000000000000000000000000000000612434608083016060840161379c565b61243e9190613da7565b63ffffffff16156124e45760405162461bcd60e51b81526020600482015260706024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20737461727454696d657374616d70206d7560648201527f73742062652061206d756c7469706c65206f662043414c43554c4154494f4e5f60848201526f494e54455256414c5f5345434f4e445360801b60a482015260c4016109fd565b6124f4608082016060830161379c565b63ffffffff167f000000000000000000000000000000000000000000000000000000000000000063ffffffff164261252c91906138fc565b111580156125755750612545608082016060830161379c565b63ffffffff167f000000000000000000000000000000000000000000000000000000000000000063ffffffff1611155b6125ef5760405162461bcd60e51b81526020600482015260516024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20737461727454696d657374616d7020746f6064820152701bc819985c881a5b881d1a19481c185cdd607a1b608482015260a4016109fd565b61261f63ffffffff7f00000000000000000000000000000000000000000000000000000000000000001642613bef565b61262f608083016060840161379c565b63ffffffff1611156126b35760405162461bcd60e51b81526020600482015260536024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20737461727454696d657374616d7020746f6064820152726f2066617220696e207468652066757475726560681b608482015260a4016109fd565b6000805b6126c18380613c86565b90508110156128e45760006126d68480613c86565b838181106126e6576126e6613913565b6126fc92602060409092020190810191506135a9565b60405163198f077960e21b81526001600160a01b0380831660048301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063663c1de490602401602060405180830381865afa158015612767573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061278b91906139a7565b806127b257506001600160a01b03811673beac0eeeeeeeeeeeeeeeeeeeeeeeeeeeeeebeac0145b6128255760405162461bcd60e51b815260206004820152604a6024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20696e76616c69642073747261746567792060648201526918dbdb9cda59195c995960b21b608482015260a4016109fd565b806001600160a01b0316836001600160a01b0316106128d25760405162461bcd60e51b81526020600482015260696024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a2073747261746567696573206d757374206260648201527f6520696e20617363656e64696e67206f7264657220746f2068616e646c65206460848201526875706c69636174657360b81b60a482015260c4016109fd565b91506128dd81613c1a565b90506126b7565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526129549085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612f61565b50505050565b8060600151156129b35760405162461bcd60e51b81526020600482015260306024820152600080516020613eab83398151915260448201526f1c9bdbdd081a5cc8191a5cd8589b195960821b60648201526084016109fd565b806040015163ffffffff16421015612a1a5760405162461bcd60e51b81526020600482015260366024820152600080516020613eab8339815191526044820152751c9bdbdd081b9bdd081858dd1a5d985d1959081e595d60521b60648201526084016109fd565b612a2760c0830183613c35565b9050612a3660a0840184613c35565b905014612aae5760405162461bcd60e51b815260206004820152604c6024820152600080516020613eab83398151915260448201527f746f6b656e496e646963657320616e6420746f6b656e50726f6f6673206c656e60648201526b0cee8d040dad2e6dac2e8c6d60a31b608482015260a4016109fd565b612abb60e0830183613c86565b9050612aca60c0840184613c35565b905014612b405760405162461bcd60e51b815260206004820152604a6024820152600080516020613eab83398151915260448201527f746f6b656e5472656550726f6f667320616e64206c6561766573206c656e67746064820152690d040dad2e6dac2e8c6d60b31b608482015260a4016109fd565b8051612b6c90612b56604085016020860161379c565b612b636040860186613dca565b86606001613033565b60005b612b7c60a0840184613c35565b90508110156128e457612c166080840135612b9a60a0860186613c35565b84818110612baa57612baa613913565b9050602002016020810190612bbf919061379c565b612bcc60c0870187613c35565b85818110612bdc57612bdc613913565b9050602002810190612bee9190613dca565b612bfb60e0890189613c86565b87818110612c0b57612c0b613913565b9050604002016131a7565b612c1f81613c1a565b9050612b6f565b6040516001600160a01b0383166024820152604481018290526128e490849063a9059cbb60e01b9060640161291d565b60cb546040805163ffffffff600160a01b9093048316815291831660208301527faf557c6c02c208794817a705609cfa935f827312a1adfdd26494b6b95dd2b4b3910160405180910390a160cb805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60cb546040516001600160a01b038084169216907f237b82f438d75fc568ebab484b75b01d9287b9e98b490b7c23221623b6705dbb90600090a360cb80546001600160a01b0319166001600160a01b0392909216919091179055565b604080518082018252600a81526922b4b3b2b72630bcb2b960b11b60209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527f71b625cfad44bac63b13dba07f2e1d6084ee04b6f8752101ece6126d584ee6ea81840152466060820152306080808301919091528351808303909101815260a0909101909252815191012090565b6065546001600160a01b0316158015612e2d57506001600160a01b03821615155b612eaf5760405162461bcd60e51b815260206004820152604760248201527f5061757361626c652e5f696e697469616c697a655061757365723a205f696e6960448201527f7469616c697a6550617573657228292063616e206f6e6c792062652063616c6c6064820152666564206f6e636560c81b608482015260a4016109fd565b606681905560405181815233907fab40a374bc51de372200a8bc981af8c9ecdc08dfdaef0bb6e09f88f3c616ef3d9060200160405180910390a2612ef28261201a565b5050565b60cb546040805161ffff600160e01b9093048316815291831660208301527f8cdc428b0431b82d1619763f443a48197db344ba96905f3949643acd1c863a06910160405180910390a160cb805461ffff909216600160e01b0261ffff60e01b19909216919091179055565b6000612fb6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166132f89092919063ffffffff16565b8051909150156128e45780806020019051810190612fd491906139a7565b6128e45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109fd565b61303e602083613e11565b6001901b8463ffffffff16106130c85760405162461bcd60e51b815260206004820152604360248201527f52657761726473436f6f7264696e61746f722e5f7665726966794561726e657260448201527f436c61696d50726f6f663a20696e76616c6964206561726e65724c656166496e6064820152620c8caf60eb1b608482015260a4016109fd565b60006130d382610b51565b905061311e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a92508591505063ffffffff891661330f565b61319f5760405162461bcd60e51b815260206004820152604660248201527f52657761726473436f6f7264696e61746f722e5f7665726966794561726e657260448201527f436c61696d50726f6f663a20696e76616c6964206561726e657220636c61696d60648201526510383937b7b360d11b608482015260a4016109fd565b505050505050565b6131b2602083613e11565b6001901b8463ffffffff16106132305760405162461bcd60e51b815260206004820152603c60248201527f52657761726473436f6f7264696e61746f722e5f766572696679546f6b656e4360448201527f6c61696d3a20696e76616c696420746f6b656e4c656166496e6465780000000060648201526084016109fd565b600061323b82611a9e565b905061328684848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a92508591505063ffffffff891661330f565b61319f5760405162461bcd60e51b815260206004820152603f60248201527f52657761726473436f6f7264696e61746f722e5f766572696679546f6b656e4360448201527f6c61696d3a20696e76616c696420746f6b656e20636c61696d2070726f6f660060648201526084016109fd565b60606133078484600085613327565b949350505050565b60008361331d868585613458565b1495945050505050565b6060824710156133885760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109fd565b6001600160a01b0385163b6133df5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109fd565b600080866001600160a01b031685876040516133fb9190613e51565b60006040518083038185875af1925050503d8060008114613438576040519150601f19603f3d011682016040523d82523d6000602084013e61343d565b606091505b509150915061344d82828661355b565b979650505050505050565b6000602084516134689190613e63565b156134ef5760405162461bcd60e51b815260206004820152604b60248201527f4d65726b6c652e70726f63657373496e636c7573696f6e50726f6f664b65636360448201527f616b3a2070726f6f66206c656e6774682073686f756c642062652061206d756c60648201526a3a34b836329037b310199960a91b608482015260a4016109fd565b8260205b8551811161355257613506600285613e63565b61352757816000528086015160205260406000209150600284049350613540565b8086015160005281602052604060002091506002840493505b61354b602082613bef565b90506134f3565b50949350505050565b6060831561356a575081611962565b82511561357a5782518084602001fd5b8160405162461bcd60e51b81526004016109fd9190613e77565b6001600160a01b0381168114610a0f57600080fd5b6000602082840312156135bb57600080fd5b813561196281613594565b8015158114610a0f57600080fd5b600080604083850312156135e757600080fd5b82356135f281613594565b91506020830135613602816135c6565b809150509250929050565b60006020828403121561361f57600080fd5b5035919050565b60006040828403121561363857600080fd5b50919050565b60006040828403121561365057600080fd5b6119628383613626565b6000806040838503121561366d57600080fd5b823561367881613594565b9150602083013561360281613594565b6000806020838503121561369b57600080fd5b823567ffffffffffffffff808211156136b357600080fd5b818501915085601f8301126136c757600080fd5b8135818111156136d657600080fd5b8660208260051b85010111156136eb57600080fd5b60209290920196919550909350505050565b6000610100828403121561363857600080fd5b6000806040838503121561372357600080fd5b823567ffffffffffffffff81111561373a57600080fd5b613746858286016136fd565b925050602083013561360281613594565b803563ffffffff8116811461376b57600080fd5b919050565b6000806040838503121561378357600080fd5b8235915061379360208401613757565b90509250929050565b6000602082840312156137ae57600080fd5b61196282613757565b6000602082840312156137c957600080fd5b813560ff8116811461196257600080fd5b6000602082840312156137ec57600080fd5b813567ffffffffffffffff81111561380357600080fd5b613307848285016136fd565b6000806040838503121561382257600080fd5b823561382d81613594565b946020939093013593505050565b803561376b81613594565b803561ffff8116811461376b57600080fd5b60008060008060008060c0878903121561387157600080fd5b863561387c81613594565b9550602087013561388c81613594565b94506040870135935060608701356138a381613594565b92506138b160808801613757565b91506138bf60a08801613846565b90509295509295509295565b6000602082840312156138dd57600080fd5b61196282613846565b634e487b7160e01b600052601160045260246000fd5b60008282101561390e5761390e6138e6565b500390565b634e487b7160e01b600052603260045260246000fd5b600081613938576139386138e6565b506000190190565b60006020828403121561395257600080fd5b815161196281613594565b6020808252602a908201527f6d73672e73656e646572206973206e6f74207065726d697373696f6e6564206160408201526939903ab73830bab9b2b960b11b606082015260800190565b6000602082840312156139b957600080fd5b8151611962816135c6565b60208082526028908201527f6d73672e73656e646572206973206e6f74207065726d697373696f6e6564206160408201526739903830bab9b2b960c11b606082015260800190565b60208082526019908201527f5061757361626c653a20696e6465782069732070617573656400000000000000604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008235609e19833603018112613a9057600080fd5b9190910192915050565b818352600060208085019450826000805b86811015613aff578235613abe81613594565b6001600160a01b03168852828401356bffffffffffffffffffffffff8116808214613ae7578384fd5b89860152506040978801979290920191600101613aab565b50959695505050505050565b60008135601e19833603018112613b2157600080fd5b8201803567ffffffffffffffff811115613b3a57600080fd5b8060061b3603841315613b4c57600080fd5b60a08552613b6160a086018260208501613a9a565b915050613b706020840161383b565b6001600160a01b0316602085015260408381013590850152613b9460608401613757565b63ffffffff166060850152613bab60808401613757565b63ffffffff81166080860152509392505050565b60018060a01b0384168152826020820152606060408201526000613be66060830184613b0b565b95945050505050565b60008219821115613c0257613c026138e6565b500190565b6020815260006119626020830184613b0b565b6000600019821415613c2e57613c2e6138e6565b5060010190565b6000808335601e19843603018112613c4c57600080fd5b83018035915067ffffffffffffffff821115613c6757600080fd5b6020019150600581901b3603821315613c7f57600080fd5b9250929050565b6000808335601e19843603018112613c9d57600080fd5b83018035915067ffffffffffffffff821115613cb857600080fd5b6020019150600681901b3603821315613c7f57600080fd5b60208082526034908201527f52657761726473436f6f7264696e61746f723a2063616c6c6572206973206e6f6040820152733a103a3432903932bbb0b93239aab83230ba32b960611b606082015260800190565b600063ffffffff808316818516808303821115613d4357613d436138e6565b01949350505050565b600063ffffffff83811690831681811015613d6957613d696138e6565b039392505050565b600063ffffffff821680613d8757613d876138e6565b6000190192915050565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff80841680613dbe57613dbe613d91565b92169190910692915050565b6000808335601e19843603018112613de157600080fd5b83018035915067ffffffffffffffff821115613dfc57600080fd5b602001915036819003821315613c7f57600080fd5b600082613e2057613e20613d91565b500490565b60005b83811015613e40578181015183820152602001613e28565b838111156129545750506000910152565b60008251613a90818460208701613e25565b600082613e7257613e72613d91565b500690565b6020815260008251806020840152613e96816040850160208701613e25565b601f01601f1916919091016040019291505056fe52657761726473436f6f7264696e61746f722e5f636865636b436c61696d3a2052657761726473436f6f7264696e61746f722e5f76616c696461746552657761a26469706673582212205241c48c13adad0fbac957527ccb9cdaf54ef229ca469dd35f24f5a8d52d9d9f64736f6c634300080c003300000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a0000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000005c49000000000000000000000000000000000000000000000000000000000000dd7c000000000000000000000000000000000000000000000000000000000000278d000000000000000000000000000000000000000000000000000000000065fb7880
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102ba5760003560e01c8063715018a611610182578063c46db606116100e9578063f2fde38b116100a2578063f96abf2e1161007c578063f96abf2e146107a9578063fabc1cbc146107bc578063fbf1e2c1146107cf578063fce36c7d146107e257600080fd5b8063f2fde38b1461077b578063f698da251461078e578063f8cd84481461079657600080fd5b8063c46db606146106da578063d4540a5514610708578063de02e5031461071b578063e221b2451461072e578063e810ce2114610741578063ea4d3c9b1461075457600080fd5b80639104c3191161013b5780639104c319146106365780639be3d4e4146106515780639d45c28114610659578063a0169ddd14610680578063bb7e451f14610693578063bf21a8aa146106b357600080fd5b8063715018a6146105c45780637b8f8b05146105cc578063863cb9a9146105d4578063865c6953146105e7578063886f1195146106125780638da5cb5b1461062557600080fd5b806337838ed01161022657806358baaa3e116101df57806358baaa3e1461053d578063595c6a67146105505780635ac86ab7146105585780635c975abb1461057b5780635e9d8348146105835780636d21117e1461059657600080fd5b806337838ed01461049b57806339b70e38146104c25780633a8c0786146104e95780633ccc861d146105005780633efe1db6146105135780634d18cc351461052657600080fd5b8063131433b411610278578063131433b4146103cb578063136439dd146103f2578063149bc8721461040557806322f19a64146104265780632b9f64a41461044757806336af41fa1461048857600080fd5b806218572c146102bf57806304a0c502146102f7578063092db007146103335780630e9a53cf1461035b5780630eb38345146103a357806310d67a2f146103b8575b600080fd5b6102e26102cd3660046135a9565b60d16020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61031e7f0000000000000000000000000000000000000000000000000000000000278d0081565b60405163ffffffff90911681526020016102ee565b60cb5461034890600160e01b900461ffff1681565b60405161ffff90911681526020016102ee565b6103636107f5565b604080518251815260208084015163ffffffff908116918301919091528383015116918101919091526060918201511515918101919091526080016102ee565b6103b66103b13660046135d4565b6108d4565b005b6103b66103c63660046135a9565b610956565b61031e7f0000000000000000000000000000000000000000000000000000000065fb788081565b6103b661040036600461360d565b610a12565b61041861041336600461363e565b610b51565b6040519081526020016102ee565b61034861043436600461365a565b505060cb54600160e01b900461ffff1690565b6104706104553660046135a9565b60cc602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102ee565b6103b6610496366004613688565b610bc7565b61031e7f0000000000000000000000000000000000000000000000000000000000dd7c0081565b6104707f000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a81565b60cb5461031e90600160a01b900463ffffffff1681565b6103b661050e366004613710565b610e01565b6103b6610521366004613770565b6111c5565b60cb5461031e90600160c01b900463ffffffff1681565b6103b661054b36600461379c565b611496565b6103b66114a7565b6102e26105663660046137b7565b606654600160ff9092169190911b9081161490565b606654610418565b6102e26105913660046137da565b61156e565b6102e26105a436600461380f565b60cf60209081526000928352604080842090915290825290205460ff1681565b6103b66115fb565b60ca54610418565b6103b66105e23660046135a9565b61160f565b6104186105f536600461365a565b60cd60209081526000928352604080842090915290825290205481565b606554610470906001600160a01b031681565b6033546001600160a01b0316610470565b61047073beac0eeeeeeeeeeeeeeeeeeeeeeeeeeeeeebeac081565b610363611620565b61031e7f0000000000000000000000000000000000000000000000000000000000093a8081565b6103b661068e3660046135a9565b6116be565b6104186106a13660046135a9565b60ce6020526000908152604090205481565b61031e7f00000000000000000000000000000000000000000000000000000000005c490081565b6102e26106e836600461380f565b60d060209081526000928352604080842090915290825290205460ff1681565b6103b6610716366004613858565b61171d565b61036361072936600461360d565b611865565b6103b661073c3660046138cb565b6118f7565b61031e61074f36600461360d565b611908565b6104707f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a81565b6103b66107893660046135a9565b6119ea565b610418611a60565b6104186107a436600461363e565b611a9e565b6103b66107b736600461379c565b611aaf565b6103b66107ca36600461360d565b611ce5565b60cb54610470906001600160a01b031681565b6103b66107f0366004613688565b611e41565b60408051608081018252600080825260208201819052918101829052606081019190915260ca545b80156108d057600060ca6108326001846138fc565b8154811061084257610842613913565b600091825260209182902060408051608081018252600293909302909101805483526001015463ffffffff80821694840194909452600160201b810490931690820152600160401b90910460ff1615801560608301819052919250906108b25750806040015163ffffffff164210155b156108bd5792915050565b50806108c881613929565b91505061081d565b5090565b6108dc611fc0565b6001600160a01b038216600081815260d1602052604080822054905160ff9091169284151592841515927f4de6293e668df1398422e1def12118052c1539a03cbfedc145895d48d7685f1c9190a4506001600160a01b0391909116600090815260d160205260409020805460ff1916911515919091179055565b606560009054906101000a90046001600160a01b03166001600160a01b031663eab66d7a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cd9190613940565b6001600160a01b0316336001600160a01b031614610a065760405162461bcd60e51b81526004016109fd9061395d565b60405180910390fd5b610a0f8161201a565b50565b60655460405163237dfb4760e11b81523360048201526001600160a01b03909116906346fbf68e90602401602060405180830381865afa158015610a5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7e91906139a7565b610a9a5760405162461bcd60e51b81526004016109fd906139c4565b60665481811614610b135760405162461bcd60e51b815260206004820152603860248201527f5061757361626c652e70617573653a20696e76616c696420617474656d70742060448201527f746f20756e70617573652066756e6374696f6e616c697479000000000000000060648201526084016109fd565b606681905560405181815233907fab40a374bc51de372200a8bc981af8c9ecdc08dfdaef0bb6e09f88f3c616ef3d906020015b60405180910390a250565b600080610b6160208401846135a9565b8360200135604051602001610baa9392919060f89390931b6001600160f81b031916835260609190911b6bffffffffffffffffffffffff19166001830152601582015260350190565b604051602081830303815290604052805190602001209050919050565b60665460019060029081161415610bf05760405162461bcd60e51b81526004016109fd90613a0c565b33600090815260d1602052604090205460ff16610c8f5760405162461bcd60e51b815260206004820152605160248201527f52657761726473436f6f7264696e61746f723a2063616c6c6572206973206e6f60448201527f7420612076616c69642063726561746552657761726473466f72416c6c53756260648201527036b4b9b9b4b7b71039bab136b4ba3a32b960791b608482015260a4016109fd565b60026097541415610cb25760405162461bcd60e51b81526004016109fd90613a43565b600260975560005b82811015610df65736848483818110610cd557610cd5613913565b9050602002810190610ce79190613a7a565b33600081815260ce60209081526040808320549051949550939192610d129290918591879101613bbf565b604051602081830303815290604052805190602001209050610d3383612111565b33600090815260d0602090815260408083208484529091529020805460ff19166001908117909155610d66908390613bef565b33600081815260ce602052604090819020929092559051829184917f51088b8c89628df3a8174002c2a034d0152fce6af8415d651b2a4734bf27048290610dae908890613c07565b60405180910390a4610de0333060408601803590610dcf90602089016135a9565b6001600160a01b03169291906128e9565b5050508080610dee90613c1a565b915050610cba565b505060016097555050565b60665460029060049081161415610e2a5760405162461bcd60e51b81526004016109fd90613a0c565b60026097541415610e4d5760405162461bcd60e51b81526004016109fd90613a43565b6002609755600060ca610e63602086018661379c565b63ffffffff1681548110610e7957610e79613913565b600091825260209182902060408051608081018252600293909302909101805483526001015463ffffffff80821694840194909452600160201b810490931690820152600160401b90910460ff16151560608201529050610eda848261295a565b6000610eec60808601606087016135a9565b6001600160a01b03808216600090815260cc60205260409020549192501680610f125750805b336001600160a01b03821614610f905760405162461bcd60e51b815260206004820152603c60248201527f52657761726473436f6f7264696e61746f722e70726f63657373436c61696d3a60448201527f2063616c6c6572206973206e6f742076616c696420636c61696d65720000000060648201526084016109fd565b60005b610fa060a0880188613c35565b90508110156111b75736610fb760e0890189613c86565b83818110610fc757610fc7613913565b6001600160a01b038716600090815260cd602090815260408083209302949094019450929091508290610ffc908501856135a9565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050808260200135116110b65760405162461bcd60e51b815260206004820152605560248201527f52657761726473436f6f7264696e61746f722e70726f63657373436c61696d3a60448201527f2063756d756c61746976654561726e696e6773206d75737420626520677420746064820152741a185b8818dd5b5d5b185d1a5d9950db185a5b5959605a1b608482015260a4016109fd565b60006110c68260208501356138fc565b6001600160a01b038716600090815260cd602090815260408220929350850180359291906110f490876135a9565b6001600160a01b0316815260208082019290925260400160002091909155611136908a908390611126908701876135a9565b6001600160a01b03169190612c26565b86516001600160a01b03808b1691878216918916907f9543dbd55580842586a951f0386e24d68a5df99ae29e3b216588b45fd684ce319061117a60208901896135a9565b604080519283526001600160a01b039091166020830152810186905260600160405180910390a450505080806111af90613c1a565b915050610f93565b505060016097555050505050565b606654600390600890811614156111ee5760405162461bcd60e51b81526004016109fd90613a0c565b60cb546001600160a01b031633146112185760405162461bcd60e51b81526004016109fd90613cd0565b60cb5463ffffffff600160c01b9091048116908316116112b45760405162461bcd60e51b815260206004820152604b60248201527f52657761726473436f6f7264696e61746f722e7375626d6974526f6f743a206e60448201527f657720726f6f74206d75737420626520666f72206e657765722063616c63756c60648201526a185d1959081c195c9a5bd960aa1b608482015260a4016109fd565b428263ffffffff161061134d5760405162461bcd60e51b815260206004820152605560248201527f52657761726473436f6f7264696e61746f722e7375626d6974526f6f743a207260448201527f65776172647343616c63756c6174696f6e456e6454696d657374616d702063616064820152746e6e6f7420626520696e207468652066757475726560581b608482015260a4016109fd565b60ca5460cb5460009061136d90600160a01b900463ffffffff1642613d24565b6040805160808101825287815263ffffffff878116602080840182815286841685870181815260006060880181815260ca8054600181018255925297517f42d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee160029092029182015592517f42d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee290930180549151975193871667ffffffffffffffff1990921691909117600160201b978716979097029690961760ff60401b1916600160401b921515929092029190911790945560cb805463ffffffff60c01b1916600160c01b840217905593519283529394508892908616917fecd866c3c158fa00bf34d803d5f6023000b57080bcb48af004c2b4b46b3afd08910160405180910390a45050505050565b61149e611fc0565b610a0f81612c56565b60655460405163237dfb4760e11b81523360048201526001600160a01b03909116906346fbf68e90602401602060405180830381865afa1580156114ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151391906139a7565b61152f5760405162461bcd60e51b81526004016109fd906139c4565b600019606681905560405190815233907fab40a374bc51de372200a8bc981af8c9ecdc08dfdaef0bb6e09f88f3c616ef3d9060200160405180910390a2565b60006115f38260ca611583602083018361379c565b63ffffffff168154811061159957611599613913565b600091825260209182902060408051608081018252600293909302909101805483526001015463ffffffff80821694840194909452600160201b810490931690820152600160401b90910460ff161515606082015261295a565b506001919050565b611603611fc0565b61160d6000612cc7565b565b611617611fc0565b610a0f81612d19565b60408051608081018252600080825260208201819052918101829052606081019190915260ca8054611654906001906138fc565b8154811061166457611664613913565b600091825260209182902060408051608081018252600293909302909101805483526001015463ffffffff80821694840194909452600160201b810490931690820152600160401b90910460ff1615156060820152919050565b33600081815260cc602052604080822080546001600160a01b031981166001600160a01b038781169182179093559251911692839185917fbab947934d42e0ad206f25c9cab18b5bb6ae144acfb00f40b4e3aa59590ca31291a4505050565b600054610100900460ff161580801561173d5750600054600160ff909116105b806117575750303b158015611757575060005460ff166001145b6117ba5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109fd565b6000805460ff1916600117905580156117dd576000805461ff0019166101001790555b6117e5612d75565b60c9556117f28686612e0c565b6117fb87612cc7565b61180484612d19565b61180d83612c56565b61181682612ef6565b801561185c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b60408051608081018252600080825260208201819052918101829052606081019190915260ca828154811061189c5761189c613913565b600091825260209182902060408051608081018252600293909302909101805483526001015463ffffffff80821694840194909452600160201b810490931690820152600160401b90910460ff161515606082015292915050565b6118ff611fc0565b610a0f81612ef6565b60ca546000905b63ffffffff81161561197b578260ca611929600184613d4c565b63ffffffff168154811061193f5761193f613913565b906000526020600020906002020160000154141561196957611962600182613d4c565b9392505050565b8061197381613d71565b91505061190f565b5060405162461bcd60e51b815260206004820152603760248201527f52657761726473436f6f7264696e61746f722e676574526f6f74496e6465784660448201527f726f6d486173683a20726f6f74206e6f7420666f756e6400000000000000000060648201526084016109fd565b6119f2611fc0565b6001600160a01b038116611a575760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109fd565b610a0f81612cc7565b60007f0000000000000000000000000000000000000000000000000000000000000001461415611a91575060c95490565b611a99612d75565b905090565b60006001610b6160208401846135a9565b60665460039060089081161415611ad85760405162461bcd60e51b81526004016109fd90613a0c565b60cb546001600160a01b03163314611b025760405162461bcd60e51b81526004016109fd90613cd0565b60ca5463ffffffff831610611b735760405162461bcd60e51b815260206004820152603160248201527f52657761726473436f6f7264696e61746f722e64697361626c65526f6f743a206044820152700d2dcecc2d8d2c840e4dedee892dcc8caf607b1b60648201526084016109fd565b600060ca8363ffffffff1681548110611b8e57611b8e613913565b906000526020600020906002020190508060010160089054906101000a900460ff1615611c1b5760405162461bcd60e51b815260206004820152603560248201527f52657761726473436f6f7264696e61746f722e64697361626c65526f6f743a206044820152741c9bdbdd08185b1c9958591e48191a5cd8589b1959605a1b60648201526084016109fd565b6001810154600160201b900463ffffffff164210611c9a5760405162461bcd60e51b815260206004820152603660248201527f52657761726473436f6f7264696e61746f722e64697361626c65526f6f743a206044820152751c9bdbdd08185b1c9958591e481858dd1a5d985d195960521b60648201526084016109fd565b60018101805460ff60401b1916600160401b17905560405163ffffffff8416907fd850e6e5dfa497b72661fa73df2923464eaed9dc2ff1d3cb82bccbfeabe5c41e90600090a2505050565b606560009054906101000a90046001600160a01b03166001600160a01b031663eab66d7a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5c9190613940565b6001600160a01b0316336001600160a01b031614611d8c5760405162461bcd60e51b81526004016109fd9061395d565b606654198119606654191614611e0a5760405162461bcd60e51b815260206004820152603860248201527f5061757361626c652e756e70617573653a20696e76616c696420617474656d7060448201527f7420746f2070617573652066756e6374696f6e616c697479000000000000000060648201526084016109fd565b606681905560405181815233907f3582d1828e26bf56bd801502bc021ac0bc8afb57c826e4986b45593c8fad389c90602001610b46565b60665460009060019081161415611e6a5760405162461bcd60e51b81526004016109fd90613a0c565b60026097541415611e8d5760405162461bcd60e51b81526004016109fd90613a43565b600260975560005b82811015610df65736848483818110611eb057611eb0613913565b9050602002810190611ec29190613a7a565b33600081815260ce60209081526040808320549051949550939192611eed9290918591879101613bbf565b604051602081830303815290604052805190602001209050611f0e83612111565b33600090815260cf602090815260408083208484529091529020805460ff19166001908117909155611f41908390613bef565b33600081815260ce602052604090819020929092559051829184917f450a367a380c4e339e5ae7340c8464ef27af7781ad9945cfe8abd828f89e628190611f89908890613c07565b60405180910390a4611faa333060408601803590610dcf90602089016135a9565b5050508080611fb890613c1a565b915050611e95565b6033546001600160a01b0316331461160d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109fd565b6001600160a01b0381166120a85760405162461bcd60e51b815260206004820152604960248201527f5061757361626c652e5f73657450617573657252656769737472793a206e657760448201527f50617573657252656769737472792063616e6e6f7420626520746865207a65726064820152686f206164647265737360b81b608482015260a4016109fd565b606554604080516001600160a01b03928316815291831660208301527f6e9fcd539896fca60e8b0f01dd580233e48a6b0f7df013b89ba7f565869acdb6910160405180910390a1606580546001600160a01b0319166001600160a01b0392909216919091179055565b600061211d8280613c86565b905011612182576040805162461bcd60e51b8152602060048201526024810191909152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a206e6f20737472617465676965732073657460648201526084016109fd565b60008160400135116121f45760405162461bcd60e51b81526020600482015260416024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20616d6f756e742063616e6e6f74206265206064820152600360fc1b608482015260a4016109fd565b6f4b3b4ca85a86c47a098a223fffffffff8160400135111561226c5760405162461bcd60e51b815260206004820152603f6024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20616d6f756e7420746f6f206c617267650060648201526084016109fd565b63ffffffff7f00000000000000000000000000000000000000000000000000000000005c4900166122a360a083016080840161379c565b63ffffffff1611156123285760405162461bcd60e51b81526020600482015260546024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a206475726174696f6e20657863656564732060648201527326a0ac2fa922aba0a92229afa22aa920aa24a7a760611b608482015260a4016109fd565b7f0000000000000000000000000000000000000000000000000000000000093a8061235960a083016080840161379c565b6123639190613da7565b63ffffffff16156124035760405162461bcd60e51b815260206004820152606a6024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a206475726174696f6e206d7573742062652060648201527f61206d756c7469706c65206f662043414c43554c4154494f4e5f494e54455256608482015269414c5f5345434f4e445360b01b60a482015260c4016109fd565b7f0000000000000000000000000000000000000000000000000000000000093a80612434608083016060840161379c565b61243e9190613da7565b63ffffffff16156124e45760405162461bcd60e51b81526020600482015260706024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20737461727454696d657374616d70206d7560648201527f73742062652061206d756c7469706c65206f662043414c43554c4154494f4e5f60848201526f494e54455256414c5f5345434f4e445360801b60a482015260c4016109fd565b6124f4608082016060830161379c565b63ffffffff167f0000000000000000000000000000000000000000000000000000000000dd7c0063ffffffff164261252c91906138fc565b111580156125755750612545608082016060830161379c565b63ffffffff167f0000000000000000000000000000000000000000000000000000000065fb788063ffffffff1611155b6125ef5760405162461bcd60e51b81526020600482015260516024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20737461727454696d657374616d7020746f6064820152701bc819985c881a5b881d1a19481c185cdd607a1b608482015260a4016109fd565b61261f63ffffffff7f0000000000000000000000000000000000000000000000000000000000278d001642613bef565b61262f608083016060840161379c565b63ffffffff1611156126b35760405162461bcd60e51b81526020600482015260536024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20737461727454696d657374616d7020746f6064820152726f2066617220696e207468652066757475726560681b608482015260a4016109fd565b6000805b6126c18380613c86565b90508110156128e45760006126d68480613c86565b838181106126e6576126e6613913565b6126fc92602060409092020190810191506135a9565b60405163198f077960e21b81526001600160a01b0380831660048301529192507f000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a9091169063663c1de490602401602060405180830381865afa158015612767573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061278b91906139a7565b806127b257506001600160a01b03811673beac0eeeeeeeeeeeeeeeeeeeeeeeeeeeeeebeac0145b6128255760405162461bcd60e51b815260206004820152604a6024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a20696e76616c69642073747261746567792060648201526918dbdb9cda59195c995960b21b608482015260a4016109fd565b806001600160a01b0316836001600160a01b0316106128d25760405162461bcd60e51b81526020600482015260696024820152600080516020613ecb83398151915260448201527f7264735375626d697373696f6e3a2073747261746567696573206d757374206260648201527f6520696e20617363656e64696e67206f7264657220746f2068616e646c65206460848201526875706c69636174657360b81b60a482015260c4016109fd565b91506128dd81613c1a565b90506126b7565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526129549085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612f61565b50505050565b8060600151156129b35760405162461bcd60e51b81526020600482015260306024820152600080516020613eab83398151915260448201526f1c9bdbdd081a5cc8191a5cd8589b195960821b60648201526084016109fd565b806040015163ffffffff16421015612a1a5760405162461bcd60e51b81526020600482015260366024820152600080516020613eab8339815191526044820152751c9bdbdd081b9bdd081858dd1a5d985d1959081e595d60521b60648201526084016109fd565b612a2760c0830183613c35565b9050612a3660a0840184613c35565b905014612aae5760405162461bcd60e51b815260206004820152604c6024820152600080516020613eab83398151915260448201527f746f6b656e496e646963657320616e6420746f6b656e50726f6f6673206c656e60648201526b0cee8d040dad2e6dac2e8c6d60a31b608482015260a4016109fd565b612abb60e0830183613c86565b9050612aca60c0840184613c35565b905014612b405760405162461bcd60e51b815260206004820152604a6024820152600080516020613eab83398151915260448201527f746f6b656e5472656550726f6f667320616e64206c6561766573206c656e67746064820152690d040dad2e6dac2e8c6d60b31b608482015260a4016109fd565b8051612b6c90612b56604085016020860161379c565b612b636040860186613dca565b86606001613033565b60005b612b7c60a0840184613c35565b90508110156128e457612c166080840135612b9a60a0860186613c35565b84818110612baa57612baa613913565b9050602002016020810190612bbf919061379c565b612bcc60c0870187613c35565b85818110612bdc57612bdc613913565b9050602002810190612bee9190613dca565b612bfb60e0890189613c86565b87818110612c0b57612c0b613913565b9050604002016131a7565b612c1f81613c1a565b9050612b6f565b6040516001600160a01b0383166024820152604481018290526128e490849063a9059cbb60e01b9060640161291d565b60cb546040805163ffffffff600160a01b9093048316815291831660208301527faf557c6c02c208794817a705609cfa935f827312a1adfdd26494b6b95dd2b4b3910160405180910390a160cb805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60cb546040516001600160a01b038084169216907f237b82f438d75fc568ebab484b75b01d9287b9e98b490b7c23221623b6705dbb90600090a360cb80546001600160a01b0319166001600160a01b0392909216919091179055565b604080518082018252600a81526922b4b3b2b72630bcb2b960b11b60209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527f71b625cfad44bac63b13dba07f2e1d6084ee04b6f8752101ece6126d584ee6ea81840152466060820152306080808301919091528351808303909101815260a0909101909252815191012090565b6065546001600160a01b0316158015612e2d57506001600160a01b03821615155b612eaf5760405162461bcd60e51b815260206004820152604760248201527f5061757361626c652e5f696e697469616c697a655061757365723a205f696e6960448201527f7469616c697a6550617573657228292063616e206f6e6c792062652063616c6c6064820152666564206f6e636560c81b608482015260a4016109fd565b606681905560405181815233907fab40a374bc51de372200a8bc981af8c9ecdc08dfdaef0bb6e09f88f3c616ef3d9060200160405180910390a2612ef28261201a565b5050565b60cb546040805161ffff600160e01b9093048316815291831660208301527f8cdc428b0431b82d1619763f443a48197db344ba96905f3949643acd1c863a06910160405180910390a160cb805461ffff909216600160e01b0261ffff60e01b19909216919091179055565b6000612fb6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166132f89092919063ffffffff16565b8051909150156128e45780806020019051810190612fd491906139a7565b6128e45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109fd565b61303e602083613e11565b6001901b8463ffffffff16106130c85760405162461bcd60e51b815260206004820152604360248201527f52657761726473436f6f7264696e61746f722e5f7665726966794561726e657260448201527f436c61696d50726f6f663a20696e76616c6964206561726e65724c656166496e6064820152620c8caf60eb1b608482015260a4016109fd565b60006130d382610b51565b905061311e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a92508591505063ffffffff891661330f565b61319f5760405162461bcd60e51b815260206004820152604660248201527f52657761726473436f6f7264696e61746f722e5f7665726966794561726e657260448201527f436c61696d50726f6f663a20696e76616c6964206561726e657220636c61696d60648201526510383937b7b360d11b608482015260a4016109fd565b505050505050565b6131b2602083613e11565b6001901b8463ffffffff16106132305760405162461bcd60e51b815260206004820152603c60248201527f52657761726473436f6f7264696e61746f722e5f766572696679546f6b656e4360448201527f6c61696d3a20696e76616c696420746f6b656e4c656166496e6465780000000060648201526084016109fd565b600061323b82611a9e565b905061328684848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a92508591505063ffffffff891661330f565b61319f5760405162461bcd60e51b815260206004820152603f60248201527f52657761726473436f6f7264696e61746f722e5f766572696679546f6b656e4360448201527f6c61696d3a20696e76616c696420746f6b656e20636c61696d2070726f6f660060648201526084016109fd565b60606133078484600085613327565b949350505050565b60008361331d868585613458565b1495945050505050565b6060824710156133885760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109fd565b6001600160a01b0385163b6133df5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109fd565b600080866001600160a01b031685876040516133fb9190613e51565b60006040518083038185875af1925050503d8060008114613438576040519150601f19603f3d011682016040523d82523d6000602084013e61343d565b606091505b509150915061344d82828661355b565b979650505050505050565b6000602084516134689190613e63565b156134ef5760405162461bcd60e51b815260206004820152604b60248201527f4d65726b6c652e70726f63657373496e636c7573696f6e50726f6f664b65636360448201527f616b3a2070726f6f66206c656e6774682073686f756c642062652061206d756c60648201526a3a34b836329037b310199960a91b608482015260a4016109fd565b8260205b8551811161355257613506600285613e63565b61352757816000528086015160205260406000209150600284049350613540565b8086015160005281602052604060002091506002840493505b61354b602082613bef565b90506134f3565b50949350505050565b6060831561356a575081611962565b82511561357a5782518084602001fd5b8160405162461bcd60e51b81526004016109fd9190613e77565b6001600160a01b0381168114610a0f57600080fd5b6000602082840312156135bb57600080fd5b813561196281613594565b8015158114610a0f57600080fd5b600080604083850312156135e757600080fd5b82356135f281613594565b91506020830135613602816135c6565b809150509250929050565b60006020828403121561361f57600080fd5b5035919050565b60006040828403121561363857600080fd5b50919050565b60006040828403121561365057600080fd5b6119628383613626565b6000806040838503121561366d57600080fd5b823561367881613594565b9150602083013561360281613594565b6000806020838503121561369b57600080fd5b823567ffffffffffffffff808211156136b357600080fd5b818501915085601f8301126136c757600080fd5b8135818111156136d657600080fd5b8660208260051b85010111156136eb57600080fd5b60209290920196919550909350505050565b6000610100828403121561363857600080fd5b6000806040838503121561372357600080fd5b823567ffffffffffffffff81111561373a57600080fd5b613746858286016136fd565b925050602083013561360281613594565b803563ffffffff8116811461376b57600080fd5b919050565b6000806040838503121561378357600080fd5b8235915061379360208401613757565b90509250929050565b6000602082840312156137ae57600080fd5b61196282613757565b6000602082840312156137c957600080fd5b813560ff8116811461196257600080fd5b6000602082840312156137ec57600080fd5b813567ffffffffffffffff81111561380357600080fd5b613307848285016136fd565b6000806040838503121561382257600080fd5b823561382d81613594565b946020939093013593505050565b803561376b81613594565b803561ffff8116811461376b57600080fd5b60008060008060008060c0878903121561387157600080fd5b863561387c81613594565b9550602087013561388c81613594565b94506040870135935060608701356138a381613594565b92506138b160808801613757565b91506138bf60a08801613846565b90509295509295509295565b6000602082840312156138dd57600080fd5b61196282613846565b634e487b7160e01b600052601160045260246000fd5b60008282101561390e5761390e6138e6565b500390565b634e487b7160e01b600052603260045260246000fd5b600081613938576139386138e6565b506000190190565b60006020828403121561395257600080fd5b815161196281613594565b6020808252602a908201527f6d73672e73656e646572206973206e6f74207065726d697373696f6e6564206160408201526939903ab73830bab9b2b960b11b606082015260800190565b6000602082840312156139b957600080fd5b8151611962816135c6565b60208082526028908201527f6d73672e73656e646572206973206e6f74207065726d697373696f6e6564206160408201526739903830bab9b2b960c11b606082015260800190565b60208082526019908201527f5061757361626c653a20696e6465782069732070617573656400000000000000604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008235609e19833603018112613a9057600080fd5b9190910192915050565b818352600060208085019450826000805b86811015613aff578235613abe81613594565b6001600160a01b03168852828401356bffffffffffffffffffffffff8116808214613ae7578384fd5b89860152506040978801979290920191600101613aab565b50959695505050505050565b60008135601e19833603018112613b2157600080fd5b8201803567ffffffffffffffff811115613b3a57600080fd5b8060061b3603841315613b4c57600080fd5b60a08552613b6160a086018260208501613a9a565b915050613b706020840161383b565b6001600160a01b0316602085015260408381013590850152613b9460608401613757565b63ffffffff166060850152613bab60808401613757565b63ffffffff81166080860152509392505050565b60018060a01b0384168152826020820152606060408201526000613be66060830184613b0b565b95945050505050565b60008219821115613c0257613c026138e6565b500190565b6020815260006119626020830184613b0b565b6000600019821415613c2e57613c2e6138e6565b5060010190565b6000808335601e19843603018112613c4c57600080fd5b83018035915067ffffffffffffffff821115613c6757600080fd5b6020019150600581901b3603821315613c7f57600080fd5b9250929050565b6000808335601e19843603018112613c9d57600080fd5b83018035915067ffffffffffffffff821115613cb857600080fd5b6020019150600681901b3603821315613c7f57600080fd5b60208082526034908201527f52657761726473436f6f7264696e61746f723a2063616c6c6572206973206e6f6040820152733a103a3432903932bbb0b93239aab83230ba32b960611b606082015260800190565b600063ffffffff808316818516808303821115613d4357613d436138e6565b01949350505050565b600063ffffffff83811690831681811015613d6957613d696138e6565b039392505050565b600063ffffffff821680613d8757613d876138e6565b6000190192915050565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff80841680613dbe57613dbe613d91565b92169190910692915050565b6000808335601e19843603018112613de157600080fd5b83018035915067ffffffffffffffff821115613dfc57600080fd5b602001915036819003821315613c7f57600080fd5b600082613e2057613e20613d91565b500490565b60005b83811015613e40578181015183820152602001613e28565b838111156129545750506000910152565b60008251613a90818460208701613e25565b600082613e7257613e72613d91565b500690565b6020815260008251806020840152613e96816040850160208701613e25565b601f01601f1916919091016040019291505056fe52657761726473436f6f7264696e61746f722e5f636865636b436c61696d3a2052657761726473436f6f7264696e61746f722e5f76616c696461746552657761a26469706673582212205241c48c13adad0fbac957527ccb9cdaf54ef229ca469dd35f24f5a8d52d9d9f64736f6c634300080c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a0000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000005c49000000000000000000000000000000000000000000000000000000000000dd7c000000000000000000000000000000000000000000000000000000000000278d000000000000000000000000000000000000000000000000000000000065fb7880
-----Decoded View---------------
Arg [0] : _delegationManager (address): 0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A
Arg [1] : _strategyManager (address): 0x858646372CC42E1A627fcE94aa7A7033e7CF075A
Arg [2] : _CALCULATION_INTERVAL_SECONDS (uint32): 604800
Arg [3] : _MAX_REWARDS_DURATION (uint32): 6048000
Arg [4] : _MAX_RETROACTIVE_LENGTH (uint32): 14515200
Arg [5] : _MAX_FUTURE_LENGTH (uint32): 2592000
Arg [6] : __GENESIS_REWARDS_TIMESTAMP (uint32): 1710979200
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a
Arg [1] : 000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a
Arg [2] : 0000000000000000000000000000000000000000000000000000000000093a80
Arg [3] : 00000000000000000000000000000000000000000000000000000000005c4900
Arg [4] : 0000000000000000000000000000000000000000000000000000000000dd7c00
Arg [5] : 0000000000000000000000000000000000000000000000000000000000278d00
Arg [6] : 0000000000000000000000000000000000000000000000000000000065fb7880
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.