Contract Address Details
contract
0xA02Af160a280957A8881879Ee9239A614Ab47F0D
- Contract Name
- HoprStakeSeason6
- Creator
- 0x4ff4e6–861976 at 0x1b0df9–79d552
- Balance
- 0 xDai ( )
- Tokens
-
Fetching tokens...
- Transactions
- 3,134 Transactions
- Transfers
- 9,828 Transfers
- Gas Used
- 776,605,416
- Last Balance Update
- 28172092
Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- HoprStakeSeason6
- Optimization enabled
- true
- Compiler version
- v0.8.13+commit.abaa5c0e
- Optimization runs
- 200
- EVM Version
- london
- Verified at
- 2023-01-03T14:58:43.203945Z
Constructor Arguments
0x0000000000000000000000004ff4e61052a4dfb1be72866ab711ae08dd86197600000000000000000000000043d13d7b83607f14335cf2cb75e87da369d056c7000000000000000000000000d057604a14982fe8d88c5fc25aac3267ea142a0800000000000000000000000066225de86cac02b32f34992eb3410f59de416698
Arg [0] (address) : <a href=/xdai/mainnet/address/0x4ff4e61052a4dfb1be72866ab711ae08dd861976>0x4ff4e61052a4dfb1be72866ab711ae08dd861976</a>
Arg [1] (address) : <a href=/xdai/mainnet/address/0x43d13d7b83607f14335cf2cb75e87da369d056c7>0x43d13d7b83607f14335cf2cb75e87da369d056c7</a>
Arg [2] (address) : <a href=/xdai/mainnet/address/0xd057604a14982fe8d88c5fc25aac3267ea142a08>0xd057604a14982fe8d88c5fc25aac3267ea142a08</a>
Arg [3] (address) : <a href=/xdai/mainnet/address/0x66225de86cac02b32f34992eb3410f59de416698>0x66225de86cac02b32f34992eb3410f59de416698</a>
src/stake/HoprStakeSeason6.sol
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; import './HoprStakeBase.sol'; /** * Staking program - Season 6 * Inherit a HoprStakeBase. * Include new function for owner to stake for a group of accounts */ contract HoprStakeSeason6 is HoprStakeBase { using SafeERC20 for IERC20; /** * Staking season 6 starts at 1674738000 2pm CET 26th January 2023 and ends at 1682510400 2pm CET 26th April 2023 * Basic APY is 1.25 % (= 1.25 / 100 * 1e12 / (365 * 24 * 60 * 60)) * the boost cap is 250k xHOPR (25e22) * It blocks HODLr, DAO_v2, Surveyor, Wildhorn_v2, PuzzleHunt_v1, PuzzleHunt_v2, PuzzleHunt_v3, ETH_Denver, * Lucky NFTs, PuzzleHunt_v3, Matterhorn, DAO_v3, AMA_zing, Restaker, QV_game, Meme_master, Tokenlon_AMA, * TokenlonAMA, Meme_master_v2 and Metadata_games at start * @param _newOwner address Address of the new owner. In production, it's 0xD9a00176Cf49dFB9cA3Ef61805a2850F45Cb1D05 * @param _nftAddress address Address of the NFT contract. In production, it's 0x43d13D7B83607F14335cF2cB75E87dA369D056c7 * @param _lockToken address Address of the stake token xHOPR. In production, it's 0xD057604A14982FE8D88c5fC25Aac3267eA142a08 * @param _rewardToken address Address of the reward token wxHOPR. In production, it's 0xD4fdec44DB9D44B8f2b6d529620f9C0C7066A2c1 */ constructor( address _newOwner, address _nftAddress, address _lockToken, address _rewardToken ) HoprStakeBase( block.chainid == 100 ? 0xD9a00176Cf49dFB9cA3Ef61805a2850F45Cb1D05 : _newOwner, 1674738000, 1682510400, 396, 25e22, block.chainid == 100 ? 0x43d13D7B83607F14335cF2cB75E87dA369D056c7 : _nftAddress, block.chainid == 100 ? 0xD057604A14982FE8D88c5fC25Aac3267eA142a08 : _lockToken, block.chainid == 100 ? 0xD4fdec44DB9D44B8f2b6d529620f9C0C7066A2c1 : _rewardToken ) { // block a selection of HoprBoost NFTs _ownerBlockNftType(2); // HODLr _ownerBlockNftType(3); // Wildhorn_v1 _ownerBlockNftType(4); // PuzzleHunt_v1 _ownerBlockNftType(7); // PuzzleHunt_v2 _ownerBlockNftType(8); // Wildhorn_v2 _ownerBlockNftType(9); // DAO_v2 _ownerBlockNftType(10); // Surveyor _ownerBlockNftType(11); // ETH_Denver _ownerBlockNftType(12); // Lucky _ownerBlockNftType(13); // PuzzleHunt_v3 _ownerBlockNftType(14); // Matterhorn _ownerBlockNftType(15); // DAO_v3 _ownerBlockNftType(16); // AMA_zing _ownerBlockNftType(17); // Restaker _ownerBlockNftType(18); // QV_game _ownerBlockNftType(19); // Meme_master _ownerBlockNftType(20); // Tokenlon_AMA _ownerBlockNftType(21); // TokenlonAMA _ownerBlockNftType(22); // Meme_master_v2 _ownerBlockNftType(23); // Metadata_games } /** * @dev allow the owner to stake tokens for some accounts * @notice Owner should have called `increaseApproval(s6contract, largeEnoughValue)` where ideally the * `largeEnoughValue` equals the sum of all the stakes * After PROGRAM_END, it refuses tokens; * @param _accounts address array of addresses that receives LOCK_TOKEN * @param _stakes uint256 array of token amount being transferred from owner's wallet */ function batchStakeFor(address[] calldata _accounts, uint256[] calldata _stakes) external onlyOwner { require(block.timestamp <= PROGRAM_END, 'HoprStake: Program ended, cannot stake anymore.'); require(_accounts.length == _stakes.length, 'HoprStake: accounts and stakes array lengths do not match'); uint256 increaseLocked; address acc; uint256 val; for (uint256 index = 0; index < _accounts.length; index++) { acc = _accounts[index]; val = _stakes[index]; // for each account _sync(acc); accounts[acc].actualLockedTokenAmount += val; increaseLocked += val; emit Staked(acc, val); } totalLocked += increaseLocked; IERC20(LOCK_TOKEN).safeTransferFrom(owner(), address(this), increaseLocked); } }
lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
lib/openzeppelin-contracts/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.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. * * By default, the owner account will be the one that deploys the contract. 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 Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing 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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @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 ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @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 `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
lib/openzeppelin-contracts/contracts/token/ERC777/IERC777Recipient.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP. * * Accounts can be notified of {IERC777} tokens being sent to them by having a * contract implement this interface (contract holders can be their own * implementer) and registering it on the * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. * * See {IERC1820Registry} and {ERC1820Implementer}. */ interface IERC777Recipient { /** * @dev Called by an {IERC777} token contract whenever tokens are being * moved or created into a registered account (`to`). The type of operation * is conveyed by `from` being the zero address or not. * * This call occurs _after_ the token contract's state is updated, so * {IERC777-balanceOf}, etc., can be used to query the post-operation state. * * This function may revert to prevent the operation from being executed. */ function tokensReceived( address operator, address from, address to, uint256 amount, bytes calldata userData, bytes calldata operatorData ) external; }
lib/openzeppelin-contracts/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
lib/openzeppelin-contracts/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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 Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
lib/openzeppelin-contracts/contracts/utils/introspection/IERC1820Registry.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC1820Registry.sol) pragma solidity ^0.8.0; /** * @dev Interface of the global ERC1820 Registry, as defined in the * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register * implementers for interfaces in this registry, as well as query support. * * Implementers may be shared by multiple accounts, and can also implement more * than a single interface for each account. Contracts can implement interfaces * for themselves, but externally-owned accounts (EOA) must delegate this to a * contract. * * {IERC165} interfaces can also be queried via the registry. * * For an in-depth explanation and source code analysis, see the EIP text. */ interface IERC1820Registry { /** * @dev Sets `newManager` as the manager for `account`. A manager of an * account is able to set interface implementers for it. * * By default, each account is its own manager. Passing a value of `0x0` in * `newManager` will reset the manager to this initial state. * * Emits a {ManagerChanged} event. * * Requirements: * * - the caller must be the current manager for `account`. */ function setManager(address account, address newManager) external; /** * @dev Returns the manager for `account`. * * See {setManager}. */ function getManager(address account) external view returns (address); /** * @dev Sets the `implementer` contract as ``account``'s implementer for * `interfaceHash`. * * `account` being the zero address is an alias for the caller's address. * The zero address can also be used in `implementer` to remove an old one. * * See {interfaceHash} to learn how these are created. * * Emits an {InterfaceImplementerSet} event. * * Requirements: * * - the caller must be the current manager for `account`. * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not * end in 28 zeroes). * - `implementer` must implement {IERC1820Implementer} and return true when * queried for support, unless `implementer` is the caller. See * {IERC1820Implementer-canImplementInterfaceForAddress}. */ function setInterfaceImplementer( address account, bytes32 _interfaceHash, address implementer ) external; /** * @dev Returns the implementer of `interfaceHash` for `account`. If no such * implementer is registered, returns the zero address. * * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28 * zeroes), `account` will be queried for support of it. * * `account` being the zero address is an alias for the caller's address. */ function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address); /** * @dev Returns the interface hash for an `interfaceName`, as defined in the * corresponding * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP]. */ function interfaceHash(string calldata interfaceName) external pure returns (bytes32); /** * @notice Updates the cache with whether the contract implements an ERC165 interface or not. * @param account Address of the contract for which to update the cache. * @param interfaceId ERC165 interface for which to update the cache. */ function updateERC165Cache(address account, bytes4 interfaceId) external; /** * @notice Checks whether a contract implements an ERC165 interface or not. * If the result is not cached a direct lookup on the contract address is performed. * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling * {updateERC165Cache} with the contract address. * @param account Address of the contract to check. * @param interfaceId ERC165 interface to check. * @return True if `account` implements `interfaceId`, false otherwise. */ function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool); /** * @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache. * @param account Address of the contract to check. * @param interfaceId ERC165 interface to check. * @return True if `account` implements `interfaceId`, false otherwise. */ function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool); event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer); event ManagerChanged(address indexed account, address indexed newManager); }
lib/openzeppelin-contracts/contracts/utils/math/Math.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a / b + (a % b == 0 ? 0 : 1); } }
src/stake/HoprStakeBase.sol
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/introspection/IERC1820Registry.sol'; import '@openzeppelin/contracts/utils/math/Math.sol'; import './IHoprBoost.sol'; /** * @dev Create a base contract for HOPR's staking program. * New season can inherit this contract to reduce work for testing. */ contract HoprStakeBase is Ownable, IERC777Recipient, IERC721Receiver, ReentrancyGuard { using SafeERC20 for IERC20; using Math for uint256; struct Account { uint256 actualLockedTokenAmount; // The amount of LOCK_TOKEN being actually locked to the contract. // Those tokens can be withdrawn after “UNLOCK_START” uint256 lastSyncTimestamp; // Timestamp at which any “Account” attribute gets synced for the last time. uint256 cumulatedRewards; // Rewards accredited to the account at “lastSyncTimestamp”. uint256 claimedRewards; // Rewards claimed by the account. } // public constants uint256 public constant FACTOR_DENOMINATOR = 1e12; // Denominator of the “Basic reward factor”. Default value is 1e12. address public LOCK_TOKEN = 0xD057604A14982FE8D88c5fC25Aac3267eA142a08; // Token that HOPR holders need to lock to the contract: xHOPR address. address public REWARD_TOKEN = 0xD4fdec44DB9D44B8f2b6d529620f9C0C7066A2c1; // Token that HOPR holders can claim as rewards: wxHOPR address IHoprBoost public NFT_CONTRACT = IHoprBoost(0x43d13D7B83607F14335cF2cB75E87dA369D056c7); // Address of the HoprBoost NFT smart contract. // immutable variables defined in the constructor uint256 public immutable PROGRAM_START; // Block timestamp at which incentive program starts. uint256 public immutable PROGRAM_END; // Block timestamp at which incentive program ends. From this timestamp on, tokens can be unlocked. uint256 public immutable BASIC_FACTOR_NUMERATOR; // Numerator of the “Basic reward factor”, for all accounts that participate in the program. Reward rate is BASIC_FACTOR_NUMERATOR/FACTOR_DENOMINATOR per second. uint256 public immutable BOOST_CAP; // Cap on actual locked tokens for receiving additional boosts, in LOCK_TOKEN's decimals (1e18) mapping(address => mapping(uint256 => uint256)) public redeemedNft; // Redeemed NFT per account, structured as “account -> index -> NFT tokenId”. mapping(address => uint256) public redeemedNftIndex; // The last index of redeemed NFT of an account. It defines the length of the “redeemedBoostToken mapping. mapping(address => mapping(uint256 => uint256)) public redeemedFactor; // Redeemed boost factor per account, structured as “account -> index -> NFT tokenId”. mapping(address => uint256) public redeemedFactorIndex; // The last index of redeemed boost factor factor of an account. It defines the length of the “redeemedFactor” mapping. mapping(uint256 => bool) public isBlockedNft; // Type index of HoprBoost NFT that is not accepted in this season mapping(address => Account) public accounts; // It stores the locked token amount, earned and claimed rewards per account. uint256 public totalLocked; // Total amount of tokens being locked in the incentive program. uint256 public availableReward; // Total amount of reward tokens currently available in the lock. // setup ERC1820 IERC1820Registry private constant ERC1820_REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); bytes32 private constant TOKENS_RECIPIENT_INTERFACE_HASH = keccak256('ERC777TokensRecipient'); event Sync(address indexed account, uint256 indexed increment); event Staked(address indexed account, uint256 indexed actualAmount); event Released(address indexed account, uint256 indexed actualAmount); event RewardFueled(uint256 indexed amount); event Redeemed(address indexed account, uint256 indexed boostTokenId, bool indexed factorRegistered); event Claimed(address indexed account, uint256 indexed rewardAmount); event NftBlocked(uint256 indexed typeIndex); event NftAllowed(uint256 indexed typeIndex); /** * @dev Provide basic parameters for the new staking season. * Transfer owner role to the new owner address. * At deployment, it also registers the staking contract as an ERC777 recipient. * @param _newOwner address Address of the new owner. This new owner can reclaim any ERC20 and ERC721 token being accidentally sent to the lock contract. * @param _programStart uint256 Timestamp from which the new staking season starts. * @param _programEnd uint256 Timestamp till which the new staking season ends. * @param _basicFactorNumerator uint256 Mumerator for the basic APY. * @param _boostCap uint256 Cap for staked tokens to enjoy extra boost * @param _nftAddress address Address of the NFT contract. * @param _lockToken address Address of the stake token xHOPR. * @param _rewardToken address Address of the reward token wxHOPR. */ constructor( address _newOwner, uint256 _programStart, uint256 _programEnd, uint256 _basicFactorNumerator, uint256 _boostCap, address _nftAddress, address _lockToken, address _rewardToken ) { // set program parameters PROGRAM_START = _programStart; PROGRAM_END = _programEnd; BASIC_FACTOR_NUMERATOR = _basicFactorNumerator; BOOST_CAP = _boostCap; transferOwnership(_newOwner); ERC1820_REGISTRY.setInterfaceImplementer(address(this), TOKENS_RECIPIENT_INTERFACE_HASH, address(this)); // implement in favor of testing if (block.chainid != 100) { LOCK_TOKEN = _lockToken; REWARD_TOKEN = _rewardToken; NFT_CONTRACT = IHoprBoost(_nftAddress); } } /** * @dev Given NFT name type and rank name (as in HoprBoost) returns if the hodler has redeemed such an NFT * @param nftType string Type name of the HoprBoost NFT. * @param nftRank string Rank name of the HoprBoost NFT. * @param hodler address Address of an account that stakes xHOPR tokens and/or redeems its HoprBoost NFT. */ function isNftTypeAndRankRedeemed1( string memory nftType, string memory nftRank, address hodler ) external view returns (bool) { string memory nftURI = string(abi.encodePacked(nftType, '/', nftRank)); // compare `boostType/boosRank` of redeemed NFTs with `nftURI` for (uint256 index = 0; index < redeemedNftIndex[hodler]; index++) { uint256 redeemedTokenId = redeemedNft[hodler][index]; string memory redeemedTokenURI = NFT_CONTRACT.tokenURI(redeemedTokenId); if (_hasSubstring(redeemedTokenURI, nftURI)) { return true; } } return false; } /** * @dev Given NFT type index and rank name (as in HoprBoost) returns if the hodler has redeemed such an NFT * @param nftTypeIndex uint256 Type index of the HoprBoost NFT. * @param nftRank string Rank name of the HoprBoost NFT. * @param hodler address Address of an account that stakes xHOPR tokens and/or redeems its HoprBoost NFT. */ function isNftTypeAndRankRedeemed2( uint256 nftTypeIndex, string memory nftRank, address hodler ) external view returns (bool) { // compare `boostType/boosRank` of redeemed NFTs with `nftURI` for (uint256 index = 0; index < redeemedNftIndex[hodler]; index++) { uint256 redeemedTokenId = redeemedNft[hodler][index]; string memory redeemedTokenURI = NFT_CONTRACT.tokenURI(redeemedTokenId); if (NFT_CONTRACT.typeIndexOf(redeemedTokenId) == nftTypeIndex && _hasSubstring(redeemedTokenURI, nftRank)) { return true; } } return false; } /** * @dev Given NFT type index and the boost numerator (as in HoprBoost) returns if the hodler has redeemed such an NFT * @param nftTypeIndex uint256 Type index of the HoprBoost NFT. * @param boostNumerator uint256 Boost numerator of the HoprBoost NFT. * @param hodler address Address of an account that stakes xHOPR tokens and/or redeems its HoprBoost NFT. */ function isNftTypeAndRankRedeemed3( uint256 nftTypeIndex, uint256 boostNumerator, address hodler ) external view returns (bool) { for (uint256 index = 0; index < redeemedNftIndex[hodler]; index++) { uint256 redeemedTokenId = redeemedNft[hodler][index]; (uint256 redeemedBoost, ) = NFT_CONTRACT.boostOf(redeemedTokenId); if (NFT_CONTRACT.typeIndexOf(redeemedTokenId) == nftTypeIndex && boostNumerator == redeemedBoost) { return true; } } return false; } /** * @dev Given NFT type name and the boost numerator (as in HoprBoost) returns if the hodler has redeemed such an NFT * @param nftType string Type name of the HoprBoost NFT. * @param boostNumerator uint256 Boost numerator of the HoprBoost NFT. * @param hodler address Address of an account that stakes xHOPR tokens and/or redeems its HoprBoost NFT. */ function isNftTypeAndRankRedeemed4( string memory nftType, uint256 boostNumerator, address hodler ) external view returns (bool) { for (uint256 index = 0; index < redeemedNftIndex[hodler]; index++) { uint256 redeemedTokenId = redeemedNft[hodler][index]; (uint256 redeemedBoost, ) = NFT_CONTRACT.boostOf(redeemedTokenId); if ( keccak256((bytes(NFT_CONTRACT.typeOf(redeemedTokenId)))) == keccak256((bytes(nftType))) && boostNumerator == redeemedBoost ) { return true; } } return false; } /** * @dev Owner can block NFTs from being redeemed in the current staking contract by its type name (as in HoprBoost) * @param typeIndex integer Type index to be blocked */ function ownerBlockNftType(uint256 typeIndex) external onlyOwner { require(!isBlockedNft[typeIndex], 'HoprStake: NFT type is already blocked'); _ownerBlockNftType(typeIndex); } /** * @dev Owner can allow blocked NFTs to be redeemable. * @param typeIndex integer Type index to be allowed */ function ownerUnblockNftType(uint256 typeIndex) external onlyOwner { require(isBlockedNft[typeIndex], 'HoprStake: NFT type is not blocked'); isBlockedNft[typeIndex] = false; emit NftAllowed(typeIndex); } /** * @dev ERC677 hook. Token holders can send their tokens with `transferAndCall` to the stake contract. * After PROGRAM_END, it refuses tokens; Before PROGRAM_END, it accepts tokens xHOPR token, sync * Account state, and update totalLocked. * @param _from address Address of tokens sender * @param _value uint256 token amount being transferred * @param _data bytes Data being sent along with token transfer */ function onTokenTransfer( address _from, uint256 _value, bytes memory _data ) external returns (bool) { require(msg.sender == LOCK_TOKEN, 'HoprStake: Only accept LOCK_TOKEN in staking'); require(block.timestamp <= PROGRAM_END, 'HoprStake: Program ended, cannot stake anymore.'); _sync(_from); accounts[_from].actualLockedTokenAmount += _value; totalLocked += _value; emit Staked(_from, _value); return true; } /** * @dev ERC777 hook. To receive wxHOPR to fuel the reward pool with `send()` method. It updates the availableReward by tokenAmount. * @param operator address operator requesting the transfer * @param from address token holder address * @param to address recipient address * @param amount uint256 amount of tokens to transfer * @param userData bytes hex information provided by the token holder (if any) * @param operatorData bytes extra information provided by the operator (if any) */ function tokensReceived( address operator, address from, address to, uint256 amount, bytes calldata userData, bytes calldata operatorData ) external override { require(msg.sender == REWARD_TOKEN, 'HoprStake: Sender must be wxHOPR token'); require(to == address(this), 'HoprStake: Must be sending tokens to HoprStake contract'); require(from == owner(), 'HoprStake: Only accept owner to provide rewards'); availableReward += amount; emit RewardFueled(amount); } /** * @dev Whenever a boost `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * when redeeming, this function is called. Boost factor associated with the * It must return its Solidity selector to confirm the token transfer upon success. * @param operator address operator requesting the transfer * @param from address token holder address * @param tokenId uint256 amount of tokens to transfer * @param data bytes hex information provided by the token holder (if any) */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external override returns (bytes4) { require(_msgSender() == address(NFT_CONTRACT), 'HoprStake: Cannot SafeTransferFrom tokens other than HoprBoost.'); require(block.timestamp <= PROGRAM_END, 'HoprStake: Program ended, cannot redeem boosts.'); // Account memory account = accounts[from]; _sync(from); // redeem NFT redeemedNft[from][redeemedNftIndex[from]] = tokenId; redeemedNftIndex[from] += 1; // update boost factor uint256 typeId = NFT_CONTRACT.typeIndexOf(tokenId); (uint256 factor, ) = NFT_CONTRACT.boostOf(tokenId); require(!isBlockedNft[typeId], 'HoprStake: Can only redeem NFTs of allowed types.'); uint256 boostIndex = redeemedFactorIndex[from]; uint256 index = 0; for (index; index < boostIndex; index++) { // loop through redeemed factors, replace the factor of the same type, if the current factor is larger. uint256 redeemedId = redeemedFactor[from][index]; uint256 redeemedIndex = NFT_CONTRACT.typeIndexOf(redeemedId); (uint256 redeemedFactorValue, ) = NFT_CONTRACT.boostOf(redeemedId); if (redeemedIndex == typeId) { if (redeemedFactorValue < factor) { redeemedFactor[from][index] = tokenId; } emit Redeemed(from, tokenId, redeemedFactorValue < factor); break; } } if (index == boostIndex) { // new type being redeemed. redeemedFactor[from][boostIndex] = tokenId; redeemedFactorIndex[from] += 1; emit Redeemed(from, tokenId, true); } return IERC721Receiver(address(this)).onERC721Received.selector; } /** * @dev Manually sync account's reward states * @notice public function of ``_sync``. * @param account address Account whose stake rewards will be synced. */ function sync(address account) external { _sync(account); } /** * @dev Sync rewards and claim them * @notice public function of ``_sync`` + ``_claim`` * @param account address Account whose stake rewards will be synced and claimed. */ function claimRewards(address account) external { _sync(account); _claim(account); } /** * @dev Unlock staking for caller */ function unlock() external { _unlockFor(msg.sender); } /** * @dev Unlock staking for a given account * @param account address Account that staked tokens. */ function unlockFor(address account) external { _unlockFor(account); } /** * @dev Reclaim any ERC20 token being accidentally sent to the contract. * @param tokenAddress address ERC20 token address. */ function reclaimErc20Tokens(address tokenAddress) external onlyOwner nonReentrant { uint256 difference; if (tokenAddress == LOCK_TOKEN) { difference = IERC20(LOCK_TOKEN).balanceOf(address(this)) - totalLocked; } else { difference = IERC20(tokenAddress).balanceOf(address(this)); } IERC20(tokenAddress).safeTransfer(owner(), difference); } /** * @dev Reclaim any ERC721 token being accidentally sent to the contract. * @param tokenAddress address ERC721 token address. */ function reclaimErc721Tokens(address tokenAddress, uint256 tokenId) external onlyOwner nonReentrant { require(tokenAddress != address(NFT_CONTRACT), 'HoprStake: Cannot claim HoprBoost NFT'); IHoprBoost(tokenAddress).transferFrom(address(this), owner(), tokenId); } /** * @dev Shortcut that returns the actual stake of an account. * @param _account address Address of the staker account. */ function stakedHoprTokens(address _account) public view returns (uint256) { return accounts[_account].actualLockedTokenAmount; } /** * @dev Returns the increment of cumulated rewards during the “lastSyncTimestamp” and current block.timestamp. * @param _account address Address of the account whose rewards will be calculated. */ function getCumulatedRewardsIncrement(address _account) public view returns (uint256) { return _getCumulatedRewardsIncrement(_account); } /** * @dev Calculates the increment of cumulated rewards during the “lastSyncTimestamp” and block.timestamp. * current block timestamp and lastSyncTimestamp are confined in [PROGRAM_START, PROGRAM_END] for basic and boosted lockup, * @param _account address Address of the account whose rewards will be calculated. */ function _getCumulatedRewardsIncrement(address _account) internal view returns (uint256) { Account memory account = accounts[_account]; if (block.timestamp <= PROGRAM_START || account.lastSyncTimestamp >= PROGRAM_END) { // skip calculation and return directly 0; return 0; } // Per second gain, for basic lock-up. uint256 gainPerSec = account.actualLockedTokenAmount * BASIC_FACTOR_NUMERATOR; // Per second gain, for additional boost, applicable to amount under BOOST_CAP for (uint256 index = 0; index < redeemedFactorIndex[_account]; index++) { uint256 tokenId = redeemedFactor[_account][index]; (uint256 boost, ) = NFT_CONTRACT.boostOf(tokenId); gainPerSec += (account.actualLockedTokenAmount.min(BOOST_CAP)) * boost; } return (gainPerSec * (block.timestamp.max(PROGRAM_START).min(PROGRAM_END) - account.lastSyncTimestamp.max(PROGRAM_START).min(PROGRAM_END))) / FACTOR_DENOMINATOR; } /** * @dev if the given `tokenURI` end with `/substring` * @param tokenURI string URI of the HoprBoost NFT. E.g. "https://stake.hoprnet.org/PuzzleHunt_v2/Bronze - Week 5" * @param substring string of the `boostRank` or `boostType/boostRank`. E.g. "Bronze - Week 5", "PuzzleHunt_v2/Bronze - Week 5" */ function _hasSubstring(string memory tokenURI, string memory substring) internal pure returns (bool) { // convert string to bytes bytes memory tokenURIInBytes = bytes(tokenURI); bytes memory substringInBytes = bytes(substring); // lenghth of tokenURI is the sum of substringLen and restLen, where // - `substringLen` is the length of the part that is extracted and compared with the provided substring // - `restLen` is the length of the baseURI and boostType, which will be offset uint256 substringLen = substringInBytes.length; uint256 restLen = tokenURIInBytes.length - substringLen; // one byte before the supposed substring, to see if it's the start of `substring` bytes1 slashPositionContent = tokenURIInBytes[restLen - 1]; if (slashPositionContent != 0x2f) { // if this position is not a `/`, substring in the tokenURI is for sure neither `boostRank` nor `boostType/boostRank` return false; } // offset so that value from the next calldata (`substring`) is removed, so bitwise it needs to shift // log2(16) * (32 - substringLen) * 2 uint256 offset = (32 - substringLen) * 8; bytes32 trimed; // left-padded extracted `boostRank` from the `tokenURI` bytes32 substringInBytes32 = bytes32(substringInBytes); // convert substring in to bytes32 bytes32 shifted; // shift the substringInBytes32 from right-padded to left-padded bool result; assembly { // assuming `boostRank` or `boostType/boostRank` will never exceed 32 bytes // left-pad the `boostRank` extracted from the `tokenURI`, so that possible // extra pieces of `substring` is not included // 32 jumps the storage of bytes length and restLen offsets the `baseURI` trimed := shr(offset, mload(add(add(tokenURIInBytes, 32), restLen))) // tokenURIInBytes32 := mload(add(add(tokenURIInBytes, 32), restLen)) // left-pad `substring` shifted := shr(offset, substringInBytes32) // compare results result := eq(trimed, shifted) } return result; } /** * @dev Update “lastSyncTimestamp” with the current block timestamp and update “cumulatedRewards” with _getCumulatedRewardsIncrement(account) * @param _account address Address of the account whose rewards will be calculated. */ function _sync(address _account) internal { uint256 increment = _getCumulatedRewardsIncrement(_account); accounts[_account].cumulatedRewards += increment; accounts[_account].lastSyncTimestamp = block.timestamp; emit Sync(_account, increment); } /** * @dev Claim rewards for staking. * @param _account address Address of the staking account. */ function _claim(address _account) internal { Account memory account = accounts[_account]; // update states uint256 amount = account.cumulatedRewards - account.claimedRewards; if (amount > 0) { accounts[_account].claimedRewards = accounts[_account].cumulatedRewards; require(availableReward >= amount, 'HoprStake: Insufficient reward pool.'); availableReward -= amount; // send rewards to the account. IERC20(REWARD_TOKEN).safeTransfer(_account, amount); emit Claimed(_account, amount); } } /** * @dev Unlock staking for a given account * @param _account address Account that staked tokens. */ function _unlockFor(address _account) internal { require(block.timestamp > PROGRAM_END, 'HoprStake: Program is ongoing, cannot unlock stake.'); uint256 actualStake = accounts[_account].actualLockedTokenAmount; _sync(_account); accounts[_account].actualLockedTokenAmount = 0; totalLocked -= actualStake; _claim(_account); // unlock actual staked tokens IERC20(LOCK_TOKEN).safeTransfer(_account, actualStake); // unlock redeemed NFTs for (uint256 index = 0; index < redeemedNftIndex[_account]; index++) { NFT_CONTRACT.transferFrom(address(this), _account, redeemedNft[_account][index]); } emit Released(_account, actualStake); } /** * @dev Internal function to block an NFT * @param typeIndex integer Type index to be blocked */ function _ownerBlockNftType(uint256 typeIndex) internal { isBlockedNft[typeIndex] = true; emit NftBlocked(typeIndex); } }
src/stake/IHoprBoost.sol
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; /** * @dev Required interface of an ERC721 compliant contract. */ interface IHoprBoost is IERC721Metadata { /** * @dev Returns the boost factor and the redeem deadline associated with ``tokenId``. * @param tokenId uint256 token Id of the boost. */ function boostOf(uint256 tokenId) external view returns (uint256, uint256); /** * @dev Returns the boost type associated with ``tokenId``. * @param tokenId uint256 token Id of the boost. */ function typeOf(uint256 tokenId) external view returns (string memory); /** * @dev Returns the boost type index associated with ``tokenId``. * @param tokenId uint256 token Id of the boost. */ function typeIndexOf(uint256 tokenId) external view returns (uint256); }
Compiler Settings
{"remappings":["@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","ds-test/=lib/forge-std/lib/ds-test/src/","forge-std/=lib/forge-std/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/"],"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{"script/utils/BoostUtilsLib.sol":{"BoostUtilsLib":"0x8197525557233031b110038Ae52dfC3C4A75567A"}},"evmVersion":"london"}
Contract ABI
[{"type":"constructor","inputs":[{"type":"address","name":"_newOwner","internalType":"address"},{"type":"address","name":"_nftAddress","internalType":"address"},{"type":"address","name":"_lockToken","internalType":"address"},{"type":"address","name":"_rewardToken","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"BASIC_FACTOR_NUMERATOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"BOOST_CAP","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"FACTOR_DENOMINATOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"LOCK_TOKEN","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IHoprBoost"}],"name":"NFT_CONTRACT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"PROGRAM_END","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"PROGRAM_START","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"REWARD_TOKEN","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"actualLockedTokenAmount","internalType":"uint256"},{"type":"uint256","name":"lastSyncTimestamp","internalType":"uint256"},{"type":"uint256","name":"cumulatedRewards","internalType":"uint256"},{"type":"uint256","name":"claimedRewards","internalType":"uint256"}],"name":"accounts","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"availableReward","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchStakeFor","inputs":[{"type":"address[]","name":"_accounts","internalType":"address[]"},{"type":"uint256[]","name":"_stakes","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimRewards","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCumulatedRewardsIncrement","inputs":[{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isBlockedNft","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isNftTypeAndRankRedeemed1","inputs":[{"type":"string","name":"nftType","internalType":"string"},{"type":"string","name":"nftRank","internalType":"string"},{"type":"address","name":"hodler","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isNftTypeAndRankRedeemed2","inputs":[{"type":"uint256","name":"nftTypeIndex","internalType":"uint256"},{"type":"string","name":"nftRank","internalType":"string"},{"type":"address","name":"hodler","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isNftTypeAndRankRedeemed3","inputs":[{"type":"uint256","name":"nftTypeIndex","internalType":"uint256"},{"type":"uint256","name":"boostNumerator","internalType":"uint256"},{"type":"address","name":"hodler","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isNftTypeAndRankRedeemed4","inputs":[{"type":"string","name":"nftType","internalType":"string"},{"type":"uint256","name":"boostNumerator","internalType":"uint256"},{"type":"address","name":"hodler","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC721Received","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"address","name":"from","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"onTokenTransfer","inputs":[{"type":"address","name":"_from","internalType":"address"},{"type":"uint256","name":"_value","internalType":"uint256"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"ownerBlockNftType","inputs":[{"type":"uint256","name":"typeIndex","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"ownerUnblockNftType","inputs":[{"type":"uint256","name":"typeIndex","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"reclaimErc20Tokens","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"reclaimErc721Tokens","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"redeemedFactor","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"redeemedFactorIndex","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"redeemedNft","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"redeemedNftIndex","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"stakedHoprTokens","inputs":[{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"sync","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"tokensReceived","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"bytes","name":"userData","internalType":"bytes"},{"type":"bytes","name":"operatorData","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalLocked","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlock","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlockFor","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"event","name":"Claimed","inputs":[{"type":"address","name":"account","indexed":true},{"type":"uint256","name":"rewardAmount","indexed":true}],"anonymous":false},{"type":"event","name":"NftAllowed","inputs":[{"type":"uint256","name":"typeIndex","indexed":true}],"anonymous":false},{"type":"event","name":"NftBlocked","inputs":[{"type":"uint256","name":"typeIndex","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","indexed":true},{"type":"address","name":"newOwner","indexed":true}],"anonymous":false},{"type":"event","name":"Redeemed","inputs":[{"type":"address","name":"account","indexed":true},{"type":"uint256","name":"boostTokenId","indexed":true},{"type":"bool","name":"factorRegistered","indexed":true}],"anonymous":false},{"type":"event","name":"Released","inputs":[{"type":"address","name":"account","indexed":true},{"type":"uint256","name":"actualAmount","indexed":true}],"anonymous":false},{"type":"event","name":"RewardFueled","inputs":[{"type":"uint256","name":"amount","indexed":true}],"anonymous":false},{"type":"event","name":"Staked","inputs":[{"type":"address","name":"account","indexed":true},{"type":"uint256","name":"actualAmount","indexed":true}],"anonymous":false},{"type":"event","name":"Sync","inputs":[{"type":"address","name":"account","indexed":true},{"type":"uint256","name":"increment","indexed":true}],"anonymous":false}]
Contract Creation Code
0x610100604052600280546001600160a01b031990811673d057604a14982fe8d88c5fc25aac3267ea142a081790915560038054821673d4fdec44db9d44b8f2b6d529620f9c0c7066a2c1179055600480549091167343d13d7b83607f14335cf2cb75e87da369d056c71790553480156200007857600080fd5b5060405162003358380380620033588339810160408190526200009b91620004e0565b46606414620000ab5783620000c1565b73d9a00176cf49dfb9ca3ef61805a2850f45cb1d055b6363d27950636449124061018c6934f086f3b33b6840000046606414620000e95787620000ff565b7343d13d7b83607f14335cf2cb75e87da369d056c75b466064146200010f578762000125565b73d057604a14982fe8d88c5fc25aac3267ea142a085b466064146200013557876200014b565b73d4fdec44db9d44b8f2b6d529620f9c0c7066a2c15b62000156336200035b565b60018055608087905260a086905260c085905260e08490526200017988620003ab565b6040516329965a1d60e01b815230600482018190527fb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b60248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad24906329965a1d90606401600060405180830381600087803b158015620001f357600080fd5b505af115801562000208573d6000803e3d6000fd5b50505050466064146200025357600280546001600160a01b038085166001600160a01b0319928316179092556003805484841690831617905560048054928616929091169190911790555b50505050505050506200026d60026200048060201b60201c565b62000279600362000480565b62000285600462000480565b62000291600762000480565b6200029d600862000480565b620002a9600962000480565b620002b5600a62000480565b620002c1600b62000480565b620002cd600c62000480565b620002d9600d62000480565b620002e5600e62000480565b620002f1600f62000480565b620002fd601062000480565b62000309601162000480565b62000315601262000480565b62000321601362000480565b6200032d601462000480565b62000339601562000480565b62000345601662000480565b62000351601762000480565b505050506200053d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031633146200040b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b038116620004725760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000402565b6200047d816200035b565b50565b600081815260096020526040808220805460ff191660011790555182917f620d09c7c7f3c5c41d8b5ea7f274622ddd6ac6b801f035fc741205d113199c0c91a250565b80516001600160a01b0381168114620004db57600080fd5b919050565b60008060008060808587031215620004f757600080fd5b6200050285620004c3565b93506200051260208601620004c3565b92506200052260408601620004c3565b91506200053260608601620004c3565b905092959194509250565b60805160a05160c05160e051612d8d620005cb6000396000818161059e0152611dd10152600081816104130152611ced01526000818161050b0152818161084a015281816115020152818161187a01528181611cad01528181611e2c01528181611e8d0152611ff701526000818161036501528181611c8301528181611e500152611eb20152612d8d6000f3fe608060405234801561001057600080fd5b50600436106102265760003560e01c806381128c1d11610130578063cbffa3c7116100b8578063dde499791161007c578063dde4997914610586578063ef0526a214610599578063ef5cfb8c146105c0578063f2fde38b146105d3578063f978fff1146105e657600080fd5b8063cbffa3c714610506578063ce23177e1461052d578063d0c02d6314610540578063d0da680114610560578063d0f2dfa41461057357600080fd5b806399248ea7116100ff57806399248ea7146104b2578063a4c0ed36146104c5578063a5841194146104d8578063a69df4b5146104eb578063a83d1ed6146104f357600080fd5b806381128c1d146104505780638c24add41461047b5780638da5cb5b1461048e57806396a9cd7d1461049f57600080fd5b806356891412116101b35780635ef73d58116101825780635ef73d58146103ef5780636067bc15146103fb5780636aa8d4cf1461040e57806370af093414610435578063715018a61461044857600080fd5b806356891412146103575780635bbb63a6146103605780635e4c0e15146103875780635e5c06e21461039a57600080fd5b80631fda9a02116101fa5780631fda9a02146102ca57806321cf85ba146102f557806342c933611461030857806348c64e411461033b5780634ad84b341461034e57600080fd5b806223de291461022b5780630a1a257a14610240578063150b7a021461027e5780631f014d83146102aa575b600080fd5b61023e6102393660046125dc565b61060f565b005b61026b61024e366004612687565b600560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61029161028c3660046126b1565b6107bc565b6040516001600160e01b03199091168152602001610275565b61026b6102b8366004612720565b60086020526000908152604090205481565b6004546102dd906001600160a01b031681565b6040516001600160a01b039091168152602001610275565b61023e61030336600461273b565b610cd0565b61032b61031636600461273b565b60096020526000908152604090205460ff1681565b6040519015158152602001610275565b61023e610349366004612687565b610da3565b61026b600c5481565b61026b600b5481565b61026b7f000000000000000000000000000000000000000000000000000000000000000081565b61023e61039536600461273b565b610f21565b6103cf6103a8366004612720565b600a6020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610275565b61026b64e8d4a5100081565b61023e610409366004612720565b610fc5565b61026b7f000000000000000000000000000000000000000000000000000000000000000081565b61026b610443366004612720565b611178565b61023e611189565b61026b61045e366004612687565b600760209081526000928352604080842090915290825290205481565b61032b610489366004612821565b6111bf565b6000546001600160a01b03166102dd565b61032b6104ad366004612878565b611331565b6003546102dd906001600160a01b031681565b61032b6104d33660046128c6565b61148e565b61023e6104e6366004612720565b6115cf565b61023e6115d8565b61032b610501366004612931565b6115e1565b61026b7f000000000000000000000000000000000000000000000000000000000000000081565b61032b61053b36600461295d565b611734565b61026b61054e366004612720565b60066020526000908152604090205481565b6002546102dd906001600160a01b031681565b61023e6105813660046129fe565b61184e565b61023e610594366004612720565b611a50565b61026b7f000000000000000000000000000000000000000000000000000000000000000081565b61023e6105ce366004612720565b611a59565b61023e6105e1366004612720565b611a6b565b61026b6105f4366004612720565b6001600160a01b03166000908152600a602052604090205490565b6003546001600160a01b0316331461067d5760405162461bcd60e51b815260206004820152602660248201527f486f70725374616b653a2053656e646572206d757374206265207778484f5052604482015265103a37b5b2b760d11b60648201526084015b60405180910390fd5b6001600160a01b03861630146106fb5760405162461bcd60e51b815260206004820152603760248201527f486f70725374616b653a204d7573742062652073656e64696e6720746f6b656e60448201527f7320746f20486f70725374616b6520636f6e74726163740000000000000000006064820152608401610674565b6000546001600160a01b038881169116146107705760405162461bcd60e51b815260206004820152602f60248201527f486f70725374616b653a204f6e6c7920616363657074206f776e657220746f2060448201526e70726f76696465207265776172647360881b6064820152608401610674565b84600c60008282546107829190612a80565b909155505060405185907f2bf52bcae319602514e02ff69bbe4b89a19718b96e7867044128ec872419437c90600090a25050505050505050565b6004546000906001600160a01b0316336001600160a01b0316146108485760405162461bcd60e51b815260206004820152603f60248201527f486f70725374616b653a2043616e6e6f7420536166655472616e73666572467260448201527f6f6d20746f6b656e73206f74686572207468616e20486f7072426f6f73742e006064820152608401610674565b7f00000000000000000000000000000000000000000000000000000000000000004211156108d05760405162461bcd60e51b815260206004820152602f60248201527f486f70725374616b653a2050726f6772616d20656e6465642c2063616e6e6f7460448201526e103932b232b2b6903137b7b9ba399760891b6064820152608401610674565b6108d985611b03565b6001600160a01b0385166000818152600560209081526040808320600680845282852080548652918452918420899055938352905281546001929190610920908490612a80565b90915550506004805460405163562317c560e01b81529182018690526000916001600160a01b039091169063562317c590602401602060405180830381865afa158015610971573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109959190612a98565b6004805460405163225b377d60e21b81529182018890529192506000916001600160a01b03169063896cddf4906024016040805180830381865afa1580156109e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a059190612ab1565b5060008381526009602052604090205490915060ff1615610a825760405162461bcd60e51b815260206004820152603160248201527f486f70725374616b653a2043616e206f6e6c792072656465656d204e4654732060448201527037b31030b63637bbb2b2103a3cb832b99760791b6064820152608401610674565b6001600160a01b038716600090815260086020526040812054905b81811015610c33576001600160a01b0389811660009081526007602090815260408083208584529091528082205460048054925163562317c560e01b81529081018290529093919091169063562317c590602401602060405180830381865afa158015610b0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b329190612a98565b6004805460405163225b377d60e21b81529182018590529192506000916001600160a01b03169063896cddf4906024016040805180830381865afa158015610b7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba29190612ab1565b509050868203610c1d5785811015610bdb576001600160a01b038c16600090815260076020908152604080832087845290915290208b90555b604051868210908c906001600160a01b038f16907f066d96cb280fccf3a0a3a5686966a801b2690a32ec98fd2711a4e09f345d935d90600090a4505050610c33565b5050508080610c2b90612ad5565b915050610a9d565b818103610cba576001600160a01b038916600081815260076020908152604080832086845282528083208c905592825260089052908120805460019290610c7b908490612a80565b909155505060405160019089906001600160a01b038c16907f066d96cb280fccf3a0a3a5686966a801b2690a32ec98fd2711a4e09f345d935d90600090a45b50630a85bd0160e11b9998505050505050505050565b6000546001600160a01b03163314610cfa5760405162461bcd60e51b815260040161067490612aee565b60008181526009602052604090205460ff16610d635760405162461bcd60e51b815260206004820152602260248201527f486f70725374616b653a204e46542074797065206973206e6f7420626c6f636b604482015261195960f21b6064820152608401610674565b600081815260096020526040808220805460ff191690555182917ff78f7266ab985ddb2782b52fc236b9d2f22ff251a37a336a296ed4b188f7a92691a250565b6000546001600160a01b03163314610dcd5760405162461bcd60e51b815260040161067490612aee565b600260015403610e1f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610674565b60026001556004546001600160a01b0390811690831603610e905760405162461bcd60e51b815260206004820152602560248201527f486f70725374616b653a2043616e6e6f7420636c61696d20486f7072426f6f736044820152641d0813919560da1b6064820152608401610674565b816001600160a01b03166323b872dd30610eb26000546001600160a01b031690565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b158015610f0157600080fd5b505af1158015610f15573d6000803e3d6000fd5b50506001805550505050565b6000546001600160a01b03163314610f4b5760405162461bcd60e51b815260040161067490612aee565b60008181526009602052604090205460ff1615610fb95760405162461bcd60e51b815260206004820152602660248201527f486f70725374616b653a204e4654207479706520697320616c726561647920626044820152651b1bd8dad95960d21b6064820152608401610674565b610fc281611b8e565b50565b6000546001600160a01b03163314610fef5760405162461bcd60e51b815260040161067490612aee565b6002600154036110415760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610674565b60026001819055546000906001600160a01b03908116908316036110df57600b546002546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156110aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ce9190612a98565b6110d89190612b23565b905061114a565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015611123573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111479190612a98565b90505b61117061115f6000546001600160a01b031690565b6001600160a01b0384169083611bd1565b505060018055565b600061118382611c39565b92915050565b6000546001600160a01b031633146111b35760405162461bcd60e51b815260040161067490612aee565b6111bd6000611efc565b565b6000805b6001600160a01b038316600090815260066020526040902054811015611324576001600160a01b0383811660009081526005602090815260408083208584529091528082205460048054925163225b377d60e21b81529081018290529093919091169063896cddf4906024016040805180830381865afa15801561124b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126f9190612ab1565b50875160208901206004805460405163c588ff8b60e01b815291820186905292935090916001600160a01b03169063c588ff8b90602401600060405180830381865afa1580156112c3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112eb9190810190612b66565b805190602001201480156112fe57508086145b1561130f576001935050505061132a565b5050808061131c90612ad5565b9150506111c3565b50600090505b9392505050565b6000805b6001600160a01b038316600090815260066020526040902054811015611324576001600160a01b0383811660009081526005602090815260408083208584529091528082205460048054925163c87b56dd60e01b81529081018290529093919091169063c87b56dd90602401600060405180830381865afa1580156113be573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113e69190810190612b66565b6004805460405163562317c560e01b815291820185905291925088916001600160a01b03169063562317c590602401602060405180830381865afa158015611432573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114569190612a98565b14801561146857506114688187611f4c565b15611479576001935050505061132a565b5050808061148690612ad5565b915050611335565b6002546000906001600160a01b031633146115005760405162461bcd60e51b815260206004820152602c60248201527f486f70725374616b653a204f6e6c7920616363657074204c4f434b5f544f4b4560448201526b4e20696e207374616b696e6760a01b6064820152608401610674565b7f00000000000000000000000000000000000000000000000000000000000000004211156115405760405162461bcd60e51b815260040161067490612bdd565b61154984611b03565b6001600160a01b0384166000908152600a602052604081208054859290611571908490612a80565b9250508190555082600b600082825461158a9190612a80565b909155505060405183906001600160a01b038616907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90600090a35060019392505050565b610fc281611b03565b6111bd33611ff5565b6000805b6001600160a01b038316600090815260066020526040902054811015611324576001600160a01b0383811660009081526005602090815260408083208584529091528082205460048054925163225b377d60e21b81529081018290529093919091169063896cddf4906024016040805180830381865afa15801561166d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116919190612ab1565b506004805460405163562317c560e01b815291820185905291925088916001600160a01b03169063562317c590602401602060405180830381865afa1580156116de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117029190612a98565b14801561170e57508086145b1561171f576001935050505061132a565b5050808061172c90612ad5565b9150506115e5565b600080848460405160200161174a929190612c2c565b604051602081830303815290604052905060005b6001600160a01b038416600090815260066020526040902054811015611842576001600160a01b0384811660009081526005602090815260408083208584529091528082205460048054925163c87b56dd60e01b81529081018290529093919091169063c87b56dd90602401600060405180830381865afa1580156117e7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261180f9190810190612b66565b905061181b8185611f4c565b1561182d57600194505050505061132a565b5050808061183a90612ad5565b91505061175e565b50600095945050505050565b6000546001600160a01b031633146118785760405162461bcd60e51b815260040161067490612aee565b7f00000000000000000000000000000000000000000000000000000000000000004211156118b85760405162461bcd60e51b815260040161067490612bdd565b82811461192d5760405162461bcd60e51b815260206004820152603960248201527f486f70725374616b653a206163636f756e747320616e64207374616b6573206160448201527f72726179206c656e6774687320646f206e6f74206d61746368000000000000006064820152608401610674565b60008080805b86811015611a0b5787878281811061194d5761194d612c68565b90506020020160208101906119629190612720565b925085858281811061197657611976612c68565b90506020020135915061198883611b03565b6001600160a01b0383166000908152600a6020526040812080548492906119b0908490612a80565b909155506119c090508285612a80565b935081836001600160a01b03167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d60405160405180910390a380611a0381612ad5565b915050611933565b5082600b6000828254611a1e9190612a80565b9091555050600054611a47906001600160a01b03166002546001600160a01b03169030866121ef565b50505050505050565b610fc281611ff5565b611a6281611b03565b610fc28161222d565b6000546001600160a01b03163314611a955760405162461bcd60e51b815260040161067490612aee565b6001600160a01b038116611afa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610674565b610fc281611efc565b6000611b0e82611c39565b6001600160a01b0383166000908152600a6020526040812060020180549293508392909190611b3e908490612a80565b90915550506001600160a01b0382166000818152600a602052604080822042600190910155518392917f99869d968ca3581a661f31abb3a6aa70ccec5cdc49855eab174cf9e00a2462db91a35050565b600081815260096020526040808220805460ff191660011790555182917f620d09c7c7f3c5c41d8b5ea7f274622ddd6ac6b801f035fc741205d113199c0c91a250565b6040516001600160a01b038316602482015260448101829052611c3490849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612374565b505050565b6001600160a01b0381166000908152600a602090815260408083208151608081018352815481526001820154938101939093526002810154918301919091526003015460608201527f000000000000000000000000000000000000000000000000000000000000000042111580611cd457507f0000000000000000000000000000000000000000000000000000000000000000816020015110155b15611ce25750600092915050565b8051600090611d12907f000000000000000000000000000000000000000000000000000000000000000090612c7e565b905060005b6001600160a01b038516600090815260086020526040902054811015611e20576001600160a01b0385811660009081526007602090815260408083208584529091528082205460048054925163225b377d60e21b81529081018290529093919091169063896cddf4906024016040805180830381865afa158015611d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc39190612ab1565b5085519091508190611df5907f0000000000000000000000000000000000000000000000000000000000000000612446565b611dff9190612c7e565b611e099085612a80565b935050508080611e1890612ad5565b915050611d17565b5064e8d4a51000611e887f0000000000000000000000000000000000000000000000000000000000000000611e827f0000000000000000000000000000000000000000000000000000000000000000866020015161245c90919063ffffffff16565b90612446565b611ed67f0000000000000000000000000000000000000000000000000000000000000000611e82427f000000000000000000000000000000000000000000000000000000000000000061245c565b611ee09190612b23565b611eea9083612c7e565b611ef49190612c9d565b949350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051825160009184918491908490611f65908390612b23565b9050600084611f75600184612b23565b81518110611f8557611f85612c68565b01602001516001600160f81b0319169050602f60f81b8114611faf57600095505050505050611183565b6000611fbc846020612b23565b611fc7906008612c7e565b9050600080611fd587612cbf565b979094016020015196821c9690911c959095149550505050505092915050565b7f000000000000000000000000000000000000000000000000000000000000000042116120805760405162461bcd60e51b815260206004820152603360248201527f486f70725374616b653a2050726f6772616d206973206f6e676f696e672c206360448201527230b73737ba103ab73637b1b59039ba30b5b29760691b6064820152608401610674565b6001600160a01b0381166000908152600a60205260409020546120a282611b03565b6001600160a01b0382166000908152600a60205260408120819055600b80548392906120cf908490612b23565b909155506120de90508261222d565b6002546120f5906001600160a01b03168383611bd1565b60005b6001600160a01b0383166000908152600660205260409020548110156121b457600480546001600160a01b038581166000818152600560209081526040808320888452909152908190205490516323b872dd60e01b815230958101959095526024850191909152604484015216906323b872dd90606401600060405180830381600087803b15801561218957600080fd5b505af115801561219d573d6000803e3d6000fd5b5050505080806121ac90612ad5565b9150506120f8565b5060405181906001600160a01b038416907fb21fb52d5749b80f3182f8c6992236b5e5576681880914484d7f4c9b062e619e90600090a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526122279085906323b872dd60e01b90608401611bfd565b50505050565b6001600160a01b0381166000908152600a602090815260408083208151608081018352815481526001820154938101939093526002810154918301829052600301546060830181905291929161228291612b23565b90508015611c34576001600160a01b0383166000908152600a602052604090206002810154600390910155600c5481111561230b5760405162461bcd60e51b8152602060048201526024808201527f486f70725374616b653a20496e73756666696369656e7420726577617264207060448201526337b7b61760e11b6064820152608401610674565b80600c600082825461231d9190612b23565b9091555050600354612339906001600160a01b03168483611bd1565b60405181906001600160a01b038516907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a90600090a3505050565b60006123c9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661246c9092919063ffffffff16565b805190915015611c3457808060200190518101906123e79190612ce6565b611c345760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610674565b6000818310612455578161132a565b5090919050565b600081831015612455578161132a565b6060611ef4848460008585843b6124c55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610674565b600080866001600160a01b031685876040516124e19190612d08565b60006040518083038185875af1925050503d806000811461251e576040519150601f19603f3d011682016040523d82523d6000602084013e612523565b606091505b509150915061253382828661253e565b979650505050505050565b6060831561254d57508161132a565b82511561255d5782518084602001fd5b8160405162461bcd60e51b81526004016106749190612d24565b80356001600160a01b038116811461258e57600080fd5b919050565b60008083601f8401126125a557600080fd5b50813567ffffffffffffffff8111156125bd57600080fd5b6020830191508360208285010111156125d557600080fd5b9250929050565b60008060008060008060008060c0898b0312156125f857600080fd5b61260189612577565b975061260f60208a01612577565b965061261d60408a01612577565b955060608901359450608089013567ffffffffffffffff8082111561264157600080fd5b61264d8c838d01612593565b909650945060a08b013591508082111561266657600080fd5b506126738b828c01612593565b999c989b5096995094979396929594505050565b6000806040838503121561269a57600080fd5b6126a383612577565b946020939093013593505050565b6000806000806000608086880312156126c957600080fd5b6126d286612577565b94506126e060208701612577565b935060408601359250606086013567ffffffffffffffff81111561270357600080fd5b61270f88828901612593565b969995985093965092949392505050565b60006020828403121561273257600080fd5b61132a82612577565b60006020828403121561274d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561279357612793612754565b604052919050565b600067ffffffffffffffff8211156127b5576127b5612754565b50601f01601f191660200190565b60006127d66127d18461279b565b61276a565b90508281528383830111156127ea57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261281257600080fd5b61132a838335602085016127c3565b60008060006060848603121561283657600080fd5b833567ffffffffffffffff81111561284d57600080fd5b61285986828701612801565b9350506020840135915061286f60408501612577565b90509250925092565b60008060006060848603121561288d57600080fd5b83359250602084013567ffffffffffffffff8111156128ab57600080fd5b6128b786828701612801565b92505061286f60408501612577565b6000806000606084860312156128db57600080fd5b6128e484612577565b925060208401359150604084013567ffffffffffffffff81111561290757600080fd5b8401601f8101861361291857600080fd5b612927868235602084016127c3565b9150509250925092565b60008060006060848603121561294657600080fd5b833592506020840135915061286f60408501612577565b60008060006060848603121561297257600080fd5b833567ffffffffffffffff8082111561298a57600080fd5b61299687838801612801565b945060208601359150808211156129ac57600080fd5b506128b786828701612801565b60008083601f8401126129cb57600080fd5b50813567ffffffffffffffff8111156129e357600080fd5b6020830191508360208260051b85010111156125d557600080fd5b60008060008060408587031215612a1457600080fd5b843567ffffffffffffffff80821115612a2c57600080fd5b612a38888389016129b9565b90965094506020870135915080821115612a5157600080fd5b50612a5e878288016129b9565b95989497509550505050565b634e487b7160e01b600052601160045260246000fd5b60008219821115612a9357612a93612a6a565b500190565b600060208284031215612aaa57600080fd5b5051919050565b60008060408385031215612ac457600080fd5b505080516020909101519092909150565b600060018201612ae757612ae7612a6a565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082821015612b3557612b35612a6a565b500390565b60005b83811015612b55578181015183820152602001612b3d565b838111156122275750506000910152565b600060208284031215612b7857600080fd5b815167ffffffffffffffff811115612b8f57600080fd5b8201601f81018413612ba057600080fd5b8051612bae6127d18261279b565b818152856020838501011115612bc357600080fd5b612bd4826020830160208601612b3a565b95945050505050565b6020808252602f908201527f486f70725374616b653a2050726f6772616d20656e6465642c2063616e6e6f7460408201526e1039ba30b5b29030b73cb6b7b9329760891b606082015260800190565b60008351612c3e818460208801612b3a565b602f60f81b9083019081528351612c5c816001840160208801612b3a565b01600101949350505050565b634e487b7160e01b600052603260045260246000fd5b6000816000190483118215151615612c9857612c98612a6a565b500290565b600082612cba57634e487b7160e01b600052601260045260246000fd5b500490565b80516020808301519190811015612ce0576000198160200360031b1b821691505b50919050565b600060208284031215612cf857600080fd5b8151801515811461132a57600080fd5b60008251612d1a818460208701612b3a565b9190910192915050565b6020815260008251806020840152612d43816040850160208701612b3a565b601f01601f1916919091016040019291505056fea26469706673582212205b397bfea0cd8b3d861713122f228a49f30a8fbf4e50c6d43e2d41da34d7b39d64736f6c634300080d00330000000000000000000000004ff4e61052a4dfb1be72866ab711ae08dd86197600000000000000000000000043d13d7b83607f14335cf2cb75e87da369d056c7000000000000000000000000d057604a14982fe8d88c5fc25aac3267ea142a0800000000000000000000000066225de86cac02b32f34992eb3410f59de416698
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106102265760003560e01c806381128c1d11610130578063cbffa3c7116100b8578063dde499791161007c578063dde4997914610586578063ef0526a214610599578063ef5cfb8c146105c0578063f2fde38b146105d3578063f978fff1146105e657600080fd5b8063cbffa3c714610506578063ce23177e1461052d578063d0c02d6314610540578063d0da680114610560578063d0f2dfa41461057357600080fd5b806399248ea7116100ff57806399248ea7146104b2578063a4c0ed36146104c5578063a5841194146104d8578063a69df4b5146104eb578063a83d1ed6146104f357600080fd5b806381128c1d146104505780638c24add41461047b5780638da5cb5b1461048e57806396a9cd7d1461049f57600080fd5b806356891412116101b35780635ef73d58116101825780635ef73d58146103ef5780636067bc15146103fb5780636aa8d4cf1461040e57806370af093414610435578063715018a61461044857600080fd5b806356891412146103575780635bbb63a6146103605780635e4c0e15146103875780635e5c06e21461039a57600080fd5b80631fda9a02116101fa5780631fda9a02146102ca57806321cf85ba146102f557806342c933611461030857806348c64e411461033b5780634ad84b341461034e57600080fd5b806223de291461022b5780630a1a257a14610240578063150b7a021461027e5780631f014d83146102aa575b600080fd5b61023e6102393660046125dc565b61060f565b005b61026b61024e366004612687565b600560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61029161028c3660046126b1565b6107bc565b6040516001600160e01b03199091168152602001610275565b61026b6102b8366004612720565b60086020526000908152604090205481565b6004546102dd906001600160a01b031681565b6040516001600160a01b039091168152602001610275565b61023e61030336600461273b565b610cd0565b61032b61031636600461273b565b60096020526000908152604090205460ff1681565b6040519015158152602001610275565b61023e610349366004612687565b610da3565b61026b600c5481565b61026b600b5481565b61026b7f0000000000000000000000000000000000000000000000000000000063d2795081565b61023e61039536600461273b565b610f21565b6103cf6103a8366004612720565b600a6020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610275565b61026b64e8d4a5100081565b61023e610409366004612720565b610fc5565b61026b7f000000000000000000000000000000000000000000000000000000000000018c81565b61026b610443366004612720565b611178565b61023e611189565b61026b61045e366004612687565b600760209081526000928352604080842090915290825290205481565b61032b610489366004612821565b6111bf565b6000546001600160a01b03166102dd565b61032b6104ad366004612878565b611331565b6003546102dd906001600160a01b031681565b61032b6104d33660046128c6565b61148e565b61023e6104e6366004612720565b6115cf565b61023e6115d8565b61032b610501366004612931565b6115e1565b61026b7f000000000000000000000000000000000000000000000000000000006449124081565b61032b61053b36600461295d565b611734565b61026b61054e366004612720565b60066020526000908152604090205481565b6002546102dd906001600160a01b031681565b61023e6105813660046129fe565b61184e565b61023e610594366004612720565b611a50565b61026b7f0000000000000000000000000000000000000000000034f086f3b33b6840000081565b61023e6105ce366004612720565b611a59565b61023e6105e1366004612720565b611a6b565b61026b6105f4366004612720565b6001600160a01b03166000908152600a602052604090205490565b6003546001600160a01b0316331461067d5760405162461bcd60e51b815260206004820152602660248201527f486f70725374616b653a2053656e646572206d757374206265207778484f5052604482015265103a37b5b2b760d11b60648201526084015b60405180910390fd5b6001600160a01b03861630146106fb5760405162461bcd60e51b815260206004820152603760248201527f486f70725374616b653a204d7573742062652073656e64696e6720746f6b656e60448201527f7320746f20486f70725374616b6520636f6e74726163740000000000000000006064820152608401610674565b6000546001600160a01b038881169116146107705760405162461bcd60e51b815260206004820152602f60248201527f486f70725374616b653a204f6e6c7920616363657074206f776e657220746f2060448201526e70726f76696465207265776172647360881b6064820152608401610674565b84600c60008282546107829190612a80565b909155505060405185907f2bf52bcae319602514e02ff69bbe4b89a19718b96e7867044128ec872419437c90600090a25050505050505050565b6004546000906001600160a01b0316336001600160a01b0316146108485760405162461bcd60e51b815260206004820152603f60248201527f486f70725374616b653a2043616e6e6f7420536166655472616e73666572467260448201527f6f6d20746f6b656e73206f74686572207468616e20486f7072426f6f73742e006064820152608401610674565b7f00000000000000000000000000000000000000000000000000000000644912404211156108d05760405162461bcd60e51b815260206004820152602f60248201527f486f70725374616b653a2050726f6772616d20656e6465642c2063616e6e6f7460448201526e103932b232b2b6903137b7b9ba399760891b6064820152608401610674565b6108d985611b03565b6001600160a01b0385166000818152600560209081526040808320600680845282852080548652918452918420899055938352905281546001929190610920908490612a80565b90915550506004805460405163562317c560e01b81529182018690526000916001600160a01b039091169063562317c590602401602060405180830381865afa158015610971573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109959190612a98565b6004805460405163225b377d60e21b81529182018890529192506000916001600160a01b03169063896cddf4906024016040805180830381865afa1580156109e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a059190612ab1565b5060008381526009602052604090205490915060ff1615610a825760405162461bcd60e51b815260206004820152603160248201527f486f70725374616b653a2043616e206f6e6c792072656465656d204e4654732060448201527037b31030b63637bbb2b2103a3cb832b99760791b6064820152608401610674565b6001600160a01b038716600090815260086020526040812054905b81811015610c33576001600160a01b0389811660009081526007602090815260408083208584529091528082205460048054925163562317c560e01b81529081018290529093919091169063562317c590602401602060405180830381865afa158015610b0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b329190612a98565b6004805460405163225b377d60e21b81529182018590529192506000916001600160a01b03169063896cddf4906024016040805180830381865afa158015610b7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba29190612ab1565b509050868203610c1d5785811015610bdb576001600160a01b038c16600090815260076020908152604080832087845290915290208b90555b604051868210908c906001600160a01b038f16907f066d96cb280fccf3a0a3a5686966a801b2690a32ec98fd2711a4e09f345d935d90600090a4505050610c33565b5050508080610c2b90612ad5565b915050610a9d565b818103610cba576001600160a01b038916600081815260076020908152604080832086845282528083208c905592825260089052908120805460019290610c7b908490612a80565b909155505060405160019089906001600160a01b038c16907f066d96cb280fccf3a0a3a5686966a801b2690a32ec98fd2711a4e09f345d935d90600090a45b50630a85bd0160e11b9998505050505050505050565b6000546001600160a01b03163314610cfa5760405162461bcd60e51b815260040161067490612aee565b60008181526009602052604090205460ff16610d635760405162461bcd60e51b815260206004820152602260248201527f486f70725374616b653a204e46542074797065206973206e6f7420626c6f636b604482015261195960f21b6064820152608401610674565b600081815260096020526040808220805460ff191690555182917ff78f7266ab985ddb2782b52fc236b9d2f22ff251a37a336a296ed4b188f7a92691a250565b6000546001600160a01b03163314610dcd5760405162461bcd60e51b815260040161067490612aee565b600260015403610e1f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610674565b60026001556004546001600160a01b0390811690831603610e905760405162461bcd60e51b815260206004820152602560248201527f486f70725374616b653a2043616e6e6f7420636c61696d20486f7072426f6f736044820152641d0813919560da1b6064820152608401610674565b816001600160a01b03166323b872dd30610eb26000546001600160a01b031690565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b158015610f0157600080fd5b505af1158015610f15573d6000803e3d6000fd5b50506001805550505050565b6000546001600160a01b03163314610f4b5760405162461bcd60e51b815260040161067490612aee565b60008181526009602052604090205460ff1615610fb95760405162461bcd60e51b815260206004820152602660248201527f486f70725374616b653a204e4654207479706520697320616c726561647920626044820152651b1bd8dad95960d21b6064820152608401610674565b610fc281611b8e565b50565b6000546001600160a01b03163314610fef5760405162461bcd60e51b815260040161067490612aee565b6002600154036110415760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610674565b60026001819055546000906001600160a01b03908116908316036110df57600b546002546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156110aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ce9190612a98565b6110d89190612b23565b905061114a565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015611123573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111479190612a98565b90505b61117061115f6000546001600160a01b031690565b6001600160a01b0384169083611bd1565b505060018055565b600061118382611c39565b92915050565b6000546001600160a01b031633146111b35760405162461bcd60e51b815260040161067490612aee565b6111bd6000611efc565b565b6000805b6001600160a01b038316600090815260066020526040902054811015611324576001600160a01b0383811660009081526005602090815260408083208584529091528082205460048054925163225b377d60e21b81529081018290529093919091169063896cddf4906024016040805180830381865afa15801561124b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126f9190612ab1565b50875160208901206004805460405163c588ff8b60e01b815291820186905292935090916001600160a01b03169063c588ff8b90602401600060405180830381865afa1580156112c3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112eb9190810190612b66565b805190602001201480156112fe57508086145b1561130f576001935050505061132a565b5050808061131c90612ad5565b9150506111c3565b50600090505b9392505050565b6000805b6001600160a01b038316600090815260066020526040902054811015611324576001600160a01b0383811660009081526005602090815260408083208584529091528082205460048054925163c87b56dd60e01b81529081018290529093919091169063c87b56dd90602401600060405180830381865afa1580156113be573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113e69190810190612b66565b6004805460405163562317c560e01b815291820185905291925088916001600160a01b03169063562317c590602401602060405180830381865afa158015611432573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114569190612a98565b14801561146857506114688187611f4c565b15611479576001935050505061132a565b5050808061148690612ad5565b915050611335565b6002546000906001600160a01b031633146115005760405162461bcd60e51b815260206004820152602c60248201527f486f70725374616b653a204f6e6c7920616363657074204c4f434b5f544f4b4560448201526b4e20696e207374616b696e6760a01b6064820152608401610674565b7f00000000000000000000000000000000000000000000000000000000644912404211156115405760405162461bcd60e51b815260040161067490612bdd565b61154984611b03565b6001600160a01b0384166000908152600a602052604081208054859290611571908490612a80565b9250508190555082600b600082825461158a9190612a80565b909155505060405183906001600160a01b038616907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90600090a35060019392505050565b610fc281611b03565b6111bd33611ff5565b6000805b6001600160a01b038316600090815260066020526040902054811015611324576001600160a01b0383811660009081526005602090815260408083208584529091528082205460048054925163225b377d60e21b81529081018290529093919091169063896cddf4906024016040805180830381865afa15801561166d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116919190612ab1565b506004805460405163562317c560e01b815291820185905291925088916001600160a01b03169063562317c590602401602060405180830381865afa1580156116de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117029190612a98565b14801561170e57508086145b1561171f576001935050505061132a565b5050808061172c90612ad5565b9150506115e5565b600080848460405160200161174a929190612c2c565b604051602081830303815290604052905060005b6001600160a01b038416600090815260066020526040902054811015611842576001600160a01b0384811660009081526005602090815260408083208584529091528082205460048054925163c87b56dd60e01b81529081018290529093919091169063c87b56dd90602401600060405180830381865afa1580156117e7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261180f9190810190612b66565b905061181b8185611f4c565b1561182d57600194505050505061132a565b5050808061183a90612ad5565b91505061175e565b50600095945050505050565b6000546001600160a01b031633146118785760405162461bcd60e51b815260040161067490612aee565b7f00000000000000000000000000000000000000000000000000000000644912404211156118b85760405162461bcd60e51b815260040161067490612bdd565b82811461192d5760405162461bcd60e51b815260206004820152603960248201527f486f70725374616b653a206163636f756e747320616e64207374616b6573206160448201527f72726179206c656e6774687320646f206e6f74206d61746368000000000000006064820152608401610674565b60008080805b86811015611a0b5787878281811061194d5761194d612c68565b90506020020160208101906119629190612720565b925085858281811061197657611976612c68565b90506020020135915061198883611b03565b6001600160a01b0383166000908152600a6020526040812080548492906119b0908490612a80565b909155506119c090508285612a80565b935081836001600160a01b03167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d60405160405180910390a380611a0381612ad5565b915050611933565b5082600b6000828254611a1e9190612a80565b9091555050600054611a47906001600160a01b03166002546001600160a01b03169030866121ef565b50505050505050565b610fc281611ff5565b611a6281611b03565b610fc28161222d565b6000546001600160a01b03163314611a955760405162461bcd60e51b815260040161067490612aee565b6001600160a01b038116611afa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610674565b610fc281611efc565b6000611b0e82611c39565b6001600160a01b0383166000908152600a6020526040812060020180549293508392909190611b3e908490612a80565b90915550506001600160a01b0382166000818152600a602052604080822042600190910155518392917f99869d968ca3581a661f31abb3a6aa70ccec5cdc49855eab174cf9e00a2462db91a35050565b600081815260096020526040808220805460ff191660011790555182917f620d09c7c7f3c5c41d8b5ea7f274622ddd6ac6b801f035fc741205d113199c0c91a250565b6040516001600160a01b038316602482015260448101829052611c3490849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612374565b505050565b6001600160a01b0381166000908152600a602090815260408083208151608081018352815481526001820154938101939093526002810154918301919091526003015460608201527f0000000000000000000000000000000000000000000000000000000063d2795042111580611cd457507f0000000000000000000000000000000000000000000000000000000064491240816020015110155b15611ce25750600092915050565b8051600090611d12907f000000000000000000000000000000000000000000000000000000000000018c90612c7e565b905060005b6001600160a01b038516600090815260086020526040902054811015611e20576001600160a01b0385811660009081526007602090815260408083208584529091528082205460048054925163225b377d60e21b81529081018290529093919091169063896cddf4906024016040805180830381865afa158015611d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc39190612ab1565b5085519091508190611df5907f0000000000000000000000000000000000000000000034f086f3b33b68400000612446565b611dff9190612c7e565b611e099085612a80565b935050508080611e1890612ad5565b915050611d17565b5064e8d4a51000611e887f0000000000000000000000000000000000000000000000000000000064491240611e827f0000000000000000000000000000000000000000000000000000000063d27950866020015161245c90919063ffffffff16565b90612446565b611ed67f0000000000000000000000000000000000000000000000000000000064491240611e82427f0000000000000000000000000000000000000000000000000000000063d2795061245c565b611ee09190612b23565b611eea9083612c7e565b611ef49190612c9d565b949350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051825160009184918491908490611f65908390612b23565b9050600084611f75600184612b23565b81518110611f8557611f85612c68565b01602001516001600160f81b0319169050602f60f81b8114611faf57600095505050505050611183565b6000611fbc846020612b23565b611fc7906008612c7e565b9050600080611fd587612cbf565b979094016020015196821c9690911c959095149550505050505092915050565b7f000000000000000000000000000000000000000000000000000000006449124042116120805760405162461bcd60e51b815260206004820152603360248201527f486f70725374616b653a2050726f6772616d206973206f6e676f696e672c206360448201527230b73737ba103ab73637b1b59039ba30b5b29760691b6064820152608401610674565b6001600160a01b0381166000908152600a60205260409020546120a282611b03565b6001600160a01b0382166000908152600a60205260408120819055600b80548392906120cf908490612b23565b909155506120de90508261222d565b6002546120f5906001600160a01b03168383611bd1565b60005b6001600160a01b0383166000908152600660205260409020548110156121b457600480546001600160a01b038581166000818152600560209081526040808320888452909152908190205490516323b872dd60e01b815230958101959095526024850191909152604484015216906323b872dd90606401600060405180830381600087803b15801561218957600080fd5b505af115801561219d573d6000803e3d6000fd5b5050505080806121ac90612ad5565b9150506120f8565b5060405181906001600160a01b038416907fb21fb52d5749b80f3182f8c6992236b5e5576681880914484d7f4c9b062e619e90600090a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526122279085906323b872dd60e01b90608401611bfd565b50505050565b6001600160a01b0381166000908152600a602090815260408083208151608081018352815481526001820154938101939093526002810154918301829052600301546060830181905291929161228291612b23565b90508015611c34576001600160a01b0383166000908152600a602052604090206002810154600390910155600c5481111561230b5760405162461bcd60e51b8152602060048201526024808201527f486f70725374616b653a20496e73756666696369656e7420726577617264207060448201526337b7b61760e11b6064820152608401610674565b80600c600082825461231d9190612b23565b9091555050600354612339906001600160a01b03168483611bd1565b60405181906001600160a01b038516907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a90600090a3505050565b60006123c9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661246c9092919063ffffffff16565b805190915015611c3457808060200190518101906123e79190612ce6565b611c345760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610674565b6000818310612455578161132a565b5090919050565b600081831015612455578161132a565b6060611ef4848460008585843b6124c55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610674565b600080866001600160a01b031685876040516124e19190612d08565b60006040518083038185875af1925050503d806000811461251e576040519150601f19603f3d011682016040523d82523d6000602084013e612523565b606091505b509150915061253382828661253e565b979650505050505050565b6060831561254d57508161132a565b82511561255d5782518084602001fd5b8160405162461bcd60e51b81526004016106749190612d24565b80356001600160a01b038116811461258e57600080fd5b919050565b60008083601f8401126125a557600080fd5b50813567ffffffffffffffff8111156125bd57600080fd5b6020830191508360208285010111156125d557600080fd5b9250929050565b60008060008060008060008060c0898b0312156125f857600080fd5b61260189612577565b975061260f60208a01612577565b965061261d60408a01612577565b955060608901359450608089013567ffffffffffffffff8082111561264157600080fd5b61264d8c838d01612593565b909650945060a08b013591508082111561266657600080fd5b506126738b828c01612593565b999c989b5096995094979396929594505050565b6000806040838503121561269a57600080fd5b6126a383612577565b946020939093013593505050565b6000806000806000608086880312156126c957600080fd5b6126d286612577565b94506126e060208701612577565b935060408601359250606086013567ffffffffffffffff81111561270357600080fd5b61270f88828901612593565b969995985093965092949392505050565b60006020828403121561273257600080fd5b61132a82612577565b60006020828403121561274d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561279357612793612754565b604052919050565b600067ffffffffffffffff8211156127b5576127b5612754565b50601f01601f191660200190565b60006127d66127d18461279b565b61276a565b90508281528383830111156127ea57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261281257600080fd5b61132a838335602085016127c3565b60008060006060848603121561283657600080fd5b833567ffffffffffffffff81111561284d57600080fd5b61285986828701612801565b9350506020840135915061286f60408501612577565b90509250925092565b60008060006060848603121561288d57600080fd5b83359250602084013567ffffffffffffffff8111156128ab57600080fd5b6128b786828701612801565b92505061286f60408501612577565b6000806000606084860312156128db57600080fd5b6128e484612577565b925060208401359150604084013567ffffffffffffffff81111561290757600080fd5b8401601f8101861361291857600080fd5b612927868235602084016127c3565b9150509250925092565b60008060006060848603121561294657600080fd5b833592506020840135915061286f60408501612577565b60008060006060848603121561297257600080fd5b833567ffffffffffffffff8082111561298a57600080fd5b61299687838801612801565b945060208601359150808211156129ac57600080fd5b506128b786828701612801565b60008083601f8401126129cb57600080fd5b50813567ffffffffffffffff8111156129e357600080fd5b6020830191508360208260051b85010111156125d557600080fd5b60008060008060408587031215612a1457600080fd5b843567ffffffffffffffff80821115612a2c57600080fd5b612a38888389016129b9565b90965094506020870135915080821115612a5157600080fd5b50612a5e878288016129b9565b95989497509550505050565b634e487b7160e01b600052601160045260246000fd5b60008219821115612a9357612a93612a6a565b500190565b600060208284031215612aaa57600080fd5b5051919050565b60008060408385031215612ac457600080fd5b505080516020909101519092909150565b600060018201612ae757612ae7612a6a565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082821015612b3557612b35612a6a565b500390565b60005b83811015612b55578181015183820152602001612b3d565b838111156122275750506000910152565b600060208284031215612b7857600080fd5b815167ffffffffffffffff811115612b8f57600080fd5b8201601f81018413612ba057600080fd5b8051612bae6127d18261279b565b818152856020838501011115612bc357600080fd5b612bd4826020830160208601612b3a565b95945050505050565b6020808252602f908201527f486f70725374616b653a2050726f6772616d20656e6465642c2063616e6e6f7460408201526e1039ba30b5b29030b73cb6b7b9329760891b606082015260800190565b60008351612c3e818460208801612b3a565b602f60f81b9083019081528351612c5c816001840160208801612b3a565b01600101949350505050565b634e487b7160e01b600052603260045260246000fd5b6000816000190483118215151615612c9857612c98612a6a565b500290565b600082612cba57634e487b7160e01b600052601260045260246000fd5b500490565b80516020808301519190811015612ce0576000198160200360031b1b821691505b50919050565b600060208284031215612cf857600080fd5b8151801515811461132a57600080fd5b60008251612d1a818460208701612b3a565b9190910192915050565b6020815260008251806020840152612d43816040850160208701612b3a565b601f01601f1916919091016040019291505056fea26469706673582212205b397bfea0cd8b3d861713122f228a49f30a8fbf4e50c6d43e2d41da34d7b39d64736f6c634300080d0033
External libraries
BoostUtilsLib : 0x8197525557233031b110038Ae52dfC3C4A75567A