Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
| Transaction Hash |
Method
|
Block
|
From
|
To
|
Amount
|
||||
|---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
To
|
Amount
|
||
|---|---|---|---|---|---|---|---|
| Distribute Fees | 1600015 | 46 hrs ago | 0 ETH | ||||
| Process Oracle R... | 1595485 | 2 days ago | 0 ETH | ||||
| Distribute Fees | 1591784 | 3 days ago | 0 ETH | ||||
| Distribute Fees | 1566855 | 7 days ago | 0 ETH | ||||
| Distribute Fees | 1564259 | 7 days ago | 0 ETH | ||||
| Distribute Fees | 1526198 | 13 days ago | 0 ETH | ||||
| Distribute Fees | 1503952 | 16 days ago | 0 ETH | ||||
| Process Oracle R... | 1499083 | 17 days ago | 0 ETH | ||||
| Distribute Fees | 1498471 | 17 days ago | 0 ETH | ||||
| Distribute Fees | 1485082 | 19 days ago | 0 ETH | ||||
| Distribute Fees | 1467433 | 21 days ago | 0 ETH | ||||
| Process Oracle R... | 1452370 | 24 days ago | 0 ETH | ||||
| Distribute Fees | 1449850 | 24 days ago | 0 ETH | ||||
| Distribute Fees | 1415807 | 29 days ago | 0 ETH | ||||
| Distribute Fees | 1410316 | 30 days ago | 0 ETH | ||||
| Distribute Fees | 1409020 | 30 days ago | 0 ETH | ||||
| Process Oracle R... | 1385137 | 34 days ago | 0 ETH | ||||
| Distribute Fees | 1380793 | 34 days ago | 0 ETH | ||||
| Distribute Fees | 1356431 | 38 days ago | 0 ETH | ||||
| Distribute Fees | 1352409 | 39 days ago | 0 ETH | ||||
| Distribute Fees | 1343128 | 40 days ago | 0 ETH | ||||
| Distribute Fees | 1343116 | 40 days ago | 0 ETH | ||||
| Distribute Fees | 1343108 | 40 days ago | 0 ETH | ||||
| Distribute Fees | 1339280 | 41 days ago | 0 ETH | ||||
| Process Oracle R... | 1339243 | 41 days ago | 0 ETH |
Loading...
Loading
Loading...
Loading
This contract contains unverified libraries: AssetRecovererLib
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
CSFeeDistributor
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 250 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-FileCopyrightText: 2025 Lido <[email protected]> // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.24; import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import { AccessControlEnumerableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/extensions/AccessControlEnumerableUpgradeable.sol"; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { AssetRecoverer } from "./abstract/AssetRecoverer.sol"; import { AssetRecovererLib } from "./lib/AssetRecovererLib.sol"; import { ICSFeeDistributor } from "./interfaces/ICSFeeDistributor.sol"; import { IStETH } from "./interfaces/IStETH.sol"; /// @author madlabman contract CSFeeDistributor is ICSFeeDistributor, Initializable, AccessControlEnumerableUpgradeable, AssetRecoverer { bytes32 public constant RECOVERER_ROLE = keccak256("RECOVERER_ROLE"); IStETH public immutable STETH; address public immutable ACCOUNTING; address public immutable ORACLE; /// @notice The latest Merkle Tree root bytes32 public treeRoot; /// @notice CID of the last published Merkle tree string public treeCid; /// @notice CID of the file with log for the last frame reported string public logCid; /// @notice Amount of stETH shares sent to the Accounting in favor of the NO mapping(uint256 nodeOperatorId => uint256 distributed) public distributedShares; /// @notice Total Amount of stETH shares available for claiming by NOs uint256 public totalClaimableShares; /// @notice Array of the distribution data history mapping(uint256 index => DistributionData) internal _distributionDataHistory; /// @notice The number of _distributionDataHistory records uint256 public distributionDataHistoryCount; /// @notice The address to transfer rebate to address public rebateRecipient; modifier onlyAccounting() { if (msg.sender != ACCOUNTING) { revert SenderIsNotAccounting(); } _; } modifier onlyOracle() { if (msg.sender != ORACLE) { revert SenderIsNotOracle(); } _; } constructor(address stETH, address accounting, address oracle) { if (accounting == address(0)) { revert ZeroAccountingAddress(); } if (oracle == address(0)) { revert ZeroOracleAddress(); } if (stETH == address(0)) { revert ZeroStEthAddress(); } ACCOUNTING = accounting; STETH = IStETH(stETH); ORACLE = oracle; _disableInitializers(); } function initialize( address admin, address _rebateRecipient ) external reinitializer(2) { if (admin == address(0)) { revert ZeroAdminAddress(); } _setRebateRecipient(_rebateRecipient); __AccessControlEnumerable_init(); _grantRole(DEFAULT_ADMIN_ROLE, admin); } /// @dev This method is expected to be called only when the contract is upgraded from version 1 to version 2 for the existing version 1 deployment. /// If the version 2 contract is deployed from scratch, the `initialize` method should be used instead. function finalizeUpgradeV2( address _rebateRecipient ) external reinitializer(2) { _setRebateRecipient(_rebateRecipient); } /// @inheritdoc ICSFeeDistributor function setRebateRecipient( address _rebateRecipient ) external onlyRole(DEFAULT_ADMIN_ROLE) { _setRebateRecipient(_rebateRecipient); } /// @inheritdoc ICSFeeDistributor function distributeFees( uint256 nodeOperatorId, uint256 cumulativeFeeShares, bytes32[] calldata proof ) external onlyAccounting returns (uint256 sharesToDistribute) { sharesToDistribute = getFeesToDistribute( nodeOperatorId, cumulativeFeeShares, proof ); if (sharesToDistribute == 0) { return 0; } if (totalClaimableShares < sharesToDistribute) { revert NotEnoughShares(); } unchecked { totalClaimableShares -= sharesToDistribute; distributedShares[nodeOperatorId] += sharesToDistribute; } STETH.transferShares(ACCOUNTING, sharesToDistribute); emit OperatorFeeDistributed(nodeOperatorId, sharesToDistribute); } /// @inheritdoc ICSFeeDistributor function processOracleReport( bytes32 _treeRoot, string calldata _treeCid, string calldata _logCid, uint256 distributed, uint256 rebate, uint256 refSlot ) external onlyOracle { if ( totalClaimableShares + distributed + rebate > STETH.sharesOf(address(this)) ) { revert InvalidShares(); } if (distributed == 0 && rebate > 0) { revert InvalidReportData(); } if (distributed > 0) { if (bytes(_treeCid).length == 0) { revert InvalidTreeCid(); } if (keccak256(bytes(_treeCid)) == keccak256(bytes(treeCid))) { revert InvalidTreeCid(); } if (_treeRoot == bytes32(0)) { revert InvalidTreeRoot(); } if (_treeRoot == treeRoot) { revert InvalidTreeRoot(); } // Doesn't overflow because of the very first check. unchecked { totalClaimableShares += distributed; } treeRoot = _treeRoot; treeCid = _treeCid; emit DistributionDataUpdated( totalClaimableShares, _treeRoot, _treeCid ); } emit ModuleFeeDistributed(distributed); if (rebate > 0) { STETH.transferShares(rebateRecipient, rebate); emit RebateTransferred(rebate); } // NOTE: Make sure off-chain tooling provides a distinct CID of a log even for empty reports, e.g. by mixing // in a frame identifier such as reference slot to a file. if (bytes(_logCid).length == 0) { revert InvalidLogCID(); } if (keccak256(bytes(_logCid)) == keccak256(bytes(logCid))) { revert InvalidLogCID(); } logCid = _logCid; emit DistributionLogUpdated(_logCid); _distributionDataHistory[ distributionDataHistoryCount ] = DistributionData({ refSlot: refSlot, treeRoot: treeRoot, treeCid: treeCid, logCid: _logCid, distributed: distributed, rebate: rebate }); unchecked { ++distributionDataHistoryCount; } } /// @inheritdoc AssetRecoverer function recoverERC20(address token, uint256 amount) external override { _onlyRecoverer(); if (token == address(STETH)) { revert NotAllowedToRecover(); } AssetRecovererLib.recoverERC20(token, amount); } /// @inheritdoc ICSFeeDistributor function getInitializedVersion() external view returns (uint64) { return _getInitializedVersion(); } /// @inheritdoc ICSFeeDistributor function pendingSharesToDistribute() external view returns (uint256) { return STETH.sharesOf(address(this)) - totalClaimableShares; } /// @inheritdoc ICSFeeDistributor function getHistoricalDistributionData( uint256 index ) external view returns (DistributionData memory) { return _distributionDataHistory[index]; } /// @inheritdoc ICSFeeDistributor function getFeesToDistribute( uint256 nodeOperatorId, uint256 cumulativeFeeShares, bytes32[] calldata proof ) public view returns (uint256 sharesToDistribute) { // NOTE: We reject empty proofs to separate two business logic paths on the level of // CSAccounting.sol (see _pullFeeRewards function invocations) with and without a proof. if (proof.length == 0) { revert InvalidProof(); } bool isValid = MerkleProof.verifyCalldata( proof, treeRoot, hashLeaf(nodeOperatorId, cumulativeFeeShares) ); if (!isValid) { revert InvalidProof(); } uint256 _distributedShares = distributedShares[nodeOperatorId]; if (_distributedShares > cumulativeFeeShares) { // This error means the fee oracle brought invalid data. revert FeeSharesDecrease(); } unchecked { sharesToDistribute = cumulativeFeeShares - _distributedShares; } } /// @inheritdoc ICSFeeDistributor function hashLeaf( uint256 nodeOperatorId, uint256 shares ) public pure returns (bytes32) { return keccak256( bytes.concat(keccak256(abi.encode(nodeOperatorId, shares))) ); } function _setRebateRecipient(address _rebateRecipient) internal { if (_rebateRecipient == address(0)) { revert ZeroRebateRecipientAddress(); } rebateRecipient = _rebateRecipient; emit RebateRecipientSet(_rebateRecipient); } function _onlyRecoverer() internal view override { _checkRole(RECOVERER_ROLE); } }
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.20;
/**
* @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 MerkleProof {
/**
*@dev The multiproof provided is not valid.
*/
error MerkleProofInvalidMultiproof();
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == 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. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
if (leavesLen + proofLen != totalHashes + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
if (proofPos != proofLen) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
if (leavesLen + proofLen != totalHashes + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
if (proofPos != proofLen) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Sorts the pair (a, b) and hashes the result.
*/
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
/**
* @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
*/
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)
pragma solidity ^0.8.20;
import {IAccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol";
import {AccessControlUpgradeable} from "../AccessControlUpgradeable.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerable, AccessControlUpgradeable {
using EnumerableSet for EnumerableSet.AddressSet;
/// @custom:storage-location erc7201:openzeppelin.storage.AccessControlEnumerable
struct AccessControlEnumerableStorage {
mapping(bytes32 role => EnumerableSet.AddressSet) _roleMembers;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControlEnumerable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant AccessControlEnumerableStorageLocation = 0xc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000;
function _getAccessControlEnumerableStorage() private pure returns (AccessControlEnumerableStorage storage $) {
assembly {
$.slot := AccessControlEnumerableStorageLocation
}
}
function __AccessControlEnumerable_init() internal onlyInitializing {
}
function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {
AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
return $._roleMembers[role].at(index);
}
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {
AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
return $._roleMembers[role].length();
}
/**
* @dev Overload {AccessControl-_grantRole} to track enumerable memberships
*/
function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {
AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
bool granted = super._grantRole(role, account);
if (granted) {
$._roleMembers[role].add(account);
}
return granted;
}
/**
* @dev Overload {AccessControl-_revokeRole} to track enumerable memberships
*/
function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {
AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
bool revoked = super._revokeRole(role, account);
if (revoked) {
$._roleMembers[role].remove(account);
}
return revoked;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @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]
* ```solidity
* 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 Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 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.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._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.
*
* 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.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* 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.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._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() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @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.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}// SPDX-FileCopyrightText: 2025 Lido <[email protected]> // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.24; import { AssetRecovererLib } from "../lib/AssetRecovererLib.sol"; /// @title AssetRecoverer /// @dev Abstract contract providing mechanisms for recovering various asset types (ETH, ERC20, ERC721, ERC1155) from a contract. /// This contract is designed to allow asset recovery by an authorized address by implementing the onlyRecovererRole guardian /// @notice Assets can be sent only to the `msg.sender` abstract contract AssetRecoverer { /// @dev Allows sender to recover Ether held by the contract /// Emits an EtherRecovered event upon success function recoverEther() external { _onlyRecoverer(); AssetRecovererLib.recoverEther(); } /// @dev Allows sender to recover ERC20 tokens held by the contract /// @param token The address of the ERC20 token to recover /// @param amount The amount of the ERC20 token to recover /// Emits an ERC20Recovered event upon success /// Optionally, the inheriting contract can override this function to add additional restrictions function recoverERC20(address token, uint256 amount) external virtual { _onlyRecoverer(); AssetRecovererLib.recoverERC20(token, amount); } /// @dev Allows sender to recover ERC721 tokens held by the contract /// @param token The address of the ERC721 token to recover /// @param tokenId The token ID of the ERC721 token to recover /// Emits an ERC721Recovered event upon success function recoverERC721(address token, uint256 tokenId) external { _onlyRecoverer(); AssetRecovererLib.recoverERC721(token, tokenId); } /// @dev Allows sender to recover ERC1155 tokens held by the contract. /// @param token The address of the ERC1155 token to recover. /// @param tokenId The token ID of the ERC1155 token to recover. /// Emits an ERC1155Recovered event upon success. function recoverERC1155(address token, uint256 tokenId) external { _onlyRecoverer(); AssetRecovererLib.recoverERC1155(token, tokenId); } /// @dev Guardian to restrict access to the recover methods. /// Should be implemented by the inheriting contract function _onlyRecoverer() internal view virtual; }
// SPDX-FileCopyrightText: 2025 Lido <[email protected]> // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.24; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import { IERC1155 } from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { ILido } from "../interfaces/ILido.sol"; interface IAssetRecovererLib { event EtherRecovered(address indexed recipient, uint256 amount); event ERC20Recovered( address indexed token, address indexed recipient, uint256 amount ); event StETHSharesRecovered(address indexed recipient, uint256 shares); event ERC721Recovered( address indexed token, uint256 tokenId, address indexed recipient ); event ERC1155Recovered( address indexed token, uint256 tokenId, address indexed recipient, uint256 amount ); error FailedToSendEther(); error NotAllowedToRecover(); } /* * @title AssetRecovererLib * @dev Library providing mechanisms for recovering various asset types (ETH, ERC20, ERC721, ERC1155). * This library is designed to be used by a contract that implements the AssetRecoverer interface. */ library AssetRecovererLib { using SafeERC20 for IERC20; /** * @dev Allows the sender to recover Ether held by the contract. * Emits an EtherRecovered event upon success. */ function recoverEther() external { uint256 amount = address(this).balance; (bool success, ) = msg.sender.call{ value: amount }(""); if (!success) { revert IAssetRecovererLib.FailedToSendEther(); } emit IAssetRecovererLib.EtherRecovered(msg.sender, amount); } /** * @dev Allows the sender to recover ERC20 tokens held by the contract. * @param token The address of the ERC20 token to recover. * @param amount The amount of the ERC20 token to recover. * Emits an ERC20Recovered event upon success. */ function recoverERC20(address token, uint256 amount) external { IERC20(token).safeTransfer(msg.sender, amount); emit IAssetRecovererLib.ERC20Recovered(token, msg.sender, amount); } /** * @dev Allows the sender to recover stETH shares held by the contract. * The use of a separate method for stETH is to avoid rounding problems when converting shares to stETH. * @param lido The address of the Lido contract. * @param shares The amount of stETH shares to recover. * Emits an StETHSharesRecovered event upon success. */ function recoverStETHShares(address lido, uint256 shares) external { ILido(lido).transferShares(msg.sender, shares); emit IAssetRecovererLib.StETHSharesRecovered(msg.sender, shares); } /** * @dev Allows the sender to recover ERC721 tokens held by the contract. * @param token The address of the ERC721 token to recover. * @param tokenId The token ID of the ERC721 token to recover. * Emits an ERC721Recovered event upon success. */ function recoverERC721(address token, uint256 tokenId) external { IERC721(token).safeTransferFrom(address(this), msg.sender, tokenId); emit IAssetRecovererLib.ERC721Recovered(token, tokenId, msg.sender); } /** * @dev Allows the sender to recover ERC1155 tokens held by the contract. * @param token The address of the ERC1155 token to recover. * @param tokenId The token ID of the ERC1155 token to recover. * Emits an ERC1155Recovered event upon success. */ function recoverERC1155(address token, uint256 tokenId) external { uint256 amount = IERC1155(token).balanceOf(address(this), tokenId); IERC1155(token).safeTransferFrom({ from: address(this), to: msg.sender, id: tokenId, value: amount, data: "" }); emit IAssetRecovererLib.ERC1155Recovered( token, tokenId, msg.sender, amount ); } }
// SPDX-FileCopyrightText: 2025 Lido <[email protected]> // SPDX-License-Identifier: GPL-3.0 import { IAssetRecovererLib } from "../lib/AssetRecovererLib.sol"; import { IStETH } from "./IStETH.sol"; pragma solidity 0.8.24; interface ICSFeeDistributor is IAssetRecovererLib { struct DistributionData { /// @dev Reference slot for which the report was calculated. If the slot /// contains a block, the state being reported should include all state /// changes resulting from that block. The epoch containing the slot /// should be finalized prior to calculating the report. uint256 refSlot; /// @notice Merkle Tree root. bytes32 treeRoot; /// @notice CID of the published Merkle tree. string treeCid; /// @notice CID of the file with log of the frame reported. string logCid; /// @notice Total amount of fees distributed in the report. uint256 distributed; /// @notice Amount of the rebate shares in the report uint256 rebate; } /// @dev Emitted when fees are distributed event OperatorFeeDistributed( uint256 indexed nodeOperatorId, uint256 shares ); /// @dev Emitted when distribution data is updated event DistributionDataUpdated( uint256 totalClaimableShares, bytes32 treeRoot, string treeCid ); /// @dev Emitted when distribution log is updated event DistributionLogUpdated(string logCid); /// @dev It logs how many shares were distributed in the latest report event ModuleFeeDistributed(uint256 shares); /// @dev Emitted when rebate is transferred event RebateTransferred(uint256 shares); /// @dev Emitted when rebate recipient is set event RebateRecipientSet(address recipient); error ZeroAccountingAddress(); error ZeroStEthAddress(); error ZeroAdminAddress(); error ZeroOracleAddress(); error ZeroRebateRecipientAddress(); error SenderIsNotAccounting(); error SenderIsNotOracle(); error InvalidReportData(); error InvalidTreeRoot(); error InvalidTreeCid(); error InvalidLogCID(); error InvalidShares(); error InvalidProof(); error FeeSharesDecrease(); error NotEnoughShares(); function RECOVERER_ROLE() external view returns (bytes32); function STETH() external view returns (IStETH); function ACCOUNTING() external view returns (address); function ORACLE() external view returns (address); function treeRoot() external view returns (bytes32); function treeCid() external view returns (string calldata); function logCid() external view returns (string calldata); function distributedShares(uint256) external view returns (uint256); function totalClaimableShares() external view returns (uint256); function distributionDataHistoryCount() external view returns (uint256); function rebateRecipient() external view returns (address); /// @notice Get the initialized version of the contract function getInitializedVersion() external view returns (uint64); /// @notice Set address to send rebate to /// @param _rebateRecipient Address to send rebate to function setRebateRecipient(address _rebateRecipient) external; /// @notice Get the Amount of stETH shares that can be distributed in favor of the Node Operator /// @param nodeOperatorId ID of the Node Operator /// @param cumulativeFeeShares Total Amount of stETH shares earned as fees /// @param proof Merkle proof of the leaf /// @return sharesToDistribute Amount of stETH shares that can be distributed function getFeesToDistribute( uint256 nodeOperatorId, uint256 cumulativeFeeShares, bytes32[] calldata proof ) external view returns (uint256); /// @notice Distribute fees to the Accounting in favor of the Node Operator /// @param nodeOperatorId ID of the Node Operator /// @param cumulativeFeeShares Total Amount of stETH shares earned as fees /// @param proof Merkle proof of the leaf /// @return sharesToDistribute Amount of stETH shares distributed function distributeFees( uint256 nodeOperatorId, uint256 cumulativeFeeShares, bytes32[] calldata proof ) external returns (uint256); /// @notice Receive the data of the Merkle tree from the Oracle contract and process it /// @param _treeRoot Root of the Merkle tree /// @param _treeCid an IPFS CID of the tree /// @param _logCid an IPFS CID of the log /// @param distributed an amount of the distributed shares /// @param rebate an amount of the rebate shares /// @param refSlot refSlot of the report function processOracleReport( bytes32 _treeRoot, string calldata _treeCid, string calldata _logCid, uint256 distributed, uint256 rebate, uint256 refSlot ) external; /// @notice Get the Amount of stETH shares that are pending to be distributed /// @return pendingShares Amount shares that are pending to distribute function pendingSharesToDistribute() external view returns (uint256); /// @notice Get the historical record of distribution data /// @param index Historical entry index /// @return Historical distribution data function getHistoricalDistributionData( uint256 index ) external view returns (DistributionData memory); /// @notice Get a hash of a leaf /// @param nodeOperatorId ID of the Node Operator /// @param shares Amount of stETH shares /// @return Hash of the leaf /// @dev Double hash the leaf to prevent second preimage attacks function hashLeaf( uint256 nodeOperatorId, uint256 shares ) external pure returns (bytes32); }
// SPDX-FileCopyrightText: 2025 Lido <[email protected]> // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.24; /** * @title Interface defining ERC20-compatible StETH token */ interface IStETH { /** * @notice Get stETH amount by the provided shares amount * @param _sharesAmount shares amount * @dev dual to `getSharesByPooledEth`. */ function getPooledEthByShares( uint256 _sharesAmount ) external view returns (uint256); /** * @notice Get shares amount by the provided stETH amount * @param _pooledEthAmount stETH amount * @dev dual to `getPooledEthByShares`. */ function getSharesByPooledEth( uint256 _pooledEthAmount ) external view returns (uint256); /** * @notice Get shares amount of the provided account * @param _account provided account address. */ function sharesOf(address _account) external view returns (uint256); function balanceOf(address _account) external view returns (uint256); /** * @notice Transfer `_sharesAmount` stETH shares from `_sender` to `_recipient` using allowance. */ function transferSharesFrom( address _sender, address _recipient, uint256 _sharesAmount ) external returns (uint256); /** * @notice Moves `_sharesAmount` token shares from the caller's account to the `_recipient` account. */ function transferShares( address _recipient, uint256 _sharesAmount ) external returns (uint256); /** * @notice Moves `_amount` stETH from the caller's account to the `_recipient` account. */ function transfer( address _recipient, uint256 _amount ) external returns (bool); /** * @notice Moves `_amount` stETH from the `_sender` account to the `_recipient` account. */ function transferFrom( address _sender, address _recipient, uint256 _amount ) external returns (bool); function approve(address _spender, uint256 _amount) external returns (bool); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; function allowance( address _owner, address _spender ) external view returns (uint256); }
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "../IAccessControl.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/// @custom:storage-location erc7201:openzeppelin.storage.AccessControl
struct AccessControlStorage {
mapping(bytes32 role => RoleData) _roles;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800;
function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) {
assembly {
$.slot := AccessControlStorageLocation
}
}
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
return $._roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
AccessControlStorage storage $ = _getAccessControlStorage();
return $._roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
AccessControlStorage storage $ = _getAccessControlStorage();
bytes32 previousAdminRole = getRoleAdmin(role);
$._roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
if (!hasRole(role, account)) {
$._roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
if (hasRole(role, account)) {
$._roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.20;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position is the index of the value in the `values` array plus 1.
// Position 0 is used to mean a value is not in the set.
mapping(bytes32 value => uint256) _positions;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._positions[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We cache the value's position to prevent multiple reads from the same storage slot
uint256 position = set._positions[value];
if (position != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 valueIndex = position - 1;
uint256 lastIndex = set._values.length - 1;
if (valueIndex != lastIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the lastValue to the index where the value to delete is
set._values[valueIndex] = lastValue;
// Update the tracked position of the lastValue (that was just moved)
set._positions[lastValue] = position;
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the tracked position for the deleted slot
delete set._positions[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._positions[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or
* {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the address zero.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the value of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {onERC1155Received} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @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);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-FileCopyrightText: 2025 Lido <[email protected]> // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.24; import { IStETH } from "./IStETH.sol"; /** * @title Interface defining Lido contract */ interface ILido is IStETH { function STAKING_CONTROL_ROLE() external view returns (bytes32); function submit(address _referral) external payable returns (uint256); function deposit( uint256 _maxDepositsCount, uint256 _stakingModuleId, bytes calldata _depositCalldata ) external; function removeStakingLimit() external; function kernel() external returns (address); function sharesOf(address _account) external view returns (uint256); }
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165Upgradeable is Initializable, IERC165 {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @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.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
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].
*
* CAUTION: See Security Considerations above.
*/
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 v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @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 or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* 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.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @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`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// 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 FailedInnerCall();
}
}
}{
"remappings": [
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
"@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/",
"forge-std/=node_modules/forge-std/src/",
"ds-test/=node_modules/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"openzeppelin-contracts-v4.4/=lib/openzeppelin-contracts-v4.4/contracts/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 250
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false,
"libraries": {
"src/CSFeeDistributor.sol": {
"AssetRecovererLib": "0xa74528edc289b1a597faf83fcff7eff871cc01d9"
}
}
}Contract ABI
API[{"inputs":[{"internalType":"address","name":"stETH","type":"address"},{"internalType":"address","name":"accounting","type":"address"},{"internalType":"address","name":"oracle","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"FailedToSendEther","type":"error"},{"inputs":[],"name":"FeeSharesDecrease","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidLogCID","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"InvalidReportData","type":"error"},{"inputs":[],"name":"InvalidShares","type":"error"},{"inputs":[],"name":"InvalidTreeCid","type":"error"},{"inputs":[],"name":"InvalidTreeRoot","type":"error"},{"inputs":[],"name":"NotAllowedToRecover","type":"error"},{"inputs":[],"name":"NotEnoughShares","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"SenderIsNotAccounting","type":"error"},{"inputs":[],"name":"SenderIsNotOracle","type":"error"},{"inputs":[],"name":"ZeroAccountingAddress","type":"error"},{"inputs":[],"name":"ZeroAdminAddress","type":"error"},{"inputs":[],"name":"ZeroOracleAddress","type":"error"},{"inputs":[],"name":"ZeroRebateRecipientAddress","type":"error"},{"inputs":[],"name":"ZeroStEthAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"totalClaimableShares","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"treeRoot","type":"bytes32"},{"indexed":false,"internalType":"string","name":"treeCid","type":"string"}],"name":"DistributionDataUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"logCid","type":"string"}],"name":"DistributionLogUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC1155Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"ERC721Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EtherRecovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"ModuleFeeDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"nodeOperatorId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"OperatorFeeDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"RebateRecipientSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"RebateTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"StETHSharesRecovered","type":"event"},{"inputs":[],"name":"ACCOUNTING","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ORACLE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RECOVERER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STETH","outputs":[{"internalType":"contract IStETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nodeOperatorId","type":"uint256"},{"internalType":"uint256","name":"cumulativeFeeShares","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"distributeFees","outputs":[{"internalType":"uint256","name":"sharesToDistribute","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nodeOperatorId","type":"uint256"}],"name":"distributedShares","outputs":[{"internalType":"uint256","name":"distributed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributionDataHistoryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rebateRecipient","type":"address"}],"name":"finalizeUpgradeV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nodeOperatorId","type":"uint256"},{"internalType":"uint256","name":"cumulativeFeeShares","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"getFeesToDistribute","outputs":[{"internalType":"uint256","name":"sharesToDistribute","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getHistoricalDistributionData","outputs":[{"components":[{"internalType":"uint256","name":"refSlot","type":"uint256"},{"internalType":"bytes32","name":"treeRoot","type":"bytes32"},{"internalType":"string","name":"treeCid","type":"string"},{"internalType":"string","name":"logCid","type":"string"},{"internalType":"uint256","name":"distributed","type":"uint256"},{"internalType":"uint256","name":"rebate","type":"uint256"}],"internalType":"struct ICSFeeDistributor.DistributionData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInitializedVersion","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nodeOperatorId","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"hashLeaf","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"_rebateRecipient","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"logCid","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingSharesToDistribute","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_treeRoot","type":"bytes32"},{"internalType":"string","name":"_treeCid","type":"string"},{"internalType":"string","name":"_logCid","type":"string"},{"internalType":"uint256","name":"distributed","type":"uint256"},{"internalType":"uint256","name":"rebate","type":"uint256"},{"internalType":"uint256","name":"refSlot","type":"uint256"}],"name":"processOracleReport","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rebateRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"recoverERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"recoverERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recoverEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rebateRecipient","type":"address"}],"name":"setRebateRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalClaimableShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treeCid","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treeRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60e060405234801562000010575f80fd5b5060405162002383380380620023838339810160408190526200003391620001a7565b6001600160a01b0382166200005b576040516368ea2bc160e01b815260040160405180910390fd5b6001600160a01b038116620000835760405163dc6d352160e01b815260040160405180910390fd5b6001600160a01b038316620000ab5760405163349b663960e21b815260040160405180910390fd5b6001600160a01b0380831660a052838116608052811660c052620000ce620000d7565b505050620001ee565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620001285760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620001885780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b80516001600160a01b0381168114620001a2575f80fd5b919050565b5f805f60608486031215620001ba575f80fd5b620001c5846200018b565b9250620001d5602085016200018b565b9150620001e5604085016200018b565b90509250925092565b60805160a05160c051612132620002515f395f81816102eb015261072001525f818161038501528181610542015261061f01525f81816104b0015281816105f201528181610773015281816109b6015281816111fa015261139201526121325ff3fe608060405234801561000f575f80fd5b50600436106101fd575f3560e01c80636f962e5c11610114578063b3c65015116100a9578063d5ba2dcf11610079578063d5ba2dcf14610498578063e00bfe50146104ab578063e877f068146104d2578063ea6301ab146104e5578063fe3c9b9b14610504575f80fd5b8063b3c6501514610449578063ca15c8731461046a578063d257cf2a1461047d578063d547741f14610485575f80fd5b80639010d07c116100e45780639010d07c146103f557806391d1485414610408578063a217fddf1461041b578063acf1c94814610422575f80fd5b80636f962e5c146103a75780637e9f27ad146103bc578063819d4cc6146103cf5780638980f11f146103e2575f80fd5b806338013f02116101955780634e5b3a62116101655780634e5b3a621461033257806352d8bfc2146103525780635c654ad91461035a5780635e8e8f6f1461036d5780636dc3f2bd14610380575f80fd5b806338013f02146102e65780633d18b6f31461030d57806347d17d9d14610316578063485cc9551461031f575f80fd5b80632f2ff15d116101d05780632f2ff15d146102805780632ffa14e1146102955780633333e109146102a857806336568abe146102d3575f80fd5b806301ffc9a71461020157806314dc6c141461022957806321893f7b1461023f578063248a9ca314610252575b5f80fd5b61021461020f366004611a81565b61050c565b60405190151581526020015b60405180910390f35b6102315f5481565b604051908152602001610220565b61023161024d366004611aa8565b610536565b610231610260366004611b24565b5f9081525f80516020612106833981519152602052604090206001015490565b61029361028e366004611b56565b6106df565b005b6102936102a3366004611bc5565b610715565b6007546102bb906001600160a01b031681565b6040516001600160a01b039091168152602001610220565b6102936102e1366004611b56565b610c65565b6102bb7f000000000000000000000000000000000000000000000000000000000000000081565b61023160065481565b61023160045481565b61029361032d366004611c4f565b610c9d565b610345610340366004611b24565b610db8565b6040516102209190611cba565b610293610f5a565b610293610368366004611d27565b610fb6565b61023161037b366004611aa8565b611031565b6102bb7f000000000000000000000000000000000000000000000000000000000000000081565b6103af6110c4565b6040516102209190611d4f565b6102316103ca366004611d61565b611150565b6102936103dd366004611d27565b6111a1565b6102936103f0366004611d27565b6111f0565b6102bb610403366004611d61565b611291565b610214610416366004611b56565b6112c9565b6102315f81565b6102317fb3e25b5404b87e5a838579cb5d7481d61ad96ee284d38ec1e97c07ba64e7f6fc81565b6104516112ff565b60405167ffffffffffffffff9091168152602001610220565b610231610478366004611b24565b611337565b610231611375565b610293610493366004611b56565b61140d565b6102936104a6366004611d81565b61143d565b6102bb7f000000000000000000000000000000000000000000000000000000000000000081565b6102936104e0366004611d81565b61151d565b6102316104f3366004611b24565b60036020525f908152604090205481565b6103af611534565b5f6001600160e01b03198216635a05180f60e01b1480610530575061053082611541565b92915050565b5f336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105805760405163a8d664b560e01b815260040160405180910390fd5b61058c85858585611031565b9050805f0361059c57505f6106d7565b8060045410156105bf57604051633c57b48560e21b815260040160405180910390fd5b6004805482900381555f868152600360205260409081902080548401905551638fcb4e5b60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691638fcb4e5b9161065b917f0000000000000000000000000000000000000000000000000000000000000000918691016001600160a01b03929092168252602082015260400190565b6020604051808303815f875af1158015610677573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061069b9190611d9a565b50847f4b7ab1c192267e83350d06490a852b8dbbb25bfa00fd065b1862cf7accd2ab90826040516106ce91815260200190565b60405180910390a25b949350505050565b5f8281525f80516020612106833981519152602052604090206001015461070581611575565b61070f8383611582565b50505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461075e576040516312d4786560e01b815260040160405180910390fd5b604051633d7ad0b760e21b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f5eb42dc90602401602060405180830381865afa1580156107c0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107e49190611d9a565b82846004546107f39190611dc5565b6107fd9190611dc5565b111561081c57604051636edcc52360e01b815260040160405180910390fd5b8215801561082957505f82115b156108475760405163319c9a2160e21b815260040160405180910390fd5b8215610954575f86900361086e576040516312b7aebf60e01b815260040160405180910390fd5b600160405161087d9190611e10565b60405180910390208787604051610895929190611e82565b6040518091039020036108bb576040516312b7aebf60e01b815260040160405180910390fd5b876108d9576040516357e86a3360e01b815260040160405180910390fd5b5f5488036108fa576040516357e86a3360e01b815260040160405180910390fd5b60048054840190555f8890556001610913878983611ef0565b507f26dec7cc117e9b3907dc1f90d2dc5f6e04dbb9f285f5898be2c82ec524dcd42460045489898960405161094b9493929190611fd2565b60405180910390a15b6040518381527f010f65f5f56ba52d759f7b1dc49a3d277570cc2aa631e9c865b073a0ffc2af419060200160405180910390a18115610a5757600754604051638fcb4e5b60e01b81526001600160a01b039182166004820152602481018490527f000000000000000000000000000000000000000000000000000000000000000090911690638fcb4e5b906044016020604051808303815f875af11580156109fe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a229190611d9a565b506040518281527f7462935fb42d34d84233f737293310ca24e851021f9cb7f2549470cdf6de56bf9060200160405180910390a15b5f849003610a785760405163526ca52560e01b815260040160405180910390fd5b6002604051610a879190611e10565b60405180910390208585604051610a9f929190611e82565b604051809103902003610ac55760405163526ca52560e01b815260040160405180910390fd5b6002610ad2858783611ef0565b507f1f1a488b71a099a0d9cb71f60e14cf90bd1b5b188ca593111a40f533a3130b3b8585604051610b04929190611ffb565b60405180910390a16040518060c001604052808281526020015f54815260200160018054610b3190611dd8565b80601f0160208091040260200160405190810160405280929190818152602001828054610b5d90611dd8565b8015610ba85780601f10610b7f57610100808354040283529160200191610ba8565b820191905f5260205f20905b815481529060010190602001808311610b8b57829003601f168201915b5050505050815260200186868080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920182905250938552505050602080830187905260409283018690526006548252600581529082902083518155908301516001820155908201516002820190610c26908261200e565b5060608201516003820190610c3b908261200e565b506080820151600482015560a0909101516005909101555050600680546001019055505050505050565b6001600160a01b0381163314610c8e5760405163334bd91960e11b815260040160405180910390fd5b610c9882826115d7565b505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460029190600160401b900460ff1680610ce75750805467ffffffffffffffff808416911610155b15610d055760405163f92ee8a960e01b815260040160405180910390fd5b805468ffffffffffffffffff191667ffffffffffffffff831617600160401b1781556001600160a01b038416610d4e57604051633ef39b8160e01b815260040160405180910390fd5b610d5783611623565b610d5f6116ab565b610d695f85611582565b50805460ff60401b1916815560405167ffffffffffffffff831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a150505050565b610df06040518060c001604052805f81526020015f801916815260200160608152602001606081526020015f81526020015f81525090565b60055f8381526020019081526020015f206040518060c00160405290815f820154815260200160018201548152602001600282018054610e2f90611dd8565b80601f0160208091040260200160405190810160405280929190818152602001828054610e5b90611dd8565b8015610ea65780601f10610e7d57610100808354040283529160200191610ea6565b820191905f5260205f20905b815481529060010190602001808311610e8957829003601f168201915b50505050508152602001600382018054610ebf90611dd8565b80601f0160208091040260200160405190810160405280929190818152602001828054610eeb90611dd8565b8015610f365780601f10610f0d57610100808354040283529160200191610f36565b820191905f5260205f20905b815481529060010190602001808311610f1957829003601f168201915b50505050508152602001600482015481526020016005820154815250509050919050565b610f626116b5565b73a74528edc289b1a597faf83fcff7eff871cc01d96352d8bfc26040518163ffffffff1660e01b81526004015f6040518083038186803b158015610fa4575f80fd5b505af415801561070f573d5f803e3d5ffd5b610fbe6116b5565b604051635c654ad960e01b81526001600160a01b03831660048201526024810182905273a74528edc289b1a597faf83fcff7eff871cc01d990635c654ad9906044015b5f6040518083038186803b158015611017575f80fd5b505af4158015611029573d5f803e3d5ffd5b505050505050565b5f818103611052576040516309bde33960e01b815260040160405180910390fd5b5f61106984845f546110648a8a611150565b6116de565b905080611089576040516309bde33960e01b815260040160405180910390fd5b5f86815260036020526040902054858111156110b857604051636096ce8160e11b815260040160405180910390fd5b90940395945050505050565b600280546110d190611dd8565b80601f01602080910402602001604051908101604052809291908181526020018280546110fd90611dd8565b80156111485780601f1061111f57610100808354040283529160200191611148565b820191905f5260205f20905b81548152906001019060200180831161112b57829003601f168201915b505050505081565b60408051602081018490529081018290525f9060600160408051601f198184030181528282528051602091820120908301520160405160208183030381529060405280519060200120905092915050565b6111a96116b5565b6040516340cea66360e11b81526001600160a01b03831660048201526024810182905273a74528edc289b1a597faf83fcff7eff871cc01d99063819d4cc690604401611001565b6111f86116b5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03160361124a576040516319efe5d760e21b815260040160405180910390fd5b604051638980f11f60e01b81526001600160a01b03831660048201526024810182905273a74528edc289b1a597faf83fcff7eff871cc01d990638980f11f90604401611001565b5f8281527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320006020819052604082206106d790846116f5565b5f9182525f80516020612106833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b5f6113327ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005467ffffffffffffffff1690565b905090565b5f8181527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e8237170593200060208190526040822061136e90611700565b9392505050565b60048054604051633d7ad0b760e21b815230928101929092525f917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f5eb42dc90602401602060405180830381865afa1580156113df573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114039190611d9a565b61133291906120ca565b5f8281525f80516020612106833981519152602052604090206001015461143381611575565b61070f83836115d7565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460029190600160401b900460ff16806114875750805467ffffffffffffffff808416911610155b156114a55760405163f92ee8a960e01b815260040160405180910390fd5b805468ffffffffffffffffff191667ffffffffffffffff831617600160401b1781556114d083611623565b805460ff60401b1916815560405167ffffffffffffffff831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a1505050565b5f61152781611575565b61153082611623565b5050565b600180546110d190611dd8565b5f6001600160e01b03198216637965db0b60e01b148061053057506301ffc9a760e01b6001600160e01b0319831614610530565b61157f8133611709565b50565b5f7fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000816115af8585611746565b905080156106d7575f8581526020839052604090206115ce90856117e7565b50949350505050565b5f7fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320008161160485856117fb565b905080156106d7575f8581526020839052604090206115ce9085611874565b6001600160a01b03811661164a5760405163669766e160e01b815260040160405180910390fd5b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f9f8636d85f90aba9c7d2c9e076c6102a5459d2e063afb71d81328bbb3608a2349060200160405180910390a150565b6116b3611888565b565b6116b37fb3e25b5404b87e5a838579cb5d7481d61ad96ee284d38ec1e97c07ba64e7f6fc611575565b5f826116eb8686856118d1565b1495945050505050565b5f61136e8383611909565b5f610530825490565b61171382826112c9565b6115305760405163e2517d3f60e01b81526001600160a01b03821660048201526024810183905260440160405180910390fd5b5f5f8051602061210683398151915261175f84846112c9565b6117de575f848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556117943390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610530565b5f915050610530565b5f61136e836001600160a01b03841661192f565b5f5f8051602061210683398151915261181484846112c9565b156117de575f848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610530565b5f61136e836001600160a01b03841661197b565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166116b357604051631afcd79f60e31b815260040160405180910390fd5b5f81815b848110156115ce576118ff828787848181106118f3576118f36120dd565b90506020020135611a55565b91506001016118d5565b5f825f01828154811061191e5761191e6120dd565b905f5260205f200154905092915050565b5f81815260018301602052604081205461197457508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610530565b505f610530565b5f81815260018301602052604081205480156117de575f61199d6001836120ca565b85549091505f906119b0906001906120ca565b9050808214611a0f575f865f0182815481106119ce576119ce6120dd565b905f5260205f200154905080875f0184815481106119ee576119ee6120dd565b5f918252602080832090910192909255918252600188019052604090208390555b8554869080611a2057611a206120f1565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610530565b5f818310611a6f575f82815260208490526040902061136e565b5f83815260208390526040902061136e565b5f60208284031215611a91575f80fd5b81356001600160e01b03198116811461136e575f80fd5b5f805f8060608587031215611abb575f80fd5b8435935060208501359250604085013567ffffffffffffffff80821115611ae0575f80fd5b818701915087601f830112611af3575f80fd5b813581811115611b01575f80fd5b8860208260051b8501011115611b15575f80fd5b95989497505060200194505050565b5f60208284031215611b34575f80fd5b5035919050565b80356001600160a01b0381168114611b51575f80fd5b919050565b5f8060408385031215611b67575f80fd5b82359150611b7760208401611b3b565b90509250929050565b5f8083601f840112611b90575f80fd5b50813567ffffffffffffffff811115611ba7575f80fd5b602083019150836020828501011115611bbe575f80fd5b9250929050565b5f805f805f805f8060c0898b031215611bdc575f80fd5b88359750602089013567ffffffffffffffff80821115611bfa575f80fd5b611c068c838d01611b80565b909950975060408b0135915080821115611c1e575f80fd5b50611c2b8b828c01611b80565b999c989b5096999698976060880135976080810135975060a0013595509350505050565b5f8060408385031215611c60575f80fd5b611c6983611b3b565b9150611b7760208401611b3b565b5f81518084525f5b81811015611c9b57602081850181015186830182015201611c7f565b505f602082860101526020601f19601f83011685010191505092915050565b6020815281516020820152602082015160408201525f604083015160c06060840152611ce960e0840182611c77565b90506060840151601f19848303016080850152611d068282611c77565b915050608084015160a084015260a084015160c08401528091505092915050565b5f8060408385031215611d38575f80fd5b611d4183611b3b565b946020939093013593505050565b602081525f61136e6020830184611c77565b5f8060408385031215611d72575f80fd5b50508035926020909101359150565b5f60208284031215611d91575f80fd5b61136e82611b3b565b5f60208284031215611daa575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561053057610530611db1565b600181811c90821680611dec57607f821691505b602082108103611e0a57634e487b7160e01b5f52602260045260245ffd5b50919050565b5f808354611e1d81611dd8565b60018281168015611e355760018114611e4a57611e76565b60ff1984168752821515830287019450611e76565b875f526020805f205f5b85811015611e6d5781548a820152908401908201611e54565b50505082870194505b50929695505050505050565b818382375f9101908152919050565b634e487b7160e01b5f52604160045260245ffd5b601f821115610c9857805f5260205f20601f840160051c81016020851015611eca5750805b601f840160051c820191505b81811015611ee9575f8155600101611ed6565b5050505050565b67ffffffffffffffff831115611f0857611f08611e91565b611f1c83611f168354611dd8565b83611ea5565b5f601f841160018114611f4d575f8515611f365750838201355b5f19600387901b1c1916600186901b178355611ee9565b5f83815260208120601f198716915b82811015611f7c5786850135825560209485019460019092019101611f5c565b5086821015611f98575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b848152836020820152606060408201525f611ff1606083018486611faa565b9695505050505050565b602081525f6106d7602083018486611faa565b815167ffffffffffffffff81111561202857612028611e91565b61203c816120368454611dd8565b84611ea5565b602080601f83116001811461206f575f84156120585750858301515b5f19600386901b1c1916600185901b178555611029565b5f85815260208120601f198616915b8281101561209d5788860151825594840194600190910190840161207e565b50858210156120ba57878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b8181038181111561053057610530611db1565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52603160045260245ffdfe02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800a164736f6c6343000818000a0000000000000000000000003508a952176b3c15387c97be809eaffb1982176a000000000000000000000000a54b90ba34c5f326bc1485054080994e38fb4c60000000000000000000000000e7314f561b2e72f9543f1004e741bab6fc51028b
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106101fd575f3560e01c80636f962e5c11610114578063b3c65015116100a9578063d5ba2dcf11610079578063d5ba2dcf14610498578063e00bfe50146104ab578063e877f068146104d2578063ea6301ab146104e5578063fe3c9b9b14610504575f80fd5b8063b3c6501514610449578063ca15c8731461046a578063d257cf2a1461047d578063d547741f14610485575f80fd5b80639010d07c116100e45780639010d07c146103f557806391d1485414610408578063a217fddf1461041b578063acf1c94814610422575f80fd5b80636f962e5c146103a75780637e9f27ad146103bc578063819d4cc6146103cf5780638980f11f146103e2575f80fd5b806338013f02116101955780634e5b3a62116101655780634e5b3a621461033257806352d8bfc2146103525780635c654ad91461035a5780635e8e8f6f1461036d5780636dc3f2bd14610380575f80fd5b806338013f02146102e65780633d18b6f31461030d57806347d17d9d14610316578063485cc9551461031f575f80fd5b80632f2ff15d116101d05780632f2ff15d146102805780632ffa14e1146102955780633333e109146102a857806336568abe146102d3575f80fd5b806301ffc9a71461020157806314dc6c141461022957806321893f7b1461023f578063248a9ca314610252575b5f80fd5b61021461020f366004611a81565b61050c565b60405190151581526020015b60405180910390f35b6102315f5481565b604051908152602001610220565b61023161024d366004611aa8565b610536565b610231610260366004611b24565b5f9081525f80516020612106833981519152602052604090206001015490565b61029361028e366004611b56565b6106df565b005b6102936102a3366004611bc5565b610715565b6007546102bb906001600160a01b031681565b6040516001600160a01b039091168152602001610220565b6102936102e1366004611b56565b610c65565b6102bb7f000000000000000000000000e7314f561b2e72f9543f1004e741bab6fc51028b81565b61023160065481565b61023160045481565b61029361032d366004611c4f565b610c9d565b610345610340366004611b24565b610db8565b6040516102209190611cba565b610293610f5a565b610293610368366004611d27565b610fb6565b61023161037b366004611aa8565b611031565b6102bb7f000000000000000000000000a54b90ba34c5f326bc1485054080994e38fb4c6081565b6103af6110c4565b6040516102209190611d4f565b6102316103ca366004611d61565b611150565b6102936103dd366004611d27565b6111a1565b6102936103f0366004611d27565b6111f0565b6102bb610403366004611d61565b611291565b610214610416366004611b56565b6112c9565b6102315f81565b6102317fb3e25b5404b87e5a838579cb5d7481d61ad96ee284d38ec1e97c07ba64e7f6fc81565b6104516112ff565b60405167ffffffffffffffff9091168152602001610220565b610231610478366004611b24565b611337565b610231611375565b610293610493366004611b56565b61140d565b6102936104a6366004611d81565b61143d565b6102bb7f0000000000000000000000003508a952176b3c15387c97be809eaffb1982176a81565b6102936104e0366004611d81565b61151d565b6102316104f3366004611b24565b60036020525f908152604090205481565b6103af611534565b5f6001600160e01b03198216635a05180f60e01b1480610530575061053082611541565b92915050565b5f336001600160a01b037f000000000000000000000000a54b90ba34c5f326bc1485054080994e38fb4c6016146105805760405163a8d664b560e01b815260040160405180910390fd5b61058c85858585611031565b9050805f0361059c57505f6106d7565b8060045410156105bf57604051633c57b48560e21b815260040160405180910390fd5b6004805482900381555f868152600360205260409081902080548401905551638fcb4e5b60e01b81526001600160a01b037f0000000000000000000000003508a952176b3c15387c97be809eaffb1982176a1691638fcb4e5b9161065b917f000000000000000000000000a54b90ba34c5f326bc1485054080994e38fb4c60918691016001600160a01b03929092168252602082015260400190565b6020604051808303815f875af1158015610677573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061069b9190611d9a565b50847f4b7ab1c192267e83350d06490a852b8dbbb25bfa00fd065b1862cf7accd2ab90826040516106ce91815260200190565b60405180910390a25b949350505050565b5f8281525f80516020612106833981519152602052604090206001015461070581611575565b61070f8383611582565b50505050565b336001600160a01b037f000000000000000000000000e7314f561b2e72f9543f1004e741bab6fc51028b161461075e576040516312d4786560e01b815260040160405180910390fd5b604051633d7ad0b760e21b81523060048201527f0000000000000000000000003508a952176b3c15387c97be809eaffb1982176a6001600160a01b03169063f5eb42dc90602401602060405180830381865afa1580156107c0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107e49190611d9a565b82846004546107f39190611dc5565b6107fd9190611dc5565b111561081c57604051636edcc52360e01b815260040160405180910390fd5b8215801561082957505f82115b156108475760405163319c9a2160e21b815260040160405180910390fd5b8215610954575f86900361086e576040516312b7aebf60e01b815260040160405180910390fd5b600160405161087d9190611e10565b60405180910390208787604051610895929190611e82565b6040518091039020036108bb576040516312b7aebf60e01b815260040160405180910390fd5b876108d9576040516357e86a3360e01b815260040160405180910390fd5b5f5488036108fa576040516357e86a3360e01b815260040160405180910390fd5b60048054840190555f8890556001610913878983611ef0565b507f26dec7cc117e9b3907dc1f90d2dc5f6e04dbb9f285f5898be2c82ec524dcd42460045489898960405161094b9493929190611fd2565b60405180910390a15b6040518381527f010f65f5f56ba52d759f7b1dc49a3d277570cc2aa631e9c865b073a0ffc2af419060200160405180910390a18115610a5757600754604051638fcb4e5b60e01b81526001600160a01b039182166004820152602481018490527f0000000000000000000000003508a952176b3c15387c97be809eaffb1982176a90911690638fcb4e5b906044016020604051808303815f875af11580156109fe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a229190611d9a565b506040518281527f7462935fb42d34d84233f737293310ca24e851021f9cb7f2549470cdf6de56bf9060200160405180910390a15b5f849003610a785760405163526ca52560e01b815260040160405180910390fd5b6002604051610a879190611e10565b60405180910390208585604051610a9f929190611e82565b604051809103902003610ac55760405163526ca52560e01b815260040160405180910390fd5b6002610ad2858783611ef0565b507f1f1a488b71a099a0d9cb71f60e14cf90bd1b5b188ca593111a40f533a3130b3b8585604051610b04929190611ffb565b60405180910390a16040518060c001604052808281526020015f54815260200160018054610b3190611dd8565b80601f0160208091040260200160405190810160405280929190818152602001828054610b5d90611dd8565b8015610ba85780601f10610b7f57610100808354040283529160200191610ba8565b820191905f5260205f20905b815481529060010190602001808311610b8b57829003601f168201915b5050505050815260200186868080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920182905250938552505050602080830187905260409283018690526006548252600581529082902083518155908301516001820155908201516002820190610c26908261200e565b5060608201516003820190610c3b908261200e565b506080820151600482015560a0909101516005909101555050600680546001019055505050505050565b6001600160a01b0381163314610c8e5760405163334bd91960e11b815260040160405180910390fd5b610c9882826115d7565b505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460029190600160401b900460ff1680610ce75750805467ffffffffffffffff808416911610155b15610d055760405163f92ee8a960e01b815260040160405180910390fd5b805468ffffffffffffffffff191667ffffffffffffffff831617600160401b1781556001600160a01b038416610d4e57604051633ef39b8160e01b815260040160405180910390fd5b610d5783611623565b610d5f6116ab565b610d695f85611582565b50805460ff60401b1916815560405167ffffffffffffffff831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a150505050565b610df06040518060c001604052805f81526020015f801916815260200160608152602001606081526020015f81526020015f81525090565b60055f8381526020019081526020015f206040518060c00160405290815f820154815260200160018201548152602001600282018054610e2f90611dd8565b80601f0160208091040260200160405190810160405280929190818152602001828054610e5b90611dd8565b8015610ea65780601f10610e7d57610100808354040283529160200191610ea6565b820191905f5260205f20905b815481529060010190602001808311610e8957829003601f168201915b50505050508152602001600382018054610ebf90611dd8565b80601f0160208091040260200160405190810160405280929190818152602001828054610eeb90611dd8565b8015610f365780601f10610f0d57610100808354040283529160200191610f36565b820191905f5260205f20905b815481529060010190602001808311610f1957829003601f168201915b50505050508152602001600482015481526020016005820154815250509050919050565b610f626116b5565b73a74528edc289b1a597faf83fcff7eff871cc01d96352d8bfc26040518163ffffffff1660e01b81526004015f6040518083038186803b158015610fa4575f80fd5b505af415801561070f573d5f803e3d5ffd5b610fbe6116b5565b604051635c654ad960e01b81526001600160a01b03831660048201526024810182905273a74528edc289b1a597faf83fcff7eff871cc01d990635c654ad9906044015b5f6040518083038186803b158015611017575f80fd5b505af4158015611029573d5f803e3d5ffd5b505050505050565b5f818103611052576040516309bde33960e01b815260040160405180910390fd5b5f61106984845f546110648a8a611150565b6116de565b905080611089576040516309bde33960e01b815260040160405180910390fd5b5f86815260036020526040902054858111156110b857604051636096ce8160e11b815260040160405180910390fd5b90940395945050505050565b600280546110d190611dd8565b80601f01602080910402602001604051908101604052809291908181526020018280546110fd90611dd8565b80156111485780601f1061111f57610100808354040283529160200191611148565b820191905f5260205f20905b81548152906001019060200180831161112b57829003601f168201915b505050505081565b60408051602081018490529081018290525f9060600160408051601f198184030181528282528051602091820120908301520160405160208183030381529060405280519060200120905092915050565b6111a96116b5565b6040516340cea66360e11b81526001600160a01b03831660048201526024810182905273a74528edc289b1a597faf83fcff7eff871cc01d99063819d4cc690604401611001565b6111f86116b5565b7f0000000000000000000000003508a952176b3c15387c97be809eaffb1982176a6001600160a01b0316826001600160a01b03160361124a576040516319efe5d760e21b815260040160405180910390fd5b604051638980f11f60e01b81526001600160a01b03831660048201526024810182905273a74528edc289b1a597faf83fcff7eff871cc01d990638980f11f90604401611001565b5f8281527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320006020819052604082206106d790846116f5565b5f9182525f80516020612106833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b5f6113327ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005467ffffffffffffffff1690565b905090565b5f8181527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e8237170593200060208190526040822061136e90611700565b9392505050565b60048054604051633d7ad0b760e21b815230928101929092525f917f0000000000000000000000003508a952176b3c15387c97be809eaffb1982176a6001600160a01b03169063f5eb42dc90602401602060405180830381865afa1580156113df573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114039190611d9a565b61133291906120ca565b5f8281525f80516020612106833981519152602052604090206001015461143381611575565b61070f83836115d7565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460029190600160401b900460ff16806114875750805467ffffffffffffffff808416911610155b156114a55760405163f92ee8a960e01b815260040160405180910390fd5b805468ffffffffffffffffff191667ffffffffffffffff831617600160401b1781556114d083611623565b805460ff60401b1916815560405167ffffffffffffffff831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a1505050565b5f61152781611575565b61153082611623565b5050565b600180546110d190611dd8565b5f6001600160e01b03198216637965db0b60e01b148061053057506301ffc9a760e01b6001600160e01b0319831614610530565b61157f8133611709565b50565b5f7fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000816115af8585611746565b905080156106d7575f8581526020839052604090206115ce90856117e7565b50949350505050565b5f7fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320008161160485856117fb565b905080156106d7575f8581526020839052604090206115ce9085611874565b6001600160a01b03811661164a5760405163669766e160e01b815260040160405180910390fd5b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f9f8636d85f90aba9c7d2c9e076c6102a5459d2e063afb71d81328bbb3608a2349060200160405180910390a150565b6116b3611888565b565b6116b37fb3e25b5404b87e5a838579cb5d7481d61ad96ee284d38ec1e97c07ba64e7f6fc611575565b5f826116eb8686856118d1565b1495945050505050565b5f61136e8383611909565b5f610530825490565b61171382826112c9565b6115305760405163e2517d3f60e01b81526001600160a01b03821660048201526024810183905260440160405180910390fd5b5f5f8051602061210683398151915261175f84846112c9565b6117de575f848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556117943390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610530565b5f915050610530565b5f61136e836001600160a01b03841661192f565b5f5f8051602061210683398151915261181484846112c9565b156117de575f848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610530565b5f61136e836001600160a01b03841661197b565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166116b357604051631afcd79f60e31b815260040160405180910390fd5b5f81815b848110156115ce576118ff828787848181106118f3576118f36120dd565b90506020020135611a55565b91506001016118d5565b5f825f01828154811061191e5761191e6120dd565b905f5260205f200154905092915050565b5f81815260018301602052604081205461197457508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610530565b505f610530565b5f81815260018301602052604081205480156117de575f61199d6001836120ca565b85549091505f906119b0906001906120ca565b9050808214611a0f575f865f0182815481106119ce576119ce6120dd565b905f5260205f200154905080875f0184815481106119ee576119ee6120dd565b5f918252602080832090910192909255918252600188019052604090208390555b8554869080611a2057611a206120f1565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610530565b5f818310611a6f575f82815260208490526040902061136e565b5f83815260208390526040902061136e565b5f60208284031215611a91575f80fd5b81356001600160e01b03198116811461136e575f80fd5b5f805f8060608587031215611abb575f80fd5b8435935060208501359250604085013567ffffffffffffffff80821115611ae0575f80fd5b818701915087601f830112611af3575f80fd5b813581811115611b01575f80fd5b8860208260051b8501011115611b15575f80fd5b95989497505060200194505050565b5f60208284031215611b34575f80fd5b5035919050565b80356001600160a01b0381168114611b51575f80fd5b919050565b5f8060408385031215611b67575f80fd5b82359150611b7760208401611b3b565b90509250929050565b5f8083601f840112611b90575f80fd5b50813567ffffffffffffffff811115611ba7575f80fd5b602083019150836020828501011115611bbe575f80fd5b9250929050565b5f805f805f805f8060c0898b031215611bdc575f80fd5b88359750602089013567ffffffffffffffff80821115611bfa575f80fd5b611c068c838d01611b80565b909950975060408b0135915080821115611c1e575f80fd5b50611c2b8b828c01611b80565b999c989b5096999698976060880135976080810135975060a0013595509350505050565b5f8060408385031215611c60575f80fd5b611c6983611b3b565b9150611b7760208401611b3b565b5f81518084525f5b81811015611c9b57602081850181015186830182015201611c7f565b505f602082860101526020601f19601f83011685010191505092915050565b6020815281516020820152602082015160408201525f604083015160c06060840152611ce960e0840182611c77565b90506060840151601f19848303016080850152611d068282611c77565b915050608084015160a084015260a084015160c08401528091505092915050565b5f8060408385031215611d38575f80fd5b611d4183611b3b565b946020939093013593505050565b602081525f61136e6020830184611c77565b5f8060408385031215611d72575f80fd5b50508035926020909101359150565b5f60208284031215611d91575f80fd5b61136e82611b3b565b5f60208284031215611daa575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561053057610530611db1565b600181811c90821680611dec57607f821691505b602082108103611e0a57634e487b7160e01b5f52602260045260245ffd5b50919050565b5f808354611e1d81611dd8565b60018281168015611e355760018114611e4a57611e76565b60ff1984168752821515830287019450611e76565b875f526020805f205f5b85811015611e6d5781548a820152908401908201611e54565b50505082870194505b50929695505050505050565b818382375f9101908152919050565b634e487b7160e01b5f52604160045260245ffd5b601f821115610c9857805f5260205f20601f840160051c81016020851015611eca5750805b601f840160051c820191505b81811015611ee9575f8155600101611ed6565b5050505050565b67ffffffffffffffff831115611f0857611f08611e91565b611f1c83611f168354611dd8565b83611ea5565b5f601f841160018114611f4d575f8515611f365750838201355b5f19600387901b1c1916600186901b178355611ee9565b5f83815260208120601f198716915b82811015611f7c5786850135825560209485019460019092019101611f5c565b5086821015611f98575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b848152836020820152606060408201525f611ff1606083018486611faa565b9695505050505050565b602081525f6106d7602083018486611faa565b815167ffffffffffffffff81111561202857612028611e91565b61203c816120368454611dd8565b84611ea5565b602080601f83116001811461206f575f84156120585750858301515b5f19600386901b1c1916600185901b178555611029565b5f85815260208120601f198616915b8281101561209d5788860151825594840194600190910190840161207e565b50858210156120ba57878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b8181038181111561053057610530611db1565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52603160045260245ffdfe02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800a164736f6c6343000818000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003508a952176b3c15387c97be809eaffb1982176a000000000000000000000000a54b90ba34c5f326bc1485054080994e38fb4c60000000000000000000000000e7314f561b2e72f9543f1004e741bab6fc51028b
-----Decoded View---------------
Arg [0] : stETH (address): 0x3508A952176b3c15387C97BE809eaffB1982176a
Arg [1] : accounting (address): 0xA54b90BA34C5f326BC1485054080994e38FB4C60
Arg [2] : oracle (address): 0xe7314f561B2e72f9543F1004e741bab6Fc51028B
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000003508a952176b3c15387c97be809eaffb1982176a
Arg [1] : 000000000000000000000000a54b90ba34c5f326bc1485054080994e38fb4c60
Arg [2] : 000000000000000000000000e7314f561b2e72f9543f1004e741bab6fc51028b
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.