Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
RockXStaking
Compiler Version
v0.8.4+commit.c7e474f2
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "iface.sol"; import "BytesLib.sol"; import "SafeERC20.sol"; import "Initializable.sol"; import "AccessControlUpgradeable.sol"; import "PausableUpgradeable.sol"; import "ReentrancyGuardUpgradeable.sol"; /** * @title RockX Ethereum 2.0 Staking Contract * * Description: * * Term: * ExchangeRatio: Exchange Ratio of xETH to ETH, normally >= 1.0 * TotalXETH: Total Supply of xETH * TotalStaked: Total Ethers Staked to Validators * TotalDebts: Total unpaid debts(generated from redeemFromValidators), * awaiting to be paid by turn off validators to clean debts. * TotalPending: Pending Ethers(<32 Ethers), awaiting to be staked * RewardDebts: The amount re-staked into TotalPending * * AccountedUserRevenue: Overall Net revenue which belongs to all xETH holders(excluded re-staked amount) * ReportedValidators: Latest Reported Validator Count * ReportedValidatorBalance: Latest Reported Validator Overall Balance * RecentReceived: The Amount this contract receives recently. * CurrentReserve: Assets Under Management * * Lemma 1: (AUM) * * CurrentReserve = TotalPending + TotalStaked + AccountedUserRevenue - TotalDebts - RewardDebts * * Lemma 2: (Exchange Ratio) * * ExchangeRatio = CurrentReserve / TotalXETH * * Rule 1: (function mint) For every mint operation, the ethers pays debt in priority the reset will be put in TotalPending(deprecated), * ethersToMint: The amount user deposits * * (deprecated) * TotalDebts = TotalDebts - Min(ethersToMint, TotalDebts) * TotalPending = TotalPending + Max(0, ethersToMint - TotalDebts) * TotalXETH = TotalXETH + ethersToMint / ExchangeRatio * * (updated) * TotalPending = TotalPending + ethersToMint * TotalXETH = TotalXETH + ethersToMint / ExchangeRatio * * Rule 2: (function mint) At any time TotalPending has more than 32 Ethers, It will be staked, TotalPending * moves to TotalStaked and keeps TotalPending less than 32 Ether. * * TotalPending = TotalPending - ⌊TotalPending/32ETH⌋ * 32ETH * TotalStaked = TotalStaked + ⌊TotalPending/32ETH⌋ * 32ETH * * Rule 3: (function validatorStopped) Whenever a validator stopped, all value pays debts in priority, then: * valueStopped: The value sent-back via receive() funtion * amountUnstaked: The amount of unstaked node (base 32ethers) * validatorStopped: The count of validator stopped * * incrRewardDebt := valueStopped - amountUnstaked * RewardDebts = RewardDebt + incrRewardDebt * RecentReceived = RecentReceived + valueStopped * TotalPending = TotalPending + Max(0, amountUnstaked - TotalDebts) + incrRewardDebt * TotalStaked = TotalStaked - validatorStopped * 32 ETH * * Rule 4.1: (function pushBeacon) Oracle push balance, rebase if new validator is alive: * aliveValidator: The count of validators alive * * RewardBase = ReportedValidatorBalance + Max(0, aliveValidator - ReportedValidators) * 32 ETH * * Rule 4.2: (function pushBeacon) Oracle push balance, revenue calculation: * aliveBalance: The balance of current alive validators * * r := aliveBalance + RecentReceived - RewardBase * AccountedUserRevenue = AccountedUserRevenue + r * (1000 - managerFeeShare) / 1000 * RecentReceived = 0 * ReportedValidators = aliveValidator * ReportedValidatorBalance = aliveBalance * */ contract RockXStaking is Initializable, PausableUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable { using SafeERC20 for IERC20; using Address for address payable; using Address for address; // stored credentials struct ValidatorCredential { bytes pubkey; bytes signature; bool stopped; } // track ether debts to return to async caller struct Debt { address account; uint256 amount; } /** Incorrect storage preservation: |Implementation_v0 |Implementation_v1 | |--------------------|-------------------------| |address _owner |address _lastContributor | <=== Storage collision! |mapping _balances |address _owner | |uint256 _supply |mapping _balances | |... |uint256 _supply | | |... | Correct storage preservation: |Implementation_v0 |Implementation_v1 | |--------------------|-------------------------| |address _owner |address _owner | |mapping _balances |mapping _balances | |uint256 _supply |uint256 _supply | |... |address _lastContributor | <=== Storage extension. | |... | */ // Always extend storage instead of modifying it // Variables in implementation v0 bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE"); bytes32 public constant ORACLE_ROLE = keccak256("ORACLE_ROLE"); bytes32 public constant REGISTRY_ROLE = keccak256("REGISTRY_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); uint256 public constant DEPOSIT_SIZE = 32 ether; uint256 private constant MULTIPLIER = 1e18; uint256 private constant DEPOSIT_AMOUNT_UNIT = 1000000000 wei; uint256 private constant SIGNATURE_LENGTH = 96; uint256 private constant PUBKEY_LENGTH = 48; address public ethDepositContract; // ETH 2.0 Deposit contract address public xETHAddress; // xETH token address address public redeemContract; // redeeming contract for user to pull ethers uint256 public managerFeeShare; // manager's fee in 1/1000 bytes32 public withdrawalCredentials; // WithdrawCredential for all validator // credentials, pushed by owner ValidatorCredential [] private validatorRegistry; mapping(bytes32 => uint256) private pubkeyIndices; // indices of validatorRegistry by pubkey hash, starts from 1 // next validator id uint256 private nextValidatorId; // exchange ratio related variables // track user deposits & redeem (xETH mint & burn) uint256 private totalPending; // track pending ethers awaiting to be staked to validators uint256 private totalStaked; // track current staked ethers for validators, rounded to 32 ethers uint256 private totalDebts; // track current unpaid debts // FIFO of debts from redeemFromValidators mapping(uint256=>Debt) private etherDebts; uint256 private firstDebt; uint256 private lastDebt; mapping(address=>uint256) private userDebts; // debts from user's perspective // track revenue from validators to form exchange ratio uint256 private accountedUserRevenue; // accounted shared user revenue uint256 private accountedManagerRevenue; // accounted manager's revenue uint256 private rewardDebts; // check validatorStopped function // revenue related variables // track beacon validator & balance uint256 private reportedValidators; uint256 private reportedValidatorBalance; // balance tracking int256 private accountedBalance; // tracked balance change in functions, // NOTE(x): balance might be negative for not accounting validators's redeeming uint256 private recentSlashed; // track recently slashed value uint256 private recentReceived; // track recently received (un-accounted) value into this contract bytes32 private vectorClock; // a vector clock for detecting receive() & pushBeacon() causality violations uint256 private vectorClockTicks; // record current vector clock step; // track stopped validators uint256 stoppedValidators; // track stopped validators count // phase switch from 0 to 1 uint256 private phase; // gas refunds uint256 [] private refunds; // PATCH VARIABLES(UPGRADES) uint256 recentStopped; // track recent stopped validators(update: 20220927) /** * @dev empty reserved space for future adding of variables */ uint256[31] private __gap; // KYC control mapping(address=>uint256) quotaUsed; mapping(address=>bool) whiteList; /** * ====================================================================================== * * SYSTEM SETTINGS, OPERATED VIA OWNER(DAO/TIMELOCK) * * ====================================================================================== */ receive() external payable { } /** * @dev only phase */ modifier onlyPhase(uint256 requiredPhase) { require(phase >= requiredPhase, "PHASE_MISMATCH"); _; } /** * @dev pause the contract */ function pause() public onlyRole(PAUSER_ROLE) { _pause(); } /** * @dev unpause the contract */ function unpause() public onlyRole(PAUSER_ROLE) { _unpause(); } /** * @dev initialization address */ function initialize() initializer public { __Pausable_init(); __AccessControl_init(); __ReentrancyGuard_init(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(ORACLE_ROLE, msg.sender); _grantRole(REGISTRY_ROLE, msg.sender); _grantRole(PAUSER_ROLE, msg.sender); _grantRole(MANAGER_ROLE, msg.sender); // init default values managerFeeShare = 5; firstDebt = 1; lastDebt = 0; phase = 0; _vectorClockTick(); // initiate default withdrawal credential to the contract itself // uint8('0x1') + 11 bytes(0) + this.address bytes memory cred = abi.encodePacked(bytes1(0x01), new bytes(11), address(this)); withdrawalCredentials = BytesLib.toBytes32(cred, 0); } /** * @dev phase switch */ function switchPhase(uint256 newPhase) external onlyRole(DEFAULT_ADMIN_ROLE) { require (newPhase >= phase, "PHASE_ROLLBACK"); phase = newPhase; } /** * @dev register a validator */ function registerValidator(bytes calldata pubkey, bytes calldata signature) external onlyRole(REGISTRY_ROLE) { require(signature.length == SIGNATURE_LENGTH, "INCONSISTENT_SIG_LEN"); require(pubkey.length == PUBKEY_LENGTH, "INCONSISTENT_PUBKEY_LEN"); bytes32 pubkeyHash = keccak256(pubkey); require(pubkeyIndices[pubkeyHash] == 0, "DUPLICATED_PUBKEY"); validatorRegistry.push(ValidatorCredential({pubkey:pubkey, signature:signature, stopped:false})); pubkeyIndices[pubkeyHash] = validatorRegistry.length; } /** * @dev replace a validator in case of msitakes */ function replaceValidator(bytes calldata oldpubkey, bytes calldata pubkey, bytes calldata signature) external onlyRole(REGISTRY_ROLE) { require(pubkey.length == PUBKEY_LENGTH, "INCONSISTENT_PUBKEY_LEN"); require(signature.length == SIGNATURE_LENGTH, "INCONSISTENT_SIG_LEN"); // mark old pub key to false bytes32 oldPubKeyHash = keccak256(oldpubkey); require(pubkeyIndices[oldPubKeyHash] > 0, "PUBKEY_NOT_EXSITS"); uint256 index = pubkeyIndices[oldPubKeyHash] - 1; delete pubkeyIndices[oldPubKeyHash]; // set new pubkey bytes32 pubkeyHash = keccak256(pubkey); validatorRegistry[index] = ValidatorCredential({pubkey:pubkey, signature:signature, stopped:false}); pubkeyIndices[pubkeyHash] = index+1; } /** * @dev register a batch of validators */ function registerValidators(bytes [] calldata pubkeys, bytes [] calldata signatures) external onlyRole(REGISTRY_ROLE) { require(pubkeys.length == signatures.length, "LENGTH_NOT_EQUAL"); uint256 n = pubkeys.length; for(uint256 i=0;i<n;i++) { require(pubkeys[i].length == PUBKEY_LENGTH, "INCONSISTENT_PUBKEY_LEN"); require(signatures[i].length == SIGNATURE_LENGTH, "INCONSISTENT_SIG_LEN"); bytes32 pubkeyHash = keccak256(pubkeys[i]); require(pubkeyIndices[pubkeyHash] == 0, "DUPLICATED_PUBKEY"); validatorRegistry.push(ValidatorCredential({pubkey:pubkeys[i], signature:signatures[i], stopped:false})); pubkeyIndices[pubkeyHash] = validatorRegistry.length; } } /** * @dev toggleWhiteList */ function toggleWhiteList(address account) external onlyRole(DEFAULT_ADMIN_ROLE) { whiteList[account] = !whiteList[account]; emit WhiteListToggle(account, whiteList[account]); } /** * @dev set manager's fee in 1/1000 */ function setManagerFeeShare(uint256 milli) external onlyRole(DEFAULT_ADMIN_ROLE) { require(milli >=0 && milli <=1000, "SHARE_OUT_OF_RANGE"); managerFeeShare = milli; emit ManagerFeeSet(milli); } /** * @dev set xETH token contract address */ function setXETHContractAddress(address _xETHContract) external onlyRole(DEFAULT_ADMIN_ROLE) { xETHAddress = _xETHContract; emit XETHContractSet(_xETHContract); } /** * @dev set eth deposit contract address */ function setETHDepositContract(address _ethDepositContract) external onlyRole(DEFAULT_ADMIN_ROLE) { ethDepositContract = _ethDepositContract; emit DepositContractSet(_ethDepositContract); } /** * @dev set redeem contract */ function setRedeemContract(address _redeemContract) external onlyRole(DEFAULT_ADMIN_ROLE) { redeemContract = _redeemContract; emit RedeemContractSet(_redeemContract); } /** @dev set withdraw credential to receive revenue, usually this should be the contract itself. */ function setWithdrawCredential(bytes32 withdrawalCredentials_) external onlyRole(DEFAULT_ADMIN_ROLE) { withdrawalCredentials = withdrawalCredentials_; emit WithdrawCredentialSet(withdrawalCredentials); } /** * @dev submit reward withdrawal tx from this contract */ function sumbitRewardWithdrawal(uint256 amount) external onlyRole(MANAGER_ROLE) { require(amount <= accountedManagerRevenue, "WITHDRAW_EXCEEDED_MANAGER_REVENUE"); revert("NOT_IMPLEMENTED"); } /** * @dev stake into eth2 staking contract by calling this function */ function stake() external onlyRole(REGISTRY_ROLE) { // spin up n nodes uint256 numValidators = totalPending / DEPOSIT_SIZE; require(nextValidatorId + numValidators <= validatorRegistry.length, "REGISTRY_DEPLETED"); for (uint256 i = 0;i<numValidators;i++) { _spinup(); } emit ValidatorActivated(nextValidatorId); } /** * @dev manager withdraw fees */ function withdrawManagerFee(uint256 amount, address to, bytes32 clock) external nonReentrant onlyRole(MANAGER_ROLE) { require(vectorClock == clock, "CASUALITY_VIOLATION"); require(int256(address(this).balance) == accountedBalance, "BALANCE_DEVIATES"); require(amount <= accountedManagerRevenue, "WITHDRAW_EXCEEDED_MANAGER_REVENUE"); require(amount <= _currentEthersReceived(), "INSUFFICIENT_ETHERS"); // track balance change _balanceDecrease(amount); accountedManagerRevenue -= amount; payable(to).sendValue(amount); emit ManagerFeeWithdrawed(amount, to); } /** * @dev balance sync, also moves the vector clock if it has different value */ function syncBalance(bytes32 clock) external onlyRole(ORACLE_ROLE) { require(vectorClock == clock, "CASUALITY_VIOLATION"); assert(int256(address(this).balance) >= accountedBalance); uint256 diff = uint256(int256(address(this).balance) - accountedBalance); if (diff > 0) { accountedBalance = int256(address(this).balance); recentReceived += diff; _vectorClockTick(); emit BalanceSynced(diff); } } /** * @dev operator reports current alive validators count and overall balance */ function pushBeacon(uint256 _aliveValidators, uint256 _aliveBalance, bytes32 clock) external onlyRole(ORACLE_ROLE) { require(vectorClock == clock, "CASUALITY_VIOLATION"); require(int256(address(this).balance) == accountedBalance, "BALANCE_DEVIATES"); require(_aliveValidators + stoppedValidators <= nextValidatorId, "VALIDATOR_COUNT_MISMATCH"); require(_aliveBalance >= _aliveValidators * DEPOSIT_SIZE, "ALIVE_BALANCE_DECREASED"); // step 1. check if new validator increased // and adjust rewardBase to include the new validators' value uint256 rewardBase = reportedValidatorBalance; if (_aliveValidators + recentStopped > reportedValidators) { // newly launched validators uint256 newValidators = _aliveValidators + recentStopped - reportedValidators; rewardBase += newValidators * DEPOSIT_SIZE; } // step 2. calc rewards, this also considers recentReceived ethers from // either stopped validators or withdrawed ethers as rewards. // // During two consecutive pushBeacon operation, the ethers will ONLY: // 1. staked to new validators // 2. move from active validators to this contract // 3. slashed and stopped then the remaining ethers returned to this contract // // so, at any time, revenue generated if: // // current active validator balance // + recent received from validators(since last pushBeacon) // + recent slashed(since last pushBeacon) // >(GREATER THAN) reward base(last active validator balance + new nodes balance) // // NOTE(x): recentSlashed is accounted here, then we can adjust the basepoint to current alive validator balance. // require(_aliveBalance + recentReceived + recentSlashed > rewardBase, "NOT_ENOUGH_REVENUE"); uint256 rewards = _aliveBalance + recentReceived + recentSlashed - rewardBase; _distributeRewards(rewards); // step 3. update reportedValidators & reportedValidatorBalance // reset the recentReceived to 0 reportedValidatorBalance = _aliveBalance; reportedValidators = _aliveValidators; recentReceived = 0; recentSlashed = 0; recentStopped = 0; // step 4. vector clock moves, make sure never use the same vector again _vectorClockTick(); } /** * @dev notify some validators stopped, and pay the debts */ function validatorStopped(bytes [] calldata _stoppedPubKeys, uint256 _stoppedBalance, bytes32 clock) external nonReentrant onlyRole(ORACLE_ROLE) { require(vectorClock == clock, "CASUALITY_VIOLATION"); uint256 amountUnstaked = _stoppedPubKeys.length * DEPOSIT_SIZE; require(_stoppedPubKeys.length > 0, "EMPTY_CALLDATA"); require(_stoppedBalance >= amountUnstaked, "INSUFFICIENT_ETHERS_STOPPED"); require(_stoppedPubKeys.length + stoppedValidators <= nextValidatorId, "REPORTED_MORE_STOPPED_VALIDATORS"); require(_currentEthersReceived() >= _stoppedBalance, "INSUFFICIENT_ETHERS_PUSHED"); // track stopped validators for (uint i=0;i<_stoppedPubKeys.length;i++) { bytes32 pubkeyHash = keccak256(_stoppedPubKeys[i]); require(pubkeyIndices[pubkeyHash] > 0, "PUBKEY_NOT_EXIST"); uint256 index = pubkeyIndices[pubkeyHash] - 1; require(!validatorRegistry[index].stopped, "ID_ALREADY_STOPPED"); validatorRegistry[index].stopped = true; } stoppedValidators += _stoppedPubKeys.length; recentStopped += _stoppedPubKeys.length; // NOTE(x) The following procedure MUST keep currentReserve unchanged: // // (totalPending + _stoppedBalance - paid) + (totalStaked - amountUnstaked) + accountedUserRevenue - (rewardDebt + _stoppedBalance - amountUnstaked) - (totalDebts - paid) // == // totalPending + totalStaked + accountedUserRevenue - totalDebts - rewardDebt // // pay debts uint256 paid = _payDebts(amountUnstaked); // the remaining ethers are aggregated to totalPending totalPending += _stoppedBalance - paid; // track total staked ethers totalStaked -= amountUnstaked; // Extra value, which is more than debt clearance requirements, // will be re-staked. // NOTE(x): I name this value to be rewardDebts rewardDebts += _stoppedBalance - amountUnstaked; // Variables Compaction // compact accountedUserRevenue & rewardDebt, to avert overflow // NOTE(x): a good to have optimization. if (accountedUserRevenue >= rewardDebts) { accountedUserRevenue -= rewardDebts; rewardDebts = 0; } else { rewardDebts -= accountedUserRevenue; accountedUserRevenue = 0; } // log emit ValidatorStopped(_stoppedPubKeys.length, _stoppedBalance); // vector clock moves _vectorClockTick(); } /** * @dev notify some validators has been slashed, turn off those stopped validator */ function validatorSlashedStop(bytes [] calldata _stoppedPubKeys, uint256 _remainingAmount, uint256 _slashedAmount, bytes32 clock) external nonReentrant onlyRole(ORACLE_ROLE) { require(vectorClock == clock, "CASUALITY_VIOLATION"); uint256 amountUnstaked = _stoppedPubKeys.length * DEPOSIT_SIZE; require(_stoppedPubKeys.length > 0, "EMPTY_CALLDATA"); require(_slashedAmount + _remainingAmount >= amountUnstaked); require(_currentEthersReceived() >= _remainingAmount, "INSUFFICIENT_ETHERS_PUSHED"); // record slashed validators. for (uint i=0;i<_stoppedPubKeys.length;i++) { bytes32 pubkeyHash = keccak256(_stoppedPubKeys[i]); require(pubkeyIndices[pubkeyHash] > 0, "PUBKEY_NOT_EXIST"); uint256 index = pubkeyIndices[pubkeyHash] - 1; require(!validatorRegistry[index].stopped, "ID_ALREADY_STOPPED"); validatorRegistry[index].stopped = true; } stoppedValidators += _stoppedPubKeys.length; recentStopped += _stoppedPubKeys.length; // here we restake the remaining ethers by putting to totalPending totalPending += _remainingAmount; // track total staked ethers totalStaked -= amountUnstaked; // track recent slashed recentSlashed += _slashedAmount; // log emit ValidatorSlashedStopped(_stoppedPubKeys.length, _slashedAmount); // vector clock moves _vectorClockTick(); } /** * ====================================================================================== * * VIEW FUNCTIONS * * ====================================================================================== */ /** * @dev returns current reserve of ethers */ function currentReserve() public view returns(uint256) { return totalPending + totalStaked + accountedUserRevenue - totalDebts - rewardDebts; } /* * @dev returns current vector clock */ function getVectorClock() external view returns(bytes32) { return vectorClock; } /* * @dev returns current accounted balance */ function getAccountedBalance() external view returns(int256) { return accountedBalance; } /** * @dev return total staked ethers */ function getTotalStaked() external view returns (uint256) { return totalStaked; } /** * @dev return pending ethers */ function getPendingEthers() external view returns (uint256) { return totalPending; } /** * @dev return current debts */ function getCurrentDebts() external view returns (uint256) { return totalDebts; } /** * @dev returns the accounted user revenue */ function getAccountedUserRevenue() external view returns (uint256) { return accountedUserRevenue; } /** * @dev returns the accounted manager's revenue */ function getAccountedManagerRevenue() external view returns (uint256) { return accountedManagerRevenue; } /* * @dev returns accumulated beacon validators */ function getReportedValidators() external view returns (uint256) { return reportedValidators; } /* * @dev returns reported validator balance snapshot */ function getReportedValidatorBalance() external view returns (uint256) { return reportedValidatorBalance; } /* * @dev returns recent slashed value */ function getRecentSlashed() external view returns (uint256) { return recentSlashed; } /* * @dev returns recent received value */ function getRecentReceived() external view returns (uint256) { return recentReceived; } /** * @dev return debt for an account */ function debtOf(address account) external view returns (uint256) { return userDebts[account]; } /** * @dev return number of registered validator */ function getRegisteredValidatorsCount() external view returns (uint256) { return validatorRegistry.length; } /** * @dev return a batch of validators credential */ function getRegisteredValidators(uint256 idx_from, uint256 idx_to) external view returns (bytes [] memory pubkeys, bytes [] memory signatures, bool[] memory stopped) { pubkeys = new bytes[](idx_to - idx_from); signatures = new bytes[](idx_to - idx_from); stopped = new bool[](idx_to - idx_from); uint counter = 0; for (uint i = idx_from; i < idx_to;i++) { pubkeys[counter] = validatorRegistry[i].pubkey; signatures[counter] = validatorRegistry[i].signature; stopped[counter] = validatorRegistry[i].stopped; counter++; } } /** * @dev return next validator id */ function getNextValidatorId() external view returns (uint256) { return nextValidatorId; } /** * @dev return exchange ratio of , multiplied by 1e18 */ function exchangeRatio() external view returns (uint256) { uint256 xETHAmount = IERC20(xETHAddress).totalSupply(); if (xETHAmount == 0) { return 1 * MULTIPLIER; } uint256 ratio = currentReserve() * MULTIPLIER / xETHAmount; return ratio; } /** * @dev return debt of index */ function checkDebt(uint256 index) external view returns (address account, uint256 amount) { Debt memory debt = etherDebts[index]; return (debt.account, debt.amount); } /** * @dev return debt queue index */ function getDebtQueue() external view returns (uint256 first, uint256 last) { return (firstDebt, lastDebt); } /** * @dev get stopped validators count */ function getStoppedValidatorsCount() external view returns (uint256) { return stoppedValidators; } /** * @dev get used quota */ function getQuota(address account) external view returns (uint256) { return quotaUsed[account]; } /** * @dev check whitelist enabled */ function isWhiteListed(address account) external view returns (bool) { return whiteList[account]; } /** * ====================================================================================== * * EXTERNAL FUNCTIONS * * ====================================================================================== */ /** * @dev mint xETH with ETH */ function mint(uint256 minToMint, uint256 deadline) external payable nonReentrant whenNotPaused returns(uint256 minted){ require(block.timestamp < deadline, "TRANSACTION_EXPIRED"); require(msg.value > 0, "MINT_ZERO"); // for non KYC users, check the quota if (!whiteList[msg.sender]) { require(quotaUsed[msg.sender] + msg.value <= DEPOSIT_SIZE, "NEED_KYC_FOR_MORE"); quotaUsed[msg.sender] += msg.value; } // track balance _balanceIncrease(msg.value); // mint xETH while keeping the exchange ratio invariant uint256 totalXETH = IERC20(xETHAddress).totalSupply(); uint256 totalEthers = currentReserve(); uint256 toMint = 1 * msg.value; // default exchange ratio 1:1 if (totalEthers > 0) { // avert division overflow toMint = totalXETH * msg.value / totalEthers; } // mint xETH require(toMint >= minToMint, "EXCHANGE_RATIO_MISMATCH"); IMintableContract(xETHAddress).mint(msg.sender, toMint); totalPending += msg.value; return toMint; } /** * @dev redeem N * 32Ethers, which will turn off validadators, * note this function is asynchronous, the caller will only receive his ethers * after the validator has turned off. * * this function is dedicated for institutional operations. * * redeem keeps the ratio invariant */ function redeemFromValidators(uint256 ethersToRedeem, uint256 maxToBurn, uint256 deadline) external nonReentrant onlyPhase(1) returns(uint256 burned) { require(block.timestamp < deadline, "TRANSACTION_EXPIRED"); require(ethersToRedeem % DEPOSIT_SIZE == 0, "REDEEM_NOT_IN_32ETHERS"); uint256 totalXETH = IERC20(xETHAddress).totalSupply(); uint256 xETHToBurn = totalXETH * ethersToRedeem / currentReserve(); require(xETHToBurn <= maxToBurn, "EXCHANGE_RATIO_MISMATCH"); // transfer xETH from sender & burn IERC20(xETHAddress).safeTransferFrom(msg.sender, address(this), xETHToBurn); IMintableContract(xETHAddress).burn(xETHToBurn); // queue ether debts _enqueueDebt(msg.sender, ethersToRedeem); // return burned return xETHToBurn; } /** * ====================================================================================== * * INTERNAL FUNCTIONS * * ====================================================================================== */ function _balanceIncrease(uint256 amount) internal { accountedBalance += int256(amount); } function _balanceDecrease(uint256 amount) internal { accountedBalance -= int256(amount); } function _vectorClockTick() internal { vectorClockTicks++; vectorClock = keccak256(abi.encodePacked(vectorClock, block.timestamp, vectorClockTicks)); } function _currentEthersReceived() internal view returns(uint256) { return address(this).balance - totalPending; } function _enqueueDebt(address account, uint256 amount) internal { // debt is paid in FIFO queue lastDebt += 1; etherDebts[lastDebt] = Debt({account:account, amount:amount}); // track user debts userDebts[account] += amount; // track total debts totalDebts += amount; // log emit DebtQueued(account, amount); } function _dequeueDebt() internal returns (Debt memory debt) { require(lastDebt >= firstDebt); // non-empty queue debt = etherDebts[firstDebt]; delete etherDebts[firstDebt]; firstDebt += 1; } /** * @dev pay debts for a given amount */ function _payDebts(uint256 total) internal returns(uint256 amountPaid) { require(address(redeemContract) != address(0x0), "DEBT_CONTRACT_NOT_SET"); // ethers to pay for (uint i=firstDebt;i<=lastDebt;i++) { if (total == 0) { break; } Debt storage debt = etherDebts[i]; // clean debts uint256 toPay = debt.amount <= total? debt.amount:total; debt.amount -= toPay; total -= toPay; userDebts[debt.account] -= toPay; amountPaid += toPay; // transfer money to debt contract IRockXRedeem(redeemContract).pay{value:toPay}(debt.account); // dequeue if cleared if (debt.amount == 0) { _dequeueDebt(); } } totalDebts -= amountPaid; // track balance _balanceDecrease(amountPaid); } /** * @dev distribute revenue */ function _distributeRewards(uint256 rewards) internal { // rewards distribution uint256 fee = rewards * managerFeeShare / 1000; accountedManagerRevenue += fee; accountedUserRevenue += rewards - fee; emit RevenueAccounted(rewards); } /** * @dev spin up the node */ function _spinup() internal { // load credential ValidatorCredential memory cred = validatorRegistry[nextValidatorId]; _stake(cred.pubkey, cred.signature); nextValidatorId++; // track total staked & total pending ethers totalStaked += DEPOSIT_SIZE; totalPending -= DEPOSIT_SIZE; } /** * @dev Invokes a deposit call to the official Deposit contract */ function _stake(bytes memory pubkey, bytes memory signature) internal { require(withdrawalCredentials != bytes32(0x0), "WITHDRAWAL_CREDENTIALS_NOT_SET"); uint256 value = DEPOSIT_SIZE; uint256 depositAmount = DEPOSIT_SIZE / DEPOSIT_AMOUNT_UNIT; assert(depositAmount * DEPOSIT_AMOUNT_UNIT == value); // properly rounded // Compute deposit data root (`DepositData` hash tree root) // https://etherscan.io/address/0x00000000219ab540356cbb839cbe05303d7705fa#code bytes32 pubkey_root = sha256(abi.encodePacked(pubkey, bytes16(0))); bytes32 signature_root = sha256(abi.encodePacked( sha256(BytesLib.slice(signature, 0, 64)), sha256(abi.encodePacked(BytesLib.slice(signature, 64, SIGNATURE_LENGTH - 64), bytes32(0))) )); bytes memory amount = to_little_endian_64(uint64(depositAmount)); bytes32 depositDataRoot = sha256(abi.encodePacked( sha256(abi.encodePacked(pubkey_root, withdrawalCredentials)), sha256(abi.encodePacked(amount, bytes24(0), signature_root)) )); IDepositContract(ethDepositContract).deposit{value:DEPOSIT_SIZE} ( pubkey, abi.encodePacked(withdrawalCredentials), signature, depositDataRoot); // track balance _balanceDecrease(DEPOSIT_SIZE); } /** * @dev to little endian * https://etherscan.io/address/0x00000000219ab540356cbb839cbe05303d7705fa#code */ function to_little_endian_64(uint64 value) internal pure returns (bytes memory ret) { ret = new bytes(8); bytes8 bytesValue = bytes8(value); // Byteswapping during copying to bytes. ret[0] = bytesValue[7]; ret[1] = bytesValue[6]; ret[2] = bytesValue[5]; ret[3] = bytesValue[4]; ret[4] = bytesValue[3]; ret[5] = bytesValue[2]; ret[6] = bytesValue[1]; ret[7] = bytesValue[0]; } /** * ====================================================================================== * * ROCKX SYSTEM EVENTS * * ====================================================================================== */ event ValidatorActivated(uint256 nextValidatorId); event ValidatorStopped(uint256 stoppedCount, uint256 stoppedBalance); event RevenueAccounted(uint256 amount); event ValidatorSlashedStopped(uint256 stoppedCount, uint256 slashed); event ManagerAccountSet(address account); event ManagerFeeSet(uint256 milli); event ManagerFeeWithdrawed(uint256 amount, address); event WithdrawCredentialSet(bytes32 withdrawCredential); event DebtQueued(address creditor, uint256 amountEther); event XETHContractSet(address addr); event DepositContractSet(address addr); event RedeemContractSet(address addr); event BalanceSynced(uint256 diff); event WhiteListToggle(address account, bool enabled); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "IERC20.sol"; interface IMintableContract is IERC20 { function mint(address account, uint256 amount) external; function burn(uint256 amount) external; } // This interface is designed to be compatible with the Vyper version. /// @notice This is the Ethereum 2.0 deposit contract interface. /// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs interface IDepositContract { /// @notice A processed deposit event. event DepositEvent( bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index ); /// @notice Submit a Phase 0 DepositData object. /// @param pubkey A BLS12-381 public key. /// @param withdrawal_credentials Commitment to a public key for withdrawals. /// @param signature A BLS12-381 signature. /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object. /// Used as a protection against malformed input. function deposit( bytes calldata pubkey, bytes calldata withdrawal_credentials, bytes calldata signature, bytes32 deposit_data_root ) external payable; /// @notice Query the current deposit root hash. /// @return The deposit root hash. function get_deposit_root() external view returns (bytes32); /// @notice Query the current deposit count. /// @return The deposit count encoded as a little endian 64-bit number. function get_deposit_count() external view returns (bytes memory); } interface IRockXRedeem { function pay(address account) external payable; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^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); }
// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1 , "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "IERC20.sol"; import "Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "IAccessControlUpgradeable.sol"; import "ContextUpgradeable.sol"; import "StringsUpgradeable.sol"; import "ERC165Upgradeable.sol"; import "Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "IERC165Upgradeable.sol"; import "Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "ContextUpgradeable.sol"; import "Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
{ "evmVersion": "istanbul", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "rockx_staking.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"diff","type":"uint256"}],"name":"BalanceSynced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"creditor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountEther","type":"uint256"}],"name":"DebtQueued","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addr","type":"address"}],"name":"DepositContractSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"ManagerAccountSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"milli","type":"uint256"}],"name":"ManagerFeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"","type":"address"}],"name":"ManagerFeeWithdrawed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addr","type":"address"}],"name":"RedeemContractSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RevenueAccounted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nextValidatorId","type":"uint256"}],"name":"ValidatorActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"stoppedCount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"slashed","type":"uint256"}],"name":"ValidatorSlashedStopped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"stoppedCount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stoppedBalance","type":"uint256"}],"name":"ValidatorStopped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"WhiteListToggle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"withdrawCredential","type":"bytes32"}],"name":"WithdrawCredentialSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addr","type":"address"}],"name":"XETHContractSet","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPOSIT_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ORACLE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REGISTRY_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"checkDebt","outputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentReserve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"debtOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethDepositContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exchangeRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAccountedBalance","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAccountedManagerRevenue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAccountedUserRevenue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentDebts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDebtQueue","outputs":[{"internalType":"uint256","name":"first","type":"uint256"},{"internalType":"uint256","name":"last","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextValidatorId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPendingEthers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getQuota","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRecentReceived","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRecentSlashed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"idx_from","type":"uint256"},{"internalType":"uint256","name":"idx_to","type":"uint256"}],"name":"getRegisteredValidators","outputs":[{"internalType":"bytes[]","name":"pubkeys","type":"bytes[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"bool[]","name":"stopped","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRegisteredValidatorsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReportedValidatorBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReportedValidators","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStoppedValidatorsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVectorClock","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isWhiteListed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"managerFeeShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"minToMint","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"minted","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_aliveValidators","type":"uint256"},{"internalType":"uint256","name":"_aliveBalance","type":"uint256"},{"internalType":"bytes32","name":"clock","type":"bytes32"}],"name":"pushBeacon","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"redeemContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ethersToRedeem","type":"uint256"},{"internalType":"uint256","name":"maxToBurn","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"redeemFromValidators","outputs":[{"internalType":"uint256","name":"burned","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"pubkey","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"registerValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"pubkeys","type":"bytes[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"}],"name":"registerValidators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"oldpubkey","type":"bytes"},{"internalType":"bytes","name":"pubkey","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"replaceValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ethDepositContract","type":"address"}],"name":"setETHDepositContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"milli","type":"uint256"}],"name":"setManagerFeeShare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_redeemContract","type":"address"}],"name":"setRedeemContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"withdrawalCredentials_","type":"bytes32"}],"name":"setWithdrawCredential","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_xETHContract","type":"address"}],"name":"setXETHContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sumbitRewardWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPhase","type":"uint256"}],"name":"switchPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"clock","type":"bytes32"}],"name":"syncBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"toggleWhiteList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"_stoppedPubKeys","type":"bytes[]"},{"internalType":"uint256","name":"_remainingAmount","type":"uint256"},{"internalType":"uint256","name":"_slashedAmount","type":"uint256"},{"internalType":"bytes32","name":"clock","type":"bytes32"}],"name":"validatorSlashedStop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"_stoppedPubKeys","type":"bytes[]"},{"internalType":"uint256","name":"_stoppedBalance","type":"uint256"},{"internalType":"bytes32","name":"clock","type":"bytes32"}],"name":"validatorStopped","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes32","name":"clock","type":"bytes32"}],"name":"withdrawManagerFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawalCredentials","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xETHAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
608060405234801561001057600080fd5b506153b8806100206000396000f3fe6080604052600436106103b15760003560e01c80636f9170f6116101e7578063cdb54a1b1161010d578063e63ab1e9116100a0578063ecacf56d1161006f578063ecacf56d14610afc578063f22abf3714610b12578063f36d7ff314610b41578063f5404d6014610b6157600080fd5b8063e63ab1e914610a78578063e65468c714610a9a578063e7efb74714610aba578063ec87621c14610ada57600080fd5b8063da863b3b116100dc578063da863b3b14610a0c578063dc3fc3b214610a22578063e08f2d8914610a4c578063e43a495414610a6257600080fd5b8063cdb54a1b1461097f578063d283e75f14610995578063d547741f146109cc578063d7d25461146109ec57600080fd5b806391b66caa11610185578063b181033a11610154578063b181033a146108ac578063ba19912e146108cc578063c3d51709146108ec578063c8c3df4a1461090c57600080fd5b806391b66caa1461084157806391d1485414610861578063a217fddf14610881578063aba525361461089657600080fd5b80637a4473e1116101c15780637a4473e1146107e15780638129fc1c146108015780638456cb59146108165780638b0bfd351461082b57600080fd5b80636f9170f61461076757806372cda182146107a1578063755d7dd3146107c157600080fd5b80633884545d116102d75780634cd79e0a1161026a57806363e547171161023957806363e54717146106fb57806364363f2b1461071b5780636a42602c146107315780636bb022c81461074757600080fd5b80634cd79e0a146106975780634f431a6f146106ad5780635c975abb146106cd57806361c993c5146106e557600080fd5b806342f1e879116102a657806342f1e8791461060857806343a2a3021461062a57806349557df914610661578063496bf5bb1461067757600080fd5b80633884545d146105915780633a4b66f1146105c95780633f4ba83a146105de5780634006ccc5146105f357600080fd5b8063226f26451161034f57806330b12c8d1161031e57806330b12c8d1461052857806333e5761f1461053e57806336568abe1461055457806336bf33251461057457600080fd5b8063226f2645146104a3578063248a9ca3146104c35780632e12007c146104f35780632f2ff15d1461050857600080fd5b80630917e7761161038b5780630917e776146104385780631616e43d1461044e57806316c14416146104705780631b2ef1ca1461049057600080fd5b806301ffc9a7146103bd57806307e2cea5146103f257806308b84c0c1461042257600080fd5b366103b857005b600080fd5b3480156103c957600080fd5b506103dd6103d8366004614b48565b610b81565b60405190151581526020015b60405180910390f35b3480156103fe57600080fd5b5061041460008051602061532383398151915281565b6040519081526020016103e9565b34801561042e57600080fd5b5061010b54610414565b34801561044457600080fd5b5061010454610414565b34801561045a57600080fd5b5061046e610469366004614a26565b610bb8565b005b34801561047c57600080fd5b5061046e61048b366004614aed565b611069565b61041461049e366004614c97565b611140565b3480156104af57600080fd5b5061046e6104be366004614b70565b61146d565b3480156104cf57600080fd5b506104146104de366004614aed565b60009081526097602052604090206001015490565b3480156104ff57600080fd5b50610414611634565b34801561051457600080fd5b5061046e610523366004614b1d565b611677565b34801561053457600080fd5b5061010054610414565b34801561054a57600080fd5b5061010f54610414565b34801561056057600080fd5b5061046e61056f366004614b1d565b61169d565b34801561058057600080fd5b506104146801bc16d674ec80000081565b34801561059d57600080fd5b5060fb546105b1906001600160a01b031681565b6040516001600160a01b0390911681526020016103e9565b3480156105d557600080fd5b5061046e61171b565b3480156105ea57600080fd5b5061046e61180d565b3480156105ff57600080fd5b50610414611831565b34801561061457600080fd5b5061041460008051602061536383398151915281565b34801561063657600080fd5b506104146106453660046149a3565b6001600160a01b03166000908152610137602052604090205490565b34801561066d57600080fd5b5061011454610414565b34801561068357600080fd5b5061046e610692366004614cb8565b611909565b3480156106a357600080fd5b5061041460ff5481565b3480156106b957600080fd5b5061046e6106c83660046149a3565b611b6c565b3480156106d957600080fd5b5060335460ff166103dd565b3480156106f157600080fd5b5061010a54610414565b34801561070757600080fd5b5061046e610716366004614aed565b611bdc565b34801561072757600080fd5b5061010354610414565b34801561073d57600080fd5b5061010d54610414565b34801561075357600080fd5b5061046e6107623660046149a3565b611c33565b34801561077357600080fd5b506103dd6107823660046149a3565b6001600160a01b03166000908152610138602052604090205460ff1690565b3480156107ad57600080fd5b5061046e6107bc3660046149a3565b611c8d565b3480156107cd57600080fd5b5061046e6107dc366004614aed565b611ce7565b3480156107ed57600080fd5b5060fd546105b1906001600160a01b031681565b34801561080d57600080fd5b5061046e611d6f565b34801561082257600080fd5b5061046e611f21565b34801561083757600080fd5b5061010554610414565b34801561084d57600080fd5b5061046e61085c3660046149a3565b611f42565b34801561086d57600080fd5b506103dd61087c366004614b1d565b611f9c565b34801561088d57600080fd5b50610414600081565b3480156108a257600080fd5b5061011054610414565b3480156108b857600080fd5b5060fc546105b1906001600160a01b031681565b3480156108d857600080fd5b5061046e6108e7366004614aed565b611fc7565b3480156108f857600080fd5b5061046e610907366004614bcd565b61203d565b34801561091857600080fd5b50610960610927366004614aed565b60009081526101066020908152604091829020825180840190935280546001600160a01b03168084526001909101549290910182905291565b604080516001600160a01b0390931683526020830191909152016103e9565b34801561098b57600080fd5b5061010e54610414565b3480156109a157600080fd5b506104146109b03660046149a3565b6001600160a01b03166000908152610109602052604090205490565b3480156109d857600080fd5b5061046e6109e7366004614b1d565b61227a565b3480156109f857600080fd5b5061046e610a07366004614aed565b6122a0565b348015610a1857600080fd5b5061010254610414565b348015610a2e57600080fd5b506101075461010854604080519283526020830191909152016103e9565b348015610a5857600080fd5b5061011154610414565b348015610a6e57600080fd5b5061041460fe5481565b348015610a8457600080fd5b5061041460008051602061534383398151915281565b348015610aa657600080fd5b5061046e610ab5366004614c63565b6122e1565b348015610ac657600080fd5b5061046e610ad53660046149bd565b61247a565b348015610ae657600080fd5b5061041460008051602061530383398151915281565b348015610b0857600080fd5b5061011254610414565b348015610b1e57600080fd5b50610b32610b2d366004614c97565b61279f565b6040516103e993929190614ee5565b348015610b4d57600080fd5b5061046e610b5c366004614a75565b612b3f565b348015610b6d57600080fd5b50610414610b7c366004614cb8565b612ec1565b60006001600160e01b03198216637965db0b60e01b1480610bb257506301ffc9a760e01b6001600160e01b03198316145b92915050565b600260c9541415610be45760405162461bcd60e51b8152600401610bdb90615094565b60405180910390fd5b600260c955600080516020615323833981519152610c028133613148565b816101125414610c245760405162461bcd60e51b8152600401610bdb90614fad565b6000610c396801bc16d674ec800000866151b4565b905084610c795760405162461bcd60e51b815260206004820152600e60248201526d454d5054595f43414c4c4441544160901b6044820152606401610bdb565b80841015610cc95760405162461bcd60e51b815260206004820152601b60248201527f494e53554646494349454e545f4554484552535f53544f5050454400000000006044820152606401610bdb565b6101025461011454610cdb9087615188565b1115610d295760405162461bcd60e51b815260206004820181905260248201527f5245504f525445445f4d4f52455f53544f505045445f56414c494441544f52536044820152606401610bdb565b83610d326131ac565b1015610d805760405162461bcd60e51b815260206004820152601a60248201527f494e53554646494349454e545f4554484552535f5055534845440000000000006044820152606401610bdb565b60005b85811015610f22576000878783818110610dad57634e487b7160e01b600052603260045260246000fd5b9050602002810190610dbf9190615102565b604051610dcd929190614db2565b60405180910390209050600061010160008381526020019081526020016000205411610e2e5760405162461bcd60e51b815260206004820152601060248201526f14155092d15657d393d517d1561254d560821b6044820152606401610bdb565b60008181526101016020526040812054610e4a90600190615212565b90506101008181548110610e6e57634e487b7160e01b600052603260045260246000fd5b600091825260209091206002600390920201015460ff1615610ec75760405162461bcd60e51b8152602060048201526012602482015271125117d053149150511657d4d513d414115160721b6044820152606401610bdb565b60016101008281548110610eeb57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600390910201600201805460ff191691151591909117905550819050610f1a816152a7565b915050610d83565b50858590506101146000828254610f399190615188565b90915550506101178054869190600090610f54908490615188565b9091555060009050610f65826131bd565b9050610f718186615212565b6101036000828254610f839190615188565b92505081905550816101046000828254610f9d9190615212565b90915550610fad90508286615212565b61010c6000828254610fbf9190615188565b909155505061010c5461010a5410610ff75761010c5461010a6000828254610fe79190615212565b9091555050600061010c55611019565b61010a5461010c600082825461100d9190615212565b9091555050600061010a555b60408051878152602081018790527f5a51f96eda2fa129d02ccea2614367ece90f06ee3ced4c58a06a931a2b61995491015b60405180910390a161105b613370565b5050600160c9555050505050565b6000805160206153238339815191526110828133613148565b8161011254146110a45760405162461bcd60e51b8152600401610bdb90614fad565b61010f544712156110c557634e487b7160e01b600052600160045260246000fd5b600061010f54476110d691906151d3565b9050801561113b574761010f819055508061011160008282546110f99190615188565b909155506111079050613370565b6040518181527fe7948c33eb604391785037114655100edf93283c25b69884e9238ae197f078179060200160405180910390a15b505050565b6000600260c95414156111655760405162461bcd60e51b8152600401610bdb90615094565b600260c95560335460ff16156111b05760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610bdb565b8142106111f55760405162461bcd60e51b81526020600482015260136024820152721514905394d050d51253d397d1561412549151606a1b6044820152606401610bdb565b600034116112315760405162461bcd60e51b81526020600482015260096024820152684d494e545f5a45524f60b81b6044820152606401610bdb565b336000908152610138602052604090205460ff166112d85733600090815261013760205260409020546801bc16d674ec80000090611270903490615188565b11156112b25760405162461bcd60e51b81526020600482015260116024820152704e4545445f4b59435f464f525f4d4f524560781b6044820152606401610bdb565b3360009081526101376020526040812080543492906112d2908490615188565b90915550505b6112e1346133c5565b60fc54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b15801561132657600080fd5b505afa15801561133a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135e9190614b05565b9050600061136a611634565b905060006113793460016151b4565b90508115611399578161138c34856151b4565b61139691906151a0565b90505b858110156113e35760405162461bcd60e51b815260206004820152601760248201527608ab08690829c8e8abea482a8929ebe9a92a69a82a8869604b1b6044820152606401610bdb565b60fc546040516340c10f1960e01b8152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561142f57600080fd5b505af1158015611443573d6000803e3d6000fd5b5050505034610103600082825461145a9190615188565b9091555050600160c95595945050505050565b6000805160206153638339815191526114868133613148565b606082146114a65760405162461bcd60e51b8152600401610bdb90615066565b603084146114c65760405162461bcd60e51b8152600401610bdb906150cb565b600085856040516114d8929190614db2565b6040518091039020905061010160008281526020019081526020016000205460001461153a5760405162461bcd60e51b81526020600482015260116024820152704455504c4943415445445f5055424b455960781b6044820152606401610bdb565b6040805160806020601f8901819004028201810190925260608101878152610100928291908a908a9081908501838280828437600092019190915250505090825250604080516020601f890181900481028201810190925287815291810191908890889081908401838280828437600092018290525093855250505060209182018190528354600181018555938152819020825180519394600302909101926115e69284920190614869565b5060208281015180516115ff9260018501920190614869565b50604091820151600291909101805460ff19169115159190911790556101005460009283526101016020529120555050505050565b600061010c546101055461010a5461010454610103546116549190615188565b61165e9190615188565b6116689190615212565b6116729190615212565b905090565b6000828152609760205260409020600101546116938133613148565b61113b83836133e0565b6001600160a01b038116331461170d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610bdb565b6117178282613466565b5050565b6000805160206153638339815191526117348133613148565b60006801bc16d674ec8000006101035461174e91906151a0565b610100546101025491925090611765908390615188565b11156117a75760405162461bcd60e51b8152602060048201526011602482015270149151d254d5149657d111541311551151607a1b6044820152606401610bdb565b60005b818110156117cc576117ba6134cd565b806117c4816152a7565b9150506117aa565b507fe2a191ee805447bcf5adabadd39cb816b1b46de1364263aef69980bdafd8370f6101025460405161180191815260200190565b60405180910390a15050565b6000805160206153438339815191526118268133613148565b61182e6136a9565b50565b60008060fc60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561188257600080fd5b505afa158015611896573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ba9190614b05565b9050806118da576118d4670de0b6b3a764000060016151b4565b91505090565b600081670de0b6b3a76400006118ee611634565b6118f891906151b4565b61190291906151a0565b9392505050565b6000805160206153238339815191526119228133613148565b8161011254146119445760405162461bcd60e51b8152600401610bdb90614fad565b61010f5447146119895760405162461bcd60e51b815260206004820152601060248201526f42414c414e43455f444556494154455360801b6044820152606401610bdb565b610102546101145461199b9086615188565b11156119e95760405162461bcd60e51b815260206004820152601860248201527f56414c494441544f525f434f554e545f4d49534d4154434800000000000000006044820152606401610bdb565b6119fc6801bc16d674ec800000856151b4565b831015611a4b5760405162461bcd60e51b815260206004820152601760248201527f414c4956455f42414c414e43455f4445435245415345440000000000000000006044820152606401610bdb565b61010e5461010d5461011754611a619087615188565b1115611aa957600061010d546101175487611a7c9190615188565b611a869190615212565b9050611a9b6801bc16d674ec800000826151b4565b611aa59083615188565b9150505b80610110546101115486611abd9190615188565b611ac79190615188565b11611b095760405162461bcd60e51b81526020600482015260126024820152714e4f545f454e4f5547485f524556454e554560701b6044820152606401610bdb565b600081610110546101115487611b1f9190615188565b611b299190615188565b611b339190615212565b9050611b3e8161373c565b61010e85905561010d869055600061011181905561011081905561011755611b64613370565b505050505050565b6000611b788133613148565b6001600160a01b03821660008181526101386020908152604091829020805460ff8082161560ff1990921682179092558351948552161515908301527f96993f732e425c7615ed977e16e6e83d84bb45203ca23885018335b66c2e85be9101611801565b6000611be88133613148565b61011554821015611c2c5760405162461bcd60e51b815260206004820152600e60248201526d50484153455f524f4c4c4241434b60901b6044820152606401610bdb565b5061011555565b6000611c3f8133613148565b60fd80546001600160a01b0319166001600160a01b0384169081179091556040519081527f4d3d3f5d1d8423a4e40b3fcfccaf0c1b18ca550a8592d5e38a61765931a9cf7890602001611801565b6000611c998133613148565b60fc80546001600160a01b0319166001600160a01b0384169081179091556040519081527f65f24f264bd70348b9888b2fbf27cd04f9e2fb0fcc50dde8fb36483576ef32a390602001611801565b6000611cf38133613148565b6103e8821115611d3a5760405162461bcd60e51b815260206004820152601260248201527153484152455f4f55545f4f465f52414e474560701b6044820152606401610bdb565b60fe8290556040518281527f4de90ec86e1bc56c192e2399bacbd10bdaba720caca606354d66c5cb33d6802b90602001611801565b600054610100900460ff16611d8a5760005460ff1615611d8e565b303b155b611df15760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610bdb565b600054610100900460ff16158015611e13576000805461ffff19166101011790555b611e1b6137c5565b611e236137f6565b611e2b61381d565b611e366000336133e0565b611e4e600080516020615323833981519152336133e0565b611e66600080516020615363833981519152336133e0565b611e7e600080516020615343833981519152336133e0565b611e96600080516020615303833981519152336133e0565b600560fe55600161010755600061010881905561011555611eb5613370565b60408051600b808252818301909252600091600160f81b91906020820181803683375050604051611eed939291503090602001614d63565b6040516020818303038152906040529050611f0981600061384c565b60ff5550801561182e576000805461ff001916905550565b600080516020615343833981519152611f3a8133613148565b61182e6138aa565b6000611f4e8133613148565b60fb80546001600160a01b0319166001600160a01b0384169081179091556040519081527f1781ac9526b978975dba0fd26a33e044a55a7ace054a3ee7efa5f8459513bead90602001611801565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020615303833981519152611fe08133613148565b61010b548211156120035760405162461bcd60e51b8152600401610bdb90614fda565b60405162461bcd60e51b815260206004820152600f60248201526e1393d517d253541311535153951151608a1b6044820152606401610bdb565b6000805160206153638339815191526120568133613148565b603084146120765760405162461bcd60e51b8152600401610bdb906150cb565b606082146120965760405162461bcd60e51b8152600401610bdb90615066565b600087876040516120a8929190614db2565b6040518091039020905060006101016000838152602001908152602001600020541161210a5760405162461bcd60e51b81526020600482015260116024820152705055424b45595f4e4f545f45585349545360781b6044820152606401610bdb565b6000818152610101602052604081205461212690600190615212565b60008381526101016020526040808220829055519192509061214b9089908990614db2565b6040805191829003822060806020601f8c018190040284018101909252606083018a815290935082918b908b9081908501838280828437600092019190915250505090825250604080516020601f8a018190048102820181019092528881529181019190899089908190840183828082843760009201829052509385525050506020909101526101008054849081106121f457634e487b7160e01b600052603260045260246000fd5b9060005260206000209060030201600082015181600001908051906020019061221e929190614869565b5060208281015180516122379260018501920190614869565b50604091909101516002909101805460ff191691151591909117905561225e826001615188565b6000918252610101602052604090912055505050505050505050565b6000828152609760205260409020600101546122968133613148565b61113b8383613466565b60006122ac8133613148565b60ff8290556040518281527f690facbfacb53c9319489117a6ac422718b5cb059a6ffade4871ff10f6f9aee990602001611801565b600260c95414156123045760405162461bcd60e51b8152600401610bdb90615094565b600260c9556000805160206153038339815191526123228133613148565b8161011254146123445760405162461bcd60e51b8152600401610bdb90614fad565b61010f5447146123895760405162461bcd60e51b815260206004820152601060248201526f42414c414e43455f444556494154455360801b6044820152606401610bdb565b61010b548411156123ac5760405162461bcd60e51b8152600401610bdb90614fda565b6123b46131ac565b8411156123f95760405162461bcd60e51b8152602060048201526013602482015272494e53554646494349454e545f45544845525360681b6044820152606401610bdb565b61240284613925565b8361010b60008282546124159190615212565b9091555061242e90506001600160a01b03841685613938565b604080518581526001600160a01b03851660208201527f2425aa1fadefc5c570850aa9c9e3dfa4fc6b43ccd1c05b47db38dd6518a743b3910160405180910390a15050600160c9555050565b6000805160206153638339815191526124938133613148565b8382146124d55760405162461bcd60e51b815260206004820152601060248201526f13115391d51217d393d517d15455505360821b6044820152606401610bdb565b8360005b8181101561279657603087878381811061250357634e487b7160e01b600052603260045260246000fd5b90506020028101906125159190615102565b9050146125345760405162461bcd60e51b8152600401610bdb906150cb565b606085858381811061255657634e487b7160e01b600052603260045260246000fd5b90506020028101906125689190615102565b9050146125875760405162461bcd60e51b8152600401610bdb90615066565b60008787838181106125a957634e487b7160e01b600052603260045260246000fd5b90506020028101906125bb9190615102565b6040516125c9929190614db2565b6040518091039020905061010160008281526020019081526020016000205460001461262b5760405162461bcd60e51b81526020600482015260116024820152704455504c4943415445445f5055424b455960781b6044820152606401610bdb565b61010060405180606001604052808a8a8681811061265957634e487b7160e01b600052603260045260246000fd5b905060200281019061266b9190615102565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020018888868181106126c557634e487b7160e01b600052603260045260246000fd5b90506020028101906126d79190615102565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505050602091820181905283546001810185559381528190208251805193946003029091019261273d9284920190614869565b5060208281015180516127569260018501920190614869565b50604091820151600291909101805460ff19169115159190911790556101005460009283526101016020529120558061278e816152a7565b9150506124d9565b50505050505050565b606080806127ad8585615212565b67ffffffffffffffff8111156127d357634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561280657816020015b60608152602001906001900390816127f15790505b5092506128138585615212565b67ffffffffffffffff81111561283957634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561286c57816020015b60608152602001906001900390816128575790505b5091506128798585615212565b67ffffffffffffffff81111561289f57634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156128c8578160200160208202803683370190505b5090506000855b85811015612b365761010081815481106128f957634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160000180546129159061526c565b80601f01602080910402602001604051908101604052809291908181526020018280546129419061526c565b801561298e5780601f106129635761010080835404028352916020019161298e565b820191906000526020600020905b81548152906001019060200180831161297157829003601f168201915b50505050508583815181106129b357634e487b7160e01b600052603260045260246000fd5b602002602001018190525061010081815481106129e057634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160010180546129fc9061526c565b80601f0160208091040260200160405190810160405280929190818152602001828054612a289061526c565b8015612a755780601f10612a4a57610100808354040283529160200191612a75565b820191906000526020600020905b815481529060010190602001808311612a5857829003601f168201915b5050505050848381518110612a9a57634e487b7160e01b600052603260045260246000fd5b60200260200101819052506101008181548110612ac757634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160020160009054906101000a900460ff16838381518110612b0657634e487b7160e01b600052603260045260246000fd5b9115156020928302919091019091015281612b20816152a7565b9250508080612b2e906152a7565b9150506128cf565b50509250925092565b600260c9541415612b625760405162461bcd60e51b8152600401610bdb90615094565b600260c955600080516020615323833981519152612b808133613148565b816101125414612ba25760405162461bcd60e51b8152600401610bdb90614fad565b6000612bb76801bc16d674ec800000876151b4565b905085612bf75760405162461bcd60e51b815260206004820152600e60248201526d454d5054595f43414c4c4441544160901b6044820152606401610bdb565b80612c028686615188565b1015612c0d57600080fd5b84612c166131ac565b1015612c645760405162461bcd60e51b815260206004820152601a60248201527f494e53554646494349454e545f4554484552535f5055534845440000000000006044820152606401610bdb565b60005b86811015612e06576000888883818110612c9157634e487b7160e01b600052603260045260246000fd5b9050602002810190612ca39190615102565b604051612cb1929190614db2565b60405180910390209050600061010160008381526020019081526020016000205411612d125760405162461bcd60e51b815260206004820152601060248201526f14155092d15657d393d517d1561254d560821b6044820152606401610bdb565b60008181526101016020526040812054612d2e90600190615212565b90506101008181548110612d5257634e487b7160e01b600052603260045260246000fd5b600091825260209091206002600390920201015460ff1615612dab5760405162461bcd60e51b8152602060048201526012602482015271125117d053149150511657d4d513d414115160721b6044820152606401610bdb565b60016101008281548110612dcf57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600390910201600201805460ff191691151591909117905550819050612dfe816152a7565b915050612c67565b50868690506101146000828254612e1d9190615188565b90915550506101178054879190600090612e38908490615188565b92505081905550846101036000828254612e529190615188565b92505081905550806101046000828254612e6c9190615212565b92505081905550836101106000828254612e869190615188565b909155505060408051878152602081018690527f10d3cb48238c3e81c131ce17f23375c27148e293784bbfe05e852647c2299115910161104b565b6000600260c9541415612ee65760405162461bcd60e51b8152600401610bdb90615094565b600260c95561011554600190811115612f325760405162461bcd60e51b815260206004820152600e60248201526d0a09082a68abe9a92a69a82a886960931b6044820152606401610bdb565b824210612f775760405162461bcd60e51b81526020600482015260136024820152721514905394d050d51253d397d1561412549151606a1b6044820152606401610bdb565b612f8a6801bc16d674ec800000866152c2565b15612fd05760405162461bcd60e51b815260206004820152601660248201527552454445454d5f4e4f545f494e5f333245544845525360501b6044820152606401610bdb565b60fc54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b15801561301557600080fd5b505afa158015613029573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061304d9190614b05565b90506000613059611634565b61306388846151b4565b61306d91906151a0565b9050858111156130b95760405162461bcd60e51b815260206004820152601760248201527608ab08690829c8e8abea482a8929ebe9a92a69a82a8869604b1b6044820152606401610bdb565b60fc546130d1906001600160a01b0316333084613a51565b60fc54604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561311757600080fd5b505af115801561312b573d6000803e3d6000fd5b505050506131393388613ab1565b600160c9559695505050505050565b6131528282611f9c565b6117175761316a816001600160a01b03166014613b93565b613175836020613b93565b604051602001613186929190614e70565b60408051601f198184030181529082905262461bcd60e51b8252610bdb91600401614f9a565b600061010354476116729190615212565b60fd546000906001600160a01b03166132105760405162461bcd60e51b81526020600482015260156024820152741111509517d0d3d395149050d517d393d517d4d155605a1b6044820152606401610bdb565b610107545b610108548111613348578261322957613348565b600081815261010660205260408120600181015490919085101561324d5784613253565b81600101545b9050808260010160008282546132699190615212565b9091555061327990508186615212565b82546001600160a01b0316600090815261010960205260408120805492975083929091906132a8908490615212565b909155506132b890508185615188565b60fd548354604051630c11dedd60e01b81526001600160a01b0391821660048201529296501690630c11dedd9083906024016000604051808303818588803b15801561330357600080fd5b505af1158015613317573d6000803e3d6000fd5b505050505081600101546000141561333357613331613d75565b505b50508080613340906152a7565b915050613215565b5080610105600082825461335c9190615212565b9091555061336b905081613925565b919050565b6101138054906000613381836152a7565b909155505061011254610113546040805160208101939093524290830152606082015260800160408051601f19818403018152919052805160209091012061011255565b8061010f60008282546133d89190615147565b909155505050565b6133ea8282611f9c565b6117175760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556134223390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6134708282611f9c565b156117175760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061010061010254815481106134f457634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160405180606001604052908160008201805461351d9061526c565b80601f01602080910402602001604051908101604052809291908181526020018280546135499061526c565b80156135965780601f1061356b57610100808354040283529160200191613596565b820191906000526020600020905b81548152906001019060200180831161357957829003601f168201915b505050505081526020016001820180546135af9061526c565b80601f01602080910402602001604051908101604052809291908181526020018280546135db9061526c565b80156136285780601f106135fd57610100808354040283529160200191613628565b820191906000526020600020905b81548152906001019060200180831161360b57829003601f168201915b50505091835250506002919091015460ff16151560209182015281519082015191925061365491613e0d565b6101028054906000613665836152a7565b91905055506801bc16d674ec80000061010460008282546136869190615188565b925050819055506801bc16d674ec80000061010360008282546133d89190615212565b60335460ff166136f25760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610bdb565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60006103e860fe548361374f91906151b4565b61375991906151a0565b90508061010b600082825461376e9190615188565b9091555061377e90508183615212565b61010a60008282546137909190615188565b90915550506040518281527f82f24840c0f58d92529afdd441950ddc6e8f2d60138d4458a8d74ba367540cda90602001611801565b600054610100900460ff166137ec5760405162461bcd60e51b8152600401610bdb9061501b565b6137f461428d565b565b600054610100900460ff166137f45760405162461bcd60e51b8152600401610bdb9061501b565b600054610100900460ff166138445760405162461bcd60e51b8152600401610bdb9061501b565b6137f46142c0565b6000613859826020615188565b835110156138a15760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b6044820152606401610bdb565b50016020015190565b60335460ff16156138f05760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610bdb565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861371f3390565b8061010f60008282546133d891906151d3565b804710156139885760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610bdb565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146139d5576040519150601f19603f3d011682016040523d82523d6000602084013e6139da565b606091505b505090508061113b5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610bdb565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052613aab9085906142ee565b50505050565b60016101086000828254613ac59190615188565b90915550506040805180820182526001600160a01b0384811680835260208084018681526101085460009081526101068352868120955186546001600160a01b03191695169490941785555160019094019390935581526101099091529081208054839290613b35908490615188565b92505081905550806101056000828254613b4f9190615188565b9091555050604080516001600160a01b0384168152602081018390527f889f3b08db1ce169841b4f7e2aadfe4298088b1bce57b31fecae3260dd4358299101611801565b60606000613ba28360026151b4565b613bad906002615188565b67ffffffffffffffff811115613bd357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613bfd576020820181803683370190505b509050600360fc1b81600081518110613c2657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613c6357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000613c878460026151b4565b613c92906001615188565b90505b6001811115613d26576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613cd457634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110613cf857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93613d1f81615255565b9050613c95565b5083156119025760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610bdb565b604080518082019091526000808252602082015261010754610108541015613d9c57600080fd5b506101078054600081815261010660208181526040808420815180830190925280546001600160a01b03811683526001808301805485870152978752949093526001600160a01b031990921690915592829055835492939092909190613e03908490615188565b9250508190555090565b60ff54613e5c5760405162461bcd60e51b815260206004820152601e60248201527f5749544844524157414c5f43524544454e5449414c535f4e4f545f53455400006044820152606401610bdb565b6801bc16d674ec8000006000613e76633b9aca00836151a0565b905081613e87633b9aca00836151b4565b14613ea257634e487b7160e01b600052600160045260246000fd5b6000600285600060801b604051602001613ebd929190614dde565b60408051601f1981840301815290829052613ed791614dc2565b602060405180830381855afa158015613ef4573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190613f179190614b05565b90506000600280613f2b87600060406143c0565b604051613f389190614dc2565b602060405180830381855afa158015613f55573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190613f789190614b05565b6002613f90886040613f8b816060615212565b6143c0565b604051613fa39190600090602001614e4e565b60408051601f1981840301815290829052613fbd91614dc2565b602060405180830381855afa158015613fda573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190613ffd9190614b05565b60408051602081019390935282015260600160408051601f198184030181529082905261402991614dc2565b602060405180830381855afa158015614046573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906140699190614b05565b90506000614076846144cd565b905060006002808560ff5460405160200161409b929190918252602082015260400190565b60408051601f19818403018152908290526140b591614dc2565b602060405180830381855afa1580156140d2573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906140f59190614b05565b60405160029061410e9086906000908990602001614e16565b60408051601f198184030181529082905261412891614dc2565b602060405180830381855afa158015614145573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906141689190614b05565b60408051602081019390935282015260600160408051601f198184030181529082905261419491614dc2565b602060405180830381855afa1580156141b1573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906141d49190614b05565b60fb5460ff546040519293506001600160a01b03909116916322895118916801bc16d674ec800000918c9161420f9160200190815260200190565b6040516020818303038152906040528b866040518663ffffffff1660e01b815260040161423f9493929190614f4f565b6000604051808303818588803b15801561425857600080fd5b505af115801561426c573d6000803e3d6000fd5b50505050506142836801bc16d674ec800000613925565b5050505050505050565b600054610100900460ff166142b45760405162461bcd60e51b8152600401610bdb9061501b565b6033805460ff19169055565b600054610100900460ff166142e75760405162461bcd60e51b8152600401610bdb9061501b565b600160c955565b6000614343826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166146f19092919063ffffffff16565b80519091501561113b57808060200190518101906143619190614acd565b61113b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610bdb565b6060816143ce81601f615188565b101561440d5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610bdb565b6144178284615188565b8451101561445b5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610bdb565b60608215801561447a57604051915060008252602082016040526144c4565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156144b357805183526020928301920161449b565b5050858452601f01601f1916604052505b50949350505050565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b8260008151811061451b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060061a60f81b8260018151811061455a57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060051a60f81b8260028151811061459957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060041a60f81b826003815181106145d857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060031a60f81b8260048151811061461757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060021a60f81b8260058151811061465657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060011a60f81b8260068151811061469557634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060001a60f81b826007815181106146d457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535050919050565b60606147008484600085614708565b949350505050565b6060824710156147695760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610bdb565b843b6147b75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610bdb565b600080866001600160a01b031685876040516147d39190614dc2565b60006040518083038185875af1925050503d8060008114614810576040519150601f19603f3d011682016040523d82523d6000602084013e614815565b606091505b5091509150614825828286614830565b979650505050505050565b6060831561483f575081611902565b82511561484f5782518084602001fd5b8160405162461bcd60e51b8152600401610bdb9190614f9a565b8280546148759061526c565b90600052602060002090601f01602090048101928261489757600085556148dd565b82601f106148b057805160ff19168380011785556148dd565b828001600101855582156148dd579182015b828111156148dd5782518255916020019190600101906148c2565b506148e99291506148ed565b5090565b5b808211156148e957600081556001016148ee565b80356001600160a01b038116811461336b57600080fd5b60008083601f84011261492a578182fd5b50813567ffffffffffffffff811115614941578182fd5b6020830191508360208260051b850101111561495c57600080fd5b9250929050565b60008083601f840112614974578182fd5b50813567ffffffffffffffff81111561498b578182fd5b60208301915083602082850101111561495c57600080fd5b6000602082840312156149b4578081fd5b61190282614902565b600080600080604085870312156149d2578283fd5b843567ffffffffffffffff808211156149e9578485fd5b6149f588838901614919565b90965094506020870135915080821115614a0d578384fd5b50614a1a87828801614919565b95989497509550505050565b60008060008060608587031215614a3b578384fd5b843567ffffffffffffffff811115614a51578485fd5b614a5d87828801614919565b90989097506020870135966040013595509350505050565b600080600080600060808688031215614a8c578081fd5b853567ffffffffffffffff811115614aa2578182fd5b614aae88828901614919565b9099909850602088013597604081013597506060013595509350505050565b600060208284031215614ade578081fd5b81518015158114611902578182fd5b600060208284031215614afe578081fd5b5035919050565b600060208284031215614b16578081fd5b5051919050565b60008060408385031215614b2f578182fd5b82359150614b3f60208401614902565b90509250929050565b600060208284031215614b59578081fd5b81356001600160e01b031981168114611902578182fd5b60008060008060408587031215614b85578384fd5b843567ffffffffffffffff80821115614b9c578586fd5b614ba888838901614963565b90965094506020870135915080821115614bc0578384fd5b50614a1a87828801614963565b60008060008060008060608789031215614be5578081fd5b863567ffffffffffffffff80821115614bfc578283fd5b614c088a838b01614963565b90985096506020890135915080821115614c20578283fd5b614c2c8a838b01614963565b90965094506040890135915080821115614c44578283fd5b50614c5189828a01614963565b979a9699509497509295939492505050565b600080600060608486031215614c77578081fd5b83359250614c8760208501614902565b9150604084013590509250925092565b60008060408385031215614ca9578182fd5b50508035926020909101359150565b600080600060608486031215614ccc578081fd5b505081359360208301359350604090920135919050565b600081518084526020808501808196508360051b81019150828601855b85811015614d2a578284038952614d18848351614d37565b98850198935090840190600101614d00565b5091979650505050505050565b60008151808452614d4f816020860160208601615229565b601f01601f19169290920160200192915050565b6001600160f81b0319841681528251600090614d86816001850160208801615229565b60609390931b6bffffffffffffffffffffffff1916600192909301918201929092526015019392505050565b8183823760009101908152919050565b60008251614dd4818460208701615229565b9190910192915050565b60008351614df0818460208801615229565b6fffffffffffffffffffffffffffffffff19939093169190920190815260100192915050565b60008451614e28818460208901615229565b67ffffffffffffffff199490941691909301908152601881019190915260380192915050565b60008351614e60818460208801615229565b9190910191825250602001919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614ea8816017850160208801615229565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614ed9816028840160208801615229565b01602801949350505050565b606081526000614ef86060830186614ce3565b602083820381850152614f0b8287614ce3565b84810360408601528551808252828701935090820190845b81811015614f41578451151583529383019391830191600101614f23565b509098975050505050505050565b608081526000614f626080830187614d37565b8281036020840152614f748187614d37565b90508281036040840152614f888186614d37565b91505082606083015295945050505050565b6020815260006119026020830184614d37565b60208082526013908201527221a0a9aaa0a624aa2cafab24a7a620aa24a7a760691b604082015260600190565b60208082526021908201527f57495448445241575f45584345454445445f4d414e414745525f524556454e556040820152604560f81b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526014908201527324a721a7a729a4a9aa22a72a2fa9a4a3afa622a760611b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526017908201527f494e434f4e53495354454e545f5055424b45595f4c454e000000000000000000604082015260600190565b6000808335601e19843603018112615118578283fd5b83018035915067ffffffffffffffff821115615132578283fd5b60200191503681900382131561495c57600080fd5b600080821280156001600160ff1b0384900385131615615169576151696152d6565b600160ff1b8390038412811615615182576151826152d6565b50500190565b6000821982111561519b5761519b6152d6565b500190565b6000826151af576151af6152ec565b500490565b60008160001904831182151516156151ce576151ce6152d6565b500290565b60008083128015600160ff1b8501841216156151f1576151f16152d6565b6001600160ff1b038401831381161561520c5761520c6152d6565b50500390565b600082821015615224576152246152d6565b500390565b60005b8381101561524457818101518382015260200161522c565b83811115613aab5750506000910152565b600081615264576152646152d6565b506000190190565b600181811c9082168061528057607f821691505b602082108114156152a157634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156152bb576152bb6152d6565b5060010190565b6000826152d1576152d16152ec565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0868e79a7bf1e0bc45d0a330c573bc367f9cf464fd326078812f301165fbda4ef165d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862ac2979137d1774e40fe2638d355bf7a7b092be4c67f242aad1655e1e27f9df9cca26469706673582212209f5fd8d333e1f29cdefab06a323e609c474cc6faa40d9c73eb18ee706b44df6b64736f6c63430008040033
Deployed Bytecode
0x6080604052600436106103b15760003560e01c80636f9170f6116101e7578063cdb54a1b1161010d578063e63ab1e9116100a0578063ecacf56d1161006f578063ecacf56d14610afc578063f22abf3714610b12578063f36d7ff314610b41578063f5404d6014610b6157600080fd5b8063e63ab1e914610a78578063e65468c714610a9a578063e7efb74714610aba578063ec87621c14610ada57600080fd5b8063da863b3b116100dc578063da863b3b14610a0c578063dc3fc3b214610a22578063e08f2d8914610a4c578063e43a495414610a6257600080fd5b8063cdb54a1b1461097f578063d283e75f14610995578063d547741f146109cc578063d7d25461146109ec57600080fd5b806391b66caa11610185578063b181033a11610154578063b181033a146108ac578063ba19912e146108cc578063c3d51709146108ec578063c8c3df4a1461090c57600080fd5b806391b66caa1461084157806391d1485414610861578063a217fddf14610881578063aba525361461089657600080fd5b80637a4473e1116101c15780637a4473e1146107e15780638129fc1c146108015780638456cb59146108165780638b0bfd351461082b57600080fd5b80636f9170f61461076757806372cda182146107a1578063755d7dd3146107c157600080fd5b80633884545d116102d75780634cd79e0a1161026a57806363e547171161023957806363e54717146106fb57806364363f2b1461071b5780636a42602c146107315780636bb022c81461074757600080fd5b80634cd79e0a146106975780634f431a6f146106ad5780635c975abb146106cd57806361c993c5146106e557600080fd5b806342f1e879116102a657806342f1e8791461060857806343a2a3021461062a57806349557df914610661578063496bf5bb1461067757600080fd5b80633884545d146105915780633a4b66f1146105c95780633f4ba83a146105de5780634006ccc5146105f357600080fd5b8063226f26451161034f57806330b12c8d1161031e57806330b12c8d1461052857806333e5761f1461053e57806336568abe1461055457806336bf33251461057457600080fd5b8063226f2645146104a3578063248a9ca3146104c35780632e12007c146104f35780632f2ff15d1461050857600080fd5b80630917e7761161038b5780630917e776146104385780631616e43d1461044e57806316c14416146104705780631b2ef1ca1461049057600080fd5b806301ffc9a7146103bd57806307e2cea5146103f257806308b84c0c1461042257600080fd5b366103b857005b600080fd5b3480156103c957600080fd5b506103dd6103d8366004614b48565b610b81565b60405190151581526020015b60405180910390f35b3480156103fe57600080fd5b5061041460008051602061532383398151915281565b6040519081526020016103e9565b34801561042e57600080fd5b5061010b54610414565b34801561044457600080fd5b5061010454610414565b34801561045a57600080fd5b5061046e610469366004614a26565b610bb8565b005b34801561047c57600080fd5b5061046e61048b366004614aed565b611069565b61041461049e366004614c97565b611140565b3480156104af57600080fd5b5061046e6104be366004614b70565b61146d565b3480156104cf57600080fd5b506104146104de366004614aed565b60009081526097602052604090206001015490565b3480156104ff57600080fd5b50610414611634565b34801561051457600080fd5b5061046e610523366004614b1d565b611677565b34801561053457600080fd5b5061010054610414565b34801561054a57600080fd5b5061010f54610414565b34801561056057600080fd5b5061046e61056f366004614b1d565b61169d565b34801561058057600080fd5b506104146801bc16d674ec80000081565b34801561059d57600080fd5b5060fb546105b1906001600160a01b031681565b6040516001600160a01b0390911681526020016103e9565b3480156105d557600080fd5b5061046e61171b565b3480156105ea57600080fd5b5061046e61180d565b3480156105ff57600080fd5b50610414611831565b34801561061457600080fd5b5061041460008051602061536383398151915281565b34801561063657600080fd5b506104146106453660046149a3565b6001600160a01b03166000908152610137602052604090205490565b34801561066d57600080fd5b5061011454610414565b34801561068357600080fd5b5061046e610692366004614cb8565b611909565b3480156106a357600080fd5b5061041460ff5481565b3480156106b957600080fd5b5061046e6106c83660046149a3565b611b6c565b3480156106d957600080fd5b5060335460ff166103dd565b3480156106f157600080fd5b5061010a54610414565b34801561070757600080fd5b5061046e610716366004614aed565b611bdc565b34801561072757600080fd5b5061010354610414565b34801561073d57600080fd5b5061010d54610414565b34801561075357600080fd5b5061046e6107623660046149a3565b611c33565b34801561077357600080fd5b506103dd6107823660046149a3565b6001600160a01b03166000908152610138602052604090205460ff1690565b3480156107ad57600080fd5b5061046e6107bc3660046149a3565b611c8d565b3480156107cd57600080fd5b5061046e6107dc366004614aed565b611ce7565b3480156107ed57600080fd5b5060fd546105b1906001600160a01b031681565b34801561080d57600080fd5b5061046e611d6f565b34801561082257600080fd5b5061046e611f21565b34801561083757600080fd5b5061010554610414565b34801561084d57600080fd5b5061046e61085c3660046149a3565b611f42565b34801561086d57600080fd5b506103dd61087c366004614b1d565b611f9c565b34801561088d57600080fd5b50610414600081565b3480156108a257600080fd5b5061011054610414565b3480156108b857600080fd5b5060fc546105b1906001600160a01b031681565b3480156108d857600080fd5b5061046e6108e7366004614aed565b611fc7565b3480156108f857600080fd5b5061046e610907366004614bcd565b61203d565b34801561091857600080fd5b50610960610927366004614aed565b60009081526101066020908152604091829020825180840190935280546001600160a01b03168084526001909101549290910182905291565b604080516001600160a01b0390931683526020830191909152016103e9565b34801561098b57600080fd5b5061010e54610414565b3480156109a157600080fd5b506104146109b03660046149a3565b6001600160a01b03166000908152610109602052604090205490565b3480156109d857600080fd5b5061046e6109e7366004614b1d565b61227a565b3480156109f857600080fd5b5061046e610a07366004614aed565b6122a0565b348015610a1857600080fd5b5061010254610414565b348015610a2e57600080fd5b506101075461010854604080519283526020830191909152016103e9565b348015610a5857600080fd5b5061011154610414565b348015610a6e57600080fd5b5061041460fe5481565b348015610a8457600080fd5b5061041460008051602061534383398151915281565b348015610aa657600080fd5b5061046e610ab5366004614c63565b6122e1565b348015610ac657600080fd5b5061046e610ad53660046149bd565b61247a565b348015610ae657600080fd5b5061041460008051602061530383398151915281565b348015610b0857600080fd5b5061011254610414565b348015610b1e57600080fd5b50610b32610b2d366004614c97565b61279f565b6040516103e993929190614ee5565b348015610b4d57600080fd5b5061046e610b5c366004614a75565b612b3f565b348015610b6d57600080fd5b50610414610b7c366004614cb8565b612ec1565b60006001600160e01b03198216637965db0b60e01b1480610bb257506301ffc9a760e01b6001600160e01b03198316145b92915050565b600260c9541415610be45760405162461bcd60e51b8152600401610bdb90615094565b60405180910390fd5b600260c955600080516020615323833981519152610c028133613148565b816101125414610c245760405162461bcd60e51b8152600401610bdb90614fad565b6000610c396801bc16d674ec800000866151b4565b905084610c795760405162461bcd60e51b815260206004820152600e60248201526d454d5054595f43414c4c4441544160901b6044820152606401610bdb565b80841015610cc95760405162461bcd60e51b815260206004820152601b60248201527f494e53554646494349454e545f4554484552535f53544f5050454400000000006044820152606401610bdb565b6101025461011454610cdb9087615188565b1115610d295760405162461bcd60e51b815260206004820181905260248201527f5245504f525445445f4d4f52455f53544f505045445f56414c494441544f52536044820152606401610bdb565b83610d326131ac565b1015610d805760405162461bcd60e51b815260206004820152601a60248201527f494e53554646494349454e545f4554484552535f5055534845440000000000006044820152606401610bdb565b60005b85811015610f22576000878783818110610dad57634e487b7160e01b600052603260045260246000fd5b9050602002810190610dbf9190615102565b604051610dcd929190614db2565b60405180910390209050600061010160008381526020019081526020016000205411610e2e5760405162461bcd60e51b815260206004820152601060248201526f14155092d15657d393d517d1561254d560821b6044820152606401610bdb565b60008181526101016020526040812054610e4a90600190615212565b90506101008181548110610e6e57634e487b7160e01b600052603260045260246000fd5b600091825260209091206002600390920201015460ff1615610ec75760405162461bcd60e51b8152602060048201526012602482015271125117d053149150511657d4d513d414115160721b6044820152606401610bdb565b60016101008281548110610eeb57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600390910201600201805460ff191691151591909117905550819050610f1a816152a7565b915050610d83565b50858590506101146000828254610f399190615188565b90915550506101178054869190600090610f54908490615188565b9091555060009050610f65826131bd565b9050610f718186615212565b6101036000828254610f839190615188565b92505081905550816101046000828254610f9d9190615212565b90915550610fad90508286615212565b61010c6000828254610fbf9190615188565b909155505061010c5461010a5410610ff75761010c5461010a6000828254610fe79190615212565b9091555050600061010c55611019565b61010a5461010c600082825461100d9190615212565b9091555050600061010a555b60408051878152602081018790527f5a51f96eda2fa129d02ccea2614367ece90f06ee3ced4c58a06a931a2b61995491015b60405180910390a161105b613370565b5050600160c9555050505050565b6000805160206153238339815191526110828133613148565b8161011254146110a45760405162461bcd60e51b8152600401610bdb90614fad565b61010f544712156110c557634e487b7160e01b600052600160045260246000fd5b600061010f54476110d691906151d3565b9050801561113b574761010f819055508061011160008282546110f99190615188565b909155506111079050613370565b6040518181527fe7948c33eb604391785037114655100edf93283c25b69884e9238ae197f078179060200160405180910390a15b505050565b6000600260c95414156111655760405162461bcd60e51b8152600401610bdb90615094565b600260c95560335460ff16156111b05760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610bdb565b8142106111f55760405162461bcd60e51b81526020600482015260136024820152721514905394d050d51253d397d1561412549151606a1b6044820152606401610bdb565b600034116112315760405162461bcd60e51b81526020600482015260096024820152684d494e545f5a45524f60b81b6044820152606401610bdb565b336000908152610138602052604090205460ff166112d85733600090815261013760205260409020546801bc16d674ec80000090611270903490615188565b11156112b25760405162461bcd60e51b81526020600482015260116024820152704e4545445f4b59435f464f525f4d4f524560781b6044820152606401610bdb565b3360009081526101376020526040812080543492906112d2908490615188565b90915550505b6112e1346133c5565b60fc54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b15801561132657600080fd5b505afa15801561133a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135e9190614b05565b9050600061136a611634565b905060006113793460016151b4565b90508115611399578161138c34856151b4565b61139691906151a0565b90505b858110156113e35760405162461bcd60e51b815260206004820152601760248201527608ab08690829c8e8abea482a8929ebe9a92a69a82a8869604b1b6044820152606401610bdb565b60fc546040516340c10f1960e01b8152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561142f57600080fd5b505af1158015611443573d6000803e3d6000fd5b5050505034610103600082825461145a9190615188565b9091555050600160c95595945050505050565b6000805160206153638339815191526114868133613148565b606082146114a65760405162461bcd60e51b8152600401610bdb90615066565b603084146114c65760405162461bcd60e51b8152600401610bdb906150cb565b600085856040516114d8929190614db2565b6040518091039020905061010160008281526020019081526020016000205460001461153a5760405162461bcd60e51b81526020600482015260116024820152704455504c4943415445445f5055424b455960781b6044820152606401610bdb565b6040805160806020601f8901819004028201810190925260608101878152610100928291908a908a9081908501838280828437600092019190915250505090825250604080516020601f890181900481028201810190925287815291810191908890889081908401838280828437600092018290525093855250505060209182018190528354600181018555938152819020825180519394600302909101926115e69284920190614869565b5060208281015180516115ff9260018501920190614869565b50604091820151600291909101805460ff19169115159190911790556101005460009283526101016020529120555050505050565b600061010c546101055461010a5461010454610103546116549190615188565b61165e9190615188565b6116689190615212565b6116729190615212565b905090565b6000828152609760205260409020600101546116938133613148565b61113b83836133e0565b6001600160a01b038116331461170d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610bdb565b6117178282613466565b5050565b6000805160206153638339815191526117348133613148565b60006801bc16d674ec8000006101035461174e91906151a0565b610100546101025491925090611765908390615188565b11156117a75760405162461bcd60e51b8152602060048201526011602482015270149151d254d5149657d111541311551151607a1b6044820152606401610bdb565b60005b818110156117cc576117ba6134cd565b806117c4816152a7565b9150506117aa565b507fe2a191ee805447bcf5adabadd39cb816b1b46de1364263aef69980bdafd8370f6101025460405161180191815260200190565b60405180910390a15050565b6000805160206153438339815191526118268133613148565b61182e6136a9565b50565b60008060fc60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561188257600080fd5b505afa158015611896573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ba9190614b05565b9050806118da576118d4670de0b6b3a764000060016151b4565b91505090565b600081670de0b6b3a76400006118ee611634565b6118f891906151b4565b61190291906151a0565b9392505050565b6000805160206153238339815191526119228133613148565b8161011254146119445760405162461bcd60e51b8152600401610bdb90614fad565b61010f5447146119895760405162461bcd60e51b815260206004820152601060248201526f42414c414e43455f444556494154455360801b6044820152606401610bdb565b610102546101145461199b9086615188565b11156119e95760405162461bcd60e51b815260206004820152601860248201527f56414c494441544f525f434f554e545f4d49534d4154434800000000000000006044820152606401610bdb565b6119fc6801bc16d674ec800000856151b4565b831015611a4b5760405162461bcd60e51b815260206004820152601760248201527f414c4956455f42414c414e43455f4445435245415345440000000000000000006044820152606401610bdb565b61010e5461010d5461011754611a619087615188565b1115611aa957600061010d546101175487611a7c9190615188565b611a869190615212565b9050611a9b6801bc16d674ec800000826151b4565b611aa59083615188565b9150505b80610110546101115486611abd9190615188565b611ac79190615188565b11611b095760405162461bcd60e51b81526020600482015260126024820152714e4f545f454e4f5547485f524556454e554560701b6044820152606401610bdb565b600081610110546101115487611b1f9190615188565b611b299190615188565b611b339190615212565b9050611b3e8161373c565b61010e85905561010d869055600061011181905561011081905561011755611b64613370565b505050505050565b6000611b788133613148565b6001600160a01b03821660008181526101386020908152604091829020805460ff8082161560ff1990921682179092558351948552161515908301527f96993f732e425c7615ed977e16e6e83d84bb45203ca23885018335b66c2e85be9101611801565b6000611be88133613148565b61011554821015611c2c5760405162461bcd60e51b815260206004820152600e60248201526d50484153455f524f4c4c4241434b60901b6044820152606401610bdb565b5061011555565b6000611c3f8133613148565b60fd80546001600160a01b0319166001600160a01b0384169081179091556040519081527f4d3d3f5d1d8423a4e40b3fcfccaf0c1b18ca550a8592d5e38a61765931a9cf7890602001611801565b6000611c998133613148565b60fc80546001600160a01b0319166001600160a01b0384169081179091556040519081527f65f24f264bd70348b9888b2fbf27cd04f9e2fb0fcc50dde8fb36483576ef32a390602001611801565b6000611cf38133613148565b6103e8821115611d3a5760405162461bcd60e51b815260206004820152601260248201527153484152455f4f55545f4f465f52414e474560701b6044820152606401610bdb565b60fe8290556040518281527f4de90ec86e1bc56c192e2399bacbd10bdaba720caca606354d66c5cb33d6802b90602001611801565b600054610100900460ff16611d8a5760005460ff1615611d8e565b303b155b611df15760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610bdb565b600054610100900460ff16158015611e13576000805461ffff19166101011790555b611e1b6137c5565b611e236137f6565b611e2b61381d565b611e366000336133e0565b611e4e600080516020615323833981519152336133e0565b611e66600080516020615363833981519152336133e0565b611e7e600080516020615343833981519152336133e0565b611e96600080516020615303833981519152336133e0565b600560fe55600161010755600061010881905561011555611eb5613370565b60408051600b808252818301909252600091600160f81b91906020820181803683375050604051611eed939291503090602001614d63565b6040516020818303038152906040529050611f0981600061384c565b60ff5550801561182e576000805461ff001916905550565b600080516020615343833981519152611f3a8133613148565b61182e6138aa565b6000611f4e8133613148565b60fb80546001600160a01b0319166001600160a01b0384169081179091556040519081527f1781ac9526b978975dba0fd26a33e044a55a7ace054a3ee7efa5f8459513bead90602001611801565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020615303833981519152611fe08133613148565b61010b548211156120035760405162461bcd60e51b8152600401610bdb90614fda565b60405162461bcd60e51b815260206004820152600f60248201526e1393d517d253541311535153951151608a1b6044820152606401610bdb565b6000805160206153638339815191526120568133613148565b603084146120765760405162461bcd60e51b8152600401610bdb906150cb565b606082146120965760405162461bcd60e51b8152600401610bdb90615066565b600087876040516120a8929190614db2565b6040518091039020905060006101016000838152602001908152602001600020541161210a5760405162461bcd60e51b81526020600482015260116024820152705055424b45595f4e4f545f45585349545360781b6044820152606401610bdb565b6000818152610101602052604081205461212690600190615212565b60008381526101016020526040808220829055519192509061214b9089908990614db2565b6040805191829003822060806020601f8c018190040284018101909252606083018a815290935082918b908b9081908501838280828437600092019190915250505090825250604080516020601f8a018190048102820181019092528881529181019190899089908190840183828082843760009201829052509385525050506020909101526101008054849081106121f457634e487b7160e01b600052603260045260246000fd5b9060005260206000209060030201600082015181600001908051906020019061221e929190614869565b5060208281015180516122379260018501920190614869565b50604091909101516002909101805460ff191691151591909117905561225e826001615188565b6000918252610101602052604090912055505050505050505050565b6000828152609760205260409020600101546122968133613148565b61113b8383613466565b60006122ac8133613148565b60ff8290556040518281527f690facbfacb53c9319489117a6ac422718b5cb059a6ffade4871ff10f6f9aee990602001611801565b600260c95414156123045760405162461bcd60e51b8152600401610bdb90615094565b600260c9556000805160206153038339815191526123228133613148565b8161011254146123445760405162461bcd60e51b8152600401610bdb90614fad565b61010f5447146123895760405162461bcd60e51b815260206004820152601060248201526f42414c414e43455f444556494154455360801b6044820152606401610bdb565b61010b548411156123ac5760405162461bcd60e51b8152600401610bdb90614fda565b6123b46131ac565b8411156123f95760405162461bcd60e51b8152602060048201526013602482015272494e53554646494349454e545f45544845525360681b6044820152606401610bdb565b61240284613925565b8361010b60008282546124159190615212565b9091555061242e90506001600160a01b03841685613938565b604080518581526001600160a01b03851660208201527f2425aa1fadefc5c570850aa9c9e3dfa4fc6b43ccd1c05b47db38dd6518a743b3910160405180910390a15050600160c9555050565b6000805160206153638339815191526124938133613148565b8382146124d55760405162461bcd60e51b815260206004820152601060248201526f13115391d51217d393d517d15455505360821b6044820152606401610bdb565b8360005b8181101561279657603087878381811061250357634e487b7160e01b600052603260045260246000fd5b90506020028101906125159190615102565b9050146125345760405162461bcd60e51b8152600401610bdb906150cb565b606085858381811061255657634e487b7160e01b600052603260045260246000fd5b90506020028101906125689190615102565b9050146125875760405162461bcd60e51b8152600401610bdb90615066565b60008787838181106125a957634e487b7160e01b600052603260045260246000fd5b90506020028101906125bb9190615102565b6040516125c9929190614db2565b6040518091039020905061010160008281526020019081526020016000205460001461262b5760405162461bcd60e51b81526020600482015260116024820152704455504c4943415445445f5055424b455960781b6044820152606401610bdb565b61010060405180606001604052808a8a8681811061265957634e487b7160e01b600052603260045260246000fd5b905060200281019061266b9190615102565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020018888868181106126c557634e487b7160e01b600052603260045260246000fd5b90506020028101906126d79190615102565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505050602091820181905283546001810185559381528190208251805193946003029091019261273d9284920190614869565b5060208281015180516127569260018501920190614869565b50604091820151600291909101805460ff19169115159190911790556101005460009283526101016020529120558061278e816152a7565b9150506124d9565b50505050505050565b606080806127ad8585615212565b67ffffffffffffffff8111156127d357634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561280657816020015b60608152602001906001900390816127f15790505b5092506128138585615212565b67ffffffffffffffff81111561283957634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561286c57816020015b60608152602001906001900390816128575790505b5091506128798585615212565b67ffffffffffffffff81111561289f57634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156128c8578160200160208202803683370190505b5090506000855b85811015612b365761010081815481106128f957634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160000180546129159061526c565b80601f01602080910402602001604051908101604052809291908181526020018280546129419061526c565b801561298e5780601f106129635761010080835404028352916020019161298e565b820191906000526020600020905b81548152906001019060200180831161297157829003601f168201915b50505050508583815181106129b357634e487b7160e01b600052603260045260246000fd5b602002602001018190525061010081815481106129e057634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160010180546129fc9061526c565b80601f0160208091040260200160405190810160405280929190818152602001828054612a289061526c565b8015612a755780601f10612a4a57610100808354040283529160200191612a75565b820191906000526020600020905b815481529060010190602001808311612a5857829003601f168201915b5050505050848381518110612a9a57634e487b7160e01b600052603260045260246000fd5b60200260200101819052506101008181548110612ac757634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160020160009054906101000a900460ff16838381518110612b0657634e487b7160e01b600052603260045260246000fd5b9115156020928302919091019091015281612b20816152a7565b9250508080612b2e906152a7565b9150506128cf565b50509250925092565b600260c9541415612b625760405162461bcd60e51b8152600401610bdb90615094565b600260c955600080516020615323833981519152612b808133613148565b816101125414612ba25760405162461bcd60e51b8152600401610bdb90614fad565b6000612bb76801bc16d674ec800000876151b4565b905085612bf75760405162461bcd60e51b815260206004820152600e60248201526d454d5054595f43414c4c4441544160901b6044820152606401610bdb565b80612c028686615188565b1015612c0d57600080fd5b84612c166131ac565b1015612c645760405162461bcd60e51b815260206004820152601a60248201527f494e53554646494349454e545f4554484552535f5055534845440000000000006044820152606401610bdb565b60005b86811015612e06576000888883818110612c9157634e487b7160e01b600052603260045260246000fd5b9050602002810190612ca39190615102565b604051612cb1929190614db2565b60405180910390209050600061010160008381526020019081526020016000205411612d125760405162461bcd60e51b815260206004820152601060248201526f14155092d15657d393d517d1561254d560821b6044820152606401610bdb565b60008181526101016020526040812054612d2e90600190615212565b90506101008181548110612d5257634e487b7160e01b600052603260045260246000fd5b600091825260209091206002600390920201015460ff1615612dab5760405162461bcd60e51b8152602060048201526012602482015271125117d053149150511657d4d513d414115160721b6044820152606401610bdb565b60016101008281548110612dcf57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600390910201600201805460ff191691151591909117905550819050612dfe816152a7565b915050612c67565b50868690506101146000828254612e1d9190615188565b90915550506101178054879190600090612e38908490615188565b92505081905550846101036000828254612e529190615188565b92505081905550806101046000828254612e6c9190615212565b92505081905550836101106000828254612e869190615188565b909155505060408051878152602081018690527f10d3cb48238c3e81c131ce17f23375c27148e293784bbfe05e852647c2299115910161104b565b6000600260c9541415612ee65760405162461bcd60e51b8152600401610bdb90615094565b600260c95561011554600190811115612f325760405162461bcd60e51b815260206004820152600e60248201526d0a09082a68abe9a92a69a82a886960931b6044820152606401610bdb565b824210612f775760405162461bcd60e51b81526020600482015260136024820152721514905394d050d51253d397d1561412549151606a1b6044820152606401610bdb565b612f8a6801bc16d674ec800000866152c2565b15612fd05760405162461bcd60e51b815260206004820152601660248201527552454445454d5f4e4f545f494e5f333245544845525360501b6044820152606401610bdb565b60fc54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b15801561301557600080fd5b505afa158015613029573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061304d9190614b05565b90506000613059611634565b61306388846151b4565b61306d91906151a0565b9050858111156130b95760405162461bcd60e51b815260206004820152601760248201527608ab08690829c8e8abea482a8929ebe9a92a69a82a8869604b1b6044820152606401610bdb565b60fc546130d1906001600160a01b0316333084613a51565b60fc54604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561311757600080fd5b505af115801561312b573d6000803e3d6000fd5b505050506131393388613ab1565b600160c9559695505050505050565b6131528282611f9c565b6117175761316a816001600160a01b03166014613b93565b613175836020613b93565b604051602001613186929190614e70565b60408051601f198184030181529082905262461bcd60e51b8252610bdb91600401614f9a565b600061010354476116729190615212565b60fd546000906001600160a01b03166132105760405162461bcd60e51b81526020600482015260156024820152741111509517d0d3d395149050d517d393d517d4d155605a1b6044820152606401610bdb565b610107545b610108548111613348578261322957613348565b600081815261010660205260408120600181015490919085101561324d5784613253565b81600101545b9050808260010160008282546132699190615212565b9091555061327990508186615212565b82546001600160a01b0316600090815261010960205260408120805492975083929091906132a8908490615212565b909155506132b890508185615188565b60fd548354604051630c11dedd60e01b81526001600160a01b0391821660048201529296501690630c11dedd9083906024016000604051808303818588803b15801561330357600080fd5b505af1158015613317573d6000803e3d6000fd5b505050505081600101546000141561333357613331613d75565b505b50508080613340906152a7565b915050613215565b5080610105600082825461335c9190615212565b9091555061336b905081613925565b919050565b6101138054906000613381836152a7565b909155505061011254610113546040805160208101939093524290830152606082015260800160408051601f19818403018152919052805160209091012061011255565b8061010f60008282546133d89190615147565b909155505050565b6133ea8282611f9c565b6117175760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556134223390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6134708282611f9c565b156117175760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061010061010254815481106134f457634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160405180606001604052908160008201805461351d9061526c565b80601f01602080910402602001604051908101604052809291908181526020018280546135499061526c565b80156135965780601f1061356b57610100808354040283529160200191613596565b820191906000526020600020905b81548152906001019060200180831161357957829003601f168201915b505050505081526020016001820180546135af9061526c565b80601f01602080910402602001604051908101604052809291908181526020018280546135db9061526c565b80156136285780601f106135fd57610100808354040283529160200191613628565b820191906000526020600020905b81548152906001019060200180831161360b57829003601f168201915b50505091835250506002919091015460ff16151560209182015281519082015191925061365491613e0d565b6101028054906000613665836152a7565b91905055506801bc16d674ec80000061010460008282546136869190615188565b925050819055506801bc16d674ec80000061010360008282546133d89190615212565b60335460ff166136f25760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610bdb565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60006103e860fe548361374f91906151b4565b61375991906151a0565b90508061010b600082825461376e9190615188565b9091555061377e90508183615212565b61010a60008282546137909190615188565b90915550506040518281527f82f24840c0f58d92529afdd441950ddc6e8f2d60138d4458a8d74ba367540cda90602001611801565b600054610100900460ff166137ec5760405162461bcd60e51b8152600401610bdb9061501b565b6137f461428d565b565b600054610100900460ff166137f45760405162461bcd60e51b8152600401610bdb9061501b565b600054610100900460ff166138445760405162461bcd60e51b8152600401610bdb9061501b565b6137f46142c0565b6000613859826020615188565b835110156138a15760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b6044820152606401610bdb565b50016020015190565b60335460ff16156138f05760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610bdb565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861371f3390565b8061010f60008282546133d891906151d3565b804710156139885760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610bdb565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146139d5576040519150601f19603f3d011682016040523d82523d6000602084013e6139da565b606091505b505090508061113b5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610bdb565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052613aab9085906142ee565b50505050565b60016101086000828254613ac59190615188565b90915550506040805180820182526001600160a01b0384811680835260208084018681526101085460009081526101068352868120955186546001600160a01b03191695169490941785555160019094019390935581526101099091529081208054839290613b35908490615188565b92505081905550806101056000828254613b4f9190615188565b9091555050604080516001600160a01b0384168152602081018390527f889f3b08db1ce169841b4f7e2aadfe4298088b1bce57b31fecae3260dd4358299101611801565b60606000613ba28360026151b4565b613bad906002615188565b67ffffffffffffffff811115613bd357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613bfd576020820181803683370190505b509050600360fc1b81600081518110613c2657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613c6357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000613c878460026151b4565b613c92906001615188565b90505b6001811115613d26576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613cd457634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110613cf857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93613d1f81615255565b9050613c95565b5083156119025760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610bdb565b604080518082019091526000808252602082015261010754610108541015613d9c57600080fd5b506101078054600081815261010660208181526040808420815180830190925280546001600160a01b03811683526001808301805485870152978752949093526001600160a01b031990921690915592829055835492939092909190613e03908490615188565b9250508190555090565b60ff54613e5c5760405162461bcd60e51b815260206004820152601e60248201527f5749544844524157414c5f43524544454e5449414c535f4e4f545f53455400006044820152606401610bdb565b6801bc16d674ec8000006000613e76633b9aca00836151a0565b905081613e87633b9aca00836151b4565b14613ea257634e487b7160e01b600052600160045260246000fd5b6000600285600060801b604051602001613ebd929190614dde565b60408051601f1981840301815290829052613ed791614dc2565b602060405180830381855afa158015613ef4573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190613f179190614b05565b90506000600280613f2b87600060406143c0565b604051613f389190614dc2565b602060405180830381855afa158015613f55573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190613f789190614b05565b6002613f90886040613f8b816060615212565b6143c0565b604051613fa39190600090602001614e4e565b60408051601f1981840301815290829052613fbd91614dc2565b602060405180830381855afa158015613fda573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190613ffd9190614b05565b60408051602081019390935282015260600160408051601f198184030181529082905261402991614dc2565b602060405180830381855afa158015614046573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906140699190614b05565b90506000614076846144cd565b905060006002808560ff5460405160200161409b929190918252602082015260400190565b60408051601f19818403018152908290526140b591614dc2565b602060405180830381855afa1580156140d2573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906140f59190614b05565b60405160029061410e9086906000908990602001614e16565b60408051601f198184030181529082905261412891614dc2565b602060405180830381855afa158015614145573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906141689190614b05565b60408051602081019390935282015260600160408051601f198184030181529082905261419491614dc2565b602060405180830381855afa1580156141b1573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906141d49190614b05565b60fb5460ff546040519293506001600160a01b03909116916322895118916801bc16d674ec800000918c9161420f9160200190815260200190565b6040516020818303038152906040528b866040518663ffffffff1660e01b815260040161423f9493929190614f4f565b6000604051808303818588803b15801561425857600080fd5b505af115801561426c573d6000803e3d6000fd5b50505050506142836801bc16d674ec800000613925565b5050505050505050565b600054610100900460ff166142b45760405162461bcd60e51b8152600401610bdb9061501b565b6033805460ff19169055565b600054610100900460ff166142e75760405162461bcd60e51b8152600401610bdb9061501b565b600160c955565b6000614343826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166146f19092919063ffffffff16565b80519091501561113b57808060200190518101906143619190614acd565b61113b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610bdb565b6060816143ce81601f615188565b101561440d5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610bdb565b6144178284615188565b8451101561445b5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610bdb565b60608215801561447a57604051915060008252602082016040526144c4565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156144b357805183526020928301920161449b565b5050858452601f01601f1916604052505b50949350505050565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b8260008151811061451b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060061a60f81b8260018151811061455a57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060051a60f81b8260028151811061459957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060041a60f81b826003815181106145d857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060031a60f81b8260048151811061461757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060021a60f81b8260058151811061465657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060011a60f81b8260068151811061469557634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508060001a60f81b826007815181106146d457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535050919050565b60606147008484600085614708565b949350505050565b6060824710156147695760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610bdb565b843b6147b75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610bdb565b600080866001600160a01b031685876040516147d39190614dc2565b60006040518083038185875af1925050503d8060008114614810576040519150601f19603f3d011682016040523d82523d6000602084013e614815565b606091505b5091509150614825828286614830565b979650505050505050565b6060831561483f575081611902565b82511561484f5782518084602001fd5b8160405162461bcd60e51b8152600401610bdb9190614f9a565b8280546148759061526c565b90600052602060002090601f01602090048101928261489757600085556148dd565b82601f106148b057805160ff19168380011785556148dd565b828001600101855582156148dd579182015b828111156148dd5782518255916020019190600101906148c2565b506148e99291506148ed565b5090565b5b808211156148e957600081556001016148ee565b80356001600160a01b038116811461336b57600080fd5b60008083601f84011261492a578182fd5b50813567ffffffffffffffff811115614941578182fd5b6020830191508360208260051b850101111561495c57600080fd5b9250929050565b60008083601f840112614974578182fd5b50813567ffffffffffffffff81111561498b578182fd5b60208301915083602082850101111561495c57600080fd5b6000602082840312156149b4578081fd5b61190282614902565b600080600080604085870312156149d2578283fd5b843567ffffffffffffffff808211156149e9578485fd5b6149f588838901614919565b90965094506020870135915080821115614a0d578384fd5b50614a1a87828801614919565b95989497509550505050565b60008060008060608587031215614a3b578384fd5b843567ffffffffffffffff811115614a51578485fd5b614a5d87828801614919565b90989097506020870135966040013595509350505050565b600080600080600060808688031215614a8c578081fd5b853567ffffffffffffffff811115614aa2578182fd5b614aae88828901614919565b9099909850602088013597604081013597506060013595509350505050565b600060208284031215614ade578081fd5b81518015158114611902578182fd5b600060208284031215614afe578081fd5b5035919050565b600060208284031215614b16578081fd5b5051919050565b60008060408385031215614b2f578182fd5b82359150614b3f60208401614902565b90509250929050565b600060208284031215614b59578081fd5b81356001600160e01b031981168114611902578182fd5b60008060008060408587031215614b85578384fd5b843567ffffffffffffffff80821115614b9c578586fd5b614ba888838901614963565b90965094506020870135915080821115614bc0578384fd5b50614a1a87828801614963565b60008060008060008060608789031215614be5578081fd5b863567ffffffffffffffff80821115614bfc578283fd5b614c088a838b01614963565b90985096506020890135915080821115614c20578283fd5b614c2c8a838b01614963565b90965094506040890135915080821115614c44578283fd5b50614c5189828a01614963565b979a9699509497509295939492505050565b600080600060608486031215614c77578081fd5b83359250614c8760208501614902565b9150604084013590509250925092565b60008060408385031215614ca9578182fd5b50508035926020909101359150565b600080600060608486031215614ccc578081fd5b505081359360208301359350604090920135919050565b600081518084526020808501808196508360051b81019150828601855b85811015614d2a578284038952614d18848351614d37565b98850198935090840190600101614d00565b5091979650505050505050565b60008151808452614d4f816020860160208601615229565b601f01601f19169290920160200192915050565b6001600160f81b0319841681528251600090614d86816001850160208801615229565b60609390931b6bffffffffffffffffffffffff1916600192909301918201929092526015019392505050565b8183823760009101908152919050565b60008251614dd4818460208701615229565b9190910192915050565b60008351614df0818460208801615229565b6fffffffffffffffffffffffffffffffff19939093169190920190815260100192915050565b60008451614e28818460208901615229565b67ffffffffffffffff199490941691909301908152601881019190915260380192915050565b60008351614e60818460208801615229565b9190910191825250602001919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614ea8816017850160208801615229565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614ed9816028840160208801615229565b01602801949350505050565b606081526000614ef86060830186614ce3565b602083820381850152614f0b8287614ce3565b84810360408601528551808252828701935090820190845b81811015614f41578451151583529383019391830191600101614f23565b509098975050505050505050565b608081526000614f626080830187614d37565b8281036020840152614f748187614d37565b90508281036040840152614f888186614d37565b91505082606083015295945050505050565b6020815260006119026020830184614d37565b60208082526013908201527221a0a9aaa0a624aa2cafab24a7a620aa24a7a760691b604082015260600190565b60208082526021908201527f57495448445241575f45584345454445445f4d414e414745525f524556454e556040820152604560f81b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526014908201527324a721a7a729a4a9aa22a72a2fa9a4a3afa622a760611b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526017908201527f494e434f4e53495354454e545f5055424b45595f4c454e000000000000000000604082015260600190565b6000808335601e19843603018112615118578283fd5b83018035915067ffffffffffffffff821115615132578283fd5b60200191503681900382131561495c57600080fd5b600080821280156001600160ff1b0384900385131615615169576151696152d6565b600160ff1b8390038412811615615182576151826152d6565b50500190565b6000821982111561519b5761519b6152d6565b500190565b6000826151af576151af6152ec565b500490565b60008160001904831182151516156151ce576151ce6152d6565b500290565b60008083128015600160ff1b8501841216156151f1576151f16152d6565b6001600160ff1b038401831381161561520c5761520c6152d6565b50500390565b600082821015615224576152246152d6565b500390565b60005b8381101561524457818101518382015260200161522c565b83811115613aab5750506000910152565b600081615264576152646152d6565b506000190190565b600181811c9082168061528057607f821691505b602082108114156152a157634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156152bb576152bb6152d6565b5060010190565b6000826152d1576152d16152ec565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0868e79a7bf1e0bc45d0a330c573bc367f9cf464fd326078812f301165fbda4ef165d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862ac2979137d1774e40fe2638d355bf7a7b092be4c67f242aad1655e1e27f9df9cca26469706673582212209f5fd8d333e1f29cdefab06a323e609c474cc6faa40d9c73eb18ee706b44df6b64736f6c63430008040033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.