Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
RocketMinipoolManager
Compiler Version
v0.8.18+commit.87f61d96
Contract Source Code (Solidity Standard Json-Input format)
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ // SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.18; pragma abicoder v2; import "../RocketBase.sol"; import "../../types/MinipoolStatus.sol"; import "../../types/MinipoolDeposit.sol"; import "../../types/MinipoolDetails.sol"; import "../../interface/dao/node/RocketDAONodeTrustedInterface.sol"; import "../../interface/minipool/RocketMinipoolInterface.sol"; import "../../interface/minipool/RocketMinipoolManagerInterface.sol"; import "../../interface/node/RocketNodeStakingInterface.sol"; import "../../interface/util/AddressSetStorageInterface.sol"; import "../../interface/node/RocketNodeManagerInterface.sol"; import "../../interface/network/RocketNetworkPricesInterface.sol"; import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol"; import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol"; import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol"; import "../../interface/minipool/RocketMinipoolFactoryInterface.sol"; import "../../interface/node/RocketNodeDistributorFactoryInterface.sol"; import "../../interface/node/RocketNodeDistributorInterface.sol"; import "../../interface/network/RocketNetworkPenaltiesInterface.sol"; import "../../interface/minipool/RocketMinipoolPenaltyInterface.sol"; import "../../interface/node/RocketNodeDepositInterface.sol"; import "../network/RocketNetworkSnapshots.sol"; import "../node/RocketNodeStaking.sol"; /// @notice Minipool creation, removal and management contract RocketMinipoolManager is RocketBase, RocketMinipoolManagerInterface { // Events event MinipoolCreated(address indexed minipool, address indexed node, uint256 time); event MinipoolDestroyed(address indexed minipool, address indexed node, uint256 time); event BeginBondReduction(address indexed minipool, uint256 time); event CancelReductionVoted(address indexed minipool, address indexed member, uint256 time); event ReductionCancelled(address indexed minipool, uint256 time); constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) { version = 4; } /// @notice Get the number of minipools in the network function getMinipoolCount() override public view returns (uint256) { AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); return addressSetStorage.getCount(keccak256(bytes("minipools.index"))); } /// @notice Get the number of minipools in the network in the Staking state function getStakingMinipoolCount() override public view returns (uint256) { return getUint(keccak256(bytes("minipools.staking.count"))); } /// @notice Get the number of finalised minipools in the network function getFinalisedMinipoolCount() override external view returns (uint256) { return getUint(keccak256(bytes("minipools.finalised.count"))); } /// @notice Get the number of active minipools in the network function getActiveMinipoolCount() override public view returns (uint256) { AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); uint256 total = addressSetStorage.getCount(keccak256(bytes("minipools.index"))); uint256 finalised = getUint(keccak256(bytes("minipools.finalised.count"))); return total - finalised; } /// @notice Returns true if a minipool has had an RPL slashing function getMinipoolRPLSlashed(address _minipoolAddress) override external view returns (bool) { return getBool(keccak256(abi.encodePacked("minipool.rpl.slashed", _minipoolAddress))); } /// @notice Get the number of minipools in each status. /// Returns the counts for Initialised, Prelaunch, Staking, Withdrawable, and Dissolved in that order. /// @param _offset The offset into the minipool set to start /// @param _limit The maximum number of minipools to iterate function getMinipoolCountPerStatus(uint256 _offset, uint256 _limit) override external view returns (uint256 initialisedCount, uint256 prelaunchCount, uint256 stakingCount, uint256 withdrawableCount, uint256 dissolvedCount) { // Get contracts AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); // Precompute minipool key bytes32 minipoolKey = keccak256(abi.encodePacked("minipools.index")); // Iterate over the requested minipool range uint256 totalMinipools = getMinipoolCount(); uint256 max = _offset + _limit; if (max > totalMinipools || _limit == 0) { max = totalMinipools; } for (uint256 i = _offset; i < max; ++i) { // Get the minipool at index i RocketMinipoolInterface minipool = RocketMinipoolInterface(addressSetStorage.getItem(minipoolKey, i)); // Get the minipool's status, and update the appropriate counter MinipoolStatus status = minipool.getStatus(); if (status == MinipoolStatus.Initialised) { initialisedCount++; } else if (status == MinipoolStatus.Prelaunch) { prelaunchCount++; } else if (status == MinipoolStatus.Staking) { stakingCount++; } else if (status == MinipoolStatus.Withdrawable) { withdrawableCount++; } else if (status == MinipoolStatus.Dissolved) { dissolvedCount++; } } } /// @notice Returns an array of all minipools in the prelaunch state /// @param _offset The offset into the minipool set to start iterating /// @param _limit The maximum number of minipools to iterate over function getPrelaunchMinipools(uint256 _offset, uint256 _limit) override external view returns (address[] memory) { // Get contracts AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); // Precompute minipool key bytes32 minipoolKey = keccak256(abi.encodePacked("minipools.index")); // Iterate over the requested minipool range uint256 totalMinipools = getMinipoolCount(); uint256 max = _offset + _limit; if (max > totalMinipools || _limit == 0) { max = totalMinipools; } // Create array big enough for every minipool address[] memory minipools = new address[](max - _offset); uint256 total = 0; for (uint256 i = _offset; i < max; ++i) { // Get the minipool at index i RocketMinipoolInterface minipool = RocketMinipoolInterface(addressSetStorage.getItem(minipoolKey, i)); // Get the minipool's status, and to array if it's in prelaunch MinipoolStatus status = minipool.getStatus(); if (status == MinipoolStatus.Prelaunch) { minipools[total] = address(minipool); total++; } } // Dirty hack to cut unused elements off end of return value assembly { mstore(minipools, total) } return minipools; } /// @notice Get a network minipool address by index /// @param _index Index into the minipool set to return function getMinipoolAt(uint256 _index) override external view returns (address) { AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); return addressSetStorage.getItem(keccak256(abi.encodePacked("minipools.index")), _index); } /// @notice Get the number of minipools owned by a node /// @param _nodeAddress The node operator to query the count of minipools of function getNodeMinipoolCount(address _nodeAddress) override external view returns (uint256) { AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); return addressSetStorage.getCount(keccak256(abi.encodePacked("node.minipools.index", _nodeAddress))); } /// @notice Get the number of minipools owned by a node that are not finalised /// @param _nodeAddress The node operator to query the count of active minipools of function getNodeActiveMinipoolCount(address _nodeAddress) override public view returns (uint256) { bytes32 key = keccak256(abi.encodePacked("minipools.active.count", _nodeAddress)); RocketNetworkSnapshotsInterface rocketNetworkSnapshots = RocketNetworkSnapshotsInterface(getContractAddress("rocketNetworkSnapshots")); (bool exists,, uint224 count) = rocketNetworkSnapshots.latest(key); if (!exists){ // Fallback to old value AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); uint256 finalised = getUint(keccak256(abi.encodePacked("node.minipools.finalised.count", _nodeAddress))); uint256 total = addressSetStorage.getCount(keccak256(abi.encodePacked("node.minipools.index", _nodeAddress))); return total - finalised; } return uint256(count); } /// @notice Get the number of minipools owned by a node that are finalised /// @param _nodeAddress The node operator to query the count of finalised minipools of function getNodeFinalisedMinipoolCount(address _nodeAddress) override external view returns (uint256) { return getUint(keccak256(abi.encodePacked("node.minipools.finalised.count", _nodeAddress))); } /// @notice Get the number of minipools owned by a node that are in staking status /// @param _nodeAddress The node operator to query the count of staking minipools of function getNodeStakingMinipoolCount(address _nodeAddress) override public view returns (uint256) { RocketNodeDepositInterface rocketNodeDeposit = RocketNodeDepositInterface(getContractAddress("rocketNodeDeposit")); // Get valid deposit amounts uint256[] memory depositSizes = rocketNodeDeposit.getDepositAmounts(); uint256 total; for (uint256 i = 0; i < depositSizes.length; ++i){ total = total + getNodeStakingMinipoolCountBySize(_nodeAddress, depositSizes[i]); } return total; } /// @notice Get the number of minipools owned by a node that are in staking status /// @param _nodeAddress The node operator to query the count of minipools by desposit size of /// @param _depositSize The deposit size to filter result by function getNodeStakingMinipoolCountBySize(address _nodeAddress, uint256 _depositSize) override public view returns (uint256) { bytes32 nodeKey; if (_depositSize == 16 ether){ nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", _nodeAddress)); } else { nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", _nodeAddress, _depositSize)); } return getUint(nodeKey); } /// @notice Get a node minipool address by index /// @param _nodeAddress The node operator to query the minipool of /// @param _index Index into the node operator's set of minipools function getNodeMinipoolAt(address _nodeAddress, uint256 _index) override external view returns (address) { AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); return addressSetStorage.getItem(keccak256(abi.encodePacked("node.minipools.index", _nodeAddress)), _index); } /// @notice Get the number of validating minipools owned by a node /// @param _nodeAddress The node operator to query the count of validating minipools of function getNodeValidatingMinipoolCount(address _nodeAddress) override external view returns (uint256) { AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); return addressSetStorage.getCount(keccak256(abi.encodePacked("node.minipools.validating.index", _nodeAddress))); } /// @notice Get a validating node minipool address by index /// @param _nodeAddress The node operator to query the validating minipool of /// @param _index Index into the node operator's set of validating minipools function getNodeValidatingMinipoolAt(address _nodeAddress, uint256 _index) override external view returns (address) { AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); return addressSetStorage.getItem(keccak256(abi.encodePacked("node.minipools.validating.index", _nodeAddress)), _index); } /// @notice Get a minipool address by validator pubkey /// @param _pubkey The pubkey to query function getMinipoolByPubkey(bytes memory _pubkey) override public view returns (address) { return getAddress(keccak256(abi.encodePacked("validator.minipool", _pubkey))); } /// @notice Returns true if a minipool exists /// @param _minipoolAddress The address of the minipool to check the existence of function getMinipoolExists(address _minipoolAddress) override public view returns (bool) { return getBool(keccak256(abi.encodePacked("minipool.exists", _minipoolAddress))); } /// @notice Returns true if a minipool previously existed at the given address /// @param _minipoolAddress The address to check the previous existence of a minipool at function getMinipoolDestroyed(address _minipoolAddress) override external view returns (bool) { return getBool(keccak256(abi.encodePacked("minipool.destroyed", _minipoolAddress))); } /// @notice Returns a minipool's validator pubkey /// @param _minipoolAddress The minipool to query the pubkey of function getMinipoolPubkey(address _minipoolAddress) override public view returns (bytes memory) { return getBytes(keccak256(abi.encodePacked("minipool.pubkey", _minipoolAddress))); } /// @notice Calculates what the withdrawal credentials of a minipool should be set to /// @param _minipoolAddress The minipool to calculate the withdrawal credentials for function getMinipoolWithdrawalCredentials(address _minipoolAddress) override public pure returns (bytes memory) { return abi.encodePacked(bytes1(0x01), bytes11(0x0), address(_minipoolAddress)); } /// @notice Decrements a node operator's number of staking minipools based on the minipools prior bond amount and /// increments it based on their new bond amount. /// @param _previousBond The minipool's previous bond value /// @param _newBond The minipool's new bond value /// @param _previousFee The fee of the minipool prior to the bond change /// @param _newFee The fee of the minipool after the bond change function updateNodeStakingMinipoolCount(uint256 _previousBond, uint256 _newBond, uint256 _previousFee, uint256 _newFee) override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) { bytes32 nodeKey; bytes32 numeratorKey; // Get contracts RocketMinipoolInterface minipool = RocketMinipoolInterface(msg.sender); address nodeAddress = minipool.getNodeAddress(); // Try to distribute current fees at previous average commission rate _tryDistribute(nodeAddress); // Decrement previous bond count if (_previousBond == 16 ether){ nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", nodeAddress)); numeratorKey = keccak256(abi.encodePacked("node.average.fee.numerator", nodeAddress)); } else { nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", nodeAddress, _previousBond)); numeratorKey = keccak256(abi.encodePacked("node.average.fee.numerator", nodeAddress, _previousBond)); } subUint(nodeKey, 1); subUint(numeratorKey, _previousFee); // Increment new bond count if (_newBond == 16 ether){ nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", nodeAddress)); numeratorKey = keccak256(abi.encodePacked("node.average.fee.numerator", nodeAddress)); } else { nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", nodeAddress, _newBond)); numeratorKey = keccak256(abi.encodePacked("node.average.fee.numerator", nodeAddress, _newBond)); } addUint(nodeKey, 1); addUint(numeratorKey, _newFee); } /// @dev Increments a node operator's number of staking minipools and calculates updated average node fee. /// Must be called from the minipool itself as msg.sender is used to query the minipool's node fee /// @param _nodeAddress The node address to increment the number of staking minipools of function incrementNodeStakingMinipoolCount(address _nodeAddress) override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) { // Get contracts RocketMinipoolInterface minipool = RocketMinipoolInterface(msg.sender); // Try to distribute current fees at previous average commission rate _tryDistribute(_nodeAddress); // Update the node specific count uint256 depositSize = minipool.getNodeDepositBalance(); bytes32 nodeKey; bytes32 numeratorKey; if (depositSize == 16 ether){ nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", _nodeAddress)); numeratorKey = keccak256(abi.encodePacked("node.average.fee.numerator", _nodeAddress)); } else { nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", _nodeAddress, depositSize)); numeratorKey = keccak256(abi.encodePacked("node.average.fee.numerator", _nodeAddress, depositSize)); } uint256 nodeValue = getUint(nodeKey); setUint(nodeKey, nodeValue + 1); // Update the total count bytes32 totalKey = keccak256(abi.encodePacked("minipools.staking.count")); uint256 totalValue = getUint(totalKey); setUint(totalKey, totalValue + 1); // Update node fee average addUint(numeratorKey, minipool.getNodeFee()); } /// @dev Decrements a node operator's number of minipools in staking status and calculates updated average node fee. /// Must be called from the minipool itself as msg.sender is used to query the minipool's node fee /// @param _nodeAddress The node address to decrement the number of staking minipools of function decrementNodeStakingMinipoolCount(address _nodeAddress) override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) { // Get contracts RocketMinipoolInterface minipool = RocketMinipoolInterface(msg.sender); // Try to distribute current fees at previous average commission rate _tryDistribute(_nodeAddress); // Update the node specific count uint256 depositSize = minipool.getNodeDepositBalance(); bytes32 nodeKey; bytes32 numeratorKey; if (depositSize == 16 ether){ nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", _nodeAddress)); numeratorKey = keccak256(abi.encodePacked("node.average.fee.numerator", _nodeAddress)); } else { nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", _nodeAddress, depositSize)); numeratorKey = keccak256(abi.encodePacked("node.average.fee.numerator", _nodeAddress, depositSize)); } uint256 nodeValue = getUint(nodeKey); setUint(nodeKey, nodeValue - 1); // Update the total count bytes32 totalKey = keccak256(abi.encodePacked("minipools.staking.count")); uint256 totalValue = getUint(totalKey); setUint(totalKey, totalValue - 1); // Update node fee average subUint(numeratorKey, minipool.getNodeFee()); } /// @notice Calls distribute on the given node's distributor if it has a balance and has been initialised /// @dev Reverts if node has not initialised their distributor /// @param _nodeAddress The node operator to try distribute rewards for function tryDistribute(address _nodeAddress) override external { _tryDistribute(_nodeAddress); } /// @dev Calls distribute on the given node's distributor if it has a balance and has been initialised /// @param _nodeAddress The node operator to try distribute rewards for function _tryDistribute(address _nodeAddress) internal { // Get contracts RocketNodeDistributorFactoryInterface rocketNodeDistributorFactory = RocketNodeDistributorFactoryInterface(getContractAddress("rocketNodeDistributorFactory")); address distributorAddress = rocketNodeDistributorFactory.getProxyAddress(_nodeAddress); // If there are funds to distribute than call distribute if (distributorAddress.balance > 0) { // Get contracts RocketNodeManagerInterface rocketNodeManager = RocketNodeManagerInterface(getContractAddress("rocketNodeManager")); // Ensure distributor has been initialised require(rocketNodeManager.getFeeDistributorInitialised(_nodeAddress), "Distributor not initialised"); RocketNodeDistributorInterface distributor = RocketNodeDistributorInterface(distributorAddress); distributor.distribute(); } } /// @dev Increments a node operator's number of minipools that have been finalised /// @param _nodeAddress The node operator to increment finalised minipool count for function incrementNodeFinalisedMinipoolCount(address _nodeAddress) override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) { // Get active minipool count (before increasing finalised count in case of fallback calculation) uint256 activeMinipoolCount = getNodeActiveMinipoolCount(_nodeAddress); // Can only finalise a minipool once bytes32 finalisedKey = keccak256(abi.encodePacked("node.minipools.finalised", msg.sender)); require(!getBool(finalisedKey), "Minipool has already been finalised"); setBool(finalisedKey, true); // Update the node specific count addUint(keccak256(abi.encodePacked("node.minipools.finalised.count", _nodeAddress)), 1); // Update the total count addUint(keccak256(bytes("minipools.finalised.count")), 1); // Update ETH matched RocketNodeStakingInterface rocketNodeStaking = RocketNodeStakingInterface(getContractAddress("rocketNodeStaking")); RocketNetworkSnapshots rocketNetworkSnapshots = RocketNetworkSnapshots(getContractAddress("rocketNetworkSnapshots")); uint256 ethMatched = rocketNodeStaking.getNodeETHMatched(_nodeAddress); ethMatched -= RocketMinipoolInterface(msg.sender).getUserDepositBalance(); bytes32 key = keccak256(abi.encodePacked("eth.matched.node.amount", _nodeAddress)); rocketNetworkSnapshots.push(key, uint224(ethMatched)); // Decrement active count key = keccak256(abi.encodePacked("minipools.active.count", _nodeAddress)); rocketNetworkSnapshots.push(key, uint224(activeMinipoolCount - 1)); } /// @dev Create a minipool. Only accepts calls from the RocketNodeDeposit contract /// @param _nodeAddress The owning node operator's address /// @param _salt A salt used in determining the minipool's address function createMinipool(address _nodeAddress, uint256 _salt) override public onlyLatestContract("rocketMinipoolManager", address(this)) onlyLatestContract("rocketNodeDeposit", msg.sender) returns (RocketMinipoolInterface) { // Load contracts AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); // Check node minipool limit based on RPL stake { // Local scope to prevent stack too deep error RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool")); // Check global minipool limit uint256 totalActiveMinipoolCount = getActiveMinipoolCount(); require(totalActiveMinipoolCount + 1 <= rocketDAOProtocolSettingsMinipool.getMaximumCount(), "Global minipool limit reached"); } // Get current active minipool count for this node operator (before we insert into address set in case it uses fallback calc) uint256 activeMinipoolCount = getNodeActiveMinipoolCount(_nodeAddress); // Create minipool contract address contractAddress = deployContract(_nodeAddress, _salt); // Initialise minipool data setBool(keccak256(abi.encodePacked("minipool.exists", contractAddress)), true); // Add minipool to indexes addressSetStorage.addItem(keccak256(abi.encodePacked("minipools.index")), contractAddress); addressSetStorage.addItem(keccak256(abi.encodePacked("node.minipools.index", _nodeAddress)), contractAddress); // Increment active count RocketNetworkSnapshots rocketNetworkSnapshots = RocketNetworkSnapshots(getContractAddress("rocketNetworkSnapshots")); bytes32 key = keccak256(abi.encodePacked("minipools.active.count", _nodeAddress)); rocketNetworkSnapshots.push(key, uint224(activeMinipoolCount + 1)); // Emit minipool created event emit MinipoolCreated(contractAddress, _nodeAddress, block.timestamp); // Return created minipool address return RocketMinipoolInterface(contractAddress); } /// @notice Creates a vacant minipool that can be promoted by changing the given validator's withdrawal credentials /// @param _nodeAddress Address of the owning node operator /// @param _salt A salt used in determining the minipool's address /// @param _validatorPubkey A validator pubkey that the node operator intends to migrate the withdrawal credentials of /// @param _bondAmount The bond amount selected by the node operator /// @param _currentBalance The current balance of the validator on the beaconchain (will be checked by oDAO and scrubbed if not correct) function createVacantMinipool(address _nodeAddress, uint256 _salt, bytes calldata _validatorPubkey, uint256 _bondAmount, uint256 _currentBalance) override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyLatestContract("rocketNodeDeposit", msg.sender) returns (RocketMinipoolInterface) { // Get contracts AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); // Create the minipool RocketMinipoolInterface minipool = createMinipool(_nodeAddress, _salt); // Prepare the minipool minipool.prepareVacancy(_bondAmount, _currentBalance); // Set the minipool's validator pubkey _setMinipoolPubkey(address(minipool), _validatorPubkey); // Add minipool to the vacant set addressSetStorage.addItem(keccak256(abi.encodePacked("minipools.vacant.index")), address(minipool)); // Return return minipool; } /// @dev Called by minipool to remove from vacant set on promotion or dissolution function removeVacantMinipool() override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) { // Remove from vacant set AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); addressSetStorage.removeItem(keccak256(abi.encodePacked("minipools.vacant.index")), msg.sender); // If minipool was dissolved, remove mapping of pubkey to minipool to allow NO to try again in future RocketMinipoolInterface minipool = RocketMinipoolInterface(msg.sender); if (minipool.getStatus() == MinipoolStatus.Dissolved) { bytes memory pubkey = getMinipoolPubkey(msg.sender); deleteAddress(keccak256(abi.encodePacked("validator.minipool", pubkey))); } } /// @notice Returns the number of minipools in the vacant minipool set function getVacantMinipoolCount() override external view returns (uint256) { AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); return addressSetStorage.getCount(keccak256(abi.encodePacked("minipools.vacant.index"))); } /// @notice Returns the vacant minipool at a given index /// @param _index The index into the vacant minipool set to retrieve function getVacantMinipoolAt(uint256 _index) override external view returns (address) { AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); return addressSetStorage.getItem(keccak256(abi.encodePacked("minipools.vacant.index")), _index); } /// @dev Destroy a minipool cleaning up all relevant state. Only accepts calls from registered minipools function destroyMinipool() override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) { // Load contracts AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); // Initialize minipool & get properties RocketMinipoolInterface minipool = RocketMinipoolInterface(msg.sender); address nodeAddress = minipool.getNodeAddress(); // Update ETH matched RocketNodeStakingInterface rocketNodeStaking = RocketNodeStakingInterface(getContractAddress("rocketNodeStaking")); uint256 ethMatched = rocketNodeStaking.getNodeETHMatched(nodeAddress); ethMatched = ethMatched - minipool.getUserDepositBalance(); // Record in snapshot manager RocketNetworkSnapshots rocketNetworkSnapshots = RocketNetworkSnapshots(getContractAddress("rocketNetworkSnapshots")); bytes32 key = keccak256(abi.encodePacked("eth.matched.node.amount", nodeAddress)); rocketNetworkSnapshots.push(key, uint224(ethMatched)); // Update minipool data setBool(keccak256(abi.encodePacked("minipool.exists", msg.sender)), false); // Record minipool as destroyed to prevent recreation at same address setBool(keccak256(abi.encodePacked("minipool.destroyed", msg.sender)), true); // Get number of active minipools (before removing from address set in case of fallback calculation) uint256 activeMinipoolCount = getNodeActiveMinipoolCount(nodeAddress); // Remove minipool from indexes addressSetStorage.removeItem(keccak256(abi.encodePacked("minipools.index")), msg.sender); addressSetStorage.removeItem(keccak256(abi.encodePacked("node.minipools.index", nodeAddress)), msg.sender); // Clean up pubkey state bytes memory pubkey = getMinipoolPubkey(msg.sender); deleteBytes(keccak256(abi.encodePacked("minipool.pubkey", msg.sender))); deleteAddress(keccak256(abi.encodePacked("validator.minipool", pubkey))); // Decrement active count key = keccak256(abi.encodePacked("minipools.active.count", nodeAddress)); rocketNetworkSnapshots.push(key, uint224(activeMinipoolCount - 1)); // Emit minipool destroyed event emit MinipoolDestroyed(msg.sender, nodeAddress, block.timestamp); } /// @dev Set a minipool's validator pubkey. Only accepts calls from registered minipools /// @param _pubkey The pubkey to set for the calling minipool function setMinipoolPubkey(bytes calldata _pubkey) override public onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) { _setMinipoolPubkey(msg.sender, _pubkey); } /// @dev Internal logic to set a minipool's pubkey, reverts if pubkey already set /// @param _pubkey The pubkey to set for the calling minipool function _setMinipoolPubkey(address _minipool, bytes calldata _pubkey) private { // Check validator pubkey is not in use require(getMinipoolByPubkey(_pubkey) == address(0x0), "Validator pubkey is in use"); // Load contracts AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); // Initialise minipool & get properties RocketMinipoolInterface minipool = RocketMinipoolInterface(_minipool); address nodeAddress = minipool.getNodeAddress(); // Set minipool validator pubkey & validator minipool address setBytes(keccak256(abi.encodePacked("minipool.pubkey", _minipool)), _pubkey); setAddress(keccak256(abi.encodePacked("validator.minipool", _pubkey)), _minipool); // Add minipool to node validating minipools index addressSetStorage.addItem(keccak256(abi.encodePacked("node.minipools.validating.index", nodeAddress)), _minipool); } /// @dev Wrapper around minipool getDepositType which handles backwards compatibility with v1 and v2 delegates /// @param _minipoolAddress Minipool address to get the deposit type of function getMinipoolDepositType(address _minipoolAddress) external override view returns (MinipoolDeposit) { RocketMinipoolInterface minipoolInterface = RocketMinipoolInterface(_minipoolAddress); uint8 version = 1; // Version 1 minipools did not have a version() function try minipoolInterface.version() returns (uint8 tryVersion) { version = tryVersion; } catch (bytes memory /*lowLevelData*/) {} if (version == 1 || version == 2) { try minipoolInterface.getDepositType{gas: 30000}() returns (MinipoolDeposit depositType) { return depositType; } catch (bytes memory /*lowLevelData*/) { return MinipoolDeposit.Variable; } } return minipoolInterface.getDepositType(); } /// @dev Performs a CREATE2 deployment of a minipool contract with given salt /// @param _nodeAddress The owning node operator's address /// @param _salt A salt used in determining the minipool's address function deployContract(address _nodeAddress, uint256 _salt) private returns (address) { RocketMinipoolFactoryInterface rocketMinipoolFactory = RocketMinipoolFactoryInterface(getContractAddress("rocketMinipoolFactory")); return rocketMinipoolFactory.deployContract(_nodeAddress, _salt); } }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only interface RocketStorageInterface { // Deploy status function getDeployedStatus() external view returns (bool); // Guardian function getGuardian() external view returns(address); function setGuardian(address _newAddress) external; function confirmGuardian() external; // Getters function getAddress(bytes32 _key) external view returns (address); function getUint(bytes32 _key) external view returns (uint); function getString(bytes32 _key) external view returns (string memory); function getBytes(bytes32 _key) external view returns (bytes memory); function getBool(bytes32 _key) external view returns (bool); function getInt(bytes32 _key) external view returns (int); function getBytes32(bytes32 _key) external view returns (bytes32); // Setters function setAddress(bytes32 _key, address _value) external; function setUint(bytes32 _key, uint _value) external; function setString(bytes32 _key, string calldata _value) external; function setBytes(bytes32 _key, bytes calldata _value) external; function setBool(bytes32 _key, bool _value) external; function setInt(bytes32 _key, int _value) external; function setBytes32(bytes32 _key, bytes32 _value) external; // Deleters function deleteAddress(bytes32 _key) external; function deleteUint(bytes32 _key) external; function deleteString(bytes32 _key) external; function deleteBytes(bytes32 _key) external; function deleteBool(bytes32 _key) external; function deleteInt(bytes32 _key) external; function deleteBytes32(bytes32 _key) external; // Arithmetic function addUint(bytes32 _key, uint256 _amount) external; function subUint(bytes32 _key, uint256 _amount) external; // Protected storage function getNodeWithdrawalAddress(address _nodeAddress) external view returns (address); function getNodePendingWithdrawalAddress(address _nodeAddress) external view returns (address); function setWithdrawalAddress(address _nodeAddress, address _newWithdrawalAddress, bool _confirm) external; function confirmWithdrawalAddress(address _nodeAddress) external; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only import "../interface/RocketStorageInterface.sol"; /// @title Base settings / modifiers for each contract in Rocket Pool /// @author David Rugendyke abstract contract RocketBase { // Calculate using this as the base uint256 constant calcBase = 1 ether; // Version of the contract uint8 public version; // The main storage contract where primary persistant storage is maintained RocketStorageInterface rocketStorage = RocketStorageInterface(address(0)); /*** Modifiers **********************************************************/ /** * @dev Throws if called by any sender that doesn't match a Rocket Pool network contract */ modifier onlyLatestNetworkContract() { require(getBool(keccak256(abi.encodePacked("contract.exists", msg.sender))), "Invalid or outdated network contract"); _; } /** * @dev Throws if called by any sender that doesn't match one of the supplied contract or is the latest version of that contract */ modifier onlyLatestContract(string memory _contractName, address _contractAddress) { require(_contractAddress == getAddress(keccak256(abi.encodePacked("contract.address", _contractName))), "Invalid or outdated contract"); _; } /** * @dev Throws if called by any sender that isn't a registered node */ modifier onlyRegisteredNode(address _nodeAddress) { require(getBool(keccak256(abi.encodePacked("node.exists", _nodeAddress))), "Invalid node"); _; } /** * @dev Throws if called by any sender that isn't a trusted node DAO member */ modifier onlyTrustedNode(address _nodeAddress) { require(getBool(keccak256(abi.encodePacked("dao.trustednodes.", "member", _nodeAddress))), "Invalid trusted node"); _; } /** * @dev Throws if called by any sender that isn't a registered minipool */ modifier onlyRegisteredMinipool(address _minipoolAddress) { require(getBool(keccak256(abi.encodePacked("minipool.exists", _minipoolAddress))), "Invalid minipool"); _; } /** * @dev Throws if called by any account other than a guardian account (temporary account allowed access to settings before DAO is fully enabled) */ modifier onlyGuardian() { require(msg.sender == rocketStorage.getGuardian(), "Account is not a temporary guardian"); _; } /*** Methods **********************************************************/ /// @dev Set the main Rocket Storage address constructor(RocketStorageInterface _rocketStorageAddress) { // Update the contract address rocketStorage = RocketStorageInterface(_rocketStorageAddress); } /// @dev Get the address of a network contract by name function getContractAddress(string memory _contractName) internal view returns (address) { // Get the current contract address address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName))); // Check it require(contractAddress != address(0x0), "Contract not found"); // Return return contractAddress; } /// @dev Get the address of a network contract by name (returns address(0x0) instead of reverting if contract does not exist) function getContractAddressUnsafe(string memory _contractName) internal view returns (address) { // Get the current contract address address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName))); // Return return contractAddress; } /// @dev Get the name of a network contract by address function getContractName(address _contractAddress) internal view returns (string memory) { // Get the contract name string memory contractName = getString(keccak256(abi.encodePacked("contract.name", _contractAddress))); // Check it require(bytes(contractName).length > 0, "Contract not found"); // Return return contractName; } /// @dev Get revert error message from a .call method function getRevertMsg(bytes memory _returnData) internal pure returns (string memory) { // If the _res length is less than 68, then the transaction failed silently (without a revert message) if (_returnData.length < 68) return "Transaction reverted silently"; assembly { // Slice the sighash. _returnData := add(_returnData, 0x04) } return abi.decode(_returnData, (string)); // All that remains is the revert string } /*** Rocket Storage Methods ****************************************/ // Note: Unused helpers have been removed to keep contract sizes down /// @dev Storage get methods function getAddress(bytes32 _key) internal view returns (address) { return rocketStorage.getAddress(_key); } function getUint(bytes32 _key) internal view returns (uint) { return rocketStorage.getUint(_key); } function getString(bytes32 _key) internal view returns (string memory) { return rocketStorage.getString(_key); } function getBytes(bytes32 _key) internal view returns (bytes memory) { return rocketStorage.getBytes(_key); } function getBool(bytes32 _key) internal view returns (bool) { return rocketStorage.getBool(_key); } function getInt(bytes32 _key) internal view returns (int) { return rocketStorage.getInt(_key); } function getBytes32(bytes32 _key) internal view returns (bytes32) { return rocketStorage.getBytes32(_key); } /// @dev Storage set methods function setAddress(bytes32 _key, address _value) internal { rocketStorage.setAddress(_key, _value); } function setUint(bytes32 _key, uint _value) internal { rocketStorage.setUint(_key, _value); } function setString(bytes32 _key, string memory _value) internal { rocketStorage.setString(_key, _value); } function setBytes(bytes32 _key, bytes memory _value) internal { rocketStorage.setBytes(_key, _value); } function setBool(bytes32 _key, bool _value) internal { rocketStorage.setBool(_key, _value); } function setInt(bytes32 _key, int _value) internal { rocketStorage.setInt(_key, _value); } function setBytes32(bytes32 _key, bytes32 _value) internal { rocketStorage.setBytes32(_key, _value); } /// @dev Storage delete methods function deleteAddress(bytes32 _key) internal { rocketStorage.deleteAddress(_key); } function deleteUint(bytes32 _key) internal { rocketStorage.deleteUint(_key); } function deleteString(bytes32 _key) internal { rocketStorage.deleteString(_key); } function deleteBytes(bytes32 _key) internal { rocketStorage.deleteBytes(_key); } function deleteBool(bytes32 _key) internal { rocketStorage.deleteBool(_key); } function deleteInt(bytes32 _key) internal { rocketStorage.deleteInt(_key); } function deleteBytes32(bytes32 _key) internal { rocketStorage.deleteBytes32(_key); } /// @dev Storage arithmetic methods function addUint(bytes32 _key, uint256 _amount) internal { rocketStorage.addUint(_key, _amount); } function subUint(bytes32 _key, uint256 _amount) internal { rocketStorage.subUint(_key, _amount); } }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only // Represents a minipool's status within the network enum MinipoolStatus { Initialised, // The minipool has been initialised and is awaiting a deposit of user ETH Prelaunch, // The minipool has enough ETH to begin staking and is awaiting launch by the node operator Staking, // The minipool is currently staking Withdrawable, // NO LONGER USED Dissolved // The minipool has been dissolved and its user deposited ETH has been returned to the deposit pool }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only // Represents the type of deposits required by a minipool enum MinipoolDeposit { None, // Marks an invalid deposit type Full, // The minipool requires 32 ETH from the node operator, 16 ETH of which will be refinanced from user deposits Half, // The minipool required 16 ETH from the node operator to be matched with 16 ETH from user deposits Empty, // The minipool requires 0 ETH from the node operator to be matched with 32 ETH from user deposits (trusted nodes only) Variable // Indicates this minipool is of the new generation that supports a variable deposit amount }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only import "./MinipoolDeposit.sol"; import "./MinipoolStatus.sol"; // A struct containing all the information on-chain about a specific minipool struct MinipoolDetails { bool exists; address minipoolAddress; bytes pubkey; MinipoolStatus status; uint256 statusBlock; uint256 statusTime; bool finalised; MinipoolDeposit depositType; uint256 nodeFee; uint256 nodeDepositBalance; bool nodeDepositAssigned; uint256 userDepositBalance; bool userDepositAssigned; uint256 userDepositAssignedTime; bool useLatestDelegate; address delegate; address previousDelegate; address effectiveDelegate; uint256 penaltyCount; uint256 penaltyRate; address nodeAddress; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only interface RocketDAONodeTrustedInterface { function getBootstrapModeDisabled() external view returns (bool); function getMemberQuorumVotesRequired() external view returns (uint256); function getMemberAt(uint256 _index) external view returns (address); function getMemberCount() external view returns (uint256); function getMemberMinRequired() external view returns (uint256); function getMemberIsValid(address _nodeAddress) external view returns (bool); function getMemberLastProposalTime(address _nodeAddress) external view returns (uint256); function getMemberID(address _nodeAddress) external view returns (string memory); function getMemberUrl(address _nodeAddress) external view returns (string memory); function getMemberJoinedTime(address _nodeAddress) external view returns (uint256); function getMemberProposalExecutedTime(string memory _proposalType, address _nodeAddress) external view returns (uint256); function getMemberRPLBondAmount(address _nodeAddress) external view returns (uint256); function getMemberIsChallenged(address _nodeAddress) external view returns (bool); function getMemberUnbondedValidatorCount(address _nodeAddress) external view returns (uint256); function incrementMemberUnbondedValidatorCount(address _nodeAddress) external; function decrementMemberUnbondedValidatorCount(address _nodeAddress) external; function bootstrapMember(string memory _id, string memory _url, address _nodeAddress) external; function bootstrapSettingUint(string memory _settingContractName, string memory _settingPath, uint256 _value) external; function bootstrapSettingBool(string memory _settingContractName, string memory _settingPath, bool _value) external; function bootstrapUpgrade(string memory _type, string memory _name, string memory _contractAbi, address _contractAddress) external; function bootstrapDisable(bool _confirmDisableBootstrapMode) external; function memberJoinRequired(string memory _id, string memory _url) external; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only import "../../types/MinipoolDeposit.sol"; import "../../types/MinipoolStatus.sol"; import "../RocketStorageInterface.sol"; interface RocketMinipoolInterface { function version() external view returns (uint8); function initialise(address _nodeAddress) external; function getStatus() external view returns (MinipoolStatus); function getFinalised() external view returns (bool); function getStatusBlock() external view returns (uint256); function getStatusTime() external view returns (uint256); function getScrubVoted(address _member) external view returns (bool); function getDepositType() external view returns (MinipoolDeposit); function getNodeAddress() external view returns (address); function getNodeFee() external view returns (uint256); function getNodeDepositBalance() external view returns (uint256); function getNodeRefundBalance() external view returns (uint256); function getNodeDepositAssigned() external view returns (bool); function getPreLaunchValue() external view returns (uint256); function getNodeTopUpValue() external view returns (uint256); function getVacant() external view returns (bool); function getPreMigrationBalance() external view returns (uint256); function getUserDistributed() external view returns (bool); function getUserDepositBalance() external view returns (uint256); function getUserDepositAssigned() external view returns (bool); function getUserDepositAssignedTime() external view returns (uint256); function getTotalScrubVotes() external view returns (uint256); function calculateNodeShare(uint256 _balance) external view returns (uint256); function calculateUserShare(uint256 _balance) external view returns (uint256); function preDeposit(uint256 _bondingValue, bytes calldata _validatorPubkey, bytes calldata _validatorSignature, bytes32 _depositDataRoot) external payable; function deposit() external payable; function userDeposit() external payable; function distributeBalance(bool _rewardsOnly) external; function beginUserDistribute() external; function userDistributeAllowed() external view returns (bool); function refund() external; function slash() external; function finalise() external; function canStake() external view returns (bool); function canPromote() external view returns (bool); function stake(bytes calldata _validatorSignature, bytes32 _depositDataRoot) external; function prepareVacancy(uint256 _bondAmount, uint256 _currentBalance) external; function promote() external; function dissolve() external; function close() external; function voteScrub() external; function reduceBondAmount() external; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; pragma abicoder v2; // SPDX-License-Identifier: GPL-3.0-only import "../../types/MinipoolDeposit.sol"; import "../../types/MinipoolDetails.sol"; import "./RocketMinipoolInterface.sol"; interface RocketMinipoolManagerInterface { function getMinipoolCount() external view returns (uint256); function getStakingMinipoolCount() external view returns (uint256); function getFinalisedMinipoolCount() external view returns (uint256); function getActiveMinipoolCount() external view returns (uint256); function getMinipoolRPLSlashed(address _minipoolAddress) external view returns (bool); function getMinipoolCountPerStatus(uint256 offset, uint256 limit) external view returns (uint256, uint256, uint256, uint256, uint256); function getPrelaunchMinipools(uint256 offset, uint256 limit) external view returns (address[] memory); function getMinipoolAt(uint256 _index) external view returns (address); function getNodeMinipoolCount(address _nodeAddress) external view returns (uint256); function getNodeActiveMinipoolCount(address _nodeAddress) external view returns (uint256); function getNodeFinalisedMinipoolCount(address _nodeAddress) external view returns (uint256); function getNodeStakingMinipoolCount(address _nodeAddress) external view returns (uint256); function getNodeStakingMinipoolCountBySize(address _nodeAddress, uint256 _depositSize) external view returns (uint256); function getNodeMinipoolAt(address _nodeAddress, uint256 _index) external view returns (address); function getNodeValidatingMinipoolCount(address _nodeAddress) external view returns (uint256); function getNodeValidatingMinipoolAt(address _nodeAddress, uint256 _index) external view returns (address); function getMinipoolByPubkey(bytes calldata _pubkey) external view returns (address); function getMinipoolExists(address _minipoolAddress) external view returns (bool); function getMinipoolDestroyed(address _minipoolAddress) external view returns (bool); function getMinipoolPubkey(address _minipoolAddress) external view returns (bytes memory); function updateNodeStakingMinipoolCount(uint256 _previousBond, uint256 _newBond, uint256 _previousFee, uint256 _newFee) external; function getMinipoolWithdrawalCredentials(address _minipoolAddress) external pure returns (bytes memory); function createMinipool(address _nodeAddress, uint256 _salt) external returns (RocketMinipoolInterface); function createVacantMinipool(address _nodeAddress, uint256 _salt, bytes calldata _validatorPubkey, uint256 _bondAmount, uint256 _currentBalance) external returns (RocketMinipoolInterface); function removeVacantMinipool() external; function getVacantMinipoolCount() external view returns (uint256); function getVacantMinipoolAt(uint256 _index) external view returns (address); function destroyMinipool() external; function incrementNodeStakingMinipoolCount(address _nodeAddress) external; function decrementNodeStakingMinipoolCount(address _nodeAddress) external; function tryDistribute(address _nodeAddress) external; function incrementNodeFinalisedMinipoolCount(address _nodeAddress) external; function setMinipoolPubkey(bytes calldata _pubkey) external; function getMinipoolDepositType(address _minipoolAddress) external view returns (MinipoolDeposit); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ // SPDX-License-Identifier: GPL-3.0-only pragma solidity >0.5.0 <0.9.0; interface RocketNodeStakingInterface { function getTotalRPLStake() external view returns (uint256); function getNodeRPLStake(address _nodeAddress) external view returns (uint256); function getNodeETHMatched(address _nodeAddress) external view returns (uint256); function getNodeETHProvided(address _nodeAddress) external view returns (uint256); function getNodeETHCollateralisationRatio(address _nodeAddress) external view returns (uint256); function getNodeRPLStakedTime(address _nodeAddress) external view returns (uint256); function getNodeEffectiveRPLStake(address _nodeAddress) external view returns (uint256); function getNodeMinimumRPLStake(address _nodeAddress) external view returns (uint256); function getNodeMaximumRPLStake(address _nodeAddress) external view returns (uint256); function getNodeETHMatchedLimit(address _nodeAddress) external view returns (uint256); function getRPLLockingAllowed(address _nodeAddress) external view returns (bool); function stakeRPL(uint256 _amount) external; function stakeRPLFor(address _nodeAddress, uint256 _amount) external; function setRPLLockingAllowed(address _nodeAddress, bool _allowed) external; function setStakeRPLForAllowed(address _caller, bool _allowed) external; function setStakeRPLForAllowed(address _nodeAddress, address _caller, bool _allowed) external; function getNodeRPLLocked(address _nodeAddress) external view returns (uint256); function lockRPL(address _nodeAddress, uint256 _amount) external; function unlockRPL(address _nodeAddress, uint256 _amount) external; function transferRPL(address _from, address _to, uint256 _amount) external; function withdrawRPL(uint256 _amount) external; function withdrawRPL(address _nodeAddress, uint256 _amount) external; function slashRPL(address _nodeAddress, uint256 _ethSlashAmount) external; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only interface AddressSetStorageInterface { function getCount(bytes32 _key) external view returns (uint); function getItem(bytes32 _key, uint _index) external view returns (address); function getIndexOf(bytes32 _key, address _value) external view returns (int); function addItem(bytes32 _key, address _value) external; function removeItem(bytes32 _key, address _value) external; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only // A struct containing all the information on-chain about a specific node struct NodeDetails { bool exists; uint256 registrationTime; string timezoneLocation; bool feeDistributorInitialised; address feeDistributorAddress; uint256 rewardNetwork; uint256 rplStake; uint256 effectiveRPLStake; uint256 minimumRPLStake; uint256 maximumRPLStake; uint256 ethMatched; uint256 ethMatchedLimit; uint256 minipoolCount; uint256 balanceETH; uint256 balanceRETH; uint256 balanceRPL; uint256 balanceOldRPL; uint256 depositCreditBalance; uint256 distributorBalanceUserETH; uint256 distributorBalanceNodeETH; address withdrawalAddress; address pendingWithdrawalAddress; bool smoothingPoolRegistrationState; uint256 smoothingPoolRegistrationChanged; address nodeAddress; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ // SPDX-License-Identifier: GPL-3.0-only pragma solidity >0.5.0 <0.9.0; pragma abicoder v2; import "../../types/NodeDetails.sol"; interface RocketNodeManagerInterface { // Structs struct TimezoneCount { string timezone; uint256 count; } function getNodeCount() external view returns (uint256); function getNodeCountPerTimezone(uint256 offset, uint256 limit) external view returns (TimezoneCount[] memory); function getNodeAt(uint256 _index) external view returns (address); function getNodeExists(address _nodeAddress) external view returns (bool); function getNodeWithdrawalAddress(address _nodeAddress) external view returns (address); function getNodePendingWithdrawalAddress(address _nodeAddress) external view returns (address); function getNodeRPLWithdrawalAddress(address _nodeAddress) external view returns (address); function getNodeRPLWithdrawalAddressIsSet(address _nodeAddress) external view returns (bool); function unsetRPLWithdrawalAddress(address _nodeAddress) external; function setRPLWithdrawalAddress(address _nodeAddress, address _newRPLWithdrawalAddress, bool _confirm) external; function confirmRPLWithdrawalAddress(address _nodeAddress) external; function getNodePendingRPLWithdrawalAddress(address _nodeAddress) external view returns (address); function getNodeTimezoneLocation(address _nodeAddress) external view returns (string memory); function registerNode(string calldata _timezoneLocation) external; function getNodeRegistrationTime(address _nodeAddress) external view returns (uint256); function setTimezoneLocation(string calldata _timezoneLocation) external; function setRewardNetwork(address _nodeAddress, uint256 network) external; function getRewardNetwork(address _nodeAddress) external view returns (uint256); function getFeeDistributorInitialised(address _nodeAddress) external view returns (bool); function initialiseFeeDistributor() external; function getAverageNodeFee(address _nodeAddress) external view returns (uint256); function setSmoothingPoolRegistrationState(bool _state) external; function getSmoothingPoolRegistrationState(address _nodeAddress) external returns (bool); function getSmoothingPoolRegistrationChanged(address _nodeAddress) external returns (uint256); function getSmoothingPoolRegisteredNodeCount(uint256 _offset, uint256 _limit) external view returns (uint256); function getNodeDetails(address _nodeAddress) external view returns (NodeDetails memory); function getNodeAddresses(uint256 _offset, uint256 _limit) external view returns (address[] memory); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only interface RocketNetworkPricesInterface { function getPricesBlock() external view returns (uint256); function getRPLPrice() external view returns (uint256); function submitPrices(uint256 _block, uint256 _slotTimestamp, uint256 _rplPrice) external; function executeUpdatePrices(uint256 _block, uint256 _slotTimestamp, uint256 _rplPrice) external; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only import "../../../../types/MinipoolDeposit.sol"; interface RocketDAOProtocolSettingsMinipoolInterface { function getLaunchBalance() external view returns (uint256); function getPreLaunchValue() external pure returns (uint256); function getDepositUserAmount(MinipoolDeposit _depositType) external view returns (uint256); function getFullDepositUserAmount() external view returns (uint256); function getHalfDepositUserAmount() external view returns (uint256); function getVariableDepositAmount() external view returns (uint256); function getSubmitWithdrawableEnabled() external view returns (bool); function getBondReductionEnabled() external view returns (bool); function getLaunchTimeout() external view returns (uint256); function getMaximumCount() external view returns (uint256); function isWithinUserDistributeWindow(uint256 _time) external view returns (bool); function hasUserDistributeWindowPassed(uint256 _time) external view returns (bool); function getUserDistributeWindowStart() external view returns (uint256); function getUserDistributeWindowLength() external view returns (uint256); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only interface RocketDAOProtocolSettingsNodeInterface { function getRegistrationEnabled() external view returns (bool); function getSmoothingPoolRegistrationEnabled() external view returns (bool); function getDepositEnabled() external view returns (bool); function getVacantMinipoolsEnabled() external view returns (bool); function getMinimumPerMinipoolStake() external view returns (uint256); function getMaximumPerMinipoolStake() external view returns (uint256); function getMaximumStakeForVotingPower() external view returns (uint256); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only import "../../types/MinipoolDeposit.sol"; interface RocketMinipoolFactoryInterface { function getExpectedAddress(address _nodeAddress, uint256 _salt) external view returns (address); function deployContract(address _nodeAddress, uint256 _salt) external returns (address); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only interface RocketNodeDistributorFactoryInterface { function getProxyBytecode() external pure returns (bytes memory); function getProxyAddress(address _nodeAddress) external view returns(address); function createProxy(address _nodeAddress) external; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only interface RocketNodeDistributorInterface { function getNodeShare() external view returns (uint256); function getUserShare() external view returns (uint256); function distribute() external; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only interface RocketNetworkPenaltiesInterface { function submitPenalty(address _minipoolAddress, uint256 _block) external; function executeUpdatePenalty(address _minipoolAddress, uint256 _block) external; function getPenaltyCount(address _minipoolAddress) external view returns (uint256); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only interface RocketMinipoolPenaltyInterface { // Max penalty rate function setMaxPenaltyRate(uint256 _rate) external; function getMaxPenaltyRate() external view returns (uint256); // Penalty rate function setPenaltyRate(address _minipoolAddress, uint256 _rate) external; function getPenaltyRate(address _minipoolAddress) external view returns(uint256); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only import "../../types/MinipoolDeposit.sol"; interface RocketNodeDepositInterface { function getNodeDepositCredit(address _nodeAddress) external view returns (uint256); function getNodeEthBalance(address _nodeAddress) external view returns (uint256); function getNodeCreditAndBalance(address _nodeAddress) external view returns (uint256); function getNodeUsableCreditAndBalance(address _nodeAddress) external view returns (uint256); function getNodeUsableCredit(address _nodeAddress) external view returns (uint256); function increaseDepositCreditBalance(address _nodeOperator, uint256 _amount) external; function depositEthFor(address _nodeAddress) external payable; function withdrawEth(address _nodeAddress, uint256 _amount) external; function deposit(uint256 _depositAmount, uint256 _minimumNodeFee, bytes calldata _validatorPubkey, bytes calldata _validatorSignature, bytes32 _depositDataRoot, uint256 _salt, address _expectedMinipoolAddress) external payable; function depositWithCredit(uint256 _depositAmount, uint256 _minimumNodeFee, bytes calldata _validatorPubkey, bytes calldata _validatorSignature, bytes32 _depositDataRoot, uint256 _salt, address _expectedMinipoolAddress) external payable; function isValidDepositAmount(uint256 _amount) external pure returns (bool); function getDepositAmounts() external pure returns (uint256[] memory); function createVacantMinipool(uint256 _bondAmount, uint256 _minimumNodeFee, bytes calldata _validatorPubkey, uint256 _salt, address _expectedMinipoolAddress, uint256 _currentBalance) external; function increaseEthMatched(address _nodeAddress, uint256 _amount) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ // SPDX-License-Identifier: GPL-3.0-only pragma solidity >0.5.0 <0.9.0; struct Checkpoint224 { uint32 _block; uint224 _value; } /// @notice Accounting for snapshotting of values based on block numbers interface RocketNetworkSnapshotsInterface { function push(bytes32 _key, uint224 _value) external; function length(bytes32 _key) external view returns (uint256); function latest(bytes32 _key) external view returns (bool, uint32, uint224); function latestBlock(bytes32 _key) external view returns (uint32); function latestValue(bytes32 _key) external view returns (uint224); function lookup(bytes32 _key, uint32 _block) external view returns (uint224); function lookupRecent(bytes32 _key, uint32 _block, uint256 _recency) external view returns (uint224); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ // SPDX-License-Identifier: MIT // Copyright (c) 2016-2023 zOS Global Limited and contributors // Adapted from OpenZeppelin `Checkpoints` contract pragma solidity 0.8.18; import "@openzeppelin4/contracts/utils/math/Math.sol"; import "../RocketBase.sol"; import "../../interface/network/RocketNetworkSnapshotsInterface.sol"; /// @notice Accounting for snapshotting of values based on block numbers contract RocketNetworkSnapshots is RocketBase, RocketNetworkSnapshotsInterface { constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) { // Set contract version version = 1; } function push(bytes32 _key, uint224 _value) onlyLatestContract("rocketNetworkSnapshots", address(this)) onlyLatestNetworkContract external { _insert(_key, _value); } function length(bytes32 _key) public view returns (uint256) { return rocketStorage.getUint(keccak256(abi.encodePacked("snapshot.length", _key))); } function latest(bytes32 _key) external view returns (bool, uint32, uint224) { uint256 len = length(_key); if (len == 0) { return (false, 0, 0); } Checkpoint224 memory checkpoint = _load(_key, len - 1); return (true, checkpoint._block, checkpoint._value); } function latestBlock(bytes32 _key) external view returns (uint32) { uint256 len = length(_key); return len == 0 ? 0 : _blockAt(_key, len - 1); } function latestValue(bytes32 _key) external view returns (uint224) { uint256 len = length(_key); return len == 0 ? 0 : _valueAt(_key, len - 1); } function lookup(bytes32 _key, uint32 _block) external view returns (uint224) { uint256 len = length(_key); uint256 pos = _binaryLookup(_key, _block, 0, len); return pos == 0 ? 0 : _valueAt(_key, pos - 1); } function lookupRecent(bytes32 _key, uint32 _block, uint256 _recency) external view returns (uint224) { uint256 len = length(_key); uint256 low = 0; uint256 high = len; if (len > 5 && len > _recency) { uint256 mid = len - _recency; if (_block < _blockAt(_key, mid)) { high = mid; } else { low = mid + 1; } } uint256 pos = _binaryLookup(_key, _block, low, high); return pos == 0 ? 0 : _valueAt(_key, pos - 1); } function _insert(bytes32 _key, uint224 _value) private { uint32 blockNumber = uint32(block.number); uint256 pos = length(_key); if (pos > 0) { Checkpoint224 memory last = _load(_key, pos - 1); // Checkpoint keys must be non-decreasing. require (last._block <= blockNumber, "Unordered snapshot insertion"); // Update or push new checkpoint if (last._block == blockNumber) { last._value = _value; _set(_key, pos - 1, last); } else { _push(_key, Checkpoint224({_block: blockNumber, _value: _value})); } } else { _push(_key, Checkpoint224({_block: blockNumber, _value: _value})); } } function _binaryLookup( bytes32 _key, uint32 _block, uint256 _low, uint256 _high ) private view returns (uint256) { while (_low < _high) { uint256 mid = Math.average(_low, _high); if (_blockAt(_key, mid) > _block) { _high = mid; } else { _low = mid + 1; } } return _high; } function _load(bytes32 _key, uint256 _pos) private view returns (Checkpoint224 memory) { bytes32 key = bytes32(uint256(_key) + _pos); bytes32 raw = rocketStorage.getBytes32(key); Checkpoint224 memory result; result._block = uint32(uint256(raw) >> 224); result._value = uint224(uint256(raw)); return result; } function _blockAt(bytes32 _key, uint256 _pos) private view returns (uint32) { bytes32 key = bytes32(uint256(_key) + _pos); bytes32 raw = rocketStorage.getBytes32(key); return uint32(uint256(raw) >> 224); } function _valueAt(bytes32 _key, uint256 _pos) private view returns (uint224) { bytes32 key = bytes32(uint256(_key) + _pos); bytes32 raw = rocketStorage.getBytes32(key); return uint224(uint256(raw)); } function _push(bytes32 _key, Checkpoint224 memory _item) private { bytes32 lengthKey = keccak256(abi.encodePacked("snapshot.length", _key)); uint256 snapshotLength = rocketStorage.getUint(lengthKey); bytes32 key = bytes32(uint256(_key) + snapshotLength); rocketStorage.setUint(lengthKey, snapshotLength + 1); rocketStorage.setBytes32(key, _encode(_item)); } function _set(bytes32 _key, uint256 _pos, Checkpoint224 memory _item) private { bytes32 key = bytes32(uint256(_key) + _pos); rocketStorage.setBytes32(key, _encode(_item)); } function _encode(Checkpoint224 memory _item) private pure returns (bytes32) { return bytes32( uint256(_item._block) << 224 | uint256(_item._value) ); } }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity >0.5.0 <0.9.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ // SPDX-License-Identifier: GPL-3.0-only pragma solidity >0.5.0 <0.9.0; interface RocketDAOProtocolSettingsRewardsInterface { function setSettingRewardsClaimers(uint256 _trustedNodePercent, uint256 _protocolPercent, uint256 _nodePercent) external; function getRewardsClaimerPerc(string memory _contractName) external view returns (uint256); function getRewardsClaimersPerc() external view returns (uint256 _trustedNodePercent, uint256 _protocolPercent, uint256 _nodePercent); function getRewardsClaimersTrustedNodePerc() external view returns (uint256); function getRewardsClaimersProtocolPerc() external view returns (uint256); function getRewardsClaimersNodePerc() external view returns (uint256); function getRewardsClaimersTimeUpdated() external view returns (uint256); function getRewardsClaimIntervalPeriods() external view returns (uint256); function getRewardsClaimIntervalTime() external view returns (uint256); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) import "./IERC20.sol"; pragma solidity >0.5.0 <0.9.0; interface IERC20Burnable is IERC20 { function burn(uint256 amount) external; function burnFrom(address account, uint256 amount) external; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only import "./util/IERC20Burnable.sol"; interface RocketVaultInterface { function balanceOf(string memory _networkContractName) external view returns (uint256); function depositEther() external payable; function withdrawEther(uint256 _amount) external; function depositToken(string memory _networkContractName, IERC20 _tokenAddress, uint256 _amount) external; function withdrawToken(address _withdrawalAddress, IERC20 _tokenAddress, uint256 _amount) external; function balanceOfToken(string memory _networkContractName, IERC20 _tokenAddress) external view returns (uint256); function transferToken(string memory _networkContractName, IERC20 _tokenAddress, uint256 _amount) external; function burnToken(IERC20Burnable _tokenAddress, uint256 _amount) external; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 | * +---------------------------------------------------+ * * Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned, * decentralised, trustless and compatible with staking in Ethereum 2.0. * * For more information about Rocket Pool, visit https://rocketpool.net * * Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty * */ // SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.18; import "../../interface/util/IERC20.sol"; import "../RocketBase.sol"; import "../../interface/minipool/RocketMinipoolManagerInterface.sol"; import "../../interface/network/RocketNetworkPricesInterface.sol"; import "../../interface/node/RocketNodeStakingInterface.sol"; import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsRewardsInterface.sol"; import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol"; import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol"; import "../../interface/RocketVaultInterface.sol"; import "../../interface/util/AddressSetStorageInterface.sol"; import "../../interface/network/RocketNetworkSnapshotsInterface.sol"; import "../network/RocketNetworkSnapshots.sol"; import "../../interface/node/RocketNodeManagerInterface.sol"; /// @notice Handles node deposits and minipool creation contract RocketNodeStaking is RocketBase, RocketNodeStakingInterface { // Constants bytes32 immutable internal totalKey; // Events event RPLStaked(address indexed from, uint256 amount, uint256 time); event RPLWithdrawn(address indexed to, uint256 amount, uint256 time); event RPLSlashed(address indexed node, uint256 amount, uint256 ethValue, uint256 time); event StakeRPLForAllowed(address indexed node, address indexed caller, bool allowed, uint256 time); event RPLLockingAllowed(address indexed node, bool allowed, uint256 time); event RPLLocked(address indexed from, uint256 amount, uint256 time); event RPLUnlocked(address indexed from, uint256 amount, uint256 time); event RPLTransferred(address indexed from, address indexed to, uint256 amount, uint256 time); modifier onlyRPLWithdrawalAddressOrNode(address _nodeAddress) { // Check that the call is coming from RPL withdrawal address (or node if unset) RocketNodeManagerInterface rocketNodeManager = RocketNodeManagerInterface(getContractAddress("rocketNodeManager")); if (rocketNodeManager.getNodeRPLWithdrawalAddressIsSet(_nodeAddress)) { address rplWithdrawalAddress = rocketNodeManager.getNodeRPLWithdrawalAddress(_nodeAddress); require(msg.sender == rplWithdrawalAddress, "Must be called from RPL withdrawal address"); } else { require(msg.sender == _nodeAddress, "Must be called from node address"); } _; } constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) { version = 5; // Precompute keys totalKey = keccak256(abi.encodePacked("rpl.staked.total.amount")); } /// @notice Returns the total quantity of RPL staked on the network function getTotalRPLStake() override external view returns (uint256) { return getUint(totalKey); } /// @dev Increases the total network RPL stake /// @param _amount How much to increase by function increaseTotalRPLStake(uint256 _amount) private { addUint(totalKey, _amount); } /// @dev Decrease the total network RPL stake /// @param _amount How much to decrease by function decreaseTotalRPLStake(uint256 _amount) private { subUint(totalKey, _amount); } /// @notice Returns the amount a given node operator has staked /// @param _nodeAddress The address of the node operator to query function getNodeRPLStake(address _nodeAddress) override public view returns (uint256) { bytes32 key = keccak256(abi.encodePacked("rpl.staked.node.amount", _nodeAddress)); RocketNetworkSnapshotsInterface rocketNetworkSnapshots = RocketNetworkSnapshotsInterface(getContractAddress("rocketNetworkSnapshots")); (bool exists,, uint224 value) = rocketNetworkSnapshots.latest(key); uint256 stake = uint256(value); if (!exists){ // Fallback to old value stake = getUint(key); } return stake; } /// @dev Increases a node operator's RPL stake /// @param _amount How much to increase by function increaseNodeRPLStake(address _nodeAddress, uint256 _amount) private { RocketNetworkSnapshotsInterface rocketNetworkSnapshots = RocketNetworkSnapshotsInterface(getContractAddress("rocketNetworkSnapshots")); bytes32 key = keccak256(abi.encodePacked("rpl.staked.node.amount", _nodeAddress)); (bool exists,, uint224 value) = rocketNetworkSnapshots.latest(key); if (!exists){ value = uint224(getUint(key)); } rocketNetworkSnapshots.push(key, value + uint224(_amount)); } /// @dev Decrease a node operator's RPL stake /// @param _amount How much to decrease by function decreaseNodeRPLStake(address _nodeAddress, uint256 _amount) private { RocketNetworkSnapshotsInterface rocketNetworkSnapshots = RocketNetworkSnapshotsInterface(getContractAddress("rocketNetworkSnapshots")); bytes32 key = keccak256(abi.encodePacked("rpl.staked.node.amount", _nodeAddress)); (bool exists,, uint224 value) = rocketNetworkSnapshots.latest(key); if (!exists){ value = uint224(getUint(key)); } rocketNetworkSnapshots.push(key, value - uint224(_amount)); } /// @notice Returns a node's matched ETH amount (amount taken from protocol to stake) /// @param _nodeAddress The address of the node operator to query function getNodeETHMatched(address _nodeAddress) override public view returns (uint256) { RocketNetworkSnapshotsInterface rocketNetworkSnapshots = RocketNetworkSnapshotsInterface(getContractAddress("rocketNetworkSnapshots")); bytes32 key = keccak256(abi.encodePacked("eth.matched.node.amount", _nodeAddress)); (bool exists, , uint224 value) = rocketNetworkSnapshots.latest(key); if (exists) { // Value was previously set in a snapshot so return that return value; } else { // Fallback to old method uint256 ethMatched = getUint(key); if (ethMatched > 0) { // Value was previously calculated and stored so return that return ethMatched; } else { // Fallback for backwards compatibility before ETH matched was recorded (all legacy minipools matched 16 ETH from protocol) RocketMinipoolManagerInterface rocketMinipoolManager = RocketMinipoolManagerInterface(getContractAddress("rocketMinipoolManager")); return rocketMinipoolManager.getNodeActiveMinipoolCount(_nodeAddress) * 16 ether; } } } /// @notice Returns a node's provided ETH amount (amount supplied to create minipools) /// @param _nodeAddress The address of the node operator to query function getNodeETHProvided(address _nodeAddress) override public view returns (uint256) { // Get contracts RocketMinipoolManagerInterface rocketMinipoolManager = RocketMinipoolManagerInterface(getContractAddress("rocketMinipoolManager")); uint256 activeMinipoolCount = rocketMinipoolManager.getNodeActiveMinipoolCount(_nodeAddress); // Retrieve stored ETH matched value uint256 ethMatched = getNodeETHMatched(_nodeAddress); if (ethMatched > 0) { RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool")); uint256 launchAmount = rocketDAOProtocolSettingsMinipool.getLaunchBalance(); // ETH provided is number of staking minipools * 32 - eth matched uint256 totalEthStaked = activeMinipoolCount * launchAmount; return totalEthStaked - ethMatched; } else { // Fallback for legacy minipools is number of staking minipools * 16 return activeMinipoolCount * 16 ether; } } /// @notice Returns the ratio between capital taken from users and provided by a node operator. /// The value is a 1e18 precision fixed point integer value of (node capital + user capital) / node capital. /// @param _nodeAddress The address of the node operator to query function getNodeETHCollateralisationRatio(address _nodeAddress) override public view returns (uint256) { uint256 ethMatched = getNodeETHMatched(_nodeAddress); if (ethMatched == 0) { // Node operator only has legacy minipools and all legacy minipools had a 1:1 ratio return calcBase * 2; } else { RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool")); uint256 launchAmount = rocketDAOProtocolSettingsMinipool.getLaunchBalance(); RocketMinipoolManagerInterface rocketMinipoolManager = RocketMinipoolManagerInterface(getContractAddress("rocketMinipoolManager")); uint256 totalEthStaked = rocketMinipoolManager.getNodeActiveMinipoolCount(_nodeAddress) * launchAmount; return (totalEthStaked * calcBase) / (totalEthStaked - ethMatched); } } /// @notice Returns the timestamp at which a node last staked RPL function getNodeRPLStakedTime(address _nodeAddress) override public view returns (uint256) { return getUint(keccak256(abi.encodePacked("rpl.staked.node.time", _nodeAddress))); } /// @dev Sets the timestamp at which a node last staked RPL /// @param _nodeAddress The address of the node operator to set the value for /// @param _time The timestamp to set function setNodeRPLStakedTime(address _nodeAddress, uint256 _time) private { setUint(keccak256(abi.encodePacked("rpl.staked.node.time", _nodeAddress)), _time); } /// @notice Calculate and return a node's effective RPL stake amount /// @param _nodeAddress The address of the node operator to calculate for function getNodeEffectiveRPLStake(address _nodeAddress) override public view returns (uint256) { // Load contracts RocketNetworkPricesInterface rocketNetworkPrices = RocketNetworkPricesInterface(getContractAddress("rocketNetworkPrices")); RocketDAOProtocolSettingsNodeInterface rocketDAOProtocolSettingsNode = RocketDAOProtocolSettingsNodeInterface(getContractAddress("rocketDAOProtocolSettingsNode")); // Get node's current RPL stake uint256 rplStake = getNodeRPLStake(_nodeAddress); // Retrieve variables for calculations uint256 matchedETH = getNodeETHMatched(_nodeAddress); uint256 providedETH = getNodeETHProvided(_nodeAddress); uint256 rplPrice = rocketNetworkPrices.getRPLPrice(); // RPL stake cannot exceed maximum uint256 maximumStakePercent = rocketDAOProtocolSettingsNode.getMaximumPerMinipoolStake(); uint256 maximumStake = providedETH * maximumStakePercent / rplPrice; if (rplStake > maximumStake) { return maximumStake; } // If RPL stake is lower than minimum, node has no effective stake uint256 minimumStakePercent = rocketDAOProtocolSettingsNode.getMinimumPerMinipoolStake(); uint256 minimumStake = matchedETH * minimumStakePercent / rplPrice; if (rplStake < minimumStake) { return 0; } // Otherwise, return the actual stake return rplStake; } /// @notice Calculate and return a node's minimum RPL stake to collateralize their minipools /// @param _nodeAddress The address of the node operator to calculate for function getNodeMinimumRPLStake(address _nodeAddress) override external view returns (uint256) { // Load contracts RocketNetworkPricesInterface rocketNetworkPrices = RocketNetworkPricesInterface(getContractAddress("rocketNetworkPrices")); RocketDAOProtocolSettingsNodeInterface rocketDAOProtocolSettingsNode = RocketDAOProtocolSettingsNodeInterface(getContractAddress("rocketDAOProtocolSettingsNode")); // Retrieve variables uint256 minimumStakePercent = rocketDAOProtocolSettingsNode.getMinimumPerMinipoolStake(); uint256 matchedETH = getNodeETHMatched(_nodeAddress); return matchedETH * minimumStakePercent / rocketNetworkPrices.getRPLPrice(); } /// @notice Calculate and return a node's maximum RPL stake to fully collateralise their minipools /// @param _nodeAddress The address of the node operator to calculate for function getNodeMaximumRPLStake(address _nodeAddress) override public view returns (uint256) { // Load contracts RocketNetworkPricesInterface rocketNetworkPrices = RocketNetworkPricesInterface(getContractAddress("rocketNetworkPrices")); RocketDAOProtocolSettingsNodeInterface rocketDAOProtocolSettingsNode = RocketDAOProtocolSettingsNodeInterface(getContractAddress("rocketDAOProtocolSettingsNode")); // Retrieve variables uint256 maximumStakePercent = rocketDAOProtocolSettingsNode.getMaximumPerMinipoolStake(); uint256 providedETH = getNodeETHProvided(_nodeAddress); return providedETH * maximumStakePercent / rocketNetworkPrices.getRPLPrice(); } /// @notice Calculate and return a node's limit of how much user ETH they can use based on RPL stake /// @param _nodeAddress The address of the node operator to calculate for function getNodeETHMatchedLimit(address _nodeAddress) override external view returns (uint256) { // Load contracts RocketNetworkPricesInterface rocketNetworkPrices = RocketNetworkPricesInterface(getContractAddress("rocketNetworkPrices")); RocketDAOProtocolSettingsNodeInterface rocketDAOProtocolSettingsNode = RocketDAOProtocolSettingsNodeInterface(getContractAddress("rocketDAOProtocolSettingsNode")); // Calculate & return limit uint256 minimumStakePercent = rocketDAOProtocolSettingsNode.getMinimumPerMinipoolStake(); return getNodeRPLStake(_nodeAddress) *rocketNetworkPrices.getRPLPrice() / minimumStakePercent; } /// @notice Returns whether this node allows RPL locking or not /// @param _nodeAddress The address of the node operator to query for function getRPLLockingAllowed(address _nodeAddress) external view returns (bool) { return getBool(keccak256(abi.encodePacked("rpl.locking.allowed", _nodeAddress))); } /// @notice Accept an RPL stake from the node operator's own address /// Requires the node's RPL withdrawal address to be unset /// @param _amount The amount of RPL to stake function stakeRPL(uint256 _amount) override external { stakeRPLFor(msg.sender, _amount); } /// @notice Accept an RPL stake from any address for a specified node /// Requires caller to have approved this contract to spend RPL /// Requires caller to be on the node operator's allow list (see `setStakeForAllowed`) /// @param _nodeAddress The address of the node operator to stake on behalf of /// @param _amount The amount of RPL to stake function stakeRPLFor(address _nodeAddress, uint256 _amount) override public onlyLatestContract("rocketNodeStaking", address(this)) onlyRegisteredNode(_nodeAddress) { // Must be node's RPL withdrawal address if set or the node's address or an allow listed address or rocketMerkleDistributorMainnet if (msg.sender != getAddress(keccak256(abi.encodePacked("contract.address", "rocketMerkleDistributorMainnet")))) { RocketNodeManagerInterface rocketNodeManager = RocketNodeManagerInterface(getContractAddress("rocketNodeManager")); bool fromNode = false; if (rocketNodeManager.getNodeRPLWithdrawalAddressIsSet(_nodeAddress)) { address rplWithdrawalAddress = rocketNodeManager.getNodeRPLWithdrawalAddress(_nodeAddress); fromNode = msg.sender == rplWithdrawalAddress; } else { address withdrawalAddress = rocketStorage.getNodeWithdrawalAddress(_nodeAddress); fromNode = (msg.sender == _nodeAddress) || (msg.sender == withdrawalAddress); } if (!fromNode) { require(getBool(keccak256(abi.encodePacked("node.stake.for.allowed", _nodeAddress, msg.sender))), "Not allowed to stake for"); } } _stakeRPL(_nodeAddress, _amount); } /// @notice Sets the allow state for this node to perform functions that require locking RPL /// @param _nodeAddress The address of the node operator to change the state for /// @param _allowed Whether locking is allowed or not function setRPLLockingAllowed(address _nodeAddress, bool _allowed) override external onlyLatestContract("rocketNodeStaking", address(this)) onlyRPLWithdrawalAddressOrNode(_nodeAddress) { // Set the value setBool(keccak256(abi.encodePacked("rpl.locking.allowed", _nodeAddress)), _allowed); // Log it emit RPLLockingAllowed(_nodeAddress, _allowed, block.timestamp); } /// @notice Explicitly allow or remove allowance of an address to be able to stake on behalf of a node /// @dev The node operator is determined by the address calling this method, it is here for backwards compatibility /// @param _caller The address you wish to allow /// @param _allowed Whether the address is allowed or denied function setStakeRPLForAllowed(address _caller, bool _allowed) override external { setStakeRPLForAllowed(msg.sender, _caller, _allowed); } /// @notice Explicitly allow or remove allowance of an address to be able to stake on behalf of a node /// @param _nodeAddress The address of the node operator allowing the caller /// @param _caller The address you wish to allow /// @param _allowed Whether the address is allowed or denied function setStakeRPLForAllowed(address _nodeAddress, address _caller, bool _allowed) override public onlyLatestContract("rocketNodeStaking", address(this)) onlyRPLWithdrawalAddressOrNode(_nodeAddress) { // Set the value setBool(keccak256(abi.encodePacked("node.stake.for.allowed", _nodeAddress, _caller)), _allowed); // Log it emit StakeRPLForAllowed(_nodeAddress, _caller, _allowed, block.timestamp); } /// @dev Internal logic for staking RPL /// @param _nodeAddress The address to increase the RPL stake of /// @param _amount The amount of RPL to stake function _stakeRPL(address _nodeAddress, uint256 _amount) internal { // Load contracts address rplTokenAddress = getContractAddress("rocketTokenRPL"); address rocketVaultAddress = getContractAddress("rocketVault"); IERC20 rplToken = IERC20(rplTokenAddress); RocketVaultInterface rocketVault = RocketVaultInterface(rocketVaultAddress); // Transfer RPL tokens require(rplToken.transferFrom(msg.sender, address(this), _amount), "Could not transfer RPL to staking contract"); // Deposit RPL tokens to vault require(rplToken.approve(rocketVaultAddress, _amount), "Could not approve vault RPL deposit"); rocketVault.depositToken("rocketNodeStaking", rplToken, _amount); // Update RPL stake amounts & node RPL staked block increaseTotalRPLStake(_amount); increaseNodeRPLStake(_nodeAddress, _amount); setNodeRPLStakedTime(_nodeAddress, block.timestamp); // Emit RPL staked event emit RPLStaked(_nodeAddress, _amount, block.timestamp); } /// @notice Returns the amount of RPL that is locked for a given node /// @param _nodeAddress The address of the node operator to query for function getNodeRPLLocked(address _nodeAddress) override public view returns (uint256) { return getUint(keccak256(abi.encodePacked("rpl.locked.node.amount", _nodeAddress))); } /// @notice Locks an amount of RPL from being withdrawn even if the node operator is over capitalised /// @param _nodeAddress The address of the node operator /// @param _amount The amount of RPL to lock function lockRPL(address _nodeAddress, uint256 _amount) override external onlyLatestContract("rocketNodeStaking", address(this)) onlyLatestNetworkContract() { // Check status require(getBool(keccak256(abi.encodePacked("rpl.locking.allowed", _nodeAddress))), "Node is not allowed to lock RPL"); // The node must have unlocked stake equaling or greater than the amount uint256 rplStake = getNodeRPLStake(_nodeAddress); bytes32 lockedStakeKey = keccak256(abi.encodePacked("rpl.locked.node.amount", _nodeAddress)); uint256 lockedStake = getUint(lockedStakeKey); require(rplStake - lockedStake >= _amount, "Not enough staked RPL"); // Increase locked RPL setUint(lockedStakeKey, lockedStake + _amount); // Emit event emit RPLLocked(_nodeAddress, _amount, block.timestamp); } /// @notice Unlocks an amount of RPL making it possible to withdraw if the nod is over capitalised /// @param _nodeAddress The address of the node operator /// @param _amount The amount of RPL to unlock function unlockRPL(address _nodeAddress, uint256 _amount) override external onlyLatestContract("rocketNodeStaking", address(this)) onlyLatestNetworkContract() { // The node must have locked stake equaling or greater than the amount bytes32 lockedStakeKey = keccak256(abi.encodePacked("rpl.locked.node.amount", _nodeAddress)); uint256 lockedStake = getUint(lockedStakeKey); require(_amount <= lockedStake, "Not enough locked RPL"); // Decrease locked RPL setUint(lockedStakeKey, lockedStake - _amount); // Emit event emit RPLUnlocked(_nodeAddress, _amount, block.timestamp); } /// @notice Transfers RPL from one node to another /// @param _from The node to transfer from /// @param _to The node to transfer to /// @param _amount The amount of RPL to transfer function transferRPL(address _from, address _to, uint256 _amount) override external onlyLatestContract("rocketNodeStaking", address(this)) onlyLatestNetworkContract() onlyRegisteredNode(_from) { // Check sender has enough RPL require(getNodeRPLStake(_from) >= _amount, "Sender has insufficient RPL"); // Transfer the stake decreaseNodeRPLStake(_from, _amount); increaseNodeRPLStake(_to, _amount); // Emit event emit RPLTransferred(_from, _to, _amount, block.timestamp); } /// @notice Withdraw staked RPL back to the node account or withdraw RPL address /// Can only be called by a node if they have not set their RPL withdrawal address /// @param _amount The amount of RPL to withdraw function withdrawRPL(uint256 _amount) override external { withdrawRPL(msg.sender, _amount); } /// @notice Withdraw staked RPL back to the node account or withdraw RPL address /// If RPL withdrawal address has been set, must be called from it. Otherwise, must be called from /// node's primary withdrawal address or their node address. /// @param _nodeAddress The address of the node withdrawing /// @param _amount The amount of RPL to withdraw function withdrawRPL(address _nodeAddress, uint256 _amount) override public onlyLatestContract("rocketNodeStaking", address(this)) { // Check valid node require(getBool(keccak256(abi.encodePacked("node.exists", _nodeAddress))), "Invalid node"); // Check address is permitted to withdraw RocketNodeManagerInterface rocketNodeManager = RocketNodeManagerInterface(getContractAddress("rocketNodeManager")); address rplWithdrawalAddress = rocketNodeManager.getNodeRPLWithdrawalAddress(_nodeAddress); if (rocketNodeManager.getNodeRPLWithdrawalAddressIsSet(_nodeAddress)) { // If RPL withdrawal address is set, must be called from it require(msg.sender == rplWithdrawalAddress, "Invalid caller"); } else { // Otherwise, must be called from node address or withdrawal address address withdrawalAddress = rocketStorage.getNodeWithdrawalAddress(_nodeAddress); require(msg.sender == _nodeAddress || msg.sender == withdrawalAddress, "Invalid caller"); } // Load contracts RocketDAOProtocolSettingsRewardsInterface rocketDAOProtocolSettingsRewards = RocketDAOProtocolSettingsRewardsInterface(getContractAddress("rocketDAOProtocolSettingsRewards")); RocketVaultInterface rocketVault = RocketVaultInterface(getContractAddress("rocketVault")); // Check cooldown period (one claim period) has passed since RPL last staked require(block.timestamp - getNodeRPLStakedTime(_nodeAddress) >= rocketDAOProtocolSettingsRewards.getRewardsClaimIntervalTime(), "The withdrawal cooldown period has not passed"); // Get & check node's current RPL stake uint256 rplStake = getNodeRPLStake(_nodeAddress); uint256 lockedStake = getNodeRPLLocked(_nodeAddress); require(rplStake - lockedStake >= _amount, "Withdrawal amount exceeds node's staked RPL balance"); // Check withdrawal would not under collateralise node require(rplStake - _amount >= getNodeMaximumRPLStake(_nodeAddress) + lockedStake, "Node's staked RPL balance after withdrawal is less than required balance"); // Update RPL stake amounts decreaseTotalRPLStake(_amount); decreaseNodeRPLStake(_nodeAddress, _amount); // Transfer RPL tokens to node's RPL withdrawal address (if unset, defaults to primary withdrawal address) rocketVault.withdrawToken(rplWithdrawalAddress, IERC20(getContractAddress("rocketTokenRPL")), _amount); // Emit RPL withdrawn event emit RPLWithdrawn(_nodeAddress, _amount, block.timestamp); } /// @notice Slash a node's RPL by an ETH amount /// Only accepts calls from registered minipools /// @param _nodeAddress The address to slash RPL from /// @param _ethSlashAmount The amount of RPL to slash denominated in ETH value function slashRPL(address _nodeAddress, uint256 _ethSlashAmount) override external onlyLatestContract("rocketNodeStaking", address(this)) onlyRegisteredMinipool(msg.sender) { // Load contracts RocketNetworkPricesInterface rocketNetworkPrices = RocketNetworkPricesInterface(getContractAddress("rocketNetworkPrices")); RocketVaultInterface rocketVault = RocketVaultInterface(getContractAddress("rocketVault")); // Calculate RPL amount to slash uint256 rplSlashAmount = calcBase * _ethSlashAmount / rocketNetworkPrices.getRPLPrice(); // Cap slashed amount to node's RPL stake uint256 rplStake = getNodeRPLStake(_nodeAddress); if (rplSlashAmount > rplStake) { rplSlashAmount = rplStake; } // Transfer slashed amount to auction contract if(rplSlashAmount > 0) rocketVault.transferToken("rocketAuctionManager", IERC20(getContractAddress("rocketTokenRPL")), rplSlashAmount); // Update RPL stake amounts decreaseTotalRPLStake(rplSlashAmount); decreaseNodeRPLStake(_nodeAddress, rplSlashAmount); // Mark minipool as slashed setBool(keccak256(abi.encodePacked("minipool.rpl.slashed", msg.sender)), true); // Emit RPL slashed event emit RPLSlashed(_nodeAddress, rplSlashAmount, _ethSlashAmount, block.timestamp); } }
{ "optimizer": { "enabled": true, "runs": 15000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
[{"inputs":[{"internalType":"contract RocketStorageInterface","name":"_rocketStorageAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minipool","type":"address"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"BeginBondReduction","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minipool","type":"address"},{"indexed":true,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"CancelReductionVoted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minipool","type":"address"},{"indexed":true,"internalType":"address","name":"node","type":"address"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"MinipoolCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minipool","type":"address"},{"indexed":true,"internalType":"address","name":"node","type":"address"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"MinipoolDestroyed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minipool","type":"address"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"ReductionCancelled","type":"event"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"},{"internalType":"uint256","name":"_salt","type":"uint256"}],"name":"createMinipool","outputs":[{"internalType":"contract RocketMinipoolInterface","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"},{"internalType":"uint256","name":"_salt","type":"uint256"},{"internalType":"bytes","name":"_validatorPubkey","type":"bytes"},{"internalType":"uint256","name":"_bondAmount","type":"uint256"},{"internalType":"uint256","name":"_currentBalance","type":"uint256"}],"name":"createVacantMinipool","outputs":[{"internalType":"contract RocketMinipoolInterface","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"}],"name":"decrementNodeStakingMinipoolCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"destroyMinipool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getActiveMinipoolCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFinalisedMinipoolCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getMinipoolAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_pubkey","type":"bytes"}],"name":"getMinipoolByPubkey","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMinipoolCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"getMinipoolCountPerStatus","outputs":[{"internalType":"uint256","name":"initialisedCount","type":"uint256"},{"internalType":"uint256","name":"prelaunchCount","type":"uint256"},{"internalType":"uint256","name":"stakingCount","type":"uint256"},{"internalType":"uint256","name":"withdrawableCount","type":"uint256"},{"internalType":"uint256","name":"dissolvedCount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minipoolAddress","type":"address"}],"name":"getMinipoolDepositType","outputs":[{"internalType":"enum MinipoolDeposit","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minipoolAddress","type":"address"}],"name":"getMinipoolDestroyed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minipoolAddress","type":"address"}],"name":"getMinipoolExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minipoolAddress","type":"address"}],"name":"getMinipoolPubkey","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minipoolAddress","type":"address"}],"name":"getMinipoolRPLSlashed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minipoolAddress","type":"address"}],"name":"getMinipoolWithdrawalCredentials","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"}],"name":"getNodeActiveMinipoolCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"}],"name":"getNodeFinalisedMinipoolCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getNodeMinipoolAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"}],"name":"getNodeMinipoolCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"}],"name":"getNodeStakingMinipoolCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"},{"internalType":"uint256","name":"_depositSize","type":"uint256"}],"name":"getNodeStakingMinipoolCountBySize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getNodeValidatingMinipoolAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"}],"name":"getNodeValidatingMinipoolCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"getPrelaunchMinipools","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStakingMinipoolCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getVacantMinipoolAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVacantMinipoolCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"}],"name":"incrementNodeFinalisedMinipoolCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"}],"name":"incrementNodeStakingMinipoolCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"removeVacantMinipool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_pubkey","type":"bytes"}],"name":"setMinipoolPubkey","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeAddress","type":"address"}],"name":"tryDistribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_previousBond","type":"uint256"},{"internalType":"uint256","name":"_newBond","type":"uint256"},{"internalType":"uint256","name":"_previousFee","type":"uint256"},{"internalType":"uint256","name":"_newFee","type":"uint256"}],"name":"updateNodeStakingMinipoolCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405260008054610100600160a81b03191690553480156200002257600080fd5b5060405162005b9b38038062005b9b83398101604081905262000045916200007a565b6000805460ff196001600160a01b0390931661010002929092166001600160a81b0319909216919091176004179055620000ac565b6000602082840312156200008d57600080fd5b81516001600160a01b0381168114620000a557600080fd5b9392505050565b615adf80620000bc6000396000f3fe608060405234801561001057600080fd5b50600436106102415760003560e01c806375b59c7f11610145578063b88a89f7116100bd578063d14019911161008c578063d1ea6ce011610071578063d1ea6ce014610559578063eff7319f14610561578063f90267c41461057457600080fd5b8063d140199114610533578063d1afe9581461054657600080fd5b8063b88a89f7146104f2578063c64372bb14610505578063ce9b79ad14610518578063cf6a47631461052057600080fd5b80639da0700f11610114578063a757987a116100f9578063a757987a146104c4578063ae4d0bed146104d7578063b04e8868146104df57600080fd5b80639da0700f1461049e578063a179778b146104b157600080fd5b806375b59c7f146104455780637bb40aaf146104585780638b300029146104605780639907288c1461048b57600080fd5b80633b5ecefa116101d857806357b4ef6b116101a75780635ea1a6e21161018c5780635ea1a6e21461040a578063606bb62e1461042a57806367bca2351461043d57600080fd5b806357b4ef6b146103d75780635dfef965146103ea57600080fd5b80633b5ecefa146103625780633eb535e91461039d57806344e51a03146103b057806354fd4d50146103b857600080fd5b80631ce9ec33116102145780631ce9ec33146102ac578063240eb330146102bf5780632c7f64d4146102d25780632cb76c37146102e557600080fd5b80630c21b8a7146102465780630fcc81781461026e5780631286377e146102835780631844ec0114610299575b600080fd5b6102596102543660046152d5565b610587565b60405190151581526020015b60405180910390f35b61028161027c3660046152f2565b6105f5565b005b61028b610b43565b604051908152602001610265565b61028b6102a73660046152d5565b610c43565b61028b6102ba3660046152d5565b610f1f565b61028b6102cd366004615324565b611036565b6102816102e0366004615399565b611120565b6103556102f33660046152d5565b604080517f0100000000000000000000000000000000000000000000000000000000000000602082015260006021820152606083811b6bffffffffffffffffffffffff1916602c83015291016040516020818303038152906040529050919050565b604051610265919061542b565b61037561037036600461543e565b61127c565b604080519586526020860194909452928401919091526060830152608082015260a001610265565b6103556103ab3660046152d5565b611533565b610281611598565b6000546103c59060ff1681565b60405160ff9091168152602001610265565b61028b6103e53660046152d5565b6118af565b6103fd6103f836600461543e565b6119b1565b6040516102659190615460565b61041d6104183660046152d5565b611c33565b60405161026591906154dc565b6102596104383660046152d5565b611def565b61028b611e40565b6102816104533660046152d5565b611ea5565b6102816122d6565b61047361046e366004615324565b612b8e565b6040516001600160a01b039091168152602001610265565b6102816104993660046152d5565b612cbb565b6104736104ac366004615324565b6130e7565b6104736104bf36600461551d565b613186565b6102596104d23660046152d5565b613492565b61028b6134e3565b6102816104ed3660046152d5565b6135be565b61028b6105003660046152d5565b613c4e565b610473610513366004615324565b613c9f565b61028b6142e8565b61047361052e366004615613565b614478565b610473610541366004615693565b61448e565b6102816105543660046152d5565b6145a5565b61028b6145b1565b61047361056f366004615693565b614611565b61028b6105823660046152d5565b614696565b6040517f6d696e69706f6f6c2e72706c2e736c617368656400000000000000000000000060208201526bffffffffffffffffffffffff19606083901b1660348201526000906105ef906048015b60405160208183030381529060405280519060200120614735565b92915050565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e6167657200000000000000000000008152503061065b8260405160200161064091906156ac565b604051602081830303815290604052805190602001206147c0565b6001600160a01b0316816001600160a01b0316146106c05760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064015b60405180910390fd5b33610713816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b61075f5760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b60008060003390506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107cb91906156f1565b90506107d68161484b565b8a67de0b6b3a76400000036108a6576040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606083901b16603c82015260500160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff19606084901b16603a8301529450604e01604051602081830303815290604052805190602001209250610971565b6040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606083901b16603c820152605081018c905260700160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff19606084901b16603a830152604e82018d90529450606e016040516020818303038152906040528051906020012092505b61097c846001614a99565b610986838a614a99565b8967de0b6b3a7640000003610a56576040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606083901b16603c82015260500160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff19606084901b16603a8301529450604e01604051602081830303815290604052805190602001209250610b21565b6040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606083901b16603c820152605081018b905260700160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff19606084901b16603a830152604e82018c90529450606e016040516020818303038152906040528051906020012092505b610b2c846001614b18565b610b368389614b18565b5050505050505050505050565b600080610b846040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b9050806001600160a01b031663c9d6fee9604051602001610bc8907f6d696e69706f6f6c732e766163616e742e696e64657800000000000000000000815260160190565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610bfc91815260200190565b602060405180830381865afa158015610c19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3d919061570e565b91505090565b6040517f6d696e69706f6f6c732e6163746976652e636f756e740000000000000000000060208201526bffffffffffffffffffffffff19606083901b1660368201526000908190604a016040516020818303038152906040528051906020012090506000610ce56040518060400160405280601681526020017f726f636b65744e6574776f726b536e617073686f747300000000000000000000815250614b6d565b9050600080826001600160a01b03166379feb107856040518263ffffffff1660e01b8152600401610d1891815260200190565b606060405180830381865afa158015610d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d59919061573c565b925050915081610ef8576000610da36040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b6040517f6e6f64652e6d696e69706f6f6c732e66696e616c697365642e636f756e74000060208201526bffffffffffffffffffffffff1960608a901b16603e820152909150600090610e0e906052015b60405160208183030381529060405280519060200120614bdc565b6040517f6e6f64652e6d696e69706f6f6c732e696e64657800000000000000000000000060208201526bffffffffffffffffffffffff1960608b901b1660348201529091506000906001600160a01b0384169063c9d6fee990604801604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610e9e91815260200190565b602060405180830381865afa158015610ebb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edf919061570e565b9050610eeb82826157df565b9998505050505050505050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1695945050505050565b600080610f606040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b6040517f6e6f64652e6d696e69706f6f6c732e696e64657800000000000000000000000060208201526bffffffffffffffffffffffff19606086901b1660348201529091506001600160a01b0382169063c9d6fee9906048015b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610fee91815260200190565b602060405180830381865afa15801561100b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102f919061570e565b9392505050565b6000808267de0b6b3a76400000036110aa576040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606086901b16603c82015260500160405160208183030381529060405280519060200120905061110f565b6040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606086901b16603c820152605081018490526070016040516020818303038152906040528051906020012090505b61111881614bdc565b949350505050565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e6167657200000000000000000000008152503061116b8260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146111cb5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b3361121e816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b61126a5760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b611275338686614c67565b5050505050565b6000806000806000806112c36040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b905060006040516020016112fa907f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b604051602081830303815290604052805190602001209050600061131c6134e3565b9050600061132a8a8c6157f2565b905081811180611338575089155b156113405750805b8a5b81811015611524576040517ff3358a3a00000000000000000000000000000000000000000000000000000000815260048101859052602481018290526000906001600160a01b0387169063f3358a3a90604401602060405180830381865afa1580156113b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d691906156f1565b90506000816001600160a01b0316634e69d5606040518163ffffffff1660e01b8152600401602060405180830381865afa158015611418573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143c9190615812565b90506000816004811115611452576114526154ad565b03611469578b6114618161582f565b9c5050611511565b600181600481111561147d5761147d6154ad565b03611494578a61148c8161582f565b9b5050611511565b60028160048111156114a8576114a86154ad565b036114bf57896114b78161582f565b9a5050611511565b60038160048111156114d3576114d36154ad565b036114ea57886114e28161582f565b995050611511565b60048160048111156114fe576114fe6154ad565b03611511578761150d8161582f565b9850505b50508061151d9061582f565b9050611342565b50505050509295509295909350565b6040517f6d696e69706f6f6c2e7075626b657900000000000000000000000000000000006020820152606082811b6bffffffffffffffffffffffff1916602f830152906105ef9060430160405160208183030381529060405280519060200120614f6b565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306115e38260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146116435760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b33611696816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b6116e25760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b60006117226040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b9050806001600160a01b031663f79b36ad604051602001611766907f6d696e69706f6f6c732e766163616e742e696e64657800000000000000000000815260160190565b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1682526004820152336024820152604401600060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b50339250600491506117f39050565b816001600160a01b0316634e69d5606040518163ffffffff1660e01b8152600401602060405180830381865afa158015611831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118559190615812565b6004811115611866576118666154ad565b0361127557600061187633611533565b90506118a78160405160200161188c9190615867565b60405160208183030381529060405280519060200120614ffb565b505050505050565b6000806118f06040518060400160405280601181526020017f726f636b65744e6f64654465706f736974000000000000000000000000000000815250614b6d565b90506000816001600160a01b0316639bed5a456040518163ffffffff1660e01b8152600401600060405180830381865afa158015611932573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261195a91908101906158ac565b90506000805b82518110156119a85761198c8684838151811061197f5761197f615952565b6020026020010151611036565b61199690836157f2565b91506119a18161582f565b9050611960565b50949350505050565b606060006119f36040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b90506000604051602001611a2a907f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b6040516020818303038152906040528051906020012090506000611a4c6134e3565b90506000611a5a86886157f2565b905081811180611a68575085155b15611a705750805b6000611a7c88836157df565b67ffffffffffffffff811115611a9457611a9461558b565b604051908082528060200260200182016040528015611abd578160200160208202803683370190505b5090506000885b83811015611c25576040517ff3358a3a00000000000000000000000000000000000000000000000000000000815260048101879052602481018290526000906001600160a01b0389169063f3358a3a90604401602060405180830381865afa158015611b34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5891906156f1565b90506000816001600160a01b0316634e69d5606040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbe9190615812565b90506001816004811115611bd457611bd46154ad565b03611c125781858581518110611bec57611bec615952565b6001600160a01b039092166020928302919091019091015283611c0e8161582f565b9450505b505080611c1e9061582f565b9050611ac4565b508152979650505050505050565b600080829050600060019050816001600160a01b03166354fd4d506040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611c99575060408051601f3d908101601f19168201909252611c9691810190615981565b60015b611cd3573d808015611cc7576040519150601f19603f3d011682016040523d82523d6000602084013e611ccc565b606091505b5050611cd6565b90505b8060ff1660011480611ceb57508060ff166002145b15611d8d57816001600160a01b0316635abd37e46175306040518263ffffffff1660e01b81526004016020604051808303818786fa93505050508015611d4e575060408051601f3d908101601f19168201909252611d4b91810190615812565b60015b611118573d808015611d7c576040519150601f19603f3d011682016040523d82523d6000602084013e611d81565b606091505b50600495945050505050565b816001600160a01b0316635abd37e46040518163ffffffff1660e01b8152600401602060405180830381865afa158015611dcb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111189190615812565b6040517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208201526bffffffffffffffffffffffff19606083901b16602f8201526000906105ef906043016105d4565b60408051808201909152601781527f6d696e69706f6f6c732e7374616b696e672e636f756e740000000000000000006020909101526000611ea07f3441dc4461171402746c7de6880184ae1bfbc9def01a5bd7508263456c144419614bdc565b905090565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030611ef08260405160200161064091906156ac565b6001600160a01b0316816001600160a01b031614611f505760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b33611fa3816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b611fef5760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b33611ff98561484b565b6000816001600160a01b03166374ca6bf26040518163ffffffff1660e01b8152600401602060405180830381865afa158015612039573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205d919061570e565b90506000808267de0b6b3a764000000361211c575050604080517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e7400000000602080830191909152606089901b6bffffffffffffffffffffffff1916603c8301819052835160308185030181526050840185528051908301207f6e6f64652e617665726167652e6665652e6e756d657261746f720000000000006070850152608a8401919091528351607e818503018152609e90930190935281519101206121e7565b6040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff1960608a901b16603c8201526050810184905260700160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff1960608b901b16603a830152604e82018590529250606e016040516020818303038152906040528051906020012090505b60006121f283614bdc565b9050612208836122036001846157df565b615073565b6040517f6d696e69706f6f6c732e7374616b696e672e636f756e740000000000000000006020820152600090603701604051602081830303815290604052805190602001209050600061225a82614bdc565b905061226b826122036001846157df565b610b3684886001600160a01b031663e71501346040518163ffffffff1660e01b8152600401602060405180830381865afa1580156122ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d1919061570e565b614a99565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306123218260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146123815760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b336123d4816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b6124205760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b60006124606040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b905060003390506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124cb91906156f1565b9050600061250d6040518060400160405280601181526020017f726f636b65744e6f64655374616b696e67000000000000000000000000000000815250614b6d565b6040517fa493e6a20000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015291925060009183169063a493e6a290602401602060405180830381865afa158015612572573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612596919061570e565b9050836001600160a01b031663e7e04aba6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125fa919061570e565b61260490826157df565b905060006126466040518060400160405280601681526020017f726f636b65744e6574776f726b536e617073686f747300000000000000000000815250614b6d565b6040517f6574682e6d6174636865642e6e6f64652e616d6f756e7400000000000000000060208201526bffffffffffffffffffffffff19606087901b166037820152909150600090604b0160408051808303601f190181529082905280516020909101207f5ba59649000000000000000000000000000000000000000000000000000000008252600482018190527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8516602483015291506001600160a01b03831690635ba5964990604401600060405180830381600087803b15801561272857600080fd5b505af115801561273c573d6000803e3d6000fd5b50506040517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208201526bffffffffffffffffffffffff193360601b16602f8201526127a6925060430190506040516020818303038152906040528051906020012060006150c8565b6040517f6d696e69706f6f6c2e64657374726f796564000000000000000000000000000060208201526bffffffffffffffffffffffff193360601b16603282015261280c906046015b6040516020818303038152906040528051906020012060016150c8565b600061281786610c43565b9050876001600160a01b031663f79b36ad60405160200161285b907f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1682526004820152336024820152604401600060405180830381600087803b1580156128c557600080fd5b505af11580156128d9573d6000803e3d6000fd5b50506040517f6e6f64652e6d696e69706f6f6c732e696e64657800000000000000000000000060208201526bffffffffffffffffffffffff1960608a901b1660348201526001600160a01b038b16925063f79b36ad915060480160408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1682526004820152336024820152604401600060405180830381600087803b15801561299d57600080fd5b505af11580156129b1573d6000803e3d6000fd5b5050505060006129c033611533565b6040517f6d696e69706f6f6c2e7075626b6579000000000000000000000000000000000060208201526bffffffffffffffffffffffff193360601b16602f820152909150612a26906043016040516020818303038152906040528051906020012061511e565b612a3a8160405160200161188c9190615867565b6040517f6d696e69706f6f6c732e6163746976652e636f756e740000000000000000000060208201526bffffffffffffffffffffffff19606089901b166036820152604a01604051602081830303815290604052805190602001209250836001600160a01b0316635ba5964984600185612ab491906157df565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815260048101929092527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166024820152604401600060405180830381600087803b158015612b2857600080fd5b505af1158015612b3c573d6000803e3d6000fd5b50506040514281526001600160a01b038a1692503391507f3097cb0f536cd88115b814915d7030d2fe958943357cd2b1a9e1dba8a673ec699060200160405180910390a3505050505050505050505050565b600080612bcf6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b6040517f6e6f64652e6d696e69706f6f6c732e696e64657800000000000000000000000060208201526bffffffffffffffffffffffff19606087901b1660348201529091506001600160a01b0382169063f3358a3a906048015b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b168252600482015260248101869052604401602060405180830381865afa158015612c97573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111891906156f1565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030612d068260405160200161064091906156ac565b6001600160a01b0316816001600160a01b031614612d665760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b33612db9816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b612e055760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b33612e0f8561484b565b6000816001600160a01b03166374ca6bf26040518163ffffffff1660e01b8152600401602060405180830381865afa158015612e4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e73919061570e565b90506000808267de0b6b3a7640000003612f32575050604080517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e7400000000602080830191909152606089901b6bffffffffffffffffffffffff1916603c8301819052835160308185030181526050840185528051908301207f6e6f64652e617665726167652e6665652e6e756d657261746f720000000000006070850152608a8401919091528351607e818503018152609e9093019093528151910120612ffd565b6040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff1960608a901b16603c8201526050810184905260700160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff1960608b901b16603a830152604e82018590529250606e016040516020818303038152906040528051906020012090505b600061300883614bdc565b9050613019836122038360016157f2565b6040517f6d696e69706f6f6c732e7374616b696e672e636f756e740000000000000000006020820152600090603701604051602081830303815290604052805190602001209050600061306b82614bdc565b905061307c826122038360016157f2565b610b3684886001600160a01b031663e71501346040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130e2919061570e565b614b18565b6000806131286040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b6040517f6e6f64652e6d696e69706f6f6c732e76616c69646174696e672e696e6465780060208201526bffffffffffffffffffffffff19606087901b16603f8201529091506001600160a01b0382169063f3358a3a90605301612c29565b60006040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306131d38260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146132335760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b6040518060400160405280601181526020017f726f636b65744e6f64654465706f7369740000000000000000000000000000008152503361327e8260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146132de5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b600061331e6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b9050600061332c8d8d613c9f565b6040517f0871ffef000000000000000000000000000000000000000000000000000000008152600481018b9052602481018a90529091506001600160a01b03821690630871ffef90604401600060405180830381600087803b15801561339157600080fd5b505af11580156133a5573d6000803e3d6000fd5b505050506133b4818c8c614c67565b816001600160a01b031663889271666040516020016133f6907f6d696e69706f6f6c732e766163616e742e696e64657800000000000000000000815260160190565b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16825260048201526001600160a01b0384166024820152604401600060405180830381600087803b15801561346957600080fd5b505af115801561347d573d6000803e3d6000fd5b50929f9e505050505050505050505050505050565b6040517f6d696e69706f6f6c2e64657374726f796564000000000000000000000000000060208201526bffffffffffffffffffffffff19606083901b1660328201526000906105ef906046016105d4565b6000806135246040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b604080518082018252600f81527f6d696e69706f6f6c732e696e6465780000000000000000000000000000000000602090910152517fc9d6fee90000000000000000000000000000000000000000000000000000000081527ffd351ca1580febcf3f7f5a9bf9fd8dff9e6da5ca4df400be6b63fcdc2f2a918460048201529091506001600160a01b0382169063c9d6fee990602401610bfc565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306136098260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146136695760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b336136bc816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b6137085760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b600061371385610c43565b6040517f6e6f64652e6d696e69706f6f6c732e66696e616c69736564000000000000000060208201526bffffffffffffffffffffffff193360601b166038820152909150600090604c0160405160208183030381529060405280519060200120905061377e81614735565b156137f15760405162461bcd60e51b815260206004820152602360248201527f4d696e69706f6f6c2068617320616c7265616479206265656e2066696e616c6960448201527f736564000000000000000000000000000000000000000000000000000000000060648201526084016106b7565b6137fc8160016150c8565b6040517f6e6f64652e6d696e69706f6f6c732e66696e616c697365642e636f756e74000060208201526bffffffffffffffffffffffff19606088901b16603e82015261386290605201604051602081830303815290604052805190602001206001614b18565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e74000000000000006020909101526138c27f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d26001614b18565b60006139026040518060400160405280601181526020017f726f636b65744e6f64655374616b696e67000000000000000000000000000000815250614b6d565b905060006139446040518060400160405280601681526020017f726f636b65744e6574776f726b536e617073686f747300000000000000000000815250614b6d565b6040517fa493e6a20000000000000000000000000000000000000000000000000000000081526001600160a01b038a8116600483015291925060009184169063a493e6a290602401602060405180830381865afa1580156139a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139cd919061570e565b9050336001600160a01b031663e7e04aba6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613a0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a31919061570e565b613a3b90826157df565b6040517f6574682e6d6174636865642e6e6f64652e616d6f756e7400000000000000000060208201526bffffffffffffffffffffffff1960608c901b166037820152909150600090604b0160408051808303601f190181529082905280516020909101207f5ba59649000000000000000000000000000000000000000000000000000000008252600482018190527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8416602483015291506001600160a01b03841690635ba5964990604401600060405180830381600087803b158015613b1d57600080fd5b505af1158015613b31573d6000803e3d6000fd5b50506040517f6d696e69706f6f6c732e6163746976652e636f756e740000000000000000000060208201526bffffffffffffffffffffffff1960608e901b166036820152604a019150613b819050565b604051602081830303815290604052805190602001209050826001600160a01b0316635ba5964982600189613bb691906157df565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815260048101929092527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166024820152604401600060405180830381600087803b158015613c2a57600080fd5b505af1158015613c3e573d6000803e3d6000fd5b5050505050505050505050505050565b6040517f6e6f64652e6d696e69706f6f6c732e66696e616c697365642e636f756e74000060208201526bffffffffffffffffffffffff19606083901b16603e8201526000906105ef90605201610df3565b60006040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030613cec8260405160200161064091906156ac565b6001600160a01b0316816001600160a01b031614613d4c5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b6040518060400160405280601181526020017f726f636b65744e6f64654465706f73697400000000000000000000000000000081525033613d978260405160200161064091906156ac565b6001600160a01b0316816001600160a01b031614613df75760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b6000613e376040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b90506000613e5c604051806060016040528060218152602001615a8960219139614b6d565b90506000613e686142e8565b9050816001600160a01b0316636d4f8d3d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613ea8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ecc919061570e565b613ed78260016157f2565b1115613f255760405162461bcd60e51b815260206004820152601d60248201527f476c6f62616c206d696e69706f6f6c206c696d6974207265616368656400000060448201526064016106b7565b50506000613f3289610c43565b90506000613f408a8a61516c565b6040517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208201526bffffffffffffffffffffffff19606083901b16602f820152909150613f91906043016127ef565b826001600160a01b03166388927166604051602001613fd3907f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16825260048201526001600160a01b0384166024820152604401600060405180830381600087803b15801561404657600080fd5b505af115801561405a573d6000803e3d6000fd5b50506040517f6e6f64652e6d696e69706f6f6c732e696e64657800000000000000000000000060208201526bffffffffffffffffffffffff1960608e901b1660348201526001600160a01b03861692506388927166915060480160408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16825260048201526001600160a01b0384166024820152604401600060405180830381600087803b15801561412757600080fd5b505af115801561413b573d6000803e3d6000fd5b50505050600061417f6040518060400160405280601681526020017f726f636b65744e6574776f726b536e617073686f747300000000000000000000815250614b6d565b6040517f6d696e69706f6f6c732e6163746976652e636f756e740000000000000000000060208201526bffffffffffffffffffffffff1960608e901b166036820152909150600090604a01604051602081830303815290604052805190602001209050816001600160a01b0316635ba59649828660016141ff91906157f2565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815260048101929092527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166024820152604401600060405180830381600087803b15801561427357600080fd5b505af1158015614287573d6000803e3d6000fd5b505050508b6001600160a01b0316836001600160a01b03167f08b4b91bafaf992145c5dd7e098dfcdb32f879714c154c651c2758a44c7aeae4426040516142d091815260200190565b60405180910390a350909a9950505050505050505050565b6000806143296040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b604080518082018252600f81527f6d696e69706f6f6c732e696e6465780000000000000000000000000000000000602090910152517fc9d6fee90000000000000000000000000000000000000000000000000000000081527ffd351ca1580febcf3f7f5a9bf9fd8dff9e6da5ca4df400be6b63fcdc2f2a918460048201529091506000906001600160a01b0383169063c9d6fee990602401602060405180830381865afa1580156143de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614402919061570e565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e7400000000000000602090910152905060006144647f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d2614bdc565b905061447081836157df565b935050505090565b60006105ef826040516020016106409190615867565b6000806144cf6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b9050806001600160a01b031663f3358a3a604051602001614513907f6d696e69706f6f6c732e766163616e742e696e64657800000000000000000000815260160190565b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b168252600482015260248101869052604401602060405180830381865afa158015614581573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102f91906156f1565b6145ae8161484b565b50565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e74000000000000006020909101526000611ea07f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d2614bdc565b6000806146526040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b9050806001600160a01b031663f3358a3a604051602001614513907f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b6000806146d76040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b6040517f6e6f64652e6d696e69706f6f6c732e76616c69646174696e672e696e6465780060208201526bffffffffffffffffffffffff19606086901b16603f8201529091506001600160a01b0382169063c9d6fee990605301610fba565b600080546040517f7ae1cfca000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b031690637ae1cfca90602401602060405180830381865afa15801561479c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ef91906159a4565b600080546040517f21f8a721000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b0316906321f8a72190602401602060405180830381865afa158015614827573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ef91906156f1565b600061488b6040518060400160405280601c81526020017f726f636b65744e6f64654469737472696275746f72466163746f727900000000815250614b6d565b6040517ffa2a5b010000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015291925060009183169063fa2a5b0190602401602060405180830381865afa1580156148f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061491491906156f1565b90506001600160a01b0381163115614a945760006149666040518060400160405280601181526020017f726f636b65744e6f64654d616e61676572000000000000000000000000000000815250614b6d565b6040517f927ece4f0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301529192509082169063927ece4f90602401602060405180830381865afa1580156149c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906149ed91906159a4565b614a395760405162461bcd60e51b815260206004820152601b60248201527f4469737472696275746f72206e6f7420696e697469616c69736564000000000060448201526064016106b7565b6000829050806001600160a01b031663e4fc6b6d6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015614a7957600080fd5b505af1158015614a8d573d6000803e3d6000fd5b5050505050505b505050565b6000546040517febb9d8c900000000000000000000000000000000000000000000000000000000815260048101849052602481018390526101009091046001600160a01b03169063ebb9d8c9906044015b600060405180830381600087803b158015614b0457600080fd5b505af11580156118a7573d6000803e3d6000fd5b6000546040517fadb353dc00000000000000000000000000000000000000000000000000000000815260048101849052602481018390526101009091046001600160a01b03169063adb353dc90604401614aea565b600080614b848360405160200161064091906156ac565b90506001600160a01b0381166105ef5760405162461bcd60e51b815260206004820152601260248201527f436f6e7472616374206e6f7420666f756e64000000000000000000000000000060448201526064016106b7565b600080546040517fbd02d0f5000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b03169063bd02d0f590602401602060405180830381865afa158015614c43573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ef919061570e565b60006001600160a01b0316614cb183838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061447892505050565b6001600160a01b031614614d075760405162461bcd60e51b815260206004820152601a60248201527f56616c696461746f72207075626b657920697320696e2075736500000000000060448201526064016106b7565b6000614d476040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b905060008490506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614db291906156f1565b6040517f6d696e69706f6f6c2e7075626b6579000000000000000000000000000000000060208201526bffffffffffffffffffffffff19606089901b16602f820152909150614e50906043016040516020818303038152906040528051906020012086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061521992505050565b614e828585604051602001614e669291906159bf565b6040516020818303038152906040528051906020012087615268565b6040517f6e6f64652e6d696e69706f6f6c732e76616c69646174696e672e696e6465780060208201526bffffffffffffffffffffffff19606083901b16603f8201526001600160a01b0384169063889271669060530160408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16825260048201526001600160a01b0389166024820152604401600060405180830381600087803b158015614f4b57600080fd5b505af1158015614f5f573d6000803e3d6000fd5b50505050505050505050565b6000546040517fc031a1800000000000000000000000000000000000000000000000000000000081526004810183905260609161010090046001600160a01b03169063c031a18090602401600060405180830381865afa158015614fd3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105ef91908101906159f8565b6000546040517f0e14a376000000000000000000000000000000000000000000000000000000008152600481018390526101009091046001600160a01b031690630e14a376906024015b600060405180830381600087803b15801561505f57600080fd5b505af1158015611275573d6000803e3d6000fd5b6000546040517fe2a4853a00000000000000000000000000000000000000000000000000000000815260048101849052602481018390526101009091046001600160a01b03169063e2a4853a90604401614aea565b6000546040517fabfdcced0000000000000000000000000000000000000000000000000000000081526004810184905282151560248201526101009091046001600160a01b03169063abfdcced90604401614aea565b6000546040517f616b59f6000000000000000000000000000000000000000000000000000000008152600481018390526101009091046001600160a01b03169063616b59f690602401615045565b6000806151ad6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c466163746f72790000000000000000000000815250614b6d565b6040517fa2d41d600000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152602482018690529192509082169063a2d41d60906044016020604051808303816000875af1158015612c97573d6000803e3d6000fd5b6000546040517f2e28d0840000000000000000000000000000000000000000000000000000000081526101009091046001600160a01b031690632e28d08490614aea9085908590600401615a6f565b6000546040517fca446dd9000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0383811660248301526101009092049091169063ca446dd990604401614aea565b6001600160a01b03811681146145ae57600080fd5b6000602082840312156152e757600080fd5b813561102f816152c0565b6000806000806080858703121561530857600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561533757600080fd5b8235615342816152c0565b946020939093013593505050565b60008083601f84011261536257600080fd5b50813567ffffffffffffffff81111561537a57600080fd5b60208301915083602082850101111561539257600080fd5b9250929050565b600080602083850312156153ac57600080fd5b823567ffffffffffffffff8111156153c357600080fd5b6153cf85828601615350565b90969095509350505050565b60005b838110156153f65781810151838201526020016153de565b50506000910152565b600081518084526154178160208601602086016153db565b601f01601f19169290920160200192915050565b60208152600061102f60208301846153ff565b6000806040838503121561545157600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b818110156154a15783516001600160a01b03168352928401929184019160010161547c565b50909695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6020810160058310615517577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b60008060008060008060a0878903121561553657600080fd5b8635615541816152c0565b955060208701359450604087013567ffffffffffffffff81111561556457600080fd5b61557089828a01615350565b979a9699509760608101359660809091013595509350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156155e3576155e361558b565b604052919050565b600067ffffffffffffffff8211156156055761560561558b565b50601f01601f191660200190565b60006020828403121561562557600080fd5b813567ffffffffffffffff81111561563c57600080fd5b8201601f8101841361564d57600080fd5b803561566061565b826155eb565b6155ba565b81815285602083850101111561567557600080fd5b81602084016020830137600091810160200191909152949350505050565b6000602082840312156156a557600080fd5b5035919050565b7f636f6e74726163742e61646472657373000000000000000000000000000000008152600082516156e48160108501602087016153db565b9190910160100192915050565b60006020828403121561570357600080fd5b815161102f816152c0565b60006020828403121561572057600080fd5b5051919050565b8051801515811461573757600080fd5b919050565b60008060006060848603121561575157600080fd5b61575a84615727565b9250602084015163ffffffff8116811461577357600080fd5b60408501519092507bffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146157a557600080fd5b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156105ef576105ef6157b0565b808201808211156105ef576105ef6157b0565b600581106145ae57600080fd5b60006020828403121561582457600080fd5b815161102f81615805565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203615860576158606157b0565b5060010190565b7f76616c696461746f722e6d696e69706f6f6c000000000000000000000000000081526000825161589f8160128501602087016153db565b9190910160120192915050565b600060208083850312156158bf57600080fd5b825167ffffffffffffffff808211156158d757600080fd5b818501915085601f8301126158eb57600080fd5b8151818111156158fd576158fd61558b565b8060051b915061590e8483016155ba565b818152918301840191848101908884111561592857600080fd5b938501935b838510156159465784518252938501939085019061592d565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561599357600080fd5b815160ff8116811461102f57600080fd5b6000602082840312156159b657600080fd5b61102f82615727565b7f76616c696461746f722e6d696e69706f6f6c000000000000000000000000000081528183601283013760009101601201908152919050565b600060208284031215615a0a57600080fd5b815167ffffffffffffffff811115615a2157600080fd5b8201601f81018413615a3257600080fd5b8051615a4061565b826155eb565b818152856020838501011115615a5557600080fd5b615a668260208301602086016153db565b95945050505050565b82815260406020820152600061111860408301846153ff56fe726f636b657444414f50726f746f636f6c53657474696e67734d696e69706f6f6ca26469706673582212208c3ed08c17ac9e8a07af90d0deb3ea3f7330fd5534c6e96f4b1fdcccb62a48de64736f6c63430008120033000000000000000000000000594fb75d3dc2dfa0150ad03f99f97817747dd4e1
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102415760003560e01c806375b59c7f11610145578063b88a89f7116100bd578063d14019911161008c578063d1ea6ce011610071578063d1ea6ce014610559578063eff7319f14610561578063f90267c41461057457600080fd5b8063d140199114610533578063d1afe9581461054657600080fd5b8063b88a89f7146104f2578063c64372bb14610505578063ce9b79ad14610518578063cf6a47631461052057600080fd5b80639da0700f11610114578063a757987a116100f9578063a757987a146104c4578063ae4d0bed146104d7578063b04e8868146104df57600080fd5b80639da0700f1461049e578063a179778b146104b157600080fd5b806375b59c7f146104455780637bb40aaf146104585780638b300029146104605780639907288c1461048b57600080fd5b80633b5ecefa116101d857806357b4ef6b116101a75780635ea1a6e21161018c5780635ea1a6e21461040a578063606bb62e1461042a57806367bca2351461043d57600080fd5b806357b4ef6b146103d75780635dfef965146103ea57600080fd5b80633b5ecefa146103625780633eb535e91461039d57806344e51a03146103b057806354fd4d50146103b857600080fd5b80631ce9ec33116102145780631ce9ec33146102ac578063240eb330146102bf5780632c7f64d4146102d25780632cb76c37146102e557600080fd5b80630c21b8a7146102465780630fcc81781461026e5780631286377e146102835780631844ec0114610299575b600080fd5b6102596102543660046152d5565b610587565b60405190151581526020015b60405180910390f35b61028161027c3660046152f2565b6105f5565b005b61028b610b43565b604051908152602001610265565b61028b6102a73660046152d5565b610c43565b61028b6102ba3660046152d5565b610f1f565b61028b6102cd366004615324565b611036565b6102816102e0366004615399565b611120565b6103556102f33660046152d5565b604080517f0100000000000000000000000000000000000000000000000000000000000000602082015260006021820152606083811b6bffffffffffffffffffffffff1916602c83015291016040516020818303038152906040529050919050565b604051610265919061542b565b61037561037036600461543e565b61127c565b604080519586526020860194909452928401919091526060830152608082015260a001610265565b6103556103ab3660046152d5565b611533565b610281611598565b6000546103c59060ff1681565b60405160ff9091168152602001610265565b61028b6103e53660046152d5565b6118af565b6103fd6103f836600461543e565b6119b1565b6040516102659190615460565b61041d6104183660046152d5565b611c33565b60405161026591906154dc565b6102596104383660046152d5565b611def565b61028b611e40565b6102816104533660046152d5565b611ea5565b6102816122d6565b61047361046e366004615324565b612b8e565b6040516001600160a01b039091168152602001610265565b6102816104993660046152d5565b612cbb565b6104736104ac366004615324565b6130e7565b6104736104bf36600461551d565b613186565b6102596104d23660046152d5565b613492565b61028b6134e3565b6102816104ed3660046152d5565b6135be565b61028b6105003660046152d5565b613c4e565b610473610513366004615324565b613c9f565b61028b6142e8565b61047361052e366004615613565b614478565b610473610541366004615693565b61448e565b6102816105543660046152d5565b6145a5565b61028b6145b1565b61047361056f366004615693565b614611565b61028b6105823660046152d5565b614696565b6040517f6d696e69706f6f6c2e72706c2e736c617368656400000000000000000000000060208201526bffffffffffffffffffffffff19606083901b1660348201526000906105ef906048015b60405160208183030381529060405280519060200120614735565b92915050565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e6167657200000000000000000000008152503061065b8260405160200161064091906156ac565b604051602081830303815290604052805190602001206147c0565b6001600160a01b0316816001600160a01b0316146106c05760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064015b60405180910390fd5b33610713816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b61075f5760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b60008060003390506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107cb91906156f1565b90506107d68161484b565b8a67de0b6b3a76400000036108a6576040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606083901b16603c82015260500160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff19606084901b16603a8301529450604e01604051602081830303815290604052805190602001209250610971565b6040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606083901b16603c820152605081018c905260700160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff19606084901b16603a830152604e82018d90529450606e016040516020818303038152906040528051906020012092505b61097c846001614a99565b610986838a614a99565b8967de0b6b3a7640000003610a56576040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606083901b16603c82015260500160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff19606084901b16603a8301529450604e01604051602081830303815290604052805190602001209250610b21565b6040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606083901b16603c820152605081018b905260700160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff19606084901b16603a830152604e82018c90529450606e016040516020818303038152906040528051906020012092505b610b2c846001614b18565b610b368389614b18565b5050505050505050505050565b600080610b846040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b9050806001600160a01b031663c9d6fee9604051602001610bc8907f6d696e69706f6f6c732e766163616e742e696e64657800000000000000000000815260160190565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610bfc91815260200190565b602060405180830381865afa158015610c19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3d919061570e565b91505090565b6040517f6d696e69706f6f6c732e6163746976652e636f756e740000000000000000000060208201526bffffffffffffffffffffffff19606083901b1660368201526000908190604a016040516020818303038152906040528051906020012090506000610ce56040518060400160405280601681526020017f726f636b65744e6574776f726b536e617073686f747300000000000000000000815250614b6d565b9050600080826001600160a01b03166379feb107856040518263ffffffff1660e01b8152600401610d1891815260200190565b606060405180830381865afa158015610d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d59919061573c565b925050915081610ef8576000610da36040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b6040517f6e6f64652e6d696e69706f6f6c732e66696e616c697365642e636f756e74000060208201526bffffffffffffffffffffffff1960608a901b16603e820152909150600090610e0e906052015b60405160208183030381529060405280519060200120614bdc565b6040517f6e6f64652e6d696e69706f6f6c732e696e64657800000000000000000000000060208201526bffffffffffffffffffffffff1960608b901b1660348201529091506000906001600160a01b0384169063c9d6fee990604801604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610e9e91815260200190565b602060405180830381865afa158015610ebb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edf919061570e565b9050610eeb82826157df565b9998505050505050505050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1695945050505050565b600080610f606040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b6040517f6e6f64652e6d696e69706f6f6c732e696e64657800000000000000000000000060208201526bffffffffffffffffffffffff19606086901b1660348201529091506001600160a01b0382169063c9d6fee9906048015b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610fee91815260200190565b602060405180830381865afa15801561100b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102f919061570e565b9392505050565b6000808267de0b6b3a76400000036110aa576040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606086901b16603c82015260500160405160208183030381529060405280519060200120905061110f565b6040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff19606086901b16603c820152605081018490526070016040516020818303038152906040528051906020012090505b61111881614bdc565b949350505050565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e6167657200000000000000000000008152503061116b8260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146111cb5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b3361121e816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b61126a5760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b611275338686614c67565b5050505050565b6000806000806000806112c36040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b905060006040516020016112fa907f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b604051602081830303815290604052805190602001209050600061131c6134e3565b9050600061132a8a8c6157f2565b905081811180611338575089155b156113405750805b8a5b81811015611524576040517ff3358a3a00000000000000000000000000000000000000000000000000000000815260048101859052602481018290526000906001600160a01b0387169063f3358a3a90604401602060405180830381865afa1580156113b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d691906156f1565b90506000816001600160a01b0316634e69d5606040518163ffffffff1660e01b8152600401602060405180830381865afa158015611418573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143c9190615812565b90506000816004811115611452576114526154ad565b03611469578b6114618161582f565b9c5050611511565b600181600481111561147d5761147d6154ad565b03611494578a61148c8161582f565b9b5050611511565b60028160048111156114a8576114a86154ad565b036114bf57896114b78161582f565b9a5050611511565b60038160048111156114d3576114d36154ad565b036114ea57886114e28161582f565b995050611511565b60048160048111156114fe576114fe6154ad565b03611511578761150d8161582f565b9850505b50508061151d9061582f565b9050611342565b50505050509295509295909350565b6040517f6d696e69706f6f6c2e7075626b657900000000000000000000000000000000006020820152606082811b6bffffffffffffffffffffffff1916602f830152906105ef9060430160405160208183030381529060405280519060200120614f6b565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306115e38260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146116435760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b33611696816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b6116e25760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b60006117226040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b9050806001600160a01b031663f79b36ad604051602001611766907f6d696e69706f6f6c732e766163616e742e696e64657800000000000000000000815260160190565b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1682526004820152336024820152604401600060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b50339250600491506117f39050565b816001600160a01b0316634e69d5606040518163ffffffff1660e01b8152600401602060405180830381865afa158015611831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118559190615812565b6004811115611866576118666154ad565b0361127557600061187633611533565b90506118a78160405160200161188c9190615867565b60405160208183030381529060405280519060200120614ffb565b505050505050565b6000806118f06040518060400160405280601181526020017f726f636b65744e6f64654465706f736974000000000000000000000000000000815250614b6d565b90506000816001600160a01b0316639bed5a456040518163ffffffff1660e01b8152600401600060405180830381865afa158015611932573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261195a91908101906158ac565b90506000805b82518110156119a85761198c8684838151811061197f5761197f615952565b6020026020010151611036565b61199690836157f2565b91506119a18161582f565b9050611960565b50949350505050565b606060006119f36040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b90506000604051602001611a2a907f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b6040516020818303038152906040528051906020012090506000611a4c6134e3565b90506000611a5a86886157f2565b905081811180611a68575085155b15611a705750805b6000611a7c88836157df565b67ffffffffffffffff811115611a9457611a9461558b565b604051908082528060200260200182016040528015611abd578160200160208202803683370190505b5090506000885b83811015611c25576040517ff3358a3a00000000000000000000000000000000000000000000000000000000815260048101879052602481018290526000906001600160a01b0389169063f3358a3a90604401602060405180830381865afa158015611b34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5891906156f1565b90506000816001600160a01b0316634e69d5606040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbe9190615812565b90506001816004811115611bd457611bd46154ad565b03611c125781858581518110611bec57611bec615952565b6001600160a01b039092166020928302919091019091015283611c0e8161582f565b9450505b505080611c1e9061582f565b9050611ac4565b508152979650505050505050565b600080829050600060019050816001600160a01b03166354fd4d506040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611c99575060408051601f3d908101601f19168201909252611c9691810190615981565b60015b611cd3573d808015611cc7576040519150601f19603f3d011682016040523d82523d6000602084013e611ccc565b606091505b5050611cd6565b90505b8060ff1660011480611ceb57508060ff166002145b15611d8d57816001600160a01b0316635abd37e46175306040518263ffffffff1660e01b81526004016020604051808303818786fa93505050508015611d4e575060408051601f3d908101601f19168201909252611d4b91810190615812565b60015b611118573d808015611d7c576040519150601f19603f3d011682016040523d82523d6000602084013e611d81565b606091505b50600495945050505050565b816001600160a01b0316635abd37e46040518163ffffffff1660e01b8152600401602060405180830381865afa158015611dcb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111189190615812565b6040517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208201526bffffffffffffffffffffffff19606083901b16602f8201526000906105ef906043016105d4565b60408051808201909152601781527f6d696e69706f6f6c732e7374616b696e672e636f756e740000000000000000006020909101526000611ea07f3441dc4461171402746c7de6880184ae1bfbc9def01a5bd7508263456c144419614bdc565b905090565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030611ef08260405160200161064091906156ac565b6001600160a01b0316816001600160a01b031614611f505760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b33611fa3816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b611fef5760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b33611ff98561484b565b6000816001600160a01b03166374ca6bf26040518163ffffffff1660e01b8152600401602060405180830381865afa158015612039573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205d919061570e565b90506000808267de0b6b3a764000000361211c575050604080517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e7400000000602080830191909152606089901b6bffffffffffffffffffffffff1916603c8301819052835160308185030181526050840185528051908301207f6e6f64652e617665726167652e6665652e6e756d657261746f720000000000006070850152608a8401919091528351607e818503018152609e90930190935281519101206121e7565b6040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff1960608a901b16603c8201526050810184905260700160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff1960608b901b16603a830152604e82018590529250606e016040516020818303038152906040528051906020012090505b60006121f283614bdc565b9050612208836122036001846157df565b615073565b6040517f6d696e69706f6f6c732e7374616b696e672e636f756e740000000000000000006020820152600090603701604051602081830303815290604052805190602001209050600061225a82614bdc565b905061226b826122036001846157df565b610b3684886001600160a01b031663e71501346040518163ffffffff1660e01b8152600401602060405180830381865afa1580156122ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d1919061570e565b614a99565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306123218260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146123815760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b336123d4816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b6124205760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b60006124606040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b905060003390506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124cb91906156f1565b9050600061250d6040518060400160405280601181526020017f726f636b65744e6f64655374616b696e67000000000000000000000000000000815250614b6d565b6040517fa493e6a20000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015291925060009183169063a493e6a290602401602060405180830381865afa158015612572573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612596919061570e565b9050836001600160a01b031663e7e04aba6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125fa919061570e565b61260490826157df565b905060006126466040518060400160405280601681526020017f726f636b65744e6574776f726b536e617073686f747300000000000000000000815250614b6d565b6040517f6574682e6d6174636865642e6e6f64652e616d6f756e7400000000000000000060208201526bffffffffffffffffffffffff19606087901b166037820152909150600090604b0160408051808303601f190181529082905280516020909101207f5ba59649000000000000000000000000000000000000000000000000000000008252600482018190527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8516602483015291506001600160a01b03831690635ba5964990604401600060405180830381600087803b15801561272857600080fd5b505af115801561273c573d6000803e3d6000fd5b50506040517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208201526bffffffffffffffffffffffff193360601b16602f8201526127a6925060430190506040516020818303038152906040528051906020012060006150c8565b6040517f6d696e69706f6f6c2e64657374726f796564000000000000000000000000000060208201526bffffffffffffffffffffffff193360601b16603282015261280c906046015b6040516020818303038152906040528051906020012060016150c8565b600061281786610c43565b9050876001600160a01b031663f79b36ad60405160200161285b907f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1682526004820152336024820152604401600060405180830381600087803b1580156128c557600080fd5b505af11580156128d9573d6000803e3d6000fd5b50506040517f6e6f64652e6d696e69706f6f6c732e696e64657800000000000000000000000060208201526bffffffffffffffffffffffff1960608a901b1660348201526001600160a01b038b16925063f79b36ad915060480160408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1682526004820152336024820152604401600060405180830381600087803b15801561299d57600080fd5b505af11580156129b1573d6000803e3d6000fd5b5050505060006129c033611533565b6040517f6d696e69706f6f6c2e7075626b6579000000000000000000000000000000000060208201526bffffffffffffffffffffffff193360601b16602f820152909150612a26906043016040516020818303038152906040528051906020012061511e565b612a3a8160405160200161188c9190615867565b6040517f6d696e69706f6f6c732e6163746976652e636f756e740000000000000000000060208201526bffffffffffffffffffffffff19606089901b166036820152604a01604051602081830303815290604052805190602001209250836001600160a01b0316635ba5964984600185612ab491906157df565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815260048101929092527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166024820152604401600060405180830381600087803b158015612b2857600080fd5b505af1158015612b3c573d6000803e3d6000fd5b50506040514281526001600160a01b038a1692503391507f3097cb0f536cd88115b814915d7030d2fe958943357cd2b1a9e1dba8a673ec699060200160405180910390a3505050505050505050505050565b600080612bcf6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b6040517f6e6f64652e6d696e69706f6f6c732e696e64657800000000000000000000000060208201526bffffffffffffffffffffffff19606087901b1660348201529091506001600160a01b0382169063f3358a3a906048015b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b168252600482015260248101869052604401602060405180830381865afa158015612c97573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111891906156f1565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030612d068260405160200161064091906156ac565b6001600160a01b0316816001600160a01b031614612d665760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b33612db9816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b612e055760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b33612e0f8561484b565b6000816001600160a01b03166374ca6bf26040518163ffffffff1660e01b8152600401602060405180830381865afa158015612e4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e73919061570e565b90506000808267de0b6b3a7640000003612f32575050604080517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e7400000000602080830191909152606089901b6bffffffffffffffffffffffff1916603c8301819052835160308185030181526050840185528051908301207f6e6f64652e617665726167652e6665652e6e756d657261746f720000000000006070850152608a8401919091528351607e818503018152609e9093019093528151910120612ffd565b6040517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e740000000060208201526bffffffffffffffffffffffff1960608a901b16603c8201526050810184905260700160408051601f198184030181529082905280516020918201207f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000918301919091526bffffffffffffffffffffffff1960608b901b16603a830152604e82018590529250606e016040516020818303038152906040528051906020012090505b600061300883614bdc565b9050613019836122038360016157f2565b6040517f6d696e69706f6f6c732e7374616b696e672e636f756e740000000000000000006020820152600090603701604051602081830303815290604052805190602001209050600061306b82614bdc565b905061307c826122038360016157f2565b610b3684886001600160a01b031663e71501346040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130e2919061570e565b614b18565b6000806131286040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b6040517f6e6f64652e6d696e69706f6f6c732e76616c69646174696e672e696e6465780060208201526bffffffffffffffffffffffff19606087901b16603f8201529091506001600160a01b0382169063f3358a3a90605301612c29565b60006040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306131d38260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146132335760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b6040518060400160405280601181526020017f726f636b65744e6f64654465706f7369740000000000000000000000000000008152503361327e8260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146132de5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b600061331e6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b9050600061332c8d8d613c9f565b6040517f0871ffef000000000000000000000000000000000000000000000000000000008152600481018b9052602481018a90529091506001600160a01b03821690630871ffef90604401600060405180830381600087803b15801561339157600080fd5b505af11580156133a5573d6000803e3d6000fd5b505050506133b4818c8c614c67565b816001600160a01b031663889271666040516020016133f6907f6d696e69706f6f6c732e766163616e742e696e64657800000000000000000000815260160190565b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16825260048201526001600160a01b0384166024820152604401600060405180830381600087803b15801561346957600080fd5b505af115801561347d573d6000803e3d6000fd5b50929f9e505050505050505050505050505050565b6040517f6d696e69706f6f6c2e64657374726f796564000000000000000000000000000060208201526bffffffffffffffffffffffff19606083901b1660328201526000906105ef906046016105d4565b6000806135246040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b604080518082018252600f81527f6d696e69706f6f6c732e696e6465780000000000000000000000000000000000602090910152517fc9d6fee90000000000000000000000000000000000000000000000000000000081527ffd351ca1580febcf3f7f5a9bf9fd8dff9e6da5ca4df400be6b63fcdc2f2a918460048201529091506001600160a01b0382169063c9d6fee990602401610bfc565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306136098260405160200161064091906156ac565b6001600160a01b0316816001600160a01b0316146136695760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b336136bc816040516020016105d491907f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b6137085760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c0000000000000000000000000000000060448201526064016106b7565b600061371385610c43565b6040517f6e6f64652e6d696e69706f6f6c732e66696e616c69736564000000000000000060208201526bffffffffffffffffffffffff193360601b166038820152909150600090604c0160405160208183030381529060405280519060200120905061377e81614735565b156137f15760405162461bcd60e51b815260206004820152602360248201527f4d696e69706f6f6c2068617320616c7265616479206265656e2066696e616c6960448201527f736564000000000000000000000000000000000000000000000000000000000060648201526084016106b7565b6137fc8160016150c8565b6040517f6e6f64652e6d696e69706f6f6c732e66696e616c697365642e636f756e74000060208201526bffffffffffffffffffffffff19606088901b16603e82015261386290605201604051602081830303815290604052805190602001206001614b18565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e74000000000000006020909101526138c27f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d26001614b18565b60006139026040518060400160405280601181526020017f726f636b65744e6f64655374616b696e67000000000000000000000000000000815250614b6d565b905060006139446040518060400160405280601681526020017f726f636b65744e6574776f726b536e617073686f747300000000000000000000815250614b6d565b6040517fa493e6a20000000000000000000000000000000000000000000000000000000081526001600160a01b038a8116600483015291925060009184169063a493e6a290602401602060405180830381865afa1580156139a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139cd919061570e565b9050336001600160a01b031663e7e04aba6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613a0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a31919061570e565b613a3b90826157df565b6040517f6574682e6d6174636865642e6e6f64652e616d6f756e7400000000000000000060208201526bffffffffffffffffffffffff1960608c901b166037820152909150600090604b0160408051808303601f190181529082905280516020909101207f5ba59649000000000000000000000000000000000000000000000000000000008252600482018190527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8416602483015291506001600160a01b03841690635ba5964990604401600060405180830381600087803b158015613b1d57600080fd5b505af1158015613b31573d6000803e3d6000fd5b50506040517f6d696e69706f6f6c732e6163746976652e636f756e740000000000000000000060208201526bffffffffffffffffffffffff1960608e901b166036820152604a019150613b819050565b604051602081830303815290604052805190602001209050826001600160a01b0316635ba5964982600189613bb691906157df565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815260048101929092527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166024820152604401600060405180830381600087803b158015613c2a57600080fd5b505af1158015613c3e573d6000803e3d6000fd5b5050505050505050505050505050565b6040517f6e6f64652e6d696e69706f6f6c732e66696e616c697365642e636f756e74000060208201526bffffffffffffffffffffffff19606083901b16603e8201526000906105ef90605201610df3565b60006040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030613cec8260405160200161064091906156ac565b6001600160a01b0316816001600160a01b031614613d4c5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b6040518060400160405280601181526020017f726f636b65744e6f64654465706f73697400000000000000000000000000000081525033613d978260405160200161064091906156ac565b6001600160a01b0316816001600160a01b031614613df75760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e74726163740000000060448201526064016106b7565b6000613e376040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b90506000613e5c604051806060016040528060218152602001615a8960219139614b6d565b90506000613e686142e8565b9050816001600160a01b0316636d4f8d3d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613ea8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ecc919061570e565b613ed78260016157f2565b1115613f255760405162461bcd60e51b815260206004820152601d60248201527f476c6f62616c206d696e69706f6f6c206c696d6974207265616368656400000060448201526064016106b7565b50506000613f3289610c43565b90506000613f408a8a61516c565b6040517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208201526bffffffffffffffffffffffff19606083901b16602f820152909150613f91906043016127ef565b826001600160a01b03166388927166604051602001613fd3907f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16825260048201526001600160a01b0384166024820152604401600060405180830381600087803b15801561404657600080fd5b505af115801561405a573d6000803e3d6000fd5b50506040517f6e6f64652e6d696e69706f6f6c732e696e64657800000000000000000000000060208201526bffffffffffffffffffffffff1960608e901b1660348201526001600160a01b03861692506388927166915060480160408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16825260048201526001600160a01b0384166024820152604401600060405180830381600087803b15801561412757600080fd5b505af115801561413b573d6000803e3d6000fd5b50505050600061417f6040518060400160405280601681526020017f726f636b65744e6574776f726b536e617073686f747300000000000000000000815250614b6d565b6040517f6d696e69706f6f6c732e6163746976652e636f756e740000000000000000000060208201526bffffffffffffffffffffffff1960608e901b166036820152909150600090604a01604051602081830303815290604052805190602001209050816001600160a01b0316635ba59649828660016141ff91906157f2565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815260048101929092527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166024820152604401600060405180830381600087803b15801561427357600080fd5b505af1158015614287573d6000803e3d6000fd5b505050508b6001600160a01b0316836001600160a01b03167f08b4b91bafaf992145c5dd7e098dfcdb32f879714c154c651c2758a44c7aeae4426040516142d091815260200190565b60405180910390a350909a9950505050505050505050565b6000806143296040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b604080518082018252600f81527f6d696e69706f6f6c732e696e6465780000000000000000000000000000000000602090910152517fc9d6fee90000000000000000000000000000000000000000000000000000000081527ffd351ca1580febcf3f7f5a9bf9fd8dff9e6da5ca4df400be6b63fcdc2f2a918460048201529091506000906001600160a01b0383169063c9d6fee990602401602060405180830381865afa1580156143de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614402919061570e565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e7400000000000000602090910152905060006144647f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d2614bdc565b905061447081836157df565b935050505090565b60006105ef826040516020016106409190615867565b6000806144cf6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b9050806001600160a01b031663f3358a3a604051602001614513907f6d696e69706f6f6c732e766163616e742e696e64657800000000000000000000815260160190565b60408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b168252600482015260248101869052604401602060405180830381865afa158015614581573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102f91906156f1565b6145ae8161484b565b50565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e74000000000000006020909101526000611ea07f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d2614bdc565b6000806146526040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b9050806001600160a01b031663f3358a3a604051602001614513907f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b6000806146d76040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b6040517f6e6f64652e6d696e69706f6f6c732e76616c69646174696e672e696e6465780060208201526bffffffffffffffffffffffff19606086901b16603f8201529091506001600160a01b0382169063c9d6fee990605301610fba565b600080546040517f7ae1cfca000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b031690637ae1cfca90602401602060405180830381865afa15801561479c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ef91906159a4565b600080546040517f21f8a721000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b0316906321f8a72190602401602060405180830381865afa158015614827573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ef91906156f1565b600061488b6040518060400160405280601c81526020017f726f636b65744e6f64654469737472696275746f72466163746f727900000000815250614b6d565b6040517ffa2a5b010000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015291925060009183169063fa2a5b0190602401602060405180830381865afa1580156148f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061491491906156f1565b90506001600160a01b0381163115614a945760006149666040518060400160405280601181526020017f726f636b65744e6f64654d616e61676572000000000000000000000000000000815250614b6d565b6040517f927ece4f0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301529192509082169063927ece4f90602401602060405180830381865afa1580156149c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906149ed91906159a4565b614a395760405162461bcd60e51b815260206004820152601b60248201527f4469737472696275746f72206e6f7420696e697469616c69736564000000000060448201526064016106b7565b6000829050806001600160a01b031663e4fc6b6d6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015614a7957600080fd5b505af1158015614a8d573d6000803e3d6000fd5b5050505050505b505050565b6000546040517febb9d8c900000000000000000000000000000000000000000000000000000000815260048101849052602481018390526101009091046001600160a01b03169063ebb9d8c9906044015b600060405180830381600087803b158015614b0457600080fd5b505af11580156118a7573d6000803e3d6000fd5b6000546040517fadb353dc00000000000000000000000000000000000000000000000000000000815260048101849052602481018390526101009091046001600160a01b03169063adb353dc90604401614aea565b600080614b848360405160200161064091906156ac565b90506001600160a01b0381166105ef5760405162461bcd60e51b815260206004820152601260248201527f436f6e7472616374206e6f7420666f756e64000000000000000000000000000060448201526064016106b7565b600080546040517fbd02d0f5000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b03169063bd02d0f590602401602060405180830381865afa158015614c43573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ef919061570e565b60006001600160a01b0316614cb183838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061447892505050565b6001600160a01b031614614d075760405162461bcd60e51b815260206004820152601a60248201527f56616c696461746f72207075626b657920697320696e2075736500000000000060448201526064016106b7565b6000614d476040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250614b6d565b905060008490506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614db291906156f1565b6040517f6d696e69706f6f6c2e7075626b6579000000000000000000000000000000000060208201526bffffffffffffffffffffffff19606089901b16602f820152909150614e50906043016040516020818303038152906040528051906020012086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061521992505050565b614e828585604051602001614e669291906159bf565b6040516020818303038152906040528051906020012087615268565b6040517f6e6f64652e6d696e69706f6f6c732e76616c69646174696e672e696e6465780060208201526bffffffffffffffffffffffff19606083901b16603f8201526001600160a01b0384169063889271669060530160408051601f198184030181529082905280516020909101207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16825260048201526001600160a01b0389166024820152604401600060405180830381600087803b158015614f4b57600080fd5b505af1158015614f5f573d6000803e3d6000fd5b50505050505050505050565b6000546040517fc031a1800000000000000000000000000000000000000000000000000000000081526004810183905260609161010090046001600160a01b03169063c031a18090602401600060405180830381865afa158015614fd3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105ef91908101906159f8565b6000546040517f0e14a376000000000000000000000000000000000000000000000000000000008152600481018390526101009091046001600160a01b031690630e14a376906024015b600060405180830381600087803b15801561505f57600080fd5b505af1158015611275573d6000803e3d6000fd5b6000546040517fe2a4853a00000000000000000000000000000000000000000000000000000000815260048101849052602481018390526101009091046001600160a01b03169063e2a4853a90604401614aea565b6000546040517fabfdcced0000000000000000000000000000000000000000000000000000000081526004810184905282151560248201526101009091046001600160a01b03169063abfdcced90604401614aea565b6000546040517f616b59f6000000000000000000000000000000000000000000000000000000008152600481018390526101009091046001600160a01b03169063616b59f690602401615045565b6000806151ad6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c466163746f72790000000000000000000000815250614b6d565b6040517fa2d41d600000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152602482018690529192509082169063a2d41d60906044016020604051808303816000875af1158015612c97573d6000803e3d6000fd5b6000546040517f2e28d0840000000000000000000000000000000000000000000000000000000081526101009091046001600160a01b031690632e28d08490614aea9085908590600401615a6f565b6000546040517fca446dd9000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0383811660248301526101009092049091169063ca446dd990604401614aea565b6001600160a01b03811681146145ae57600080fd5b6000602082840312156152e757600080fd5b813561102f816152c0565b6000806000806080858703121561530857600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561533757600080fd5b8235615342816152c0565b946020939093013593505050565b60008083601f84011261536257600080fd5b50813567ffffffffffffffff81111561537a57600080fd5b60208301915083602082850101111561539257600080fd5b9250929050565b600080602083850312156153ac57600080fd5b823567ffffffffffffffff8111156153c357600080fd5b6153cf85828601615350565b90969095509350505050565b60005b838110156153f65781810151838201526020016153de565b50506000910152565b600081518084526154178160208601602086016153db565b601f01601f19169290920160200192915050565b60208152600061102f60208301846153ff565b6000806040838503121561545157600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b818110156154a15783516001600160a01b03168352928401929184019160010161547c565b50909695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6020810160058310615517577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b60008060008060008060a0878903121561553657600080fd5b8635615541816152c0565b955060208701359450604087013567ffffffffffffffff81111561556457600080fd5b61557089828a01615350565b979a9699509760608101359660809091013595509350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156155e3576155e361558b565b604052919050565b600067ffffffffffffffff8211156156055761560561558b565b50601f01601f191660200190565b60006020828403121561562557600080fd5b813567ffffffffffffffff81111561563c57600080fd5b8201601f8101841361564d57600080fd5b803561566061565b826155eb565b6155ba565b81815285602083850101111561567557600080fd5b81602084016020830137600091810160200191909152949350505050565b6000602082840312156156a557600080fd5b5035919050565b7f636f6e74726163742e61646472657373000000000000000000000000000000008152600082516156e48160108501602087016153db565b9190910160100192915050565b60006020828403121561570357600080fd5b815161102f816152c0565b60006020828403121561572057600080fd5b5051919050565b8051801515811461573757600080fd5b919050565b60008060006060848603121561575157600080fd5b61575a84615727565b9250602084015163ffffffff8116811461577357600080fd5b60408501519092507bffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146157a557600080fd5b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156105ef576105ef6157b0565b808201808211156105ef576105ef6157b0565b600581106145ae57600080fd5b60006020828403121561582457600080fd5b815161102f81615805565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203615860576158606157b0565b5060010190565b7f76616c696461746f722e6d696e69706f6f6c000000000000000000000000000081526000825161589f8160128501602087016153db565b9190910160120192915050565b600060208083850312156158bf57600080fd5b825167ffffffffffffffff808211156158d757600080fd5b818501915085601f8301126158eb57600080fd5b8151818111156158fd576158fd61558b565b8060051b915061590e8483016155ba565b818152918301840191848101908884111561592857600080fd5b938501935b838510156159465784518252938501939085019061592d565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561599357600080fd5b815160ff8116811461102f57600080fd5b6000602082840312156159b657600080fd5b61102f82615727565b7f76616c696461746f722e6d696e69706f6f6c000000000000000000000000000081528183601283013760009101601201908152919050565b600060208284031215615a0a57600080fd5b815167ffffffffffffffff811115615a2157600080fd5b8201601f81018413615a3257600080fd5b8051615a4061565b826155eb565b818152856020838501011115615a5557600080fd5b615a668260208301602086016153db565b95945050505050565b82815260406020820152600061111860408301846153ff56fe726f636b657444414f50726f746f636f6c53657474696e67734d696e69706f6f6ca26469706673582212208c3ed08c17ac9e8a07af90d0deb3ea3f7330fd5534c6e96f4b1fdcccb62a48de64736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000594Fb75D3dc2DFa0150Ad03F99F97817747dd4E1
-----Decoded View---------------
Arg [0] : _rocketStorageAddress (address): 0x594Fb75D3dc2DFa0150Ad03F99F97817747dd4E1
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000594Fb75D3dc2DFa0150Ad03F99F97817747dd4E1
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.