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.7.6+commit.7338295f
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.7.6; pragma abicoder v2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../RocketBase.sol"; import "./RocketMinipoolBase.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 "./RocketMinipoolDelegate.sol"; /// @notice Minipool creation, removal and management contract RocketMinipoolManager is RocketBase, RocketMinipoolManagerInterface { // Libs using SafeMath for uint; // 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 = 3; } /// @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.sub(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.add(_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.add(_limit); if (max > totalMinipools || _limit == 0) { max = totalMinipools; } // Create array big enough for every minipool address[] memory minipools = new address[](max.sub(_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) { 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.sub(finalised); } /// @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.add(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(byte(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.add(1)); // Update the total count bytes32 totalKey = keccak256(abi.encodePacked("minipools.staking.count")); uint256 totalValue = getUint(totalKey); setUint(totalKey, totalValue.add(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.sub(1)); // Update the total count bytes32 totalKey = keccak256(abi.encodePacked("minipools.staking.count")); uint256 totalValue = getUint(totalKey); setUint(totalKey, totalValue.sub(1)); // Update node fee average subUint(numeratorKey, minipool.getNodeFee()); } /// @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) { // 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 uint256 ethMatched = getUint(keccak256(abi.encodePacked("eth.matched.node.amount", _nodeAddress))); if (ethMatched == 0) { ethMatched = getNodeActiveMinipoolCount(_nodeAddress).mul(16 ether); } else { RocketMinipoolInterface minipool = RocketMinipoolInterface(msg.sender); ethMatched = ethMatched.sub(minipool.getUserDepositBalance()); } setUint(keccak256(abi.encodePacked("eth.matched.node.amount", _nodeAddress)), ethMatched); } /// @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 totalMinipoolCount = getActiveMinipoolCount(); require(totalMinipoolCount.add(1) <= rocketDAOProtocolSettingsMinipool.getMaximumCount(), "Global minipool limit reached"); } // 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); // 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); // Remove mapping of pubkey to minipool to allow NO to try again in future 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 uint256 ethMatched = getUint(keccak256(abi.encodePacked("eth.matched.node.amount", nodeAddress))); if (ethMatched == 0) { ethMatched = getNodeActiveMinipoolCount(nodeAddress).mul(16 ether); } // Handle legacy minipools if (minipool.getDepositType() == MinipoolDeposit.Variable) { ethMatched = ethMatched.sub(minipool.getUserDepositBalance()); } else { ethMatched = ethMatched.sub(16 ether); } setUint(keccak256(abi.encodePacked("eth.matched.node.amount", nodeAddress)), 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); // 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))); // 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); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | 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.7.6; // 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(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.7.6; // 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.7.6; // 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.7.6; // SPDX-License-Identifier: GPL-3.0-only import "../../interface/RocketStorageInterface.sol"; import "../../types/MinipoolDeposit.sol"; import "../../types/MinipoolStatus.sol"; // The RocketMinipool contract storage layout, shared by RocketMinipoolDelegate // ****************************************************** // Note: This contract MUST NOT BE UPDATED after launch. // All deployed minipool contracts must maintain a // Consistent storage layout with RocketMinipoolDelegate. // ****************************************************** abstract contract RocketMinipoolStorageLayout { // Storage state enum enum StorageState { Undefined, Uninitialised, Initialised } // Main Rocket Pool storage contract RocketStorageInterface internal rocketStorage = RocketStorageInterface(0); // Status MinipoolStatus internal status; uint256 internal statusBlock; uint256 internal statusTime; uint256 internal withdrawalBlock; // Deposit type MinipoolDeposit internal depositType; // Node details address internal nodeAddress; uint256 internal nodeFee; uint256 internal nodeDepositBalance; bool internal nodeDepositAssigned; // NO LONGER IN USE uint256 internal nodeRefundBalance; uint256 internal nodeSlashBalance; // User deposit details uint256 internal userDepositBalanceLegacy; uint256 internal userDepositAssignedTime; // Upgrade options bool internal useLatestDelegate = false; address internal rocketMinipoolDelegate; address internal rocketMinipoolDelegatePrev; // Local copy of RETH address address internal rocketTokenRETH; // Local copy of penalty contract address internal rocketMinipoolPenalty; // Used to prevent direct access to delegate and prevent calling initialise more than once StorageState internal storageState = StorageState.Undefined; // Whether node operator has finalised the pool bool internal finalised; // Trusted member scrub votes mapping(address => bool) internal memberScrubVotes; uint256 internal totalScrubVotes; // Variable minipool uint256 internal preLaunchValue; uint256 internal userDepositBalance; // Vacant minipool bool internal vacant; uint256 internal preMigrationBalance; // User distribution bool internal userDistributed; uint256 internal userDistributeTime; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | 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 RocketMinipoolBaseInterface { function initialise(address _rocketStorage, address _nodeAddress) external; function delegateUpgrade() external; function delegateRollback() external; function setUseLatestDelegate(bool _setting) external; function getUseLatestDelegate() external view returns (bool); function getDelegate() external view returns (address); function getPreviousDelegate() external view returns (address); function getEffectiveDelegate() external view 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 * */ // SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.7.6; import "./RocketMinipoolStorageLayout.sol"; import "../../interface/RocketStorageInterface.sol"; import "../../interface/minipool/RocketMinipoolBaseInterface.sol"; /// @notice Contains the initialisation and delegate upgrade logic for minipools contract RocketMinipoolBase is RocketMinipoolBaseInterface, RocketMinipoolStorageLayout { // Events event EtherReceived(address indexed from, uint256 amount, uint256 time); event DelegateUpgraded(address oldDelegate, address newDelegate, uint256 time); event DelegateRolledBack(address oldDelegate, address newDelegate, uint256 time); // Store a reference to the address of RocketMinipoolBase itself to prevent direct calls to this contract address immutable self; constructor () { self = address(this); } /// @dev Prevent direct calls to this contract modifier notSelf() { require(address(this) != self); _; } /// @dev Only allow access from the owning node address modifier onlyMinipoolOwner() { // Only the node operator can upgrade address withdrawalAddress = rocketStorage.getNodeWithdrawalAddress(nodeAddress); require(msg.sender == nodeAddress || msg.sender == withdrawalAddress, "Only the node operator can access this method"); _; } /// @notice Sets up starting delegate contract and then delegates initialisation to it function initialise(address _rocketStorage, address _nodeAddress) external override notSelf { // Check input require(_nodeAddress != address(0), "Invalid node address"); require(storageState == StorageState.Undefined, "Already initialised"); // Set storage state to uninitialised storageState = StorageState.Uninitialised; // Set rocketStorage rocketStorage = RocketStorageInterface(_rocketStorage); // Set the current delegate address delegateAddress = getContractAddress("rocketMinipoolDelegate"); rocketMinipoolDelegate = delegateAddress; // Check for contract existence require(contractExists(delegateAddress), "Delegate contract does not exist"); // Call initialise on delegate (bool success, bytes memory data) = delegateAddress.delegatecall(abi.encodeWithSignature('initialise(address)', _nodeAddress)); if (!success) { revert(getRevertMessage(data)); } } /// @notice Receive an ETH deposit receive() external payable notSelf { // Emit ether received event emit EtherReceived(msg.sender, msg.value, block.timestamp); } /// @notice Upgrade this minipool to the latest network delegate contract function delegateUpgrade() external override onlyMinipoolOwner notSelf { // Set previous address rocketMinipoolDelegatePrev = rocketMinipoolDelegate; // Set new delegate rocketMinipoolDelegate = getContractAddress("rocketMinipoolDelegate"); // Verify require(rocketMinipoolDelegate != rocketMinipoolDelegatePrev, "New delegate is the same as the existing one"); // Log event emit DelegateUpgraded(rocketMinipoolDelegatePrev, rocketMinipoolDelegate, block.timestamp); } /// @notice Rollback to previous delegate contract function delegateRollback() external override onlyMinipoolOwner notSelf { // Make sure they have upgraded before require(rocketMinipoolDelegatePrev != address(0x0), "Previous delegate contract is not set"); // Store original address originalDelegate = rocketMinipoolDelegate; // Update delegate to previous and zero out previous rocketMinipoolDelegate = rocketMinipoolDelegatePrev; rocketMinipoolDelegatePrev = address(0x0); // Log event emit DelegateRolledBack(originalDelegate, rocketMinipoolDelegate, block.timestamp); } /// @notice Sets the flag to automatically use the latest delegate contract or not /// @param _setting If true, will always use the latest delegate contract function setUseLatestDelegate(bool _setting) external override onlyMinipoolOwner notSelf { useLatestDelegate = _setting; } /// @notice Returns true if this minipool always uses the latest delegate contract function getUseLatestDelegate() external override view returns (bool) { return useLatestDelegate; } /// @notice Returns the address of the minipool's stored delegate function getDelegate() external override view returns (address) { return rocketMinipoolDelegate; } /// @notice Returns the address of the minipool's previous delegate (or address(0) if not set) function getPreviousDelegate() external override view returns (address) { return rocketMinipoolDelegatePrev; } /// @notice Returns the delegate which will be used when calling this minipool taking into account useLatestDelegate setting function getEffectiveDelegate() external override view returns (address) { return useLatestDelegate ? getContractAddress("rocketMinipoolDelegate") : rocketMinipoolDelegate; } /// @notice Delegates all calls to minipool delegate contract (or latest if flag is set) fallback(bytes calldata _input) external payable notSelf returns (bytes memory) { // If useLatestDelegate is set, use the latest delegate contract address delegateContract = useLatestDelegate ? getContractAddress("rocketMinipoolDelegate") : rocketMinipoolDelegate; // Check for contract existence require(contractExists(delegateContract), "Delegate contract does not exist"); // Execute delegatecall (bool success, bytes memory data) = delegateContract.delegatecall(_input); if (!success) { revert(getRevertMessage(data)); } return data; } /// @dev Get the address of a Rocket Pool network contract function getContractAddress(string memory _contractName) private view returns (address) { address contractAddress = rocketStorage.getAddress(keccak256(abi.encodePacked("contract.address", _contractName))); require(contractAddress != address(0x0), "Contract not found"); return contractAddress; } /// @dev Get a revert message from delegatecall return data function getRevertMessage(bytes memory _returnData) private pure returns (string memory) { if (_returnData.length < 68) { return "Transaction reverted silently"; } assembly { _returnData := add(_returnData, 0x04) } return abi.decode(_returnData, (string)); } /// @dev Returns true if contract exists at _contractAddress (if called during that contract's construction it will return a false negative) function contractExists(address _contractAddress) private view returns (bool) { uint32 codeSize; assembly { codeSize := extcodesize(_contractAddress) } return codeSize > 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 * */ pragma solidity 0.7.6; // 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 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 * */ pragma solidity >0.5.0 <0.9.0; // SPDX-License-Identifier: GPL-3.0-only 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 stakeRPL(uint256 _amount) external; function stakeRPLFor(address _nodeAddress, uint256 _amount) external; function setStakeRPLForAllowed(address _caller, bool _allowed) external; function withdrawRPL(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.7.6; // 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 * */ pragma solidity >0.5.0 <0.9.0; pragma abicoder v2; // SPDX-License-Identifier: GPL-3.0-only 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 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 getLatestReportableBlock() external view returns (uint256); function submitPrices(uint256 _block, uint256 _rplPrice) external; function executeUpdatePrices(uint256 _block, 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); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | 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.7.6; // 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.7.6; // 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.7.6; // 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 _nodeOperator) external view returns (uint256); function increaseDepositCreditBalance(address _nodeOperator, 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; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | 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 DepositInterface { function deposit(bytes calldata _pubkey, bytes calldata _withdrawalCredentials, bytes calldata _signature, bytes32 _depositDataRoot) external payable; }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | 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 RocketDepositPoolInterface { function getBalance() external view returns (uint256); function getNodeBalance() external view returns (uint256); function getUserBalance() external view returns (int256); function getExcessBalance() external view returns (uint256); function deposit() external payable; function getMaximumDepositAmount() external view returns (uint256); function nodeDeposit(uint256 _totalAmount) external payable; function nodeCreditWithdrawal(uint256 _amount) external; function recycleDissolvedDeposit() external payable; function recycleExcessCollateral() external payable; function recycleLiquidatedStake() external payable; function assignDeposits() external; function maybeAssignDeposits() external returns (bool); function withdrawExcessBalance(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 "../../types/MinipoolDeposit.sol"; interface RocketMinipoolQueueInterface { function getTotalLength() external view returns (uint256); function getContainsLegacy() external view returns (bool); function getLengthLegacy(MinipoolDeposit _depositType) external view returns (uint256); function getLength() external view returns (uint256); function getTotalCapacity() external view returns (uint256); function getEffectiveCapacity() external view returns (uint256); function getNextCapacityLegacy() external view returns (uint256); function getNextDepositLegacy() external view returns (MinipoolDeposit, uint256); function enqueueMinipool(address _minipool) external; function dequeueMinipoolByDepositLegacy(MinipoolDeposit _depositType) external returns (address minipoolAddress); function dequeueMinipools(uint256 _maxToDequeue) external returns (address[] memory minipoolAddress); function removeMinipool(MinipoolDeposit _depositType) external; function getMinipoolAt(uint256 _index) external view returns(address); function getMinipoolPosition(address _minipool) external view returns (int256); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | 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 RocketDAONodeTrustedSettingsMinipoolInterface { function getScrubPeriod() external view returns(uint256); function getPromotionScrubPeriod() external view returns(uint256); function getScrubQuorum() external view returns(uint256); function getCancelBondReductionQuorum() external view returns(uint256); function getScrubPenaltyEnabled() external view returns(bool); function isWithinBondReductionWindow(uint256 _time) external view returns (bool); function getBondReductionWindowStart() external view returns (uint256); function getBondReductionWindowLength() 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 RocketNetworkFeesInterface { function getNodeDemand() external view returns (int256); function getNodeFee() external view returns (uint256); function getNodeFeeByDemand(int256 _nodeDemand) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool); /** * @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); }
/** * . * / \ * |.'.| * |'.'| * ,'| |`. * |,-'-|-'-.| * __|_| | _ _ _____ _ * | ___ \| | | | | | ___ \ | | * | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | * | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| | * | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | * \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| * +---------------------------------------------------+ * | 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 "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface RocketTokenRETHInterface is IERC20 { function getEthValue(uint256 _rethAmount) external view returns (uint256); function getRethValue(uint256 _ethAmount) external view returns (uint256); function getExchangeRate() external view returns (uint256); function getTotalCollateral() external view returns (uint256); function getCollateralRate() external view returns (uint256); function depositExcess() external payable; function depositExcessCollateral() external; function mint(uint256 _ethAmount, address _to) external; function burn(uint256 _rethAmount) 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.5.0 <0.9.0; pragma abicoder v2; interface RocketMinipoolBondReducerInterface { function beginReduceBondAmount(address _minipoolAddress, uint256 _newBondAmount) external; function getReduceBondTime(address _minipoolAddress) external view returns (uint256); function getReduceBondValue(address _minipoolAddress) external view returns (uint256); function getReduceBondCancelled(address _minipoolAddress) external view returns (bool); function canReduceBondAmount(address _minipoolAddress) external view returns (bool); function voteCancelReduction(address _minipoolAddress) external; function reduceBondAmount() external returns (uint256); function getLastBondReductionTime(address _minipoolAddress) external view returns (uint256); function getLastBondReductionPrevValue(address _minipoolAddress) external view returns (uint256); function getLastBondReductionPrevNodeFee(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 * */ // SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.7.6; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./RocketMinipoolStorageLayout.sol"; import "../../interface/casper/DepositInterface.sol"; import "../../interface/deposit/RocketDepositPoolInterface.sol"; import "../../interface/minipool/RocketMinipoolInterface.sol"; import "../../interface/minipool/RocketMinipoolManagerInterface.sol"; import "../../interface/minipool/RocketMinipoolQueueInterface.sol"; import "../../interface/minipool/RocketMinipoolPenaltyInterface.sol"; import "../../interface/node/RocketNodeStakingInterface.sol"; import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol"; import "../../interface/dao/node/settings/RocketDAONodeTrustedSettingsMinipoolInterface.sol"; import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol"; import "../../interface/dao/node/RocketDAONodeTrustedInterface.sol"; import "../../interface/network/RocketNetworkFeesInterface.sol"; import "../../interface/token/RocketTokenRETHInterface.sol"; import "../../types/MinipoolDeposit.sol"; import "../../types/MinipoolStatus.sol"; import "../../interface/node/RocketNodeDepositInterface.sol"; import "../../interface/minipool/RocketMinipoolBondReducerInterface.sol"; /// @notice Provides the logic for each individual minipool in the Rocket Pool network /// @dev Minipools exclusively DELEGATECALL into this contract it is never called directly contract RocketMinipoolDelegate is RocketMinipoolStorageLayout, RocketMinipoolInterface { // Constants uint8 public constant override version = 3; // Used to identify which delegate contract each minipool is using uint256 constant calcBase = 1 ether; // Fixed point arithmetic uses this for value for precision uint256 constant legacyPrelaunchAmount = 16 ether; // The amount of ETH initially deposited when minipool is created (for legacy minipools) // Libs using SafeMath for uint; // Events event StatusUpdated(uint8 indexed status, uint256 time); event ScrubVoted(address indexed member, uint256 time); event BondReduced(uint256 previousBondAmount, uint256 newBondAmount, uint256 time); event MinipoolScrubbed(uint256 time); event MinipoolPrestaked(bytes validatorPubkey, bytes validatorSignature, bytes32 depositDataRoot, uint256 amount, bytes withdrawalCredentials, uint256 time); event MinipoolPromoted(uint256 time); event MinipoolVacancyPrepared(uint256 bondAmount, uint256 currentBalance, uint256 time); event EtherDeposited(address indexed from, uint256 amount, uint256 time); event EtherWithdrawn(address indexed to, uint256 amount, uint256 time); event EtherWithdrawalProcessed(address indexed executed, uint256 nodeAmount, uint256 userAmount, uint256 totalBalance, uint256 time); // Status getters function getStatus() override external view returns (MinipoolStatus) { return status; } function getFinalised() override external view returns (bool) { return finalised; } function getStatusBlock() override external view returns (uint256) { return statusBlock; } function getStatusTime() override external view returns (uint256) { return statusTime; } function getScrubVoted(address _member) override external view returns (bool) { return memberScrubVotes[_member]; } // Deposit type getter function getDepositType() override external view returns (MinipoolDeposit) { return depositType; } // Node detail getters function getNodeAddress() override external view returns (address) { return nodeAddress; } function getNodeFee() override external view returns (uint256) { return nodeFee; } function getNodeDepositBalance() override external view returns (uint256) { return nodeDepositBalance; } function getNodeRefundBalance() override external view returns (uint256) { return nodeRefundBalance; } function getNodeDepositAssigned() override external view returns (bool) { return userDepositAssignedTime != 0; } function getPreLaunchValue() override external view returns (uint256) { return preLaunchValue; } function getNodeTopUpValue() override external view returns (uint256) { return nodeDepositBalance.sub(preLaunchValue); } function getVacant() override external view returns (bool) { return vacant; } function getPreMigrationBalance() override external view returns (uint256) { return preMigrationBalance; } function getUserDistributed() override external view returns (bool) { return userDistributed; } // User deposit detail getters function getUserDepositBalance() override public view returns (uint256) { if (depositType == MinipoolDeposit.Variable) { return userDepositBalance; } else { return userDepositBalanceLegacy; } } function getUserDepositAssigned() override external view returns (bool) { return userDepositAssignedTime != 0; } function getUserDepositAssignedTime() override external view returns (uint256) { return userDepositAssignedTime; } function getTotalScrubVotes() override external view returns (uint256) { return totalScrubVotes; } /// @dev Prevent direct calls to this contract modifier onlyInitialised() { require(storageState == StorageState.Initialised, "Storage state not initialised"); _; } /// @dev Prevent multiple calls to initialise modifier onlyUninitialised() { require(storageState == StorageState.Uninitialised, "Storage state already initialised"); _; } /// @dev Only allow access from the owning node address modifier onlyMinipoolOwner(address _nodeAddress) { require(_nodeAddress == nodeAddress, "Invalid minipool owner"); _; } /// @dev Only allow access from the owning node address or their withdrawal address modifier onlyMinipoolOwnerOrWithdrawalAddress(address _nodeAddress) { require(_nodeAddress == nodeAddress || _nodeAddress == rocketStorage.getNodeWithdrawalAddress(nodeAddress), "Invalid minipool owner"); _; } /// @dev Only allow access from the latest version of the specified Rocket Pool contract modifier onlyLatestContract(string memory _contractName, address _contractAddress) { require(_contractAddress == getContractAddress(_contractName), "Invalid or outdated contract"); _; } /// @dev Get the address of a Rocket Pool network contract /// @param _contractName The internal name of the contract to retrieve the address for function getContractAddress(string memory _contractName) private view returns (address) { address contractAddress = rocketStorage.getAddress(keccak256(abi.encodePacked("contract.address", _contractName))); require(contractAddress != address(0x0), "Contract not found"); return contractAddress; } /// @dev Called once on creation to initialise starting state /// @param _nodeAddress The address of the node operator who will own this minipool function initialise(address _nodeAddress) override external onlyUninitialised { // Check parameters require(_nodeAddress != address(0x0), "Invalid node address"); // Load contracts RocketNetworkFeesInterface rocketNetworkFees = RocketNetworkFeesInterface(getContractAddress("rocketNetworkFees")); // Set initial status status = MinipoolStatus.Initialised; statusBlock = block.number; statusTime = block.timestamp; // Set details depositType = MinipoolDeposit.Variable; nodeAddress = _nodeAddress; nodeFee = rocketNetworkFees.getNodeFee(); // Set the rETH address rocketTokenRETH = getContractAddress("rocketTokenRETH"); // Set local copy of penalty contract rocketMinipoolPenalty = getContractAddress("rocketMinipoolPenalty"); // Intialise storage state storageState = StorageState.Initialised; } /// @notice Performs the initial pre-stake on the beacon chain to set the withdrawal credentials /// @param _bondValue The amount of the stake which will be provided by the node operator /// @param _validatorPubkey The public key of the validator /// @param _validatorSignature A signature over the deposit message object /// @param _depositDataRoot The hash tree root of the deposit data object function preDeposit(uint256 _bondValue, bytes calldata _validatorPubkey, bytes calldata _validatorSignature, bytes32 _depositDataRoot) override external payable onlyLatestContract("rocketNodeDeposit", msg.sender) onlyInitialised { // Check current status & node deposit status require(status == MinipoolStatus.Initialised, "The pre-deposit can only be made while initialised"); require(preLaunchValue == 0, "Pre-deposit already performed"); // Update node deposit details nodeDepositBalance = _bondValue; preLaunchValue = msg.value; // Emit ether deposited event emit EtherDeposited(msg.sender, preLaunchValue, block.timestamp); // Perform the pre-stake to lock in withdrawal credentials on beacon chain preStake(_validatorPubkey, _validatorSignature, _depositDataRoot); } /// @notice Performs the second deposit which provides the validator with the remaining balance to become active function deposit() override external payable onlyLatestContract("rocketDepositPool", msg.sender) onlyInitialised { // Check current status & node deposit status require(status == MinipoolStatus.Initialised, "The node deposit can only be assigned while initialised"); require(userDepositAssignedTime == 0, "The user deposit has already been assigned"); // Set the minipool status to prelaunch (ready for node to call `stake()`) setStatus(MinipoolStatus.Prelaunch); // Update deposit details userDepositBalance = msg.value.add(preLaunchValue).sub(nodeDepositBalance); userDepositAssignedTime = block.timestamp; // Emit ether deposited event emit EtherDeposited(msg.sender, msg.value, block.timestamp); } /// @notice Assign user deposited ETH to the minipool and mark it as prelaunch /// @dev No longer used in "Variable" type minipools (only retained for legacy minipools still in queue) function userDeposit() override external payable onlyLatestContract("rocketDepositPool", msg.sender) onlyInitialised { // Check current status & user deposit status require(status >= MinipoolStatus.Initialised && status <= MinipoolStatus.Staking, "The user deposit can only be assigned while initialised, in prelaunch, or staking"); require(userDepositAssignedTime == 0, "The user deposit has already been assigned"); // Progress initialised minipool to prelaunch if (status == MinipoolStatus.Initialised) { setStatus(MinipoolStatus.Prelaunch); } // Update user deposit details userDepositBalance = msg.value; userDepositAssignedTime = block.timestamp; // Refinance full minipool if (depositType == MinipoolDeposit.Full) { // Update node balances nodeDepositBalance = nodeDepositBalance.sub(msg.value); nodeRefundBalance = nodeRefundBalance.add(msg.value); } // Emit ether deposited event emit EtherDeposited(msg.sender, msg.value, block.timestamp); } /// @notice Refund node ETH refinanced from user deposited ETH function refund() override external onlyMinipoolOwnerOrWithdrawalAddress(msg.sender) onlyInitialised { // Check refund balance require(nodeRefundBalance > 0, "No amount of the node deposit is available for refund"); // If this minipool was distributed by a user, force finalisation on the node operator if (!finalised && userDistributed) { // Note: _refund is called inside _finalise _finalise(); } else { // Refund node _refund(); } } /// @notice Called to slash node operator's RPL balance if withdrawal balance was less than user deposit function slash() external override onlyInitialised { // Check there is a slash balance require(nodeSlashBalance > 0, "No balance to slash"); // Perform slash _slash(); } /// @notice Returns true when `stake()` can be called by node operator taking into consideration the scrub period function canStake() override external view onlyInitialised returns (bool) { // Check status if (status != MinipoolStatus.Prelaunch) { return false; } // Get contracts RocketDAONodeTrustedSettingsMinipoolInterface rocketDAONodeTrustedSettingsMinipool = RocketDAONodeTrustedSettingsMinipoolInterface(getContractAddress("rocketDAONodeTrustedSettingsMinipool")); // Get scrub period uint256 scrubPeriod = rocketDAONodeTrustedSettingsMinipool.getScrubPeriod(); // Check if we have been in prelaunch status for long enough return block.timestamp > statusTime + scrubPeriod; } /// @notice Returns true when `promote()` can be called by node operator taking into consideration the scrub period function canPromote() override external view onlyInitialised returns (bool) { // Check status if (status != MinipoolStatus.Prelaunch) { return false; } // Get contracts RocketDAONodeTrustedSettingsMinipoolInterface rocketDAONodeTrustedSettingsMinipool = RocketDAONodeTrustedSettingsMinipoolInterface(getContractAddress("rocketDAONodeTrustedSettingsMinipool")); // Get scrub period uint256 scrubPeriod = rocketDAONodeTrustedSettingsMinipool.getPromotionScrubPeriod(); // Check if we have been in prelaunch status for long enough return block.timestamp > statusTime + scrubPeriod; } /// @notice Progress the minipool to staking, sending its ETH deposit to the deposit contract. Only accepts calls from the minipool owner (node) while in prelaunch and once scrub period has ended /// @param _validatorSignature A signature over the deposit message object /// @param _depositDataRoot The hash tree root of the deposit data object function stake(bytes calldata _validatorSignature, bytes32 _depositDataRoot) override external onlyMinipoolOwner(msg.sender) onlyInitialised { // Get contracts RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool")); { // Get scrub period RocketDAONodeTrustedSettingsMinipoolInterface rocketDAONodeTrustedSettingsMinipool = RocketDAONodeTrustedSettingsMinipoolInterface(getContractAddress("rocketDAONodeTrustedSettingsMinipool")); uint256 scrubPeriod = rocketDAONodeTrustedSettingsMinipool.getScrubPeriod(); // Check current status require(status == MinipoolStatus.Prelaunch, "The minipool can only begin staking while in prelaunch"); require(block.timestamp > statusTime + scrubPeriod, "Not enough time has passed to stake"); require(!vacant, "Cannot stake a vacant minipool"); } // Progress to staking setStatus(MinipoolStatus.Staking); // Load contracts DepositInterface casperDeposit = DepositInterface(getContractAddress("casperDeposit")); RocketMinipoolManagerInterface rocketMinipoolManager = RocketMinipoolManagerInterface(getContractAddress("rocketMinipoolManager")); // Get launch amount uint256 launchAmount = rocketDAOProtocolSettingsMinipool.getLaunchBalance(); uint256 depositAmount; // Legacy minipools had a prestake equal to the bond amount if (depositType == MinipoolDeposit.Variable) { depositAmount = launchAmount.sub(preLaunchValue); } else { depositAmount = launchAmount.sub(legacyPrelaunchAmount); } // Check minipool balance require(address(this).balance >= depositAmount, "Insufficient balance to begin staking"); // Retrieve validator pubkey from storage bytes memory validatorPubkey = rocketMinipoolManager.getMinipoolPubkey(address(this)); // Send staking deposit to casper casperDeposit.deposit{value : depositAmount}(validatorPubkey, rocketMinipoolManager.getMinipoolWithdrawalCredentials(address(this)), _validatorSignature, _depositDataRoot); // Increment node's number of staking minipools rocketMinipoolManager.incrementNodeStakingMinipoolCount(nodeAddress); } /// @dev Sets the bond value and vacancy flag on this minipool /// @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 prepareVacancy(uint256 _bondAmount, uint256 _currentBalance) override external onlyLatestContract("rocketMinipoolManager", msg.sender) onlyInitialised { // Check status require(status == MinipoolStatus.Initialised, "Must be in initialised status"); // Sanity check that refund balance is zero require(nodeRefundBalance == 0, "Refund balance not zero"); // Check balance RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool")); uint256 launchAmount = rocketDAOProtocolSettingsMinipool.getLaunchBalance(); require(_currentBalance >= launchAmount, "Balance is too low"); // Store bond amount nodeDepositBalance = _bondAmount; // Calculate user amount from launch amount userDepositBalance = launchAmount.sub(nodeDepositBalance); // Flag as vacant vacant = true; preMigrationBalance = _currentBalance; // Refund the node whatever rewards they have accrued prior to becoming a RP validator nodeRefundBalance = _currentBalance.sub(launchAmount); // Set status to preLaunch setStatus(MinipoolStatus.Prelaunch); // Emit event emit MinipoolVacancyPrepared(_bondAmount, _currentBalance, block.timestamp); } /// @dev Promotes this minipool to a complete minipool function promote() override external onlyMinipoolOwner(msg.sender) onlyInitialised { // Check status require(status == MinipoolStatus.Prelaunch, "The minipool can only promote while in prelaunch"); require(vacant, "Cannot promote a non-vacant minipool"); // Get contracts RocketDAONodeTrustedSettingsMinipoolInterface rocketDAONodeTrustedSettingsMinipool = RocketDAONodeTrustedSettingsMinipoolInterface(getContractAddress("rocketDAONodeTrustedSettingsMinipool")); // Clear vacant flag vacant = false; // Check scrub period uint256 scrubPeriod = rocketDAONodeTrustedSettingsMinipool.getPromotionScrubPeriod(); require(block.timestamp > statusTime + scrubPeriod, "Not enough time has passed to promote"); // Progress to staking setStatus(MinipoolStatus.Staking); // Increment node's number of staking minipools RocketMinipoolManagerInterface rocketMinipoolManager = RocketMinipoolManagerInterface(getContractAddress("rocketMinipoolManager")); rocketMinipoolManager.incrementNodeStakingMinipoolCount(nodeAddress); // Set deposit assigned time userDepositAssignedTime = block.timestamp; // Increase node operator's deposit credit RocketNodeDepositInterface rocketNodeDepositInterface = RocketNodeDepositInterface(getContractAddress("rocketNodeDeposit")); rocketNodeDepositInterface.increaseDepositCreditBalance(nodeAddress, userDepositBalance); // Remove from vacant set rocketMinipoolManager.removeVacantMinipool(); // Emit event emit MinipoolPromoted(block.timestamp); } /// @dev Stakes the balance of this minipool into the deposit contract to set withdrawal credentials to this contract /// @param _validatorSignature A signature over the deposit message object /// @param _depositDataRoot The hash tree root of the deposit data object function preStake(bytes calldata _validatorPubkey, bytes calldata _validatorSignature, bytes32 _depositDataRoot) internal { // Load contracts DepositInterface casperDeposit = DepositInterface(getContractAddress("casperDeposit")); RocketMinipoolManagerInterface rocketMinipoolManager = RocketMinipoolManagerInterface(getContractAddress("rocketMinipoolManager")); // Set minipool pubkey rocketMinipoolManager.setMinipoolPubkey(_validatorPubkey); // Get withdrawal credentials bytes memory withdrawalCredentials = rocketMinipoolManager.getMinipoolWithdrawalCredentials(address(this)); // Send staking deposit to casper casperDeposit.deposit{value : preLaunchValue}(_validatorPubkey, withdrawalCredentials, _validatorSignature, _depositDataRoot); // Emit event emit MinipoolPrestaked(_validatorPubkey, _validatorSignature, _depositDataRoot, preLaunchValue, withdrawalCredentials, block.timestamp); } /// @notice Distributes the contract's balance. /// If balance is greater or equal to 8 ETH, the NO can call to distribute capital and finalise the minipool. /// If balance is greater or equal to 8 ETH, users who have called `beginUserDistribute` and waited the required /// amount of time can call to distribute capital. /// If balance is lower than 8 ETH, can be called by anyone and is considered a partial withdrawal and funds are /// split as rewards. /// @param _rewardsOnly If set to true, will revert if balance is not being treated as rewards function distributeBalance(bool _rewardsOnly) override external onlyInitialised { // Get node withdrawal address address nodeWithdrawalAddress = rocketStorage.getNodeWithdrawalAddress(nodeAddress); bool ownerCalling = msg.sender == nodeAddress || msg.sender == nodeWithdrawalAddress; // If dissolved, distribute everything to the owner if (status == MinipoolStatus.Dissolved) { require(ownerCalling, "Only owner can distribute dissolved minipool"); distributeToOwner(); return; } // Can only be called while in staking status require(status == MinipoolStatus.Staking, "Minipool must be staking"); // Get withdrawal amount, we must also account for a possible node refund balance on the contract uint256 totalBalance = address(this).balance.sub(nodeRefundBalance); if (totalBalance >= 8 ether) { // Prevent funding front runs of distribute balance require(!_rewardsOnly, "Balance exceeds 8 ether"); // Consider this a full withdrawal _distributeBalance(totalBalance); if (ownerCalling) { // Finalise the minipool if the owner is calling _finalise(); } else { // Require user wait period to pass before allowing user to distribute require(userDistributeAllowed(), "Only owner can distribute right now"); // Mark this minipool as having been distributed by a user userDistributed = true; } } else { // Just a partial withdraw distributeSkimmedRewards(); // If node operator is calling, save a tx by calling refund immediately if (ownerCalling && nodeRefundBalance > 0) { _refund(); } } // Reset distribute waiting period userDistributeTime = 0; } /// @dev Distribute the entire balance to the minipool owner function distributeToOwner() internal { // Get balance uint256 balance = address(this).balance; // Get node withdrawal address address nodeWithdrawalAddress = rocketStorage.getNodeWithdrawalAddress(nodeAddress); // Transfer balance (bool success,) = nodeWithdrawalAddress.call{value : balance}(""); require(success, "Node ETH balance was not successfully transferred to node operator"); // Emit ether withdrawn event emit EtherWithdrawn(nodeWithdrawalAddress, balance, block.timestamp); } /// @notice Allows a user (other than the owner of this minipool) to signal they want to call distribute. /// After waiting the required period, anyone may then call `distributeBalance()`. function beginUserDistribute() override external onlyInitialised { require(status == MinipoolStatus.Staking, "Minipool must be staking"); uint256 totalBalance = address(this).balance.sub(nodeRefundBalance); require (totalBalance >= 8 ether, "Balance too low"); // Prevent calls resetting distribute time before window has passed RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool")); uint256 timeElapsed = block.timestamp.sub(userDistributeTime); require(rocketDAOProtocolSettingsMinipool.hasUserDistributeWindowPassed(timeElapsed), "User distribution already pending"); // Store current time userDistributeTime = block.timestamp; } /// @notice Returns true if enough time has passed for a user to distribute function userDistributeAllowed() override public view returns (bool) { // Get contracts RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool")); // Calculate if time elapsed since call to `beginUserDistribute` is within the allowed window uint256 timeElapsed = block.timestamp.sub(userDistributeTime); return(rocketDAOProtocolSettingsMinipool.isWithinUserDistributeWindow(timeElapsed)); } /// @notice Allows the owner of this minipool to finalise it after a user has manually distributed the balance function finalise() override external onlyMinipoolOwnerOrWithdrawalAddress(msg.sender) onlyInitialised { require(userDistributed, "Can only manually finalise after user distribution"); _finalise(); } /// @dev Perform any slashings, refunds, and unlock NO's stake function _finalise() private { // Get contracts RocketMinipoolManagerInterface rocketMinipoolManager = RocketMinipoolManagerInterface(getContractAddress("rocketMinipoolManager")); // Can only finalise the pool once require(!finalised, "Minipool has already been finalised"); // Set finalised flag finalised = true; // If slash is required then perform it if (nodeSlashBalance > 0) { _slash(); } // Refund node operator if required if (nodeRefundBalance > 0) { _refund(); } // Send any left over ETH to rETH contract if (address(this).balance > 0) { // Send user amount to rETH contract payable(rocketTokenRETH).transfer(address(this).balance); } // Trigger a deposit of excess collateral from rETH contract to deposit pool RocketTokenRETHInterface(rocketTokenRETH).depositExcessCollateral(); // Unlock node operator's RPL rocketMinipoolManager.incrementNodeFinalisedMinipoolCount(nodeAddress); rocketMinipoolManager.decrementNodeStakingMinipoolCount(nodeAddress); } /// @dev Distributes balance to user and node operator /// @param _balance The amount to distribute function _distributeBalance(uint256 _balance) private { // Deposit amounts uint256 nodeAmount = 0; uint256 userCapital = getUserDepositBalance(); // Check if node operator was slashed if (_balance < userCapital) { // Only slash on first call to distribute if (withdrawalBlock == 0) { // Record shortfall for slashing nodeSlashBalance = userCapital.sub(_balance); } } else { // Calculate node's share of the balance nodeAmount = _calculateNodeShare(_balance); } // User amount is what's left over from node's share uint256 userAmount = _balance.sub(nodeAmount); // Pay node operator via refund nodeRefundBalance = nodeRefundBalance.add(nodeAmount); // Pay user amount to rETH contract if (userAmount > 0) { // Send user amount to rETH contract payable(rocketTokenRETH).transfer(userAmount); } // Save block to prevent multiple withdrawals within a few blocks withdrawalBlock = block.number; // Log it emit EtherWithdrawalProcessed(msg.sender, nodeAmount, userAmount, _balance, block.timestamp); } /// @notice Given a balance, this function returns what portion of it belongs to the node taking into /// consideration the 8 ether reward threshold, the minipool's commission rate and any penalties it may have /// attracted. Another way of describing this function is that if this contract's balance was /// `_balance + nodeRefundBalance` this function would return how much of that balance would be paid to the node /// operator if a distribution occurred /// @param _balance The balance to calculate the node share of. Should exclude nodeRefundBalance function calculateNodeShare(uint256 _balance) override public view returns (uint256) { // Sub 8 ether balance is treated as rewards if (_balance < 8 ether) { return calculateNodeRewards(nodeDepositBalance, getUserDepositBalance(), _balance); } else { return _calculateNodeShare(_balance); } } /// @notice Performs the same calculation as `calculateNodeShare` but on the user side /// @param _balance The balance to calculate the node share of. Should exclude nodeRefundBalance function calculateUserShare(uint256 _balance) override external view returns (uint256) { // User's share is just the balance minus node refund minus node's share return _balance.sub(calculateNodeShare(_balance)); } /// @dev Given a balance, this function returns what portion of it belongs to the node taking into /// consideration the minipool's commission rate and any penalties it may have attracted /// @param _balance The balance to calculate the node share of (with nodeRefundBalance already subtracted) function _calculateNodeShare(uint256 _balance) internal view returns (uint256) { uint256 userCapital = getUserDepositBalance(); uint256 nodeCapital = nodeDepositBalance; uint256 nodeShare = 0; // Calculate the total capital (node + user) uint256 capital = userCapital.add(nodeCapital); if (_balance > capital) { // Total rewards to share uint256 rewards = _balance.sub(capital); nodeShare = nodeCapital.add(calculateNodeRewards(nodeCapital, userCapital, rewards)); } else if (_balance > userCapital) { nodeShare = _balance.sub(userCapital); } // Check if node has an ETH penalty uint256 penaltyRate = RocketMinipoolPenaltyInterface(rocketMinipoolPenalty).getPenaltyRate(address(this)); if (penaltyRate > 0) { uint256 penaltyAmount = nodeShare.mul(penaltyRate).div(calcBase); if (penaltyAmount > nodeShare) { penaltyAmount = nodeShare; } nodeShare = nodeShare.sub(penaltyAmount); } return nodeShare; } /// @dev Calculates what portion of rewards should be paid to the node operator given a capital ratio /// @param _nodeCapital The node supplied portion of the capital /// @param _userCapital The user supplied portion of the capital /// @param _rewards The amount of rewards to split function calculateNodeRewards(uint256 _nodeCapital, uint256 _userCapital, uint256 _rewards) internal view returns (uint256) { // Calculate node and user portion based on proportions of capital provided uint256 nodePortion = _rewards.mul(_nodeCapital).div(_userCapital.add(_nodeCapital)); uint256 userPortion = _rewards.sub(nodePortion); // Calculate final node amount as combination of node capital, node share and commission on user share return nodePortion.add(userPortion.mul(nodeFee).div(calcBase)); } /// @notice Dissolve the minipool, returning user deposited ETH to the deposit pool. function dissolve() override external onlyInitialised { // Check current status require(status == MinipoolStatus.Prelaunch, "The minipool can only be dissolved while in prelaunch"); // Load contracts RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool")); // Check if minipool is timed out require(block.timestamp.sub(statusTime) >= rocketDAOProtocolSettingsMinipool.getLaunchTimeout(), "The minipool can only be dissolved once it has timed out"); // Perform the dissolution _dissolve(); } /// @notice Withdraw node balances from the minipool and close it. Only accepts calls from the owner function close() override external onlyMinipoolOwner(msg.sender) onlyInitialised { // Check current status require(status == MinipoolStatus.Dissolved, "The minipool can only be closed while dissolved"); // Distribute funds to owner distributeToOwner(); // Destroy minipool RocketMinipoolManagerInterface rocketMinipoolManager = RocketMinipoolManagerInterface(getContractAddress("rocketMinipoolManager")); require(rocketMinipoolManager.getMinipoolExists(address(this)), "Minipool already closed"); rocketMinipoolManager.destroyMinipool(); // Clear state nodeDepositBalance = 0; nodeRefundBalance = 0; userDepositBalance = 0; userDepositBalanceLegacy = 0; userDepositAssignedTime = 0; } /// @notice Can be called by trusted nodes to scrub this minipool if its withdrawal credentials are not set correctly function voteScrub() override external onlyInitialised { // Check current status require(status == MinipoolStatus.Prelaunch, "The minipool can only be scrubbed while in prelaunch"); // Get contracts RocketDAONodeTrustedInterface rocketDAONode = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted")); RocketDAONodeTrustedSettingsMinipoolInterface rocketDAONodeTrustedSettingsMinipool = RocketDAONodeTrustedSettingsMinipoolInterface(getContractAddress("rocketDAONodeTrustedSettingsMinipool")); // Must be a trusted member require(rocketDAONode.getMemberIsValid(msg.sender), "Not a trusted member"); // Can only vote once require(!memberScrubVotes[msg.sender], "Member has already voted to scrub"); memberScrubVotes[msg.sender] = true; // Emit event emit ScrubVoted(msg.sender, block.timestamp); // Check if required quorum has voted uint256 quorum = rocketDAONode.getMemberCount().mul(rocketDAONodeTrustedSettingsMinipool.getScrubQuorum()).div(calcBase); if (totalScrubVotes.add(1) > quorum) { // Slash RPL equal to minimum stake amount (if enabled) if (!vacant && rocketDAONodeTrustedSettingsMinipool.getScrubPenaltyEnabled()){ RocketNodeStakingInterface rocketNodeStaking = RocketNodeStakingInterface(getContractAddress("rocketNodeStaking")); RocketDAOProtocolSettingsNodeInterface rocketDAOProtocolSettingsNode = RocketDAOProtocolSettingsNodeInterface(getContractAddress("rocketDAOProtocolSettingsNode")); RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool")); uint256 launchAmount = rocketDAOProtocolSettingsMinipool.getLaunchBalance(); // Slash amount is minRplStake * userCapital // In prelaunch userDepositBalance hasn't been set so we calculate it as 32 ETH - bond amount rocketNodeStaking.slashRPL( nodeAddress, launchAmount.sub(nodeDepositBalance) .mul(rocketDAOProtocolSettingsNode.getMinimumPerMinipoolStake()) .div(calcBase) ); } // Dissolve this minipool, recycling ETH back to deposit pool _dissolve(); // Emit event emit MinipoolScrubbed(block.timestamp); } else { // Increment total totalScrubVotes = totalScrubVotes.add(1); } } /// @notice Reduces the ETH bond amount and credits the owner the difference function reduceBondAmount() override external onlyMinipoolOwner(msg.sender) onlyInitialised { require(status == MinipoolStatus.Staking, "Minipool must be staking"); // If balance is greater than 8 ether, it is assumed to be capital not skimmed rewards. So prevent reduction uint256 totalBalance = address(this).balance.sub(nodeRefundBalance); require(totalBalance < 8 ether, "Cannot reduce bond with balance of 8 ether or more"); // Distribute any skimmed rewards distributeSkimmedRewards(); // Approve reduction and handle external state changes RocketMinipoolBondReducerInterface rocketBondReducer = RocketMinipoolBondReducerInterface(getContractAddress("rocketMinipoolBondReducer")); uint256 previousBond = nodeDepositBalance; uint256 newBond = rocketBondReducer.reduceBondAmount(); // Update user/node balances userDepositBalance = getUserDepositBalance().add(previousBond.sub(newBond)); nodeDepositBalance = newBond; // Reset node fee to current network rate RocketNetworkFeesInterface rocketNetworkFees = RocketNetworkFeesInterface(getContractAddress("rocketNetworkFees")); uint256 prevFee = nodeFee; uint256 newFee = rocketNetworkFees.getNodeFee(); nodeFee = newFee; // Update staking minipool counts and fee numerator RocketMinipoolManagerInterface rocketMinipoolManager = RocketMinipoolManagerInterface(getContractAddress("rocketMinipoolManager")); rocketMinipoolManager.updateNodeStakingMinipoolCount(previousBond, newBond, prevFee, newFee); // Break state to prevent rollback exploit if (depositType != MinipoolDeposit.Variable) { userDepositBalanceLegacy = 2 ** 256 - 1; depositType = MinipoolDeposit.Variable; } // Emit event emit BondReduced(previousBond, newBond, block.timestamp); } /// @dev Distributes the current contract balance based on capital ratio and node fee function distributeSkimmedRewards() internal { uint256 rewards = address(this).balance.sub(nodeRefundBalance); uint256 nodeShare = calculateNodeRewards(nodeDepositBalance, getUserDepositBalance(), rewards); // Pay node operator via refund mechanism nodeRefundBalance = nodeRefundBalance.add(nodeShare); // Deposit user share into rETH contract payable(rocketTokenRETH).transfer(rewards.sub(nodeShare)); } /// @dev Set the minipool's current status /// @param _status The new status function setStatus(MinipoolStatus _status) private { // Update status status = _status; statusBlock = block.number; statusTime = block.timestamp; // Emit status updated event emit StatusUpdated(uint8(_status), block.timestamp); } /// @dev Transfer refunded ETH balance to the node operator function _refund() private { // Prevent vacant minipools from calling require(vacant == false, "Vacant minipool cannot refund"); // Update refund balance uint256 refundAmount = nodeRefundBalance; nodeRefundBalance = 0; // Get node withdrawal address address nodeWithdrawalAddress = rocketStorage.getNodeWithdrawalAddress(nodeAddress); // Transfer refund amount (bool success,) = nodeWithdrawalAddress.call{value : refundAmount}(""); require(success, "ETH refund amount was not successfully transferred to node operator"); // Emit ether withdrawn event emit EtherWithdrawn(nodeWithdrawalAddress, refundAmount, block.timestamp); } /// @dev Slash node operator's RPL balance based on nodeSlashBalance function _slash() private { // Get contracts RocketNodeStakingInterface rocketNodeStaking = RocketNodeStakingInterface(getContractAddress("rocketNodeStaking")); // Slash required amount and reset storage value uint256 slashAmount = nodeSlashBalance; nodeSlashBalance = 0; rocketNodeStaking.slashRPL(nodeAddress, slashAmount); } /// @dev Dissolve this minipool function _dissolve() private { // Get contracts RocketDepositPoolInterface rocketDepositPool = RocketDepositPoolInterface(getContractAddress("rocketDepositPool")); RocketMinipoolQueueInterface rocketMinipoolQueue = RocketMinipoolQueueInterface(getContractAddress("rocketMinipoolQueue")); // Progress to dissolved setStatus(MinipoolStatus.Dissolved); if (vacant) { // Vacant minipools waiting to be promoted need to be removed from the set maintained by the minipool manager RocketMinipoolManagerInterface rocketMinipoolManager = RocketMinipoolManagerInterface(getContractAddress("rocketMinipoolManager")); rocketMinipoolManager.removeVacantMinipool(); } else { if (depositType == MinipoolDeposit.Full) { // Handle legacy Full type minipool rocketMinipoolQueue.removeMinipool(MinipoolDeposit.Full); } else { // Transfer user balance to deposit pool uint256 userCapital = getUserDepositBalance(); rocketDepositPool.recycleDissolvedDeposit{value : userCapital}(); // Emit ether withdrawn event emit EtherWithdrawn(address(rocketDepositPool), userCapital, 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":"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
608060405260008054610100600160a81b03191690553480156200002257600080fd5b506040516200524938038062005249833981016040819052620000459162000078565b6000805460ff196001600160a01b0390931661010002610100600160a81b031990911617919091166003179055620000a8565b6000602082840312156200008a578081fd5b81516001600160a01b0381168114620000a1578182fd5b9392505050565b61519180620000b86000396000f3fe608060405234801561001057600080fd5b50600436106102265760003560e01c806375b59c7f1161012a578063b04e8868116100bd578063cf6a47631161008c578063d1ea6ce011610071578063d1ea6ce0146104a2578063eff7319f146104aa578063f90267c4146104bd57610226565b8063cf6a47631461047c578063d14019911461048f57610226565b8063b04e88681461043b578063b88a89f71461044e578063c64372bb14610461578063ce9b79ad1461047457610226565b80639da0700f116100f95780639da0700f146103fa578063a179778b1461040d578063a757987a14610420578063ae4d0bed1461043357610226565b806375b59c7f146103ac5780637bb40aaf146103bf5780638b300029146103c75780639907288c146103e757610226565b80633b5ecefa116101bd57806357b4ef6b1161018c5780635ea1a6e2116101715780635ea1a6e214610371578063606bb62e1461039157806367bca235146103a457610226565b806357b4ef6b1461033e5780635dfef9651461035157610226565b80633b5ecefa146102ea5780633eb535e91461030e57806344e51a031461032157806354fd4d501461032957610226565b80631ce9ec33116101f95780631ce9ec3314610291578063240eb330146102a45780632c7f64d4146102b75780632cb76c37146102ca57610226565b80630c21b8a71461022b5780630fcc8178146102545780631286377e146102695780631844ec011461027e575b600080fd5b61023e610239366004614685565b6104d0565b60405161024b9190614eed565b60405180910390f35b610267610262366004614949565b610509565b005b610271610926565b60405161024b9190614ef8565b61027161028c366004614685565b610a0f565b61027161029f366004614685565b610b3e565b6102716102b23660046146bd565b610c2a565b6102676102c5366004614815565b610caa565b6102dd6102d8366004614685565b610e5f565b60405161024b9190614f26565b6102fd6102f8366004614928565b610eae565b60405161024b95949392919061506f565b6102dd61031c366004614685565b611119565b61026761114a565b6103316113ef565b60405161024b9190615092565b61027161034c366004614685565b6113f8565b61036461035f366004614928565b6114fb565b60405161024b9190614ea0565b61038461037f366004614685565b61175a565b60405161024b9190614f59565b61023e61039f366004614685565b611956565b61027161196c565b6102676103ba366004614685565b6119d1565b610267611d94565b6103da6103d53660046146bd565b61238a565b60405161024b9190614e73565b6102676103f5366004614685565b612471565b6103da6104083660046146bd565b61282f565b6103da61041b3660046146e8565b612892565b61023e61042e366004614685565b612bf0565b610271612c06565b610267610449366004614685565b612ce1565b61027161045c366004614685565b613053565b6103da61046f3660046146bd565b613069565b6102716134ef565b6103da61048a366004614855565b613693565b6103da61049d3660046148f8565b6136c4565b6102716137a9565b6103da6104b83660046148f8565b613809565b6102716104cb366004614685565b61386a565b6000610501826040516020016104e69190614b81565b604051602081830303815290604052805190602001206138cd565b90505b919050565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306105de8260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083835b6020831061059e5780518252601f19909201916020918201910161057f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120613959565b6001600160a01b0316816001600160a01b031614610643576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f840152835160238185030181526043909301909352815191012061069c906138cd565b6106ed576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b60008060003390506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076891906146a1565b9050610773816139b3565b8a67de0b6b3a7640000014156107da57806040516020016107949190614c73565b604051602081830303815290604052805190602001209350806040516020016107bd9190614dbf565b604051602081830303815290604052805190602001209250610831565b808b6040516020016107ed929190614cb6565b604051602081830303815290604052805190602001209350808b604051602001610818929190614e02565b6040516020818303038152906040528051906020012092505b61083c846001613bd9565b610846838a613bd9565b8967de0b6b3a7640000014156108ad57806040516020016108679190614c73565b604051602081830303815290604052805190602001209350806040516020016108909190614dbf565b604051602081830303815290604052805190602001209250610904565b808a6040516020016108c0929190614cb6565b604051602081830303815290604052805190602001209350808a6040516020016108eb929190614e02565b6040516020818303038152906040528051906020012092505b61090f846001613c59565b6109198389613c59565b5050505050505050505050565b6000806109676040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663c9d6fee960405160200161098790614c07565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016109b99190614ef8565b60206040518083038186803b1580156109d157600080fd5b505afa1580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a099190614910565b91505090565b600080610a506040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b90506000610a8384604051602001610a689190614a8f565b60405160208183030381529060405280519060200120613d82565b90506000826001600160a01b031663c9d6fee986604051602001610aa79190614bc4565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610ad99190614ef8565b60206040518083038186803b158015610af157600080fd5b505afa158015610b05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b299190614910565b9050610b358183613ddc565b95945050505050565b600080610b7f6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663c9d6fee984604051602001610ba19190614bc4565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610bd39190614ef8565b60206040518083038186803b158015610beb57600080fd5b505afa158015610bff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c239190614910565b9392505050565b6000808267de0b6b3a764000001415610c6b5783604051602001610c4e9190614c73565b604051602081830303815290604052805190602001209050610c97565b8383604051602001610c7e929190614cb6565b6040516020818303038152906040528051906020012090505b610ca081613d82565b9150505b92915050565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030610d3e8260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614610da3576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f8401528351602381850301815260439093019093528151910120610dfc906138cd565b610e4d576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b610e58338686613e39565b5050505050565b604051606090610e98907f010000000000000000000000000000000000000000000000000000000000000090600090859060200161499b565b6040516020818303038152906040529050919050565b600080600080600080610ef56040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b90506000604051602001610f0890614e4a565b6040516020818303038152906040528051906020012090506000610f2a612c06565b90506000610f388b8b61408b565b905081811180610f46575089155b15610f4e5750805b8a5b8181101561110a576040517ff3358a3a0000000000000000000000000000000000000000000000000000000081526000906001600160a01b0387169063f3358a3a90610fa29088908690600401614f18565b60206040518083038186803b158015610fba57600080fd5b505afa158015610fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff291906146a1565b90506000816001600160a01b0316634e69d5606040518163ffffffff1660e01b815260040160206040518083038186803b15801561102f57600080fd5b505afa158015611043573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106791906148dc565b9050600081600481111561107757fe5b1415611088576001909b019a611100565b600181600481111561109657fe5b14156110a7576001909a0199611100565b60028160048111156110b557fe5b14156110c657600190990198611100565b60038160048111156110d457fe5b14156110e557600190980197611100565b60048160048111156110f357fe5b1415611100576001909701965b5050600101610f50565b50505050509295509295909350565b60606105018260405160200161112f9190614c30565b604051602081830303815290604052805190602001206140e5565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306111de8260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614611243576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f840152835160238185030181526043909301909352815191012061129c906138cd565b6112ed576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b600061132d6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663f79b36ad60405160200161134d90614c07565b60405160208183030381529060405280519060200120336040518363ffffffff1660e01b8152600401611381929190614f01565b600060405180830381600087803b15801561139b57600080fd5b505af11580156113af573d6000803e3d6000fd5b5050505060006113be33611119565b9050610e58816040516020016113d49190614d7a565b60405160208183030381529060405280519060200120614241565b60005460ff1681565b6000806114396040518060400160405280601181526020017f726f636b65744e6f64654465706f736974000000000000000000000000000000815250613cc5565b90506000816001600160a01b0316639bed5a456040518163ffffffff1660e01b815260040160006040518083038186803b15801561147657600080fd5b505afa15801561148a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114b29190810190614754565b90506000805b82518110156114f2576114e86114e1878584815181106114d457fe5b6020026020010151610c2a565b839061408b565b91506001016114b8565b50949350505050565b6060600061153d6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050600060405160200161155090614e4a565b6040516020818303038152906040528051906020012090506000611572612c06565b90506000611580878761408b565b90508181118061158e575085155b156115965750805b60006115a28289613ddc565b67ffffffffffffffff811180156115b857600080fd5b506040519080825280602002602001820160405280156115e2578160200160208202803683370190505b5090506000885b8381101561174c576040517ff3358a3a0000000000000000000000000000000000000000000000000000000081526000906001600160a01b0389169063f3358a3a9061163b908a908690600401614f18565b60206040518083038186803b15801561165357600080fd5b505afa158015611667573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168b91906146a1565b90506000816001600160a01b0316634e69d5606040518163ffffffff1660e01b815260040160206040518083038186803b1580156116c857600080fd5b505afa1580156116dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170091906148dc565b9050600181600481111561171057fe5b1415611742578185858151811061172357fe5b6001600160a01b03909216602092830291909101909101526001909301925b50506001016115e9565b508152979650505050505050565b600080829050600060019050816001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160206040518083038186803b15801561179f57600080fd5b505afa9250505080156117cf575060408051601f3d908101601f191682019092526117cc9181019061497a565b60015b611809573d8080156117fd576040519150601f19603f3d011682016040523d82523d6000602084013e611802565b606091505b505061180c565b90505b8060ff166001148061182157508060ff166002145b156118dd57816001600160a01b0316635abd37e46175306040518263ffffffff1660e01b815260040160206040518083038187803b15801561186257600080fd5b5086fa93505050508015611893575060408051601f3d908101601f19168201909252611890918101906148dc565b60015b6118d3573d8080156118c1576040519150601f19603f3d011682016040523d82523d6000602084013e6118c6565b606091505b5060049350505050610504565b9250610504915050565b816001600160a01b0316635abd37e46040518163ffffffff1660e01b815260040160206040518083038186803b15801561191657600080fd5b505afa15801561192a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194e91906148dc565b949350505050565b6000610501826040516020016104e69190614cfe565b60408051808201909152601781527f6d696e69706f6f6c732e7374616b696e672e636f756e7400000000000000000060209091015260006119cc7f3441dc4461171402746c7de6880184ae1bfbc9def01a5bd7508263456c144419613d82565b905090565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030611a658260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614611aca576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f8401528351602381850301815260439093019093528151910120611b23906138cd565b611b74576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b33611b7e856139b3565b6000816001600160a01b03166374ca6bf26040518163ffffffff1660e01b815260040160206040518083038186803b158015611bb957600080fd5b505afa158015611bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf19190614910565b90506000808267de0b6b3a764000001415611c5d5787604051602001611c179190614c73565b60405160208183030381529060405280519060200120915087604051602001611c409190614dbf565b604051602081830303815290604052805190602001209050611cb4565b8783604051602001611c70929190614cb6565b6040516020818303038152906040528051906020012091508783604051602001611c9b929190614e02565b6040516020818303038152906040528051906020012090505b6000611cbf83613d82565b9050611cd583611cd0836001613ddc565b6142ba565b6000604051602001611ce690614b15565b6040516020818303038152906040528051906020012090506000611d0982613d82565b9050611d1a82611cd0836001613ddc565b61091984886001600160a01b031663e71501346040518163ffffffff1660e01b815260040160206040518083038186803b158015611d5757600080fd5b505afa158015611d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8f9190614910565b613bd9565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030611e288260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614611e8d576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f8401528351602381850301815260439093019093528151910120611ee6906138cd565b611f37576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b6000611f776040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b905060003390506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b815260040160206040518083038186803b158015611fb957600080fd5b505afa158015611fcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff191906146a1565b9050600061200982604051602001610a689190614a09565b90508061202e5761202b67de0b6b3a7640000061202584610a0f565b90614326565b90505b6004836001600160a01b0316635abd37e46040518163ffffffff1660e01b815260040160206040518083038186803b15801561206957600080fd5b505afa15801561207d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a191906148dc565b60048111156120ac57fe5b14156121345761212d836001600160a01b031663e7e04aba6040518163ffffffff1660e01b815260040160206040518083038186803b1580156120ee57600080fd5b505afa158015612102573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121269190614910565b8290613ddc565b9050612149565b6121468167de0b6b3a76400000613ddc565b90505b6121798260405160200161215d9190614a09565b60405160208183030381529060405280519060200120826142ba565b6121aa3360405160200161218d9190614cfe565b60405160208183030381529060405280519060200120600061437f565b6121db336040516020016121be9190614ad2565b60405160208183030381529060405280519060200120600161437f565b836001600160a01b031663f79b36ad6040516020016121f990614e4a565b60405160208183030381529060405280519060200120336040518363ffffffff1660e01b815260040161222d929190614f01565b600060405180830381600087803b15801561224757600080fd5b505af115801561225b573d6000803e3d6000fd5b50505050836001600160a01b031663f79b36ad8360405160200161227f9190614bc4565b60405160208183030381529060405280519060200120336040518363ffffffff1660e01b81526004016122b3929190614f01565b600060405180830381600087803b1580156122cd57600080fd5b505af11580156122e1573d6000803e3d6000fd5b5050505060006122f033611119565b9050612321336040516020016123069190614c30565b604051602081830303815290604052805190602001206143ec565b612335816040516020016113d49190614d7a565b826001600160a01b0316336001600160a01b03167f3097cb0f536cd88115b814915d7030d2fe958943357cd2b1a9e1dba8a673ec69426040516123789190614ef8565b60405180910390a35050505050505050565b6000806123cb6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663f3358a3a856040516020016123ed9190614bc4565b60405160208183030381529060405280519060200120856040518363ffffffff1660e01b8152600401612421929190614f18565b60206040518083038186803b15801561243957600080fd5b505afa15801561244d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca091906146a1565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306125058260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b03161461256a576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f84015283516023818503018152604390930190935281519101206125c3906138cd565b612614576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b3361261e856139b3565b6000816001600160a01b03166374ca6bf26040518163ffffffff1660e01b815260040160206040518083038186803b15801561265957600080fd5b505afa15801561266d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126919190614910565b90506000808267de0b6b3a7640000014156126fd57876040516020016126b79190614c73565b604051602081830303815290604052805190602001209150876040516020016126e09190614dbf565b604051602081830303815290604052805190602001209050612754565b8783604051602001612710929190614cb6565b604051602081830303815290604052805190602001209150878360405160200161273b929190614e02565b6040516020818303038152906040528051906020012090505b600061275f83613d82565b905061277083611cd083600161408b565b600060405160200161278190614b15565b60405160208183030381529060405280519060200120905060006127a482613d82565b90506127b582611cd083600161408b565b61091984886001600160a01b031663e71501346040518163ffffffff1660e01b815260040160206040518083038186803b1580156127f257600080fd5b505afa158015612806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282a9190614910565b613c59565b6000806128706040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663f3358a3a856040516020016123ed9190614a4c565b60006040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306129288260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b03161461298d576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b6040518060400160405280601181526020017f726f636b65744e6f64654465706f73697400000000000000000000000000000081525033612a218260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614612a86576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b6000612ac66040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b90506000612ad48d8d613069565b6040517f0871ffef0000000000000000000000000000000000000000000000000000000081529091506001600160a01b03821690630871ffef90612b1e908c908c90600401614f18565b600060405180830381600087803b158015612b3857600080fd5b505af1158015612b4c573d6000803e3d6000fd5b50505050612b5b818c8c613e39565b816001600160a01b03166388927166604051602001612b7990614c07565b60405160208183030381529060405280519060200120836040518363ffffffff1660e01b8152600401612bad929190614f01565b600060405180830381600087803b158015612bc757600080fd5b505af1158015612bdb573d6000803e3d6000fd5b50929f9e505050505050505050505050505050565b6000610501826040516020016104e69190614ad2565b600080612c476040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b604080518082018252600f81527f6d696e69706f6f6c732e696e6465780000000000000000000000000000000000602090910152517fc9d6fee90000000000000000000000000000000000000000000000000000000081529091506001600160a01b0382169063c9d6fee9906109b9907ffd351ca1580febcf3f7f5a9bf9fd8dff9e6da5ca4df400be6b63fcdc2f2a918490600401614ef8565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030612d758260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614612dda576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f8401528351602381850301815260439093019093528151910120612e33906138cd565b612e84576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b600033604051602001612e979190614b3e565b604051602081830303815290604052805190602001209050612eb8816138cd565b15612ede5760405162461bcd60e51b8152600401612ed590615012565b60405180910390fd5b612ee981600161437f565b612f1a85604051602001612efd9190614a8f565b604051602081830303815290604052805190602001206001613c59565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e7400000000000000602090910152612f7a7f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d26001613c59565b6000612f9086604051602001610a689190614a09565b905080612fb357612fac67de0b6b3a7640000061202588610a0f565b9050613037565b6000339050613033816001600160a01b031663e7e04aba6040518163ffffffff1660e01b815260040160206040518083038186803b158015612ff457600080fd5b505afa158015613008573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061302c9190614910565b8390613ddc565b9150505b61304b8660405160200161215d9190614a09565b505050505050565b600061050182604051602001610a689190614a8f565b60006040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306130ff8260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614613164576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b6040518060400160405280601181526020017f726f636b65744e6f64654465706f736974000000000000000000000000000000815250336131f88260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b03161461325d576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b600061329d6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b905060006132c260405180606001604052806021815260200161511a60219139613cc5565b905060006132ce6134ef565b9050816001600160a01b0316636d4f8d3d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561330957600080fd5b505afa15801561331d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133419190614910565b61334c82600161408b565b111561336a5760405162461bcd60e51b8152600401612ed590614fa4565b505060006133788989614451565b905061338e816040516020016121be9190614cfe565b816001600160a01b031663889271666040516020016133ac90614e4a565b60405160208183030381529060405280519060200120836040518363ffffffff1660e01b81526004016133e0929190614f01565b600060405180830381600087803b1580156133fa57600080fd5b505af115801561340e573d6000803e3d6000fd5b50505050816001600160a01b031663889271668a6040516020016134329190614bc4565b60405160208183030381529060405280519060200120836040518363ffffffff1660e01b8152600401613466929190614f01565b600060405180830381600087803b15801561348057600080fd5b505af1158015613494573d6000803e3d6000fd5b50505050886001600160a01b0316816001600160a01b03167f08b4b91bafaf992145c5dd7e098dfcdb32f879714c154c651c2758a44c7aeae4426040516134db9190614ef8565b60405180910390a398975050505050505050565b6000806135306040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b604080518082018252600f81527f6d696e69706f6f6c732e696e6465780000000000000000000000000000000000602090910152517fc9d6fee90000000000000000000000000000000000000000000000000000000081529091506000906001600160a01b0383169063c9d6fee9906135cd907ffd351ca1580febcf3f7f5a9bf9fd8dff9e6da5ca4df400be6b63fcdc2f2a918490600401614ef8565b60206040518083038186803b1580156135e557600080fd5b505afa1580156135f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361d9190614910565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e74000000000000006020909101529050600061367f7f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d2613d82565b905061368b8282613ddc565b935050505090565b6000610501826040516020016136a99190614d7a565b60405160208183030381529060405280519060200120613959565b6000806137056040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663f3358a3a60405160200161372590614c07565b60405160208183030381529060405280519060200120856040518363ffffffff1660e01b8152600401613759929190614f18565b60206040518083038186803b15801561377157600080fd5b505afa158015613785573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2391906146a1565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e740000000000000060209091015260006119cc7f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d2613d82565b60008061384a6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663f3358a3a60405160200161372590614e4a565b6000806138ab6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663c9d6fee984604051602001610ba19190614a4c565b60008060019054906101000a90046001600160a01b03166001600160a01b0316637ae1cfca836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561392757600080fd5b505afa15801561393b573d6000803e3d6000fd5b505050506040513d602081101561395157600080fd5b505192915050565b60008060019054906101000a90046001600160a01b03166001600160a01b03166321f8a721836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561392757600080fd5b60006139f36040518060400160405280601c81526020017f726f636b65744e6f64654469737472696275746f72466163746f727900000000815250613cc5565b90506000816001600160a01b031663fa2a5b01846040518263ffffffff1660e01b8152600401613a239190614e73565b60206040518083038186803b158015613a3b57600080fd5b505afa158015613a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a7391906146a1565b90506001600160a01b0381163115613bd4576000613ac56040518060400160405280601181526020017f726f636b65744e6f64654d616e61676572000000000000000000000000000000815250613cc5565b6040517f927ece4f0000000000000000000000000000000000000000000000000000000081529091506001600160a01b0382169063927ece4f90613b0d908790600401614e73565b60206040518083038186803b158015613b2557600080fd5b505afa158015613b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5d91906147f5565b613b795760405162461bcd60e51b8152600401612ed590614fdb565b6000829050806001600160a01b031663e4fc6b6d6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613bb957600080fd5b505af1158015613bcd573d6000803e3d6000fd5b5050505050505b505050565b60008054604080517febb9d8c9000000000000000000000000000000000000000000000000000000008152600481018690526024810185905290516101009092046001600160a01b03169263ebb9d8c99260448084019382900301818387803b158015613c4557600080fd5b505af115801561304b573d6000803e3d6000fd5b60008054604080517fadb353dc000000000000000000000000000000000000000000000000000000008152600481018690526024810185905290516101009092046001600160a01b03169263adb353dc9260448084019382900301818387803b158015613c4557600080fd5b600080613d258360405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b90506001600160a01b038116610501576040805162461bcd60e51b815260206004820152601260248201527f436f6e7472616374206e6f7420666f756e640000000000000000000000000000604482015290519081900360640190fd5b60008060019054906101000a90046001600160a01b03166001600160a01b031663bd02d0f5836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561392757600080fd5b600082821115613e33576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60006001600160a01b0316613e8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061369392505050565b6001600160a01b031614613ea95760405162461bcd60e51b8152600401612ed590614f6d565b6000613ee96040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b905060008490506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b815260040160206040518083038186803b158015613f2b57600080fd5b505afa158015613f3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f6391906146a1565b9050613fcb86604051602001613f799190614c30565b6040516020818303038152906040528051906020012086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061450a92505050565b613ffd8585604051602001613fe1929190614d41565b60405160208183030381529060405280519060200120876145cf565b826001600160a01b031663889271668260405160200161401d9190614a4c565b60405160208183030381529060405280519060200120886040518363ffffffff1660e01b8152600401614051929190614f01565b600060405180830381600087803b15801561406b57600080fd5b505af115801561407f573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610c23576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008054604080517fc031a1800000000000000000000000000000000000000000000000000000000081526004810185905290516060936101009093046001600160a01b03169263c031a1809260248082019391829003018186803b15801561414d57600080fd5b505afa158015614161573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561418a57600080fd5b81019080805160405193929190846401000000008211156141aa57600080fd5b9083019060208201858111156141bf57600080fd5b82516401000000008111828201881017156141d957600080fd5b82525081516020918201929091019080838360005b838110156142065781810151838201526020016141ee565b50505050905090810190601f1680156142335780820380516001836020036101000a031916815260200191505b506040525050509050919050565b60008054604080517f0e14a3760000000000000000000000000000000000000000000000000000000081526004810185905290516101009092046001600160a01b031692630e14a3769260248084019382900301818387803b1580156142a657600080fd5b505af1158015610e58573d6000803e3d6000fd5b60008054604080517fe2a4853a000000000000000000000000000000000000000000000000000000008152600481018690526024810185905290516101009092046001600160a01b03169263e2a4853a9260448084019382900301818387803b158015613c4557600080fd5b60008261433557506000610ca4565b8282028284828161434257fe5b0414610c235760405162461bcd60e51b815260040180806020018281038252602181526020018061513b6021913960400191505060405180910390fd5b60008054604080517fabfdcced00000000000000000000000000000000000000000000000000000000815260048101869052841515602482015290516101009092046001600160a01b03169263abfdcced9260448084019382900301818387803b158015613c4557600080fd5b60008054604080517f616b59f60000000000000000000000000000000000000000000000000000000081526004810185905290516101009092046001600160a01b03169263616b59f69260248084019382900301818387803b1580156142a657600080fd5b6000806144926040518060400160405280601581526020017f726f636b65744d696e69706f6f6c466163746f72790000000000000000000000815250613cc5565b6040517fa2d41d600000000000000000000000000000000000000000000000000000000081529091506001600160a01b0382169063a2d41d60906144dc9087908790600401614e87565b602060405180830381600087803b1580156144f657600080fd5b505af115801561244d573d6000803e3d6000fd5b600060019054906101000a90046001600160a01b03166001600160a01b0316632e28d08483836040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561458257818101518382015260200161456a565b50505050905090810190601f1680156145af5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015613c4557600080fd5b60008054604080517fca446dd9000000000000000000000000000000000000000000000000000000008152600481018690526001600160a01b03858116602483015291516101009093049091169263ca446dd99260448084019382900301818387803b158015613c4557600080fd5b60008083601f84011261464f578182fd5b50813567ffffffffffffffff811115614666578182fd5b60208301915083602082850101111561467e57600080fd5b9250929050565b600060208284031215614696578081fd5b8135610c23816150f4565b6000602082840312156146b2578081fd5b8151610c23816150f4565b600080604083850312156146cf578081fd5b82356146da816150f4565b946020939093013593505050565b60008060008060008060a08789031215614700578182fd5b863561470b816150f4565b955060208701359450604087013567ffffffffffffffff81111561472d578283fd5b61473989828a0161463e565b979a9699509760608101359660809091013595509350505050565b60006020808385031215614766578182fd5b825167ffffffffffffffff8082111561477d578384fd5b818501915085601f830112614790578384fd5b81518181111561479c57fe5b83810291506147ac8483016150a0565b8181528481019084860184860187018a10156147c6578788fd5b8795505b838610156147e85780518352600195909501949186019186016147ca565b5098975050505050505050565b600060208284031215614806578081fd5b81518015158114610c23578182fd5b60008060208385031215614827578182fd5b823567ffffffffffffffff81111561483d578283fd5b6148498582860161463e565b90969095509350505050565b60006020808385031215614867578182fd5b823567ffffffffffffffff8082111561487e578384fd5b818501915085601f830112614891578384fd5b81358181111561489d57fe5b6148af84601f19601f840116016150a0565b915080825286848285010111156148c4578485fd5b80848401858401378101909201929092529392505050565b6000602082840312156148ed578081fd5b8151610c238161510c565b600060208284031215614909578081fd5b5035919050565b600060208284031215614921578081fd5b5051919050565b6000806040838503121561493a578182fd5b50508035926020909101359150565b6000806000806080858703121561495e578182fd5b5050823594602084013594506040840135936060013592509050565b60006020828403121561498b578081fd5b815160ff81168114610c23578182fd5b7fff000000000000000000000000000000000000000000000000000000000000009390931683527fffffffffffffffffffffff00000000000000000000000000000000000000000091909116600183015260601b6bffffffffffffffffffffffff1916600c82015260200190565b7f6574682e6d6174636865642e6e6f64652e616d6f756e74000000000000000000815260609190911b6bffffffffffffffffffffffff19166017820152602b0190565b7f6e6f64652e6d696e69706f6f6c732e76616c69646174696e672e696e64657800815260609190911b6bffffffffffffffffffffffff1916601f82015260330190565b7f6e6f64652e6d696e69706f6f6c732e66696e616c697365642e636f756e740000815260609190911b6bffffffffffffffffffffffff1916601e82015260320190565b7f6d696e69706f6f6c2e64657374726f7965640000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916601282015260260190565b7f6d696e69706f6f6c732e7374616b696e672e636f756e74000000000000000000815260170190565b7f6e6f64652e6d696e69706f6f6c732e66696e616c697365640000000000000000815260609190911b6bffffffffffffffffffffffff19166018820152602c0190565b7f6d696e69706f6f6c2e72706c2e736c6173686564000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916601482015260280190565b7f6e6f64652e6d696e69706f6f6c732e696e646578000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916601482015260280190565b7f6d696e69706f6f6c732e766163616e742e696e64657800000000000000000000815260160190565b7f6d696e69706f6f6c2e7075626b65790000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b7f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e7400000000815260609190911b6bffffffffffffffffffffffff1916601c82015260300190565b7f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e7400000000815260609290921b6bffffffffffffffffffffffff1916601c830152603082015260500190565b7f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b60007f76616c696461746f722e6d696e69706f6f6c00000000000000000000000000008252828460128401379101601201908152919050565b60007f76616c696461746f722e6d696e69706f6f6c000000000000000000000000000082528251614db28160128501602087016150c4565b9190910160120192915050565b7f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000815260609190911b6bffffffffffffffffffffffff1916601a820152602e0190565b7f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000815260609290921b6bffffffffffffffffffffffff1916601a830152602e820152604e0190565b7f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015614ee15783516001600160a01b031683529284019291840191600101614ebc565b50909695505050505050565b901515815260200190565b90815260200190565b9182526001600160a01b0316602082015260400190565b918252602082015260400190565b6000602082528251806020840152614f458160408501602087016150c4565b601f01601f19169190910160400192915050565b6020810160058310614f6757fe5b91905290565b6020808252601a908201527f56616c696461746f72207075626b657920697320696e20757365000000000000604082015260600190565b6020808252601d908201527f476c6f62616c206d696e69706f6f6c206c696d69742072656163686564000000604082015260600190565b6020808252601b908201527f4469737472696275746f72206e6f7420696e697469616c697365640000000000604082015260600190565b60208082526023908201527f4d696e69706f6f6c2068617320616c7265616479206265656e2066696e616c6960408201527f7365640000000000000000000000000000000000000000000000000000000000606082015260800190565b948552602085019390935260408401919091526060830152608082015260a00190565b60ff91909116815260200190565b60405181810167ffffffffffffffff811182821017156150bc57fe5b604052919050565b60005b838110156150df5781810151838201526020016150c7565b838111156150ee576000848401525b50505050565b6001600160a01b038116811461510957600080fd5b50565b6005811061510957600080fdfe726f636b657444414f50726f746f636f6c53657474696e67734d696e69706f6f6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212204d0dc5c8ae87aa4838e2885f1075e64197c76a6cdc4b97520d0f957944e2e34364736f6c63430007060033000000000000000000000000594fb75d3dc2dfa0150ad03f99f97817747dd4e1
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102265760003560e01c806375b59c7f1161012a578063b04e8868116100bd578063cf6a47631161008c578063d1ea6ce011610071578063d1ea6ce0146104a2578063eff7319f146104aa578063f90267c4146104bd57610226565b8063cf6a47631461047c578063d14019911461048f57610226565b8063b04e88681461043b578063b88a89f71461044e578063c64372bb14610461578063ce9b79ad1461047457610226565b80639da0700f116100f95780639da0700f146103fa578063a179778b1461040d578063a757987a14610420578063ae4d0bed1461043357610226565b806375b59c7f146103ac5780637bb40aaf146103bf5780638b300029146103c75780639907288c146103e757610226565b80633b5ecefa116101bd57806357b4ef6b1161018c5780635ea1a6e2116101715780635ea1a6e214610371578063606bb62e1461039157806367bca235146103a457610226565b806357b4ef6b1461033e5780635dfef9651461035157610226565b80633b5ecefa146102ea5780633eb535e91461030e57806344e51a031461032157806354fd4d501461032957610226565b80631ce9ec33116101f95780631ce9ec3314610291578063240eb330146102a45780632c7f64d4146102b75780632cb76c37146102ca57610226565b80630c21b8a71461022b5780630fcc8178146102545780631286377e146102695780631844ec011461027e575b600080fd5b61023e610239366004614685565b6104d0565b60405161024b9190614eed565b60405180910390f35b610267610262366004614949565b610509565b005b610271610926565b60405161024b9190614ef8565b61027161028c366004614685565b610a0f565b61027161029f366004614685565b610b3e565b6102716102b23660046146bd565b610c2a565b6102676102c5366004614815565b610caa565b6102dd6102d8366004614685565b610e5f565b60405161024b9190614f26565b6102fd6102f8366004614928565b610eae565b60405161024b95949392919061506f565b6102dd61031c366004614685565b611119565b61026761114a565b6103316113ef565b60405161024b9190615092565b61027161034c366004614685565b6113f8565b61036461035f366004614928565b6114fb565b60405161024b9190614ea0565b61038461037f366004614685565b61175a565b60405161024b9190614f59565b61023e61039f366004614685565b611956565b61027161196c565b6102676103ba366004614685565b6119d1565b610267611d94565b6103da6103d53660046146bd565b61238a565b60405161024b9190614e73565b6102676103f5366004614685565b612471565b6103da6104083660046146bd565b61282f565b6103da61041b3660046146e8565b612892565b61023e61042e366004614685565b612bf0565b610271612c06565b610267610449366004614685565b612ce1565b61027161045c366004614685565b613053565b6103da61046f3660046146bd565b613069565b6102716134ef565b6103da61048a366004614855565b613693565b6103da61049d3660046148f8565b6136c4565b6102716137a9565b6103da6104b83660046148f8565b613809565b6102716104cb366004614685565b61386a565b6000610501826040516020016104e69190614b81565b604051602081830303815290604052805190602001206138cd565b90505b919050565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306105de8260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083835b6020831061059e5780518252601f19909201916020918201910161057f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120613959565b6001600160a01b0316816001600160a01b031614610643576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f840152835160238185030181526043909301909352815191012061069c906138cd565b6106ed576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b60008060003390506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076891906146a1565b9050610773816139b3565b8a67de0b6b3a7640000014156107da57806040516020016107949190614c73565b604051602081830303815290604052805190602001209350806040516020016107bd9190614dbf565b604051602081830303815290604052805190602001209250610831565b808b6040516020016107ed929190614cb6565b604051602081830303815290604052805190602001209350808b604051602001610818929190614e02565b6040516020818303038152906040528051906020012092505b61083c846001613bd9565b610846838a613bd9565b8967de0b6b3a7640000014156108ad57806040516020016108679190614c73565b604051602081830303815290604052805190602001209350806040516020016108909190614dbf565b604051602081830303815290604052805190602001209250610904565b808a6040516020016108c0929190614cb6565b604051602081830303815290604052805190602001209350808a6040516020016108eb929190614e02565b6040516020818303038152906040528051906020012092505b61090f846001613c59565b6109198389613c59565b5050505050505050505050565b6000806109676040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663c9d6fee960405160200161098790614c07565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016109b99190614ef8565b60206040518083038186803b1580156109d157600080fd5b505afa1580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a099190614910565b91505090565b600080610a506040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b90506000610a8384604051602001610a689190614a8f565b60405160208183030381529060405280519060200120613d82565b90506000826001600160a01b031663c9d6fee986604051602001610aa79190614bc4565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610ad99190614ef8565b60206040518083038186803b158015610af157600080fd5b505afa158015610b05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b299190614910565b9050610b358183613ddc565b95945050505050565b600080610b7f6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663c9d6fee984604051602001610ba19190614bc4565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610bd39190614ef8565b60206040518083038186803b158015610beb57600080fd5b505afa158015610bff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c239190614910565b9392505050565b6000808267de0b6b3a764000001415610c6b5783604051602001610c4e9190614c73565b604051602081830303815290604052805190602001209050610c97565b8383604051602001610c7e929190614cb6565b6040516020818303038152906040528051906020012090505b610ca081613d82565b9150505b92915050565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030610d3e8260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614610da3576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f8401528351602381850301815260439093019093528151910120610dfc906138cd565b610e4d576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b610e58338686613e39565b5050505050565b604051606090610e98907f010000000000000000000000000000000000000000000000000000000000000090600090859060200161499b565b6040516020818303038152906040529050919050565b600080600080600080610ef56040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b90506000604051602001610f0890614e4a565b6040516020818303038152906040528051906020012090506000610f2a612c06565b90506000610f388b8b61408b565b905081811180610f46575089155b15610f4e5750805b8a5b8181101561110a576040517ff3358a3a0000000000000000000000000000000000000000000000000000000081526000906001600160a01b0387169063f3358a3a90610fa29088908690600401614f18565b60206040518083038186803b158015610fba57600080fd5b505afa158015610fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff291906146a1565b90506000816001600160a01b0316634e69d5606040518163ffffffff1660e01b815260040160206040518083038186803b15801561102f57600080fd5b505afa158015611043573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106791906148dc565b9050600081600481111561107757fe5b1415611088576001909b019a611100565b600181600481111561109657fe5b14156110a7576001909a0199611100565b60028160048111156110b557fe5b14156110c657600190990198611100565b60038160048111156110d457fe5b14156110e557600190980197611100565b60048160048111156110f357fe5b1415611100576001909701965b5050600101610f50565b50505050509295509295909350565b60606105018260405160200161112f9190614c30565b604051602081830303815290604052805190602001206140e5565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306111de8260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614611243576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f840152835160238185030181526043909301909352815191012061129c906138cd565b6112ed576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b600061132d6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663f79b36ad60405160200161134d90614c07565b60405160208183030381529060405280519060200120336040518363ffffffff1660e01b8152600401611381929190614f01565b600060405180830381600087803b15801561139b57600080fd5b505af11580156113af573d6000803e3d6000fd5b5050505060006113be33611119565b9050610e58816040516020016113d49190614d7a565b60405160208183030381529060405280519060200120614241565b60005460ff1681565b6000806114396040518060400160405280601181526020017f726f636b65744e6f64654465706f736974000000000000000000000000000000815250613cc5565b90506000816001600160a01b0316639bed5a456040518163ffffffff1660e01b815260040160006040518083038186803b15801561147657600080fd5b505afa15801561148a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114b29190810190614754565b90506000805b82518110156114f2576114e86114e1878584815181106114d457fe5b6020026020010151610c2a565b839061408b565b91506001016114b8565b50949350505050565b6060600061153d6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050600060405160200161155090614e4a565b6040516020818303038152906040528051906020012090506000611572612c06565b90506000611580878761408b565b90508181118061158e575085155b156115965750805b60006115a28289613ddc565b67ffffffffffffffff811180156115b857600080fd5b506040519080825280602002602001820160405280156115e2578160200160208202803683370190505b5090506000885b8381101561174c576040517ff3358a3a0000000000000000000000000000000000000000000000000000000081526000906001600160a01b0389169063f3358a3a9061163b908a908690600401614f18565b60206040518083038186803b15801561165357600080fd5b505afa158015611667573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168b91906146a1565b90506000816001600160a01b0316634e69d5606040518163ffffffff1660e01b815260040160206040518083038186803b1580156116c857600080fd5b505afa1580156116dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170091906148dc565b9050600181600481111561171057fe5b1415611742578185858151811061172357fe5b6001600160a01b03909216602092830291909101909101526001909301925b50506001016115e9565b508152979650505050505050565b600080829050600060019050816001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160206040518083038186803b15801561179f57600080fd5b505afa9250505080156117cf575060408051601f3d908101601f191682019092526117cc9181019061497a565b60015b611809573d8080156117fd576040519150601f19603f3d011682016040523d82523d6000602084013e611802565b606091505b505061180c565b90505b8060ff166001148061182157508060ff166002145b156118dd57816001600160a01b0316635abd37e46175306040518263ffffffff1660e01b815260040160206040518083038187803b15801561186257600080fd5b5086fa93505050508015611893575060408051601f3d908101601f19168201909252611890918101906148dc565b60015b6118d3573d8080156118c1576040519150601f19603f3d011682016040523d82523d6000602084013e6118c6565b606091505b5060049350505050610504565b9250610504915050565b816001600160a01b0316635abd37e46040518163ffffffff1660e01b815260040160206040518083038186803b15801561191657600080fd5b505afa15801561192a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194e91906148dc565b949350505050565b6000610501826040516020016104e69190614cfe565b60408051808201909152601781527f6d696e69706f6f6c732e7374616b696e672e636f756e7400000000000000000060209091015260006119cc7f3441dc4461171402746c7de6880184ae1bfbc9def01a5bd7508263456c144419613d82565b905090565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030611a658260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614611aca576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f8401528351602381850301815260439093019093528151910120611b23906138cd565b611b74576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b33611b7e856139b3565b6000816001600160a01b03166374ca6bf26040518163ffffffff1660e01b815260040160206040518083038186803b158015611bb957600080fd5b505afa158015611bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf19190614910565b90506000808267de0b6b3a764000001415611c5d5787604051602001611c179190614c73565b60405160208183030381529060405280519060200120915087604051602001611c409190614dbf565b604051602081830303815290604052805190602001209050611cb4565b8783604051602001611c70929190614cb6565b6040516020818303038152906040528051906020012091508783604051602001611c9b929190614e02565b6040516020818303038152906040528051906020012090505b6000611cbf83613d82565b9050611cd583611cd0836001613ddc565b6142ba565b6000604051602001611ce690614b15565b6040516020818303038152906040528051906020012090506000611d0982613d82565b9050611d1a82611cd0836001613ddc565b61091984886001600160a01b031663e71501346040518163ffffffff1660e01b815260040160206040518083038186803b158015611d5757600080fd5b505afa158015611d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8f9190614910565b613bd9565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030611e288260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614611e8d576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f8401528351602381850301815260439093019093528151910120611ee6906138cd565b611f37576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b6000611f776040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b905060003390506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b815260040160206040518083038186803b158015611fb957600080fd5b505afa158015611fcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff191906146a1565b9050600061200982604051602001610a689190614a09565b90508061202e5761202b67de0b6b3a7640000061202584610a0f565b90614326565b90505b6004836001600160a01b0316635abd37e46040518163ffffffff1660e01b815260040160206040518083038186803b15801561206957600080fd5b505afa15801561207d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a191906148dc565b60048111156120ac57fe5b14156121345761212d836001600160a01b031663e7e04aba6040518163ffffffff1660e01b815260040160206040518083038186803b1580156120ee57600080fd5b505afa158015612102573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121269190614910565b8290613ddc565b9050612149565b6121468167de0b6b3a76400000613ddc565b90505b6121798260405160200161215d9190614a09565b60405160208183030381529060405280519060200120826142ba565b6121aa3360405160200161218d9190614cfe565b60405160208183030381529060405280519060200120600061437f565b6121db336040516020016121be9190614ad2565b60405160208183030381529060405280519060200120600161437f565b836001600160a01b031663f79b36ad6040516020016121f990614e4a565b60405160208183030381529060405280519060200120336040518363ffffffff1660e01b815260040161222d929190614f01565b600060405180830381600087803b15801561224757600080fd5b505af115801561225b573d6000803e3d6000fd5b50505050836001600160a01b031663f79b36ad8360405160200161227f9190614bc4565b60405160208183030381529060405280519060200120336040518363ffffffff1660e01b81526004016122b3929190614f01565b600060405180830381600087803b1580156122cd57600080fd5b505af11580156122e1573d6000803e3d6000fd5b5050505060006122f033611119565b9050612321336040516020016123069190614c30565b604051602081830303815290604052805190602001206143ec565b612335816040516020016113d49190614d7a565b826001600160a01b0316336001600160a01b03167f3097cb0f536cd88115b814915d7030d2fe958943357cd2b1a9e1dba8a673ec69426040516123789190614ef8565b60405180910390a35050505050505050565b6000806123cb6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663f3358a3a856040516020016123ed9190614bc4565b60405160208183030381529060405280519060200120856040518363ffffffff1660e01b8152600401612421929190614f18565b60206040518083038186803b15801561243957600080fd5b505afa15801561244d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca091906146a1565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306125058260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b03161461256a576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f84015283516023818503018152604390930190935281519101206125c3906138cd565b612614576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b3361261e856139b3565b6000816001600160a01b03166374ca6bf26040518163ffffffff1660e01b815260040160206040518083038186803b15801561265957600080fd5b505afa15801561266d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126919190614910565b90506000808267de0b6b3a7640000014156126fd57876040516020016126b79190614c73565b604051602081830303815290604052805190602001209150876040516020016126e09190614dbf565b604051602081830303815290604052805190602001209050612754565b8783604051602001612710929190614cb6565b604051602081830303815290604052805190602001209150878360405160200161273b929190614e02565b6040516020818303038152906040528051906020012090505b600061275f83613d82565b905061277083611cd083600161408b565b600060405160200161278190614b15565b60405160208183030381529060405280519060200120905060006127a482613d82565b90506127b582611cd083600161408b565b61091984886001600160a01b031663e71501346040518163ffffffff1660e01b815260040160206040518083038186803b1580156127f257600080fd5b505afa158015612806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282a9190614910565b613c59565b6000806128706040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663f3358a3a856040516020016123ed9190614a4c565b60006040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306129288260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b03161461298d576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b6040518060400160405280601181526020017f726f636b65744e6f64654465706f73697400000000000000000000000000000081525033612a218260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614612a86576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b6000612ac66040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b90506000612ad48d8d613069565b6040517f0871ffef0000000000000000000000000000000000000000000000000000000081529091506001600160a01b03821690630871ffef90612b1e908c908c90600401614f18565b600060405180830381600087803b158015612b3857600080fd5b505af1158015612b4c573d6000803e3d6000fd5b50505050612b5b818c8c613e39565b816001600160a01b03166388927166604051602001612b7990614c07565b60405160208183030381529060405280519060200120836040518363ffffffff1660e01b8152600401612bad929190614f01565b600060405180830381600087803b158015612bc757600080fd5b505af1158015612bdb573d6000803e3d6000fd5b50929f9e505050505050505050505050505050565b6000610501826040516020016104e69190614ad2565b600080612c476040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b604080518082018252600f81527f6d696e69706f6f6c732e696e6465780000000000000000000000000000000000602090910152517fc9d6fee90000000000000000000000000000000000000000000000000000000081529091506001600160a01b0382169063c9d6fee9906109b9907ffd351ca1580febcf3f7f5a9bf9fd8dff9e6da5ca4df400be6b63fcdc2f2a918490600401614ef8565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030612d758260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614612dda576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f8401528351602381850301815260439093019093528151910120612e33906138cd565b612e84576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b600033604051602001612e979190614b3e565b604051602081830303815290604052805190602001209050612eb8816138cd565b15612ede5760405162461bcd60e51b8152600401612ed590615012565b60405180910390fd5b612ee981600161437f565b612f1a85604051602001612efd9190614a8f565b604051602081830303815290604052805190602001206001613c59565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e7400000000000000602090910152612f7a7f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d26001613c59565b6000612f9086604051602001610a689190614a09565b905080612fb357612fac67de0b6b3a7640000061202588610a0f565b9050613037565b6000339050613033816001600160a01b031663e7e04aba6040518163ffffffff1660e01b815260040160206040518083038186803b158015612ff457600080fd5b505afa158015613008573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061302c9190614910565b8390613ddc565b9150505b61304b8660405160200161215d9190614a09565b505050505050565b600061050182604051602001610a689190614a8f565b60006040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306130ff8260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b031614613164576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b6040518060400160405280601181526020017f726f636b65744e6f64654465706f736974000000000000000000000000000000815250336131f88260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b6001600160a01b0316816001600160a01b03161461325d576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b600061329d6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b905060006132c260405180606001604052806021815260200161511a60219139613cc5565b905060006132ce6134ef565b9050816001600160a01b0316636d4f8d3d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561330957600080fd5b505afa15801561331d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133419190614910565b61334c82600161408b565b111561336a5760405162461bcd60e51b8152600401612ed590614fa4565b505060006133788989614451565b905061338e816040516020016121be9190614cfe565b816001600160a01b031663889271666040516020016133ac90614e4a565b60405160208183030381529060405280519060200120836040518363ffffffff1660e01b81526004016133e0929190614f01565b600060405180830381600087803b1580156133fa57600080fd5b505af115801561340e573d6000803e3d6000fd5b50505050816001600160a01b031663889271668a6040516020016134329190614bc4565b60405160208183030381529060405280519060200120836040518363ffffffff1660e01b8152600401613466929190614f01565b600060405180830381600087803b15801561348057600080fd5b505af1158015613494573d6000803e3d6000fd5b50505050886001600160a01b0316816001600160a01b03167f08b4b91bafaf992145c5dd7e098dfcdb32f879714c154c651c2758a44c7aeae4426040516134db9190614ef8565b60405180910390a398975050505050505050565b6000806135306040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b604080518082018252600f81527f6d696e69706f6f6c732e696e6465780000000000000000000000000000000000602090910152517fc9d6fee90000000000000000000000000000000000000000000000000000000081529091506000906001600160a01b0383169063c9d6fee9906135cd907ffd351ca1580febcf3f7f5a9bf9fd8dff9e6da5ca4df400be6b63fcdc2f2a918490600401614ef8565b60206040518083038186803b1580156135e557600080fd5b505afa1580156135f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361d9190614910565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e74000000000000006020909101529050600061367f7f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d2613d82565b905061368b8282613ddc565b935050505090565b6000610501826040516020016136a99190614d7a565b60405160208183030381529060405280519060200120613959565b6000806137056040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663f3358a3a60405160200161372590614c07565b60405160208183030381529060405280519060200120856040518363ffffffff1660e01b8152600401613759929190614f18565b60206040518083038186803b15801561377157600080fd5b505afa158015613785573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2391906146a1565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e740000000000000060209091015260006119cc7f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d2613d82565b60008061384a6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663f3358a3a60405160200161372590614e4a565b6000806138ab6040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b9050806001600160a01b031663c9d6fee984604051602001610ba19190614a4c565b60008060019054906101000a90046001600160a01b03166001600160a01b0316637ae1cfca836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561392757600080fd5b505afa15801561393b573d6000803e3d6000fd5b505050506040513d602081101561395157600080fd5b505192915050565b60008060019054906101000a90046001600160a01b03166001600160a01b03166321f8a721836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561392757600080fd5b60006139f36040518060400160405280601c81526020017f726f636b65744e6f64654469737472696275746f72466163746f727900000000815250613cc5565b90506000816001600160a01b031663fa2a5b01846040518263ffffffff1660e01b8152600401613a239190614e73565b60206040518083038186803b158015613a3b57600080fd5b505afa158015613a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a7391906146a1565b90506001600160a01b0381163115613bd4576000613ac56040518060400160405280601181526020017f726f636b65744e6f64654d616e61676572000000000000000000000000000000815250613cc5565b6040517f927ece4f0000000000000000000000000000000000000000000000000000000081529091506001600160a01b0382169063927ece4f90613b0d908790600401614e73565b60206040518083038186803b158015613b2557600080fd5b505afa158015613b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5d91906147f5565b613b795760405162461bcd60e51b8152600401612ed590614fdb565b6000829050806001600160a01b031663e4fc6b6d6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613bb957600080fd5b505af1158015613bcd573d6000803e3d6000fd5b5050505050505b505050565b60008054604080517febb9d8c9000000000000000000000000000000000000000000000000000000008152600481018690526024810185905290516101009092046001600160a01b03169263ebb9d8c99260448084019382900301818387803b158015613c4557600080fd5b505af115801561304b573d6000803e3d6000fd5b60008054604080517fadb353dc000000000000000000000000000000000000000000000000000000008152600481018690526024810185905290516101009092046001600160a01b03169263adb353dc9260448084019382900301818387803b158015613c4557600080fd5b600080613d258360405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083836020831061059e5780518252601f19909201916020918201910161057f565b90506001600160a01b038116610501576040805162461bcd60e51b815260206004820152601260248201527f436f6e7472616374206e6f7420666f756e640000000000000000000000000000604482015290519081900360640190fd5b60008060019054906101000a90046001600160a01b03166001600160a01b031663bd02d0f5836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561392757600080fd5b600082821115613e33576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60006001600160a01b0316613e8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061369392505050565b6001600160a01b031614613ea95760405162461bcd60e51b8152600401612ed590614f6d565b6000613ee96040518060400160405280601181526020017f6164647265737353657453746f72616765000000000000000000000000000000815250613cc5565b905060008490506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b815260040160206040518083038186803b158015613f2b57600080fd5b505afa158015613f3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f6391906146a1565b9050613fcb86604051602001613f799190614c30565b6040516020818303038152906040528051906020012086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061450a92505050565b613ffd8585604051602001613fe1929190614d41565b60405160208183030381529060405280519060200120876145cf565b826001600160a01b031663889271668260405160200161401d9190614a4c565b60405160208183030381529060405280519060200120886040518363ffffffff1660e01b8152600401614051929190614f01565b600060405180830381600087803b15801561406b57600080fd5b505af115801561407f573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610c23576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008054604080517fc031a1800000000000000000000000000000000000000000000000000000000081526004810185905290516060936101009093046001600160a01b03169263c031a1809260248082019391829003018186803b15801561414d57600080fd5b505afa158015614161573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561418a57600080fd5b81019080805160405193929190846401000000008211156141aa57600080fd5b9083019060208201858111156141bf57600080fd5b82516401000000008111828201881017156141d957600080fd5b82525081516020918201929091019080838360005b838110156142065781810151838201526020016141ee565b50505050905090810190601f1680156142335780820380516001836020036101000a031916815260200191505b506040525050509050919050565b60008054604080517f0e14a3760000000000000000000000000000000000000000000000000000000081526004810185905290516101009092046001600160a01b031692630e14a3769260248084019382900301818387803b1580156142a657600080fd5b505af1158015610e58573d6000803e3d6000fd5b60008054604080517fe2a4853a000000000000000000000000000000000000000000000000000000008152600481018690526024810185905290516101009092046001600160a01b03169263e2a4853a9260448084019382900301818387803b158015613c4557600080fd5b60008261433557506000610ca4565b8282028284828161434257fe5b0414610c235760405162461bcd60e51b815260040180806020018281038252602181526020018061513b6021913960400191505060405180910390fd5b60008054604080517fabfdcced00000000000000000000000000000000000000000000000000000000815260048101869052841515602482015290516101009092046001600160a01b03169263abfdcced9260448084019382900301818387803b158015613c4557600080fd5b60008054604080517f616b59f60000000000000000000000000000000000000000000000000000000081526004810185905290516101009092046001600160a01b03169263616b59f69260248084019382900301818387803b1580156142a657600080fd5b6000806144926040518060400160405280601581526020017f726f636b65744d696e69706f6f6c466163746f72790000000000000000000000815250613cc5565b6040517fa2d41d600000000000000000000000000000000000000000000000000000000081529091506001600160a01b0382169063a2d41d60906144dc9087908790600401614e87565b602060405180830381600087803b1580156144f657600080fd5b505af115801561244d573d6000803e3d6000fd5b600060019054906101000a90046001600160a01b03166001600160a01b0316632e28d08483836040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561458257818101518382015260200161456a565b50505050905090810190601f1680156145af5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015613c4557600080fd5b60008054604080517fca446dd9000000000000000000000000000000000000000000000000000000008152600481018690526001600160a01b03858116602483015291516101009093049091169263ca446dd99260448084019382900301818387803b158015613c4557600080fd5b60008083601f84011261464f578182fd5b50813567ffffffffffffffff811115614666578182fd5b60208301915083602082850101111561467e57600080fd5b9250929050565b600060208284031215614696578081fd5b8135610c23816150f4565b6000602082840312156146b2578081fd5b8151610c23816150f4565b600080604083850312156146cf578081fd5b82356146da816150f4565b946020939093013593505050565b60008060008060008060a08789031215614700578182fd5b863561470b816150f4565b955060208701359450604087013567ffffffffffffffff81111561472d578283fd5b61473989828a0161463e565b979a9699509760608101359660809091013595509350505050565b60006020808385031215614766578182fd5b825167ffffffffffffffff8082111561477d578384fd5b818501915085601f830112614790578384fd5b81518181111561479c57fe5b83810291506147ac8483016150a0565b8181528481019084860184860187018a10156147c6578788fd5b8795505b838610156147e85780518352600195909501949186019186016147ca565b5098975050505050505050565b600060208284031215614806578081fd5b81518015158114610c23578182fd5b60008060208385031215614827578182fd5b823567ffffffffffffffff81111561483d578283fd5b6148498582860161463e565b90969095509350505050565b60006020808385031215614867578182fd5b823567ffffffffffffffff8082111561487e578384fd5b818501915085601f830112614891578384fd5b81358181111561489d57fe5b6148af84601f19601f840116016150a0565b915080825286848285010111156148c4578485fd5b80848401858401378101909201929092529392505050565b6000602082840312156148ed578081fd5b8151610c238161510c565b600060208284031215614909578081fd5b5035919050565b600060208284031215614921578081fd5b5051919050565b6000806040838503121561493a578182fd5b50508035926020909101359150565b6000806000806080858703121561495e578182fd5b5050823594602084013594506040840135936060013592509050565b60006020828403121561498b578081fd5b815160ff81168114610c23578182fd5b7fff000000000000000000000000000000000000000000000000000000000000009390931683527fffffffffffffffffffffff00000000000000000000000000000000000000000091909116600183015260601b6bffffffffffffffffffffffff1916600c82015260200190565b7f6574682e6d6174636865642e6e6f64652e616d6f756e74000000000000000000815260609190911b6bffffffffffffffffffffffff19166017820152602b0190565b7f6e6f64652e6d696e69706f6f6c732e76616c69646174696e672e696e64657800815260609190911b6bffffffffffffffffffffffff1916601f82015260330190565b7f6e6f64652e6d696e69706f6f6c732e66696e616c697365642e636f756e740000815260609190911b6bffffffffffffffffffffffff1916601e82015260320190565b7f6d696e69706f6f6c2e64657374726f7965640000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916601282015260260190565b7f6d696e69706f6f6c732e7374616b696e672e636f756e74000000000000000000815260170190565b7f6e6f64652e6d696e69706f6f6c732e66696e616c697365640000000000000000815260609190911b6bffffffffffffffffffffffff19166018820152602c0190565b7f6d696e69706f6f6c2e72706c2e736c6173686564000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916601482015260280190565b7f6e6f64652e6d696e69706f6f6c732e696e646578000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916601482015260280190565b7f6d696e69706f6f6c732e766163616e742e696e64657800000000000000000000815260160190565b7f6d696e69706f6f6c2e7075626b65790000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b7f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e7400000000815260609190911b6bffffffffffffffffffffffff1916601c82015260300190565b7f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e7400000000815260609290921b6bffffffffffffffffffffffff1916601c830152603082015260500190565b7f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b60007f76616c696461746f722e6d696e69706f6f6c00000000000000000000000000008252828460128401379101601201908152919050565b60007f76616c696461746f722e6d696e69706f6f6c000000000000000000000000000082528251614db28160128501602087016150c4565b9190910160120192915050565b7f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000815260609190911b6bffffffffffffffffffffffff1916601a820152602e0190565b7f6e6f64652e617665726167652e6665652e6e756d657261746f72000000000000815260609290921b6bffffffffffffffffffffffff1916601a830152602e820152604e0190565b7f6d696e69706f6f6c732e696e64657800000000000000000000000000000000008152600f0190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015614ee15783516001600160a01b031683529284019291840191600101614ebc565b50909695505050505050565b901515815260200190565b90815260200190565b9182526001600160a01b0316602082015260400190565b918252602082015260400190565b6000602082528251806020840152614f458160408501602087016150c4565b601f01601f19169190910160400192915050565b6020810160058310614f6757fe5b91905290565b6020808252601a908201527f56616c696461746f72207075626b657920697320696e20757365000000000000604082015260600190565b6020808252601d908201527f476c6f62616c206d696e69706f6f6c206c696d69742072656163686564000000604082015260600190565b6020808252601b908201527f4469737472696275746f72206e6f7420696e697469616c697365640000000000604082015260600190565b60208082526023908201527f4d696e69706f6f6c2068617320616c7265616479206265656e2066696e616c6960408201527f7365640000000000000000000000000000000000000000000000000000000000606082015260800190565b948552602085019390935260408401919091526060830152608082015260a00190565b60ff91909116815260200190565b60405181810167ffffffffffffffff811182821017156150bc57fe5b604052919050565b60005b838110156150df5781810151838201526020016150c7565b838111156150ee576000848401525b50505050565b6001600160a01b038116811461510957600080fd5b50565b6005811061510957600080fdfe726f636b657444414f50726f746f636f6c53657474696e67734d696e69706f6f6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212204d0dc5c8ae87aa4838e2885f1075e64197c76a6cdc4b97520d0f957944e2e34364736f6c63430007060033
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.