Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
NGOLis
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; import "./interfaces/ILido.sol"; import "./interfaces/IWithdrawalQueue.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; /** * @title NGOLis * @dev The NGOLis contract manages staking and withdrawal functionalities for a Non-Governmental Organization (NGO). It interacts with the Lido Finance protocol for staking and withdrawal queue for managing withdrawals. */ contract NGOLis is Initializable, ERC721HolderUpgradeable, ReentrancyGuardUpgradeable, UUPSUpgradeable, OwnableUpgradeable { using Math for uint256; /** * @dev Struct representing stake information for a user. */ struct StakeInfo { uint16 percent; uint amount; uint startDate; } /** * @dev Emitted when a user stakes funds in the NGO. * @param _id The id of the user's stake. * @param _staker The address of the user staking funds. * @param _amountStaked The amount of funds staked. * @param _percentShare The percentage share of the NGO. * @param _ngo The address of the NGO contract. * @param _startDate The timestamp when the staking started. * @param _timestamp The block timestamp of the staking started. * @param _blockNumber The block number of the staking started. */ event Staked( uint _id, address _staker, uint256 _amountStaked, uint16 _percentShare, address _ngo, uint _startDate, uint _timestamp, uint _blockNumber ); /** * @dev Emitted when the rewards for the NGO are updated. * @param _rewardsPool The total rewards in the pool. * @param stakedBalance The total staked balance in the NGO. * @param totalShare The total share of the NGO. * @param _dateRecountRewards The timestamp when the rewards were last updated. * @param _timestamp The block timestamp when rewards was updated. * @param _blockNumber The block number when rewards was updated. */ event RewardsUpdated( uint _rewardsPool, uint stakedBalance, uint totalShare, uint _dateRecountRewards, uint _timestamp, uint _blockNumber ); /** * @dev Emitted when a user requests a withdrawal. * @param _staker The address of the user requesting withdrawal. * @param _ngo The address of the NGO contract. * @param _requestId The ID of the withdrawal request. * @param _timestamp The block timestamp when withdraw was requested. * @param _blockNumber The block number when withdraw was requested. */ event WithdrawRequested( address _staker, address _ngo, uint _requestId, uint _timestamp, uint _blockNumber, uint _stakeId ); /** * @dev Emitted when a user claims a withdrawal. * @param _claimer The address of the user claiming withdrawal. * @param _ngo The address of the NGO contract. * @param _amount The amount of ETH claimed. * @param _requestId The ID of the withdrawal request. * @param _timestamp The block timestamp when withdraw was claimed. * @param _blockNumber The block number when withdraw was claimed. */ event WithdrawClaimed( address _claimer, address _ngo, uint _amount, uint _requestId, uint _timestamp, uint _blockNumber ); /** * @dev Emitted when a user claims a withdrawal in stEth. * @param _claimer The address of the user claiming withdrawal. * @param _ngo The address of the NGO contract. * @param _amount The amount of ETH claimed. * @param _timestamp The block timestamp when withdraw was claimed. * @param _blockNumber The block number when withdraw was claimed. * @param _stakeId The id of the stake. */ event WithdrawInStEthClaimed( address _claimer, address _ngo, uint _amount, uint _timestamp, uint _blockNumber, uint _stakeId ); /** * @dev Event for graph. * @param _name The name of the NGO. * @param _imageLink The link to the image associated with the NGO. * @param _description A description of the NGO. * @param _link A link associated with the NGO. * @param _location A location of the NGO. * @param _ngo The address of the NGO contract. * @param _timestamp The block timestamp when withdraw was claimed. */ event GraphEvent( string _name, string _imageLink, string _description, string _link, string _location, address _ngo, uint _timestamp ); /** * @dev Emitted when the NGO is finished. * @param _ngo The address of the NGO contract. * @param _timestamp The timestamp when the NGO was finished. * @param _blockNumber The block number when the NGO was finished. */ event NGOFinished(address _ngo, uint256 _timestamp, uint _blockNumber); /** * @dev Error indicating an invalid percentage value. */ error InvalidPercent(); /** * @dev Error indicating that the required time has not passed. * @param _currentTime The current block timestamp. * @param _needTime The staking duration. * @param _startDate The start staking date. */ error TimeNotPassed(uint _currentTime, uint _needTime, uint _startDate); /** * @dev Error indicating that the user has not staked funds. */ error NotStaked(); /** * @dev Error indicating that the user has not owned this request. */ error InvalidRequestIdForUser(address _claimer, uint256 _requestId); /** * @dev Error indicating insufficient staked funds for a withdrawal. */ error InsufficientStakedFunds(); /** * @dev Error indicating that only the owner or oracle can perform the operation. */ error OnlyOracle(address _sender); /** * @dev Error indicating that the NGO has already finished. */ error NgoFinished(); /** * @dev Error indicating an issue with the withdrawal process. */ error WithdrawError(); /** * @dev Error indicating an issue that rewards have been already distributed. */ error RewardError(); /** * @dev Error indicating that user banned. */ error UserBanned(); /** * @dev Modifier to restrict access to only the owner or oracle. */ modifier onlyOracle() { if (!_oracles[msg.sender]) { revert OnlyOracle(msg.sender); } _; } /** * @dev Modifier to check if the NGO has finished. */ modifier notFinished() { if (isFinish) { revert NgoFinished(); } _; } /** * @dev Modifier to check valid stake info. */ modifier validStake(uint16 _ngoPercent) { if ( _ngoPercent < MIN_SHARE_PERCENT || _ngoPercent > MAX_SHARE_PERCENT ) { revert InvalidPercent(); } _; } modifier notBanned() { if (isBanned[msg.sender]) { revert UserBanned(); } _; } /** * @dev Constant representing the minimum share percentage. */ uint16 constant MIN_SHARE_PERCENT = 100; /** * @dev Constant representing the maximum share percentage. */ uint16 constant MAX_SHARE_PERCENT = 10000; /** * @dev Constant representing the percentage divider. */ uint constant PERCENT_DIVIDER = 10000; /** * @dev Constant representing the LIS fee percentage. */ uint constant LIS_FEE = 500; /** * @dev Storage variable for the total staked balance. */ uint public stakedBalance; /** * @dev Storage variable for the previous rewards. */ uint private _prevRewards; /** * @dev Storage variable for the total share of funds today. */ uint private totalShareToday; /** * @dev Storage variable for the timestamp when rewards were last counted. */ uint private lastCountRewardsTimestamp; /** * @dev Storage variable for the previous rewards. */ uint private prevRewards; /** * @dev Total shares for all staked users. */ uint private totalShares; /** * @dev Storage variable for converting assets to shares. */ uint private totalAssets; /** * @dev Storage variable for id of stake. */ uint private id; /** * @dev Storage variable for the address of the LIS token contract. */ address private _lis; /** * @dev Storage variable for last balance after distribution. */ uint private lastDistributionBalance; /** * @dev Storage variable for the Lido Smart Contract interface. */ ILido public lidoSC; /** * @dev Storage variable for the Withdrawal Queue Smart Contract interface. */ IWithdrawalQueue public withdrawalSC; /** * @dev Storage variable for the address of the rewards owner. */ address public rewardsOwner; /** * @dev Storage variable indicating whether the NGO has finished. */ bool public isFinish; /** * @dev Mapping to store stake information for each user. */ mapping(address => mapping(uint => StakeInfo)) private _userToStakeInfo; /** * @dev Mapping to store information for each oracles. */ mapping(address => bool) private _oracles; /** * @dev Mapping to store historical rewards data. */ mapping(uint => uint) private _historyRewards; /** * @dev Mapping to store historical total share data. */ mapping(uint => uint) private _historyStakedBalance; /** * @dev Mapping to store historical balance data. */ mapping(uint => uint) private _historyBalance; /** * @dev Mapping to store lido request id for users. */ mapping(uint => address) private _requestIdToUser; /** * @dev Mapping to shares for specific user. */ mapping(address => mapping(uint => uint)) shares; /** * @dev Mapping to store ban indication of user. */ mapping(address => bool) isBanned; /** * @dev Initializes the NGO contract with required parameters. * @param lidoSCAddress The address of the Lido Smart Contract. * @param _rewardOwnerAddress The address of the rewards owner. * @param withdrawalSCAddress The address of the Withdrawal Queue Smart Contract. */ function initialize( address lidoSCAddress, address _rewardOwnerAddress, address withdrawalSCAddress, address owner, address oracle ) public initializer { __ERC721Holder_init(); __UUPSUpgradeable_init(); __Ownable_init(owner); _oracles[oracle] = true; _lis = msg.sender; lidoSC = ILido(lidoSCAddress); withdrawalSC = IWithdrawalQueue(withdrawalSCAddress); rewardsOwner = _rewardOwnerAddress; lastCountRewardsTimestamp = getRoundDate(block.timestamp); id = 1; } /** * @dev Upgrades version of NGO contract. * @param newImplementation The address of the new implementation. */ function _authorizeUpgrade( address newImplementation ) internal override onlyOwner {} /** * @dev Converts user amount to shares. * @param assets The amount of assets. * @return The amount of shares. */ function convertAssetsToShares( uint256 assets ) private view returns (uint256) { if (totalShares == 0) { return assets; } return (assets * totalShares) / totalAssets; } /** * @dev Stakes funds in the NGO. * @notice Emit [Staked()](#staked) event * @param _ngoPercent The percentage share of the NGO. */ function stake( uint16 _ngoPercent ) public payable notFinished validStake(_ngoPercent) notBanned { totalAssets = getCurrentBalanceFromLido(); lidoSC.submit{value: msg.value}(address(this)); uint256 balanceAfterStaked = getCurrentBalanceFromLido(); uint256 assets = balanceAfterStaked - totalAssets; _userToStakeInfo[msg.sender][id] = StakeInfo({ percent: _ngoPercent, amount: assets, startDate: block.timestamp }); uint256 share = convertAssetsToShares(assets); if (totalShares == 0) { totalShares += 1000; shares[address(0)][id] += 1000; share -= 1000; } shares[msg.sender][id] += share; totalShares += share; stakedBalance += assets; totalShareToday += (assets * (_ngoPercent)) / PERCENT_DIVIDER; emit Staked( id, msg.sender, assets, _ngoPercent, address(this), lastCountRewardsTimestamp, block.timestamp, block.number ); id++; } /** * @dev Stakes stETH in the NGO. * @notice Emit [Staked()](#staked) event * @param amount The amount of stETH to transfer * @param _ngoPercent The percentage share of the NGO. */ function stakeStEth( uint256 amount, uint16 _ngoPercent ) public notFinished validStake(_ngoPercent) notBanned { totalAssets = getCurrentBalanceFromLido(); lidoSC.transferFrom(msg.sender, address(this), amount); uint256 balanceAfterStaked = getCurrentBalanceFromLido(); uint256 assets = balanceAfterStaked - totalAssets; _userToStakeInfo[msg.sender][id] = StakeInfo({ percent: _ngoPercent, amount: amount, startDate: block.timestamp }); uint256 share = convertAssetsToShares(assets); if (totalShares == 0) { totalShares += 1000; shares[address(0)][id] += 1000; share -= 1000; } shares[msg.sender][id] += share; totalShares += share; stakedBalance += assets; totalShareToday += (amount * (_ngoPercent)) / PERCENT_DIVIDER; emit Staked( id, msg.sender, amount, _ngoPercent, address(this), lastCountRewardsTimestamp, block.timestamp, block.number ); id++; } /** * @dev Handles the distribution of NGO share based on staking. * @notice Emit [RewardsUpdated()](#rewardsupdated) event */ function handleNGOShareDistribution() public onlyOracle { if (block.timestamp < lastCountRewardsTimestamp) revert TimeNotPassed(block.timestamp, lastCountRewardsTimestamp, 0); if (totalShareToday == 0) revert NotStaked(); uint currentBalance = getCurrentBalanceFromLido(); uint256 _rewardsForToday = currentBalance - stakedBalance - prevRewards; if (_rewardsForToday <= 0) revert RewardError(); uint256 shareToNgo = (totalShareToday * _rewardsForToday) / stakedBalance; uint256 _lisFee = (shareToNgo * LIS_FEE) / PERCENT_DIVIDER; lidoSC.transfer(_lis, _lisFee); lidoSC.transfer(rewardsOwner, shareToNgo - _lisFee); _historyRewards[lastCountRewardsTimestamp] = _rewardsForToday; _historyStakedBalance[lastCountRewardsTimestamp] = stakedBalance; _historyBalance[lastCountRewardsTimestamp] = currentBalance; emit RewardsUpdated( _rewardsForToday, stakedBalance, totalShareToday, lastCountRewardsTimestamp, block.timestamp, block.number ); lastCountRewardsTimestamp += 1 hours; prevRewards += (_rewardsForToday - shareToNgo); } /** * @dev Requests withdrawal of funds from the NGO. * @param _amount The amount of funds to be withdrawn. * @param _id The id of stake. * @notice Emit [WithdrawRequested()](#withdrawrequested) event */ function requestWithdrawals(uint256 _amount, uint _id) public notBanned { ( uint256 stakedBalBefore, uint256 amountInShares, StakeInfo storage stakeInfo ) = withdrawCalculation(_amount, _id); uint256[] memory _amounts = new uint256[](1); _amounts[0] = _amount; lidoSC.approve(address(withdrawalSC), _amount); uint256[] memory _requestsIds = withdrawalSC.requestWithdrawals( _amounts, address(this) ); if (amountInShares > totalShares) { totalShares = 0; } else { totalShares -= amountInShares; } _requestIdToUser[_requestsIds[0]] = msg.sender; totalShareToday -= ((stakedBalBefore - stakeInfo.amount) * stakeInfo.percent) / PERCENT_DIVIDER; emit WithdrawRequested( msg.sender, address(this), _requestsIds[0], block.timestamp, block.number, _id ); } /** * @dev Claims the withdrawal of funds from the NGO. * @param _requestId The ID of the withdrawal request. * @notice Emit [WithdrawClaimed()](#withdrawclaimed) event */ function claimWithdrawal(uint256 _requestId) public nonReentrant notBanned { if (_requestIdToUser[_requestId] != msg.sender) { revert InvalidRequestIdForUser(msg.sender, _requestId); } uint256[] memory _requestsIds = new uint256[](1); _requestsIds[0] = _requestId; IWithdrawalQueue.WithdrawalRequestStatus memory status = withdrawalSC .getWithdrawalStatus(_requestsIds)[0]; require(status.isFinalized, "The request is not available for claim"); withdrawalSC.claimWithdrawal(_requestId); payable(msg.sender).transfer(status.amountOfStETH); emit WithdrawClaimed( msg.sender, address(this), status.amountOfStETH, _requestId, block.timestamp, block.number ); } /** * @dev Claims the `_amount` of funds in stETH from the NGO. * @param _amount Amount of stEth for claiming. * @param _id The id of stake. * @notice */ function claimWithdrawInStEth(uint256 _amount, uint _id) public notBanned { ( uint256 stakedBalBefore, uint256 amountInShares, StakeInfo storage stakeInfo ) = withdrawCalculation(_amount, _id); lidoSC.transfer(msg.sender, _amount); if (amountInShares > totalShares) { totalShares = 0; } else { totalShares -= amountInShares; } totalShareToday -= ((stakedBalBefore - stakeInfo.amount) * stakeInfo.percent) / PERCENT_DIVIDER; emit WithdrawInStEthClaimed( msg.sender, address(this), _amount, block.timestamp, block.number, _id ); } /** * @dev Ends the NGO and marks it as finished. * @notice Emit [NGOFinished()](#ngofinished) event */ function endNGO() public notFinished onlyOwner { isFinish = true; emit NGOFinished(address(this), block.timestamp, block.number); } /** * @dev Gets the user's share of funds in the NGO. * @param _user The address of the user. * @param _id The id of stake. * @return userTotal The user's share rewards. */ function getUserBalance( address _user, uint _id ) public view returns (uint256 userTotal) { StakeInfo memory stakedInfo = _userToStakeInfo[_user][_id]; uint currentBalance = getCurrentBalanceFromLido(); uint rewardToNgo; if (shares[_user][_id] == 0) { return stakedInfo.amount; } if (currentBalance == 0) { return 0; } uint256 userTotalShareWithNgoReward = shares[_user][_id].mulDiv( currentBalance, totalShares ); if (userTotalShareWithNgoReward < stakedInfo.amount) { return stakedInfo.amount; } rewardToNgo = ((((shares[_user][_id] * currentBalance) / totalShares) - stakedInfo.amount) * stakedInfo.percent) / PERCENT_DIVIDER; userTotal = userTotalShareWithNgoReward - rewardToNgo; return (userTotal); } /** * @dev Private function for calculation and changing state * @dev while withdrawing * @param _amount The amount of funds to be withdrawn. * @param _id The id of stake. * @notice Uses in `requestWithdrawals()` and `withdrawStEth()` */ function withdrawCalculation( uint256 _amount, uint _id ) private returns (uint256, uint256, StakeInfo storage) { StakeInfo storage stakeInfo = _userToStakeInfo[msg.sender][_id]; uint currentBalance = getCurrentBalanceFromLido(); uint256 userBalance = getUserBalance(msg.sender, _id); if (stakeInfo.amount == 0) { revert NotStaked(); } if (userBalance < _amount) { revert InsufficientStakedFunds(); } uint rewards = userBalance - stakeInfo.amount; uint256 amountInShares = _amount.mulDiv( totalShares + 1, currentBalance ); if (_amount == userBalance) { shares[msg.sender][_id] = 0; } else { shares[msg.sender][_id] -= amountInShares; } uint stakedBalBefore = stakeInfo.amount; if (_amount > rewards) { stakeInfo.amount -= (_amount - rewards); stakedBalance -= (_amount - rewards); prevRewards = prevRewards > rewards ? prevRewards - rewards : 0; } else { prevRewards -= _amount; } return (stakedBalBefore, amountInShares, stakeInfo); } /** * @dev Retrieves the rounded date for a given timestamp. * @param _timestamp The timestamp for which the rounded date is needed. * @return Rounded timestamp representing the start of the day. */ function getRoundDate(uint _timestamp) private pure returns (uint) { return (_timestamp / 1 days) * 1 days; } /** * @dev Retrieves stake information for a specific user. * @param _user The address of the user for whom stake information is requested. * @param _id The id of stake. * @return _userStakeInfo The stake information for the specified user. * @notice This function allows querying stake information for a specific stake. */ function getUserStakeInfo( address _user, uint _id ) public view returns (StakeInfo memory _userStakeInfo) { return _userToStakeInfo[_user][_id]; } /** * @dev Retrieves historical data for a specific timestamp. * @param _timestamp The timestamp for which historical data is requested. * @return _reward The historical rewards at the specified timestamp. * @return _totalShares The historical total shares at the specified timestamp. * @return _balance The historical balance at the specified timestamp. * @notice This function allows querying historical data, including rewards, total shares, and balance, * for a specific timestamp. The timestamp is rounded to the start of the day for accurate retrieval. */ function getHistoryData( uint256 _timestamp ) public view returns (uint _reward, uint _totalShares, uint _balance) { uint _roundedTimestamp = getRoundDate(_timestamp); return ( _historyRewards[_roundedTimestamp], _historyStakedBalance[_roundedTimestamp], _historyBalance[_roundedTimestamp] ); } /** * @dev Sets new oracle. * @param _newOracle Address of new oracle. * @param _state Indicator of allowing to be oracle. */ function setOracle(address _newOracle, bool _state) public onlyOwner { _oracles[_newOracle] = _state; } /** * @dev Sets new rewards owner. * @param _newRewOwner Address of new rewards owner. */ function setRewardsOwner(address _newRewOwner) public onlyOwner { rewardsOwner = _newRewOwner; } /** * @dev Retrieves the current balance of the contract from the Lido contract. * @return Current balance of the contract in stETH. */ function getCurrentBalanceFromLido() public view returns (uint256) { return lidoSC.balanceOf(address(this)); } /** * @dev Function for banning user. * @param userAddress Adress of user to ban * @param isBan Flag of ban or unban */ function setUserBan(address userAddress, bool isBan) public onlyOwner { isBanned[userAddress] = isBan; } /** * @dev Emits event with data of ngo for graph. * @param _name The name of the NGO. * @param _imageLink The link to the image associated with the NGO. * @param _description A description of the NGO. * @param _link A link associated with the NGO. * @param _location A location of the NGO. */ function emitEvent( string memory _name, string calldata _imageLink, string calldata _description, string calldata _link, string calldata _location ) public onlyOwner { emit GraphEvent( _name, _imageLink, _description, _link, _location, address(this), block.timestamp ); } receive() external payable {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. */ abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { _checkProxy(); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { _checkNotDelegated(); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC1967-compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/utils/ERC721Holder.sol) pragma solidity ^0.8.20; import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import {Initializable} from "../../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC721Receiver} interface. * * Accepts all token transfers. * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or * {IERC721-setApprovalForAll}. */ abstract contract ERC721HolderUpgradeable is Initializable, IERC721Receiver { function __ERC721Holder_init() internal onlyInitializing { } function __ERC721Holder_init_unchained() internal onlyInitializing { } /** * @dev See {IERC721Receiver-onERC721Received}. * * Always returns `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) { return this.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._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() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // On the first call to nonReentrant, _status will be NOT_ENTERED if ($._status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail $._status = ENTERED; } function _nonReentrantAfter() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) $._status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.20; import {IBeacon} from "../beacon/IBeacon.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ library ERC1967Utils { // We re-declare ERC-1967 events here because they can't be used directly from IERC1967. // This will be fixed in Solidity 0.8.21. At that point we should remove these events. /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-AdminChanged} event. */ function changeAdmin(address newAdmin) internal { emit AdminChanged(getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.20; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be * reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.9; interface ILido { function submit(address _referral) external payable returns (uint256); function balanceOf(address _tokenHolder) external view returns (uint256); function transfer( address _recipient, uint256 _amount ) external returns (bool); function approve(address _spender, uint256 _amount) external returns (bool); function transferFrom( address _sender, address _recipient, uint256 _amount ) external returns (bool); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/IAccessControl.sol"; interface IWithdrawalQueue is IAccessControl { struct WithdrawalRequestStatus { uint256 amountOfStETH; uint256 amountOfShares; address owner; uint256 timestamp; bool isFinalized; bool isClaimed; } function requestWithdrawals( uint256[] calldata _amounts, address _owner ) external returns (uint256[] calldata requestIds); function getWithdrawalStatus( uint256[] memory _requestIds ) external view returns (WithdrawalRequestStatus[] calldata statuses); function claimWithdrawal(uint256 _requestId) external; function balanceOf(address _owner) external view returns (uint256 balance); function getLastRequestId() external view returns (uint256); function onOracleReport( bool _isBunkerModeNow, uint256 _bunkerStartTimestamp, uint256 _currentReportTimestamp ) external; }
{ "optimizer": { "enabled": true, "runs": 1000000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InsufficientStakedFunds","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidPercent","type":"error"},{"inputs":[{"internalType":"address","name":"_claimer","type":"address"},{"internalType":"uint256","name":"_requestId","type":"uint256"}],"name":"InvalidRequestIdForUser","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"NgoFinished","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotStaked","type":"error"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"}],"name":"OnlyOracle","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"RewardError","type":"error"},{"inputs":[{"internalType":"uint256","name":"_currentTime","type":"uint256"},{"internalType":"uint256","name":"_needTime","type":"uint256"},{"internalType":"uint256","name":"_startDate","type":"uint256"}],"name":"TimeNotPassed","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"inputs":[],"name":"UserBanned","type":"error"},{"inputs":[],"name":"WithdrawError","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_name","type":"string"},{"indexed":false,"internalType":"string","name":"_imageLink","type":"string"},{"indexed":false,"internalType":"string","name":"_description","type":"string"},{"indexed":false,"internalType":"string","name":"_link","type":"string"},{"indexed":false,"internalType":"string","name":"_location","type":"string"},{"indexed":false,"internalType":"address","name":"_ngo","type":"address"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"GraphEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_ngo","type":"address"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_blockNumber","type":"uint256"}],"name":"NGOFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_rewardsPool","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakedBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalShare","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_dateRecountRewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_blockNumber","type":"uint256"}],"name":"RewardsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_id","type":"uint256"},{"indexed":false,"internalType":"address","name":"_staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amountStaked","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"_percentShare","type":"uint16"},{"indexed":false,"internalType":"address","name":"_ngo","type":"address"},{"indexed":false,"internalType":"uint256","name":"_startDate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_blockNumber","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_claimer","type":"address"},{"indexed":false,"internalType":"address","name":"_ngo","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_blockNumber","type":"uint256"}],"name":"WithdrawClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_claimer","type":"address"},{"indexed":false,"internalType":"address","name":"_ngo","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_blockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_stakeId","type":"uint256"}],"name":"WithdrawInStEthClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_staker","type":"address"},{"indexed":false,"internalType":"address","name":"_ngo","type":"address"},{"indexed":false,"internalType":"uint256","name":"_requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_blockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_stakeId","type":"uint256"}],"name":"WithdrawRequested","type":"event"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"claimWithdrawInStEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"}],"name":"claimWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_imageLink","type":"string"},{"internalType":"string","name":"_description","type":"string"},{"internalType":"string","name":"_link","type":"string"},{"internalType":"string","name":"_location","type":"string"}],"name":"emitEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endNGO","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCurrentBalanceFromLido","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getHistoryData","outputs":[{"internalType":"uint256","name":"_reward","type":"uint256"},{"internalType":"uint256","name":"_totalShares","type":"uint256"},{"internalType":"uint256","name":"_balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getUserBalance","outputs":[{"internalType":"uint256","name":"userTotal","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getUserStakeInfo","outputs":[{"components":[{"internalType":"uint16","name":"percent","type":"uint16"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startDate","type":"uint256"}],"internalType":"struct NGOLis.StakeInfo","name":"_userStakeInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"handleNGOShareDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"lidoSCAddress","type":"address"},{"internalType":"address","name":"_rewardOwnerAddress","type":"address"},{"internalType":"address","name":"withdrawalSCAddress","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"oracle","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isFinish","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lidoSC","outputs":[{"internalType":"contract ILido","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"requestWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardsOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOracle","type":"address"},{"internalType":"bool","name":"_state","type":"bool"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newRewOwner","type":"address"}],"name":"setRewardsOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"bool","name":"isBan","type":"bool"}],"name":"setUserBan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_ngoPercent","type":"uint16"}],"name":"stake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint16","name":"_ngoPercent","type":"uint16"}],"name":"stakeStEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdrawalSC","outputs":[{"internalType":"contract IWithdrawalQueue","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a06040523060805234801561001457600080fd5b506080516137c161003e600039600081816125ae015281816125d701526127f801526137c16000f3fe6080604052600436106101ba5760003560e01c806352d1902d116100ec578063ad3cb1cc1161008a578063d21294cc11610064578063d21294cc146105bc578063f2fde38b146105e9578063f618260714610609578063f84444361461064457600080fd5b8063ad3cb1cc14610519578063beef80a61461056f578063c7e4ff421461059c57600080fd5b8063715018a6116100c6578063715018a61461047a5780638da5cb5b1461048f57806391a9648a146104d957806393a95855146104f957600080fd5b806352d1902d1461042f5780635b9f001614610444578063653608431461045a57600080fd5b8063170c5997116101595780632c8ca0ea116101335780632c8ca0ea146103a75780632f57ee41146103e957806330b546ba146103fc5780634f1ef2861461041c57600080fd5b8063170c5997146103205780631fa568571461034057806320b3b1171461035557600080fd5b80630ef43a58116101955780630ef43a581461025657806310c7f91b1461026b5780631459457a1461028b578063150b7a02146102ab57600080fd5b8062ae5faa146101c6578063013756251461021157806308514ac91461023357600080fd5b366101c157005b600080fd5b3480156101d257600080fd5b506101e66101e1366004612db1565b610664565b60408051825161ffff1681526020808401519082015291810151908201526060015b60405180910390f35b34801561021d57600080fd5b5061023161022c366004612ddd565b6106ec565b005b34801561023f57600080fd5b5061024861073b565b604051908152602001610208565b34801561026257600080fd5b506102316107d3565b34801561027757600080fd5b50610231610286366004612dfa565b610b80565b34801561029757600080fd5b506102316102a6366004612e1c565b610f00565b3480156102b757600080fd5b506102ef6102c6366004612fc2565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610208565b34801561032c57600080fd5b5061023161033b366004613077565b61114b565b34801561034c57600080fd5b506102316111a9565b34801561036157600080fd5b50600b546103829073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610208565b3480156103b357600080fd5b50600c546103d99074010000000000000000000000000000000000000000900460ff1681565b6040519015158152602001610208565b6102316103f7366004613179565b611286565b34801561040857600080fd5b50610231610417366004613194565b611648565b61023161042a3660046131c0565b611a16565b34801561043b57600080fd5b50610248611a35565b34801561045057600080fd5b5061024860005481565b34801561046657600080fd5b5061023161047536600461321e565b611a64565b34801561048657600080fd5b50610231611ac2565b34801561049b57600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005473ffffffffffffffffffffffffffffffffffffffff16610382565b3480156104e557600080fd5b506102486104f4366004612db1565b611ad6565b34801561050557600080fd5b50610231610514366004612dfa565b611c7c565b34801561052557600080fd5b506105626040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b60405161020891906132c5565b34801561057b57600080fd5b50600c546103829073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105a857600080fd5b506102316105b736600461321e565b611e41565b3480156105c857600080fd5b50600a546103829073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105f557600080fd5b50610231610604366004612ddd565b611e9f565b34801561061557600080fd5b506106296106243660046132d8565b611f03565b60408051938452602084019290925290820152606001610208565b34801561065057600080fd5b5061023161065f3660046132d8565b611f42565b61068c6040518060600160405280600061ffff16815260200160008152602001600081525090565b5073ffffffffffffffffffffffffffffffffffffffff82166000908152600d602090815260408083208484528252918290208251606081018452815461ffff16815260018201549281019290925260020154918101919091525b92915050565b6106f46122d3565b600c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600a546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156107aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ce91906132f1565b905090565b336000908152600e602052604090205460ff16610823576040517ff432bce90000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b600354421015610873576003546040517fba6f21b200000000000000000000000000000000000000000000000000000000815242600482015260248101919091526000604482015260640161081a565b6002546000036108af576040517f039f2e1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006108b961073b565b90506000600454600054836108ce9190613339565b6108d89190613339565b905060008111610914576040517f574d163000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805482600254610926919061334c565b6109309190613392565b905060006127106109436101f48461334c565b61094d9190613392565b600a546008546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015260248101849052929350169063a9059cbb906044016020604051808303816000875af11580156109ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ee91906133cd565b50600a54600c5473ffffffffffffffffffffffffffffffffffffffff9182169163a9059cbb9116610a1f8486613339565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af1158015610a8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab391906133cd565b50600380546000908152600f6020908152604080832087905582548454845260108352818420558354835260118252808320889055915460025493548351888152928301919091529181019290925260608201524260808201524360a08201527f8baf509f1122a0f4a996885e2e55905a590bf1c210ed4a5c6d60f7b936cbdc899060c00160405180910390a1610e1060036000828254610b5491906133ea565b90915550610b6490508284613339565b60046000828254610b7591906133ea565b909155505050505050565b3360009081526014602052604090205460ff1615610bca576040517fc602500f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806000610bd98585612361565b604080516001808252818301909252939650919450925060009190602080830190803683370190505090508581600081518110610c1857610c186133fd565b6020908102919091010152600a54600b546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201526024810189905291169063095ea7b3906044016020604051808303816000875af1158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc291906133cd565b50600b546040517fd668104200000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063d668104290610d1c9085903090600401613467565b6000604051808303816000875af1158015610d3b573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610d8191908101906134c3565b9050600554841115610d97576000600555610daf565b8360056000828254610da99190613339565b90915550505b336012600083600081518110610dc757610dc76133fd565b602090810291909101810151825281019190915260400160002080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055825460018401546127109161ffff1690610e3e9088613339565b610e48919061334c565b610e529190613392565b60026000828254610e639190613339565b925050819055507fd1d9ac963153d56679940fdf0ad8742366a8886c61c8e75604af105523d130ac333083600081518110610ea057610ea06133fd565b6020908102919091018101516040805173ffffffffffffffffffffffffffffffffffffffff958616815294909316918401919091529082015242606082015243608082015260a0810188905260c00160405180910390a150505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff16600081158015610f4b5750825b905060008267ffffffffffffffff166001148015610f685750303b155b905081158015610f76575080155b15610fad576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000166001178555831561100e5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b611016612537565b61101e612537565b6110278761253f565b73ffffffffffffffffffffffffffffffffffffffff8681166000908152600e60205260409020805460017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090911617905560088054337fffffffffffffffffffffffff000000000000000000000000000000000000000091821617909155600a805482168d8416179055600b805482168b8416179055600c8054909116918b169190911790556110d642612550565b6003556001600755831561113f5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b6111536122d3565b7f7c1f8856197eb5f5aba49b7d94b3fcd6c3390033aa45de62851922bde2373fd789898989898989898930426040516111969b9a99989796959493929190613597565b60405180910390a1505050505050505050565b600c5474010000000000000000000000000000000000000000900460ff16156111fe576040517f1b001d1000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112066122d3565b600c80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017905560408051308152426020820152438183015290517fa67f03226c045d22d8a1c52cf1185252d7021a8ac9a117cba40a9f131ed99b94916060908290030190a1565b600c5474010000000000000000000000000000000000000000900460ff16156112db576040517f1b001d1000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80606461ffff821610806112f4575061271061ffff8216115b1561132b576040517fb92e9c7a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526014602052604090205460ff1615611375576040517fc602500f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61137d61073b565b600655600a546040517fa1903eab00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff9091169063a1903eab90349060240160206040518083038185885af11580156113f1573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061141691906132f1565b50600061142161073b565b90506000600654826114339190613339565b6040805160608101825261ffff8781168252602080830185815242848601908152336000908152600d84528681206007548252909352948220935184547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001693169290921783559051600183015591516002909101559091506114b58261256c565b9050600554600003611531576103e8600560008282546114d591906133ea565b909155505060075460009081527f8fa6efc3be94b5b348b21fea823fe8d100408cee9b7f90524494500445d8ff6c6020526040812080546103e8929061151c9084906133ea565b9091555061152e90506103e882613339565b90505b33600090815260136020908152604080832060075484529091528120805483929061155d9084906133ea565b92505081905550806005600082825461157691906133ea565b925050819055508160008082825461158e91906133ea565b9091555061271090506115a561ffff87168461334c565b6115af9190613392565b600260008282546115c091906133ea565b909155505060075460035460408051928352336020840152820184905261ffff8716606083015230608083015260a08201524260c08201524360e08201527f6d0736d0db7cf3ad2b8a59a1dafde71f5f4a098c2af623c8f7adaf62f04c6ff4906101000160405180910390a16007805490600061163c8361362d565b91905055505050505050565b600c5474010000000000000000000000000000000000000000900460ff161561169d576040517f1b001d1000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80606461ffff821610806116b6575061271061ffff8216115b156116ed576040517fb92e9c7a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526014602052604090205460ff1615611737576040517fc602500f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61173f61073b565b600655600a546040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810185905273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd906064016020604051808303816000875af11580156117bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117e391906133cd565b5060006117ee61073b565b90506000600654826118009190613339565b6040805160608101825261ffff878116825260208083018a815242848601908152336000908152600d84528681206007548252909352948220935184547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001693169290921783559051600183015591516002909101559091506118828261256c565b90506005546000036118fe576103e8600560008282546118a291906133ea565b909155505060075460009081527f8fa6efc3be94b5b348b21fea823fe8d100408cee9b7f90524494500445d8ff6c6020526040812080546103e892906118e99084906133ea565b909155506118fb90506103e882613339565b90505b33600090815260136020908152604080832060075484529091528120805483929061192a9084906133ea565b92505081905550806005600082825461194391906133ea565b925050819055508160008082825461195b91906133ea565b90915550612710905061197261ffff87168861334c565b61197c9190613392565b6002600082825461198d91906133ea565b909155505060075460035460408051928352336020840152820188905261ffff8716606083015230608083015260a08201524260c08201524360e08201527f6d0736d0db7cf3ad2b8a59a1dafde71f5f4a098c2af623c8f7adaf62f04c6ff4906101000160405180910390a160078054906000611a098361362d565b9190505550505050505050565b611a1e612596565b611a278261269a565b611a3182826126a2565b5050565b6000611a3f6127e0565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b611a6c6122d3565b73ffffffffffffffffffffffffffffffffffffffff919091166000908152600e6020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b611aca6122d3565b611ad4600061284f565b565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d6020908152604080832084845282528083208151606081018352815461ffff168152600182015493810193909352600201549082015281611b3361073b565b73ffffffffffffffffffffffffffffffffffffffff86166000908152601360209081526040808320888452909152812054919250908103611b7b5750506020015190506106e6565b81600003611b8f57600093505050506106e6565b60055473ffffffffffffffffffffffffffffffffffffffff871660009081526013602090815260408083208984529091528120549091611bd1919085906128e5565b90508360200151811015611bed575050506020015190506106e6565b835160208086015160055473ffffffffffffffffffffffffffffffffffffffff8b1660009081526013845260408082208c835290945292909220546127109361ffff169290611c3d90889061334c565b611c479190613392565b611c519190613339565b611c5b919061334c565b611c659190613392565b9150611c718282613339565b979650505050505050565b3360009081526014602052604090205460ff1615611cc6576040517fc602500f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806000611cd58585612361565b600a546040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018a9052939650919450925073ffffffffffffffffffffffffffffffffffffffff169063a9059cbb906044016020604051808303816000875af1158015611d52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7691906133cd565b50600554821115611d8b576000600555611da3565b8160056000828254611d9d9190613339565b90915550505b805460018201546127109161ffff1690611dbd9086613339565b611dc7919061334c565b611dd19190613392565b60026000828254611de29190613339565b90915550506040805133815230602082015290810186905242606082015243608082015260a081018590527fa0d9d59f6d8dc2d1a7d7049b337959bb33e315732197e2ea143106444fe019049060c00160405180910390a15050505050565b611e496122d3565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260146020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b611ea76122d3565b73ffffffffffffffffffffffffffffffffffffffff8116611ef7576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526000600482015260240161081a565b611f008161284f565b50565b600080600080611f1285612550565b6000908152600f602090815260408083205460108352818420546011909352922054919790965090945092505050565b611f4a6129e1565b3360009081526014602052604090205460ff1615611f94576040517fc602500f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526012602052604090205473ffffffffffffffffffffffffffffffffffffffff163314611ffa576040517fe4bd890e0000000000000000000000000000000000000000000000000000000081523360048201526024810182905260440161081a565b604080516001808252818301909252600091602080830190803683370190505090508181600081518110612030576120306133fd565b6020908102919091010152600b546040517fb8c4b85a00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063b8c4b85a90612092908590600401613665565b600060405180830381865afa1580156120af573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526120f59190810190613678565b600081518110612107576121076133fd565b6020026020010151905080608001516121a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f5468652072657175657374206973206e6f7420617661696c61626c6520666f7260448201527f20636c61696d0000000000000000000000000000000000000000000000000000606482015260840161081a565b600b546040517ff84444360000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff9091169063f844443690602401600060405180830381600087803b15801561220e57600080fd5b505af1158015612222573d6000803e3d6000fd5b5050825160405133935081156108fc0292506000818181858888f19350505050158015612253573d6000803e3d6000fd5b5080516040805133815230602082015280820192909252606082018590524260808301524360a0830152517f6fd22a558b3de572be6a8072ed873e4f31ed45c5ca309fb6f36decf58720c3e99181900360c00190a15050611f0060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b336123127f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614611ad4576040517f118cdaa700000000000000000000000000000000000000000000000000000000815233600482015260240161081a565b336000908152600d602090815260408083208484529091528120819081908161238861073b565b905060006123963388611ad6565b905082600101546000036123d6576040517f039f2e1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b87811015612410576040517f188ded2100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008360010154826124229190613339565b90506000612440600554600161243891906133ea565b8b90866128e5565b9050828a03612469573360009081526013602090815260408083208c8452909152812055612499565b3360009081526013602090815260408083208c845290915281208054839290612493908490613339565b90915550505b6001850154828b111561250e576124b0838c613339565b8660010160008282546124c39190613339565b909155506124d39050838c613339565b6000808282546124e39190613339565b909155505060045483106124f8576000612506565b826004546125069190613339565b600455612526565b8a600460008282546125209190613339565b90915550505b975095509293505050509250925092565b611ad4612a62565b612547612a62565b611f0081612ac9565b600061255f6201518083613392565b6106e6906201518061334c565b600060055460000361257c575090565b60065460055461258c908461334c565b6106e69190613392565b3073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016148061266357507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1661264a7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614155b15611ad4576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611f006122d3565b8173ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612727575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252612724918101906132f1565b60015b612775576040517f4c9c8ce300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8316600482015260240161081a565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81146127d1576040517faa1d49a40000000000000000000000000000000000000000000000000000000081526004810182905260240161081a565b6127db8383612ad1565b505050565b3073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614611ad4576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080547fffffffffffffffffffffffff0000000000000000000000000000000000000000811673ffffffffffffffffffffffffffffffffffffffff848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b6000838302817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709828110838203039150508060000361293a5783828161293057612930613363565b04925050506129da565b808411612973576040517f227bc15300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0080547ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01612a5c576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60029055565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff16611ad4576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611ea7612a62565b612ada82612b34565b60405173ffffffffffffffffffffffffffffffffffffffff8316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115612b2c576127db8282612c03565b611a31612c86565b8073ffffffffffffffffffffffffffffffffffffffff163b600003612b9d576040517f4c9c8ce300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260240161081a565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60606000808473ffffffffffffffffffffffffffffffffffffffff1684604051612c2d919061376f565b600060405180830381855af49150503d8060008114612c68576040519150601f19603f3d011682016040523d82523d6000602084013e612c6d565b606091505b5091509150612c7d858383612cbe565b95945050505050565b3415611ad4576040517fb398979f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082612cd357612cce82612d4d565b6129da565b8151158015612cf7575073ffffffffffffffffffffffffffffffffffffffff84163b155b15612d46576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161081a565b50806129da565b805115612d5d5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81168114611f0057600080fd5b60008060408385031215612dc457600080fd5b8235612dcf81612d8f565b946020939093013593505050565b600060208284031215612def57600080fd5b81356129da81612d8f565b60008060408385031215612e0d57600080fd5b50508035926020909101359150565b600080600080600060a08688031215612e3457600080fd5b8535612e3f81612d8f565b94506020860135612e4f81612d8f565b93506040860135612e5f81612d8f565b92506060860135612e6f81612d8f565b91506080860135612e7f81612d8f565b809150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715612edf57612edf612e8d565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612f2c57612f2c612e8d565b604052919050565b600082601f830112612f4557600080fd5b813567ffffffffffffffff811115612f5f57612f5f612e8d565b612f9060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601612ee5565b818152846020838601011115612fa557600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215612fd857600080fd5b8435612fe381612d8f565b93506020850135612ff381612d8f565b925060408501359150606085013567ffffffffffffffff81111561301657600080fd5b61302287828801612f34565b91505092959194509250565b60008083601f84011261304057600080fd5b50813567ffffffffffffffff81111561305857600080fd5b60208301915083602082850101111561307057600080fd5b9250929050565b600080600080600080600080600060a08a8c03121561309557600080fd5b893567ffffffffffffffff808211156130ad57600080fd5b6130b98d838e01612f34565b9a5060208c01359150808211156130cf57600080fd5b6130db8d838e0161302e565b909a50985060408c01359150808211156130f457600080fd5b6131008d838e0161302e565b909850965060608c013591508082111561311957600080fd5b6131258d838e0161302e565b909650945060808c013591508082111561313e57600080fd5b5061314b8c828d0161302e565b915080935050809150509295985092959850929598565b803561ffff8116811461317457600080fd5b919050565b60006020828403121561318b57600080fd5b6129da82613162565b600080604083850312156131a757600080fd5b823591506131b760208401613162565b90509250929050565b600080604083850312156131d357600080fd5b82356131de81612d8f565b9150602083013567ffffffffffffffff8111156131fa57600080fd5b61320685828601612f34565b9150509250929050565b8015158114611f0057600080fd5b6000806040838503121561323157600080fd5b823561323c81612d8f565b9150602083013561324c81613210565b809150509250929050565b60005b8381101561327257818101518382015260200161325a565b50506000910152565b60008151808452613293816020860160208601613257565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006129da602083018461327b565b6000602082840312156132ea57600080fd5b5035919050565b60006020828403121561330357600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156106e6576106e661330a565b80820281158282048414176106e6576106e661330a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826133c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156133df57600080fd5b81516129da81613210565b808201808211156106e6576106e661330a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561345c57815187529582019590820190600101613440565b509495945050505050565b60408152600061347a604083018561342c565b905073ffffffffffffffffffffffffffffffffffffffff831660208301529392505050565b600067ffffffffffffffff8211156134b9576134b9612e8d565b5060051b60200190565b600060208083850312156134d657600080fd5b825167ffffffffffffffff8111156134ed57600080fd5b8301601f810185136134fe57600080fd5b805161351161350c8261349f565b612ee5565b81815260059190911b8201830190838101908783111561353057600080fd5b928401925b82841015611c7157835182529284019290840190613535565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b60e0815260006135aa60e083018e61327b565b82810360208401526135bd818d8f61354e565b905082810360408401526135d2818b8d61354e565b905082810360608401526135e781898b61354e565b905082810360808401526135fc81878961354e565b73ffffffffffffffffffffffffffffffffffffffff9590951660a0840152505060c001529998505050505050505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361365e5761365e61330a565b5060010190565b6020815260006129da602083018461342c565b6000602080838503121561368b57600080fd5b825167ffffffffffffffff8111156136a257600080fd5b8301601f810185136136b357600080fd5b80516136c161350c8261349f565b81815260c091820283018401918482019190888411156136e057600080fd5b938501935b838510156137635780858a0312156136fd5760008081fd5b613705612ebc565b85518152868601518782015260408087015161372081612d8f565b908201526060868101519082015260808087015161373d81613210565b9082015260a08681015161375081613210565b90820152835293840193918501916136e5565b50979650505050505050565b60008251613781818460208701613257565b919091019291505056fea26469706673582212207d291cccc2ae71de2859718a64e904b7edeefb8af445540b52c03a7bcdfbef9664736f6c63430008140033
Deployed Bytecode
0x6080604052600436106101ba5760003560e01c806352d1902d116100ec578063ad3cb1cc1161008a578063d21294cc11610064578063d21294cc146105bc578063f2fde38b146105e9578063f618260714610609578063f84444361461064457600080fd5b8063ad3cb1cc14610519578063beef80a61461056f578063c7e4ff421461059c57600080fd5b8063715018a6116100c6578063715018a61461047a5780638da5cb5b1461048f57806391a9648a146104d957806393a95855146104f957600080fd5b806352d1902d1461042f5780635b9f001614610444578063653608431461045a57600080fd5b8063170c5997116101595780632c8ca0ea116101335780632c8ca0ea146103a75780632f57ee41146103e957806330b546ba146103fc5780634f1ef2861461041c57600080fd5b8063170c5997146103205780631fa568571461034057806320b3b1171461035557600080fd5b80630ef43a58116101955780630ef43a581461025657806310c7f91b1461026b5780631459457a1461028b578063150b7a02146102ab57600080fd5b8062ae5faa146101c6578063013756251461021157806308514ac91461023357600080fd5b366101c157005b600080fd5b3480156101d257600080fd5b506101e66101e1366004612db1565b610664565b60408051825161ffff1681526020808401519082015291810151908201526060015b60405180910390f35b34801561021d57600080fd5b5061023161022c366004612ddd565b6106ec565b005b34801561023f57600080fd5b5061024861073b565b604051908152602001610208565b34801561026257600080fd5b506102316107d3565b34801561027757600080fd5b50610231610286366004612dfa565b610b80565b34801561029757600080fd5b506102316102a6366004612e1c565b610f00565b3480156102b757600080fd5b506102ef6102c6366004612fc2565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610208565b34801561032c57600080fd5b5061023161033b366004613077565b61114b565b34801561034c57600080fd5b506102316111a9565b34801561036157600080fd5b50600b546103829073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610208565b3480156103b357600080fd5b50600c546103d99074010000000000000000000000000000000000000000900460ff1681565b6040519015158152602001610208565b6102316103f7366004613179565b611286565b34801561040857600080fd5b50610231610417366004613194565b611648565b61023161042a3660046131c0565b611a16565b34801561043b57600080fd5b50610248611a35565b34801561045057600080fd5b5061024860005481565b34801561046657600080fd5b5061023161047536600461321e565b611a64565b34801561048657600080fd5b50610231611ac2565b34801561049b57600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005473ffffffffffffffffffffffffffffffffffffffff16610382565b3480156104e557600080fd5b506102486104f4366004612db1565b611ad6565b34801561050557600080fd5b50610231610514366004612dfa565b611c7c565b34801561052557600080fd5b506105626040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b60405161020891906132c5565b34801561057b57600080fd5b50600c546103829073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105a857600080fd5b506102316105b736600461321e565b611e41565b3480156105c857600080fd5b50600a546103829073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105f557600080fd5b50610231610604366004612ddd565b611e9f565b34801561061557600080fd5b506106296106243660046132d8565b611f03565b60408051938452602084019290925290820152606001610208565b34801561065057600080fd5b5061023161065f3660046132d8565b611f42565b61068c6040518060600160405280600061ffff16815260200160008152602001600081525090565b5073ffffffffffffffffffffffffffffffffffffffff82166000908152600d602090815260408083208484528252918290208251606081018452815461ffff16815260018201549281019290925260020154918101919091525b92915050565b6106f46122d3565b600c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600a546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156107aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ce91906132f1565b905090565b336000908152600e602052604090205460ff16610823576040517ff432bce90000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b600354421015610873576003546040517fba6f21b200000000000000000000000000000000000000000000000000000000815242600482015260248101919091526000604482015260640161081a565b6002546000036108af576040517f039f2e1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006108b961073b565b90506000600454600054836108ce9190613339565b6108d89190613339565b905060008111610914576040517f574d163000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805482600254610926919061334c565b6109309190613392565b905060006127106109436101f48461334c565b61094d9190613392565b600a546008546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015260248101849052929350169063a9059cbb906044016020604051808303816000875af11580156109ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ee91906133cd565b50600a54600c5473ffffffffffffffffffffffffffffffffffffffff9182169163a9059cbb9116610a1f8486613339565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af1158015610a8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab391906133cd565b50600380546000908152600f6020908152604080832087905582548454845260108352818420558354835260118252808320889055915460025493548351888152928301919091529181019290925260608201524260808201524360a08201527f8baf509f1122a0f4a996885e2e55905a590bf1c210ed4a5c6d60f7b936cbdc899060c00160405180910390a1610e1060036000828254610b5491906133ea565b90915550610b6490508284613339565b60046000828254610b7591906133ea565b909155505050505050565b3360009081526014602052604090205460ff1615610bca576040517fc602500f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806000610bd98585612361565b604080516001808252818301909252939650919450925060009190602080830190803683370190505090508581600081518110610c1857610c186133fd565b6020908102919091010152600a54600b546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201526024810189905291169063095ea7b3906044016020604051808303816000875af1158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc291906133cd565b50600b546040517fd668104200000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063d668104290610d1c9085903090600401613467565b6000604051808303816000875af1158015610d3b573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610d8191908101906134c3565b9050600554841115610d97576000600555610daf565b8360056000828254610da99190613339565b90915550505b336012600083600081518110610dc757610dc76133fd565b602090810291909101810151825281019190915260400160002080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055825460018401546127109161ffff1690610e3e9088613339565b610e48919061334c565b610e529190613392565b60026000828254610e639190613339565b925050819055507fd1d9ac963153d56679940fdf0ad8742366a8886c61c8e75604af105523d130ac333083600081518110610ea057610ea06133fd565b6020908102919091018101516040805173ffffffffffffffffffffffffffffffffffffffff958616815294909316918401919091529082015242606082015243608082015260a0810188905260c00160405180910390a150505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff16600081158015610f4b5750825b905060008267ffffffffffffffff166001148015610f685750303b155b905081158015610f76575080155b15610fad576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000166001178555831561100e5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b611016612537565b61101e612537565b6110278761253f565b73ffffffffffffffffffffffffffffffffffffffff8681166000908152600e60205260409020805460017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090911617905560088054337fffffffffffffffffffffffff000000000000000000000000000000000000000091821617909155600a805482168d8416179055600b805482168b8416179055600c8054909116918b169190911790556110d642612550565b6003556001600755831561113f5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b6111536122d3565b7f7c1f8856197eb5f5aba49b7d94b3fcd6c3390033aa45de62851922bde2373fd789898989898989898930426040516111969b9a99989796959493929190613597565b60405180910390a1505050505050505050565b600c5474010000000000000000000000000000000000000000900460ff16156111fe576040517f1b001d1000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112066122d3565b600c80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017905560408051308152426020820152438183015290517fa67f03226c045d22d8a1c52cf1185252d7021a8ac9a117cba40a9f131ed99b94916060908290030190a1565b600c5474010000000000000000000000000000000000000000900460ff16156112db576040517f1b001d1000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80606461ffff821610806112f4575061271061ffff8216115b1561132b576040517fb92e9c7a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526014602052604090205460ff1615611375576040517fc602500f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61137d61073b565b600655600a546040517fa1903eab00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff9091169063a1903eab90349060240160206040518083038185885af11580156113f1573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061141691906132f1565b50600061142161073b565b90506000600654826114339190613339565b6040805160608101825261ffff8781168252602080830185815242848601908152336000908152600d84528681206007548252909352948220935184547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001693169290921783559051600183015591516002909101559091506114b58261256c565b9050600554600003611531576103e8600560008282546114d591906133ea565b909155505060075460009081527f8fa6efc3be94b5b348b21fea823fe8d100408cee9b7f90524494500445d8ff6c6020526040812080546103e8929061151c9084906133ea565b9091555061152e90506103e882613339565b90505b33600090815260136020908152604080832060075484529091528120805483929061155d9084906133ea565b92505081905550806005600082825461157691906133ea565b925050819055508160008082825461158e91906133ea565b9091555061271090506115a561ffff87168461334c565b6115af9190613392565b600260008282546115c091906133ea565b909155505060075460035460408051928352336020840152820184905261ffff8716606083015230608083015260a08201524260c08201524360e08201527f6d0736d0db7cf3ad2b8a59a1dafde71f5f4a098c2af623c8f7adaf62f04c6ff4906101000160405180910390a16007805490600061163c8361362d565b91905055505050505050565b600c5474010000000000000000000000000000000000000000900460ff161561169d576040517f1b001d1000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80606461ffff821610806116b6575061271061ffff8216115b156116ed576040517fb92e9c7a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526014602052604090205460ff1615611737576040517fc602500f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61173f61073b565b600655600a546040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810185905273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd906064016020604051808303816000875af11580156117bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117e391906133cd565b5060006117ee61073b565b90506000600654826118009190613339565b6040805160608101825261ffff878116825260208083018a815242848601908152336000908152600d84528681206007548252909352948220935184547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001693169290921783559051600183015591516002909101559091506118828261256c565b90506005546000036118fe576103e8600560008282546118a291906133ea565b909155505060075460009081527f8fa6efc3be94b5b348b21fea823fe8d100408cee9b7f90524494500445d8ff6c6020526040812080546103e892906118e99084906133ea565b909155506118fb90506103e882613339565b90505b33600090815260136020908152604080832060075484529091528120805483929061192a9084906133ea565b92505081905550806005600082825461194391906133ea565b925050819055508160008082825461195b91906133ea565b90915550612710905061197261ffff87168861334c565b61197c9190613392565b6002600082825461198d91906133ea565b909155505060075460035460408051928352336020840152820188905261ffff8716606083015230608083015260a08201524260c08201524360e08201527f6d0736d0db7cf3ad2b8a59a1dafde71f5f4a098c2af623c8f7adaf62f04c6ff4906101000160405180910390a160078054906000611a098361362d565b9190505550505050505050565b611a1e612596565b611a278261269a565b611a3182826126a2565b5050565b6000611a3f6127e0565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b611a6c6122d3565b73ffffffffffffffffffffffffffffffffffffffff919091166000908152600e6020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b611aca6122d3565b611ad4600061284f565b565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d6020908152604080832084845282528083208151606081018352815461ffff168152600182015493810193909352600201549082015281611b3361073b565b73ffffffffffffffffffffffffffffffffffffffff86166000908152601360209081526040808320888452909152812054919250908103611b7b5750506020015190506106e6565b81600003611b8f57600093505050506106e6565b60055473ffffffffffffffffffffffffffffffffffffffff871660009081526013602090815260408083208984529091528120549091611bd1919085906128e5565b90508360200151811015611bed575050506020015190506106e6565b835160208086015160055473ffffffffffffffffffffffffffffffffffffffff8b1660009081526013845260408082208c835290945292909220546127109361ffff169290611c3d90889061334c565b611c479190613392565b611c519190613339565b611c5b919061334c565b611c659190613392565b9150611c718282613339565b979650505050505050565b3360009081526014602052604090205460ff1615611cc6576040517fc602500f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806000611cd58585612361565b600a546040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018a9052939650919450925073ffffffffffffffffffffffffffffffffffffffff169063a9059cbb906044016020604051808303816000875af1158015611d52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7691906133cd565b50600554821115611d8b576000600555611da3565b8160056000828254611d9d9190613339565b90915550505b805460018201546127109161ffff1690611dbd9086613339565b611dc7919061334c565b611dd19190613392565b60026000828254611de29190613339565b90915550506040805133815230602082015290810186905242606082015243608082015260a081018590527fa0d9d59f6d8dc2d1a7d7049b337959bb33e315732197e2ea143106444fe019049060c00160405180910390a15050505050565b611e496122d3565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260146020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b611ea76122d3565b73ffffffffffffffffffffffffffffffffffffffff8116611ef7576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526000600482015260240161081a565b611f008161284f565b50565b600080600080611f1285612550565b6000908152600f602090815260408083205460108352818420546011909352922054919790965090945092505050565b611f4a6129e1565b3360009081526014602052604090205460ff1615611f94576040517fc602500f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526012602052604090205473ffffffffffffffffffffffffffffffffffffffff163314611ffa576040517fe4bd890e0000000000000000000000000000000000000000000000000000000081523360048201526024810182905260440161081a565b604080516001808252818301909252600091602080830190803683370190505090508181600081518110612030576120306133fd565b6020908102919091010152600b546040517fb8c4b85a00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063b8c4b85a90612092908590600401613665565b600060405180830381865afa1580156120af573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526120f59190810190613678565b600081518110612107576121076133fd565b6020026020010151905080608001516121a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f5468652072657175657374206973206e6f7420617661696c61626c6520666f7260448201527f20636c61696d0000000000000000000000000000000000000000000000000000606482015260840161081a565b600b546040517ff84444360000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff9091169063f844443690602401600060405180830381600087803b15801561220e57600080fd5b505af1158015612222573d6000803e3d6000fd5b5050825160405133935081156108fc0292506000818181858888f19350505050158015612253573d6000803e3d6000fd5b5080516040805133815230602082015280820192909252606082018590524260808301524360a0830152517f6fd22a558b3de572be6a8072ed873e4f31ed45c5ca309fb6f36decf58720c3e99181900360c00190a15050611f0060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b336123127f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614611ad4576040517f118cdaa700000000000000000000000000000000000000000000000000000000815233600482015260240161081a565b336000908152600d602090815260408083208484529091528120819081908161238861073b565b905060006123963388611ad6565b905082600101546000036123d6576040517f039f2e1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b87811015612410576040517f188ded2100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008360010154826124229190613339565b90506000612440600554600161243891906133ea565b8b90866128e5565b9050828a03612469573360009081526013602090815260408083208c8452909152812055612499565b3360009081526013602090815260408083208c845290915281208054839290612493908490613339565b90915550505b6001850154828b111561250e576124b0838c613339565b8660010160008282546124c39190613339565b909155506124d39050838c613339565b6000808282546124e39190613339565b909155505060045483106124f8576000612506565b826004546125069190613339565b600455612526565b8a600460008282546125209190613339565b90915550505b975095509293505050509250925092565b611ad4612a62565b612547612a62565b611f0081612ac9565b600061255f6201518083613392565b6106e6906201518061334c565b600060055460000361257c575090565b60065460055461258c908461334c565b6106e69190613392565b3073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c7689ce3faf19bc7a680c88df873b04931b0068216148061266357507f000000000000000000000000c7689ce3faf19bc7a680c88df873b04931b0068273ffffffffffffffffffffffffffffffffffffffff1661264a7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614155b15611ad4576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611f006122d3565b8173ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612727575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252612724918101906132f1565b60015b612775576040517f4c9c8ce300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8316600482015260240161081a565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81146127d1576040517faa1d49a40000000000000000000000000000000000000000000000000000000081526004810182905260240161081a565b6127db8383612ad1565b505050565b3073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c7689ce3faf19bc7a680c88df873b04931b006821614611ad4576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080547fffffffffffffffffffffffff0000000000000000000000000000000000000000811673ffffffffffffffffffffffffffffffffffffffff848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b6000838302817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709828110838203039150508060000361293a5783828161293057612930613363565b04925050506129da565b808411612973576040517f227bc15300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0080547ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01612a5c576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60029055565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff16611ad4576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611ea7612a62565b612ada82612b34565b60405173ffffffffffffffffffffffffffffffffffffffff8316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115612b2c576127db8282612c03565b611a31612c86565b8073ffffffffffffffffffffffffffffffffffffffff163b600003612b9d576040517f4c9c8ce300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260240161081a565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60606000808473ffffffffffffffffffffffffffffffffffffffff1684604051612c2d919061376f565b600060405180830381855af49150503d8060008114612c68576040519150601f19603f3d011682016040523d82523d6000602084013e612c6d565b606091505b5091509150612c7d858383612cbe565b95945050505050565b3415611ad4576040517fb398979f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082612cd357612cce82612d4d565b6129da565b8151158015612cf7575073ffffffffffffffffffffffffffffffffffffffff84163b155b15612d46576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161081a565b50806129da565b805115612d5d5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81168114611f0057600080fd5b60008060408385031215612dc457600080fd5b8235612dcf81612d8f565b946020939093013593505050565b600060208284031215612def57600080fd5b81356129da81612d8f565b60008060408385031215612e0d57600080fd5b50508035926020909101359150565b600080600080600060a08688031215612e3457600080fd5b8535612e3f81612d8f565b94506020860135612e4f81612d8f565b93506040860135612e5f81612d8f565b92506060860135612e6f81612d8f565b91506080860135612e7f81612d8f565b809150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715612edf57612edf612e8d565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612f2c57612f2c612e8d565b604052919050565b600082601f830112612f4557600080fd5b813567ffffffffffffffff811115612f5f57612f5f612e8d565b612f9060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601612ee5565b818152846020838601011115612fa557600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215612fd857600080fd5b8435612fe381612d8f565b93506020850135612ff381612d8f565b925060408501359150606085013567ffffffffffffffff81111561301657600080fd5b61302287828801612f34565b91505092959194509250565b60008083601f84011261304057600080fd5b50813567ffffffffffffffff81111561305857600080fd5b60208301915083602082850101111561307057600080fd5b9250929050565b600080600080600080600080600060a08a8c03121561309557600080fd5b893567ffffffffffffffff808211156130ad57600080fd5b6130b98d838e01612f34565b9a5060208c01359150808211156130cf57600080fd5b6130db8d838e0161302e565b909a50985060408c01359150808211156130f457600080fd5b6131008d838e0161302e565b909850965060608c013591508082111561311957600080fd5b6131258d838e0161302e565b909650945060808c013591508082111561313e57600080fd5b5061314b8c828d0161302e565b915080935050809150509295985092959850929598565b803561ffff8116811461317457600080fd5b919050565b60006020828403121561318b57600080fd5b6129da82613162565b600080604083850312156131a757600080fd5b823591506131b760208401613162565b90509250929050565b600080604083850312156131d357600080fd5b82356131de81612d8f565b9150602083013567ffffffffffffffff8111156131fa57600080fd5b61320685828601612f34565b9150509250929050565b8015158114611f0057600080fd5b6000806040838503121561323157600080fd5b823561323c81612d8f565b9150602083013561324c81613210565b809150509250929050565b60005b8381101561327257818101518382015260200161325a565b50506000910152565b60008151808452613293816020860160208601613257565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006129da602083018461327b565b6000602082840312156132ea57600080fd5b5035919050565b60006020828403121561330357600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156106e6576106e661330a565b80820281158282048414176106e6576106e661330a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826133c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156133df57600080fd5b81516129da81613210565b808201808211156106e6576106e661330a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561345c57815187529582019590820190600101613440565b509495945050505050565b60408152600061347a604083018561342c565b905073ffffffffffffffffffffffffffffffffffffffff831660208301529392505050565b600067ffffffffffffffff8211156134b9576134b9612e8d565b5060051b60200190565b600060208083850312156134d657600080fd5b825167ffffffffffffffff8111156134ed57600080fd5b8301601f810185136134fe57600080fd5b805161351161350c8261349f565b612ee5565b81815260059190911b8201830190838101908783111561353057600080fd5b928401925b82841015611c7157835182529284019290840190613535565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b60e0815260006135aa60e083018e61327b565b82810360208401526135bd818d8f61354e565b905082810360408401526135d2818b8d61354e565b905082810360608401526135e781898b61354e565b905082810360808401526135fc81878961354e565b73ffffffffffffffffffffffffffffffffffffffff9590951660a0840152505060c001529998505050505050505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361365e5761365e61330a565b5060010190565b6020815260006129da602083018461342c565b6000602080838503121561368b57600080fd5b825167ffffffffffffffff8111156136a257600080fd5b8301601f810185136136b357600080fd5b80516136c161350c8261349f565b81815260c091820283018401918482019190888411156136e057600080fd5b938501935b838510156137635780858a0312156136fd5760008081fd5b613705612ebc565b85518152868601518782015260408087015161372081612d8f565b908201526060868101519082015260808087015161373d81613210565b9082015260a08681015161375081613210565b90820152835293840193918501916136e5565b50979650505050505050565b60008251613781818460208701613257565b919091019291505056fea26469706673582212207d291cccc2ae71de2859718a64e904b7edeefb8af445540b52c03a7bcdfbef9664736f6c63430008140033
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.