Contract Overview
Balance:
0 MATIC
My Name Tag:
Not Available
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0xa35529a9fed4d0b6fd29aa0baee2bee671fc4365ccafd1f43b4845df91d13b42 | Stake Team | 33637950 | 73 days 9 hrs ago | 0xc39e79e490ba541b4f7fbfb81fbadd0c5efe4095 | IN | 0xe91f0aa9384f877f7dd0eb8bea90c5b7f4bc1b20 | 0 MATIC | 0.000603346506 | |
0xda22163ffd4e5c9cc0c8f2c8bbf362164cdec50de15efd9cb4c84d24468fb65e | Set Grades Bonus | 33637934 | 73 days 9 hrs ago | 0xc39e79e490ba541b4f7fbfb81fbadd0c5efe4095 | IN | 0xe91f0aa9384f877f7dd0eb8bea90c5b7f4bc1b20 | 0 MATIC | 0.000092438062 | |
0x0f35d7408708477a9fefffe1c3c716ef05ac3258809a7247d2e21d875ee010ec | Set Add Momo Gra... | 33637919 | 73 days 9 hrs ago | 0xc39e79e490ba541b4f7fbfb81fbadd0c5efe4095 | IN | 0xe91f0aa9384f877f7dd0eb8bea90c5b7f4bc1b20 | 0 MATIC | 0.000382658747 | |
0xe4bc44ec4d80d5b1c5d624c4f8022fe87fbd60a5f862734df15bad977889a4a1 | 0x60806040 | 33637902 | 73 days 9 hrs ago | 0xc39e79e490ba541b4f7fbfb81fbadd0c5efe4095 | IN | Create: TMHCRebornStakeR6 | 0 MATIC | 0.007573902749 |
[ Download CSV Export ]
Contract Source Code Verified (Exact Match)
Contract Name:
TMHCRebornStakeR6
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (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() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.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)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (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`. * * 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; /** * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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 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 the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// 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); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./interface/IPermissions.sol"; import "../lib/TWStrings.sol"; /** * @title Permissions * @dev This contracts provides extending-contracts with role-based access control mechanisms */ contract Permissions is IPermissions { /// @dev Map from keccak256 hash of a role => a map from address => whether address has role. mapping(bytes32 => mapping(address => bool)) private _hasRole; /// @dev Map from keccak256 hash of a role to role admin. See {getRoleAdmin}. mapping(bytes32 => bytes32) private _getRoleAdmin; /// @dev Default admin role for all roles. Only accounts with this role can grant/revoke other roles. bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @dev Modifier that checks if an account has the specified role; reverts otherwise. modifier onlyRole(bytes32 role) { _checkRole(role, msg.sender); _; } /** * @notice Checks whether an account has a particular role. * @dev Returns `true` if `account` has been granted `role`. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account for which the role is being checked. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _hasRole[role][account]; } /** * @notice Checks whether an account has a particular role; * role restrictions can be swtiched on and off. * * @dev Returns `true` if `account` has been granted `role`. * Role restrictions can be swtiched on and off: * - If address(0) has ROLE, then the ROLE restrictions * don't apply. * - If address(0) does not have ROLE, then the ROLE * restrictions will apply. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account for which the role is being checked. */ function hasRoleWithSwitch(bytes32 role, address account) public view returns (bool) { if (!_hasRole[role][address(0)]) { return _hasRole[role][account]; } return true; } /** * @notice Returns the admin role that controls the specified role. * @dev See {grantRole} and {revokeRole}. * To change a role's admin, use {_setRoleAdmin}. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") */ function getRoleAdmin(bytes32 role) external view override returns (bytes32) { return _getRoleAdmin[role]; } /** * @notice Grants a role to an account, if not previously granted. * @dev Caller must have admin role for the `role`. * Emits {RoleGranted Event}. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account to which the role is being granted. */ function grantRole(bytes32 role, address account) public virtual override { _checkRole(_getRoleAdmin[role], msg.sender); if (_hasRole[role][account]) { revert("Can only grant to non holders"); } _setupRole(role, account); } /** * @notice Revokes role from an account. * @dev Caller must have admin role for the `role`. * Emits {RoleRevoked Event}. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account from which the role is being revoked. */ function revokeRole(bytes32 role, address account) public virtual override { _checkRole(_getRoleAdmin[role], msg.sender); _revokeRole(role, account); } /** * @notice Revokes role from the account. * @dev Caller must have the `role`, with caller being the same as `account`. * Emits {RoleRevoked Event}. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account from which the role is being revoked. */ function renounceRole(bytes32 role, address account) public virtual override { if (msg.sender != account) { revert("Can only renounce for self"); } _revokeRole(role, account); } /// @dev Sets `adminRole` as `role`'s admin role. function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = _getRoleAdmin[role]; _getRoleAdmin[role] = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /// @dev Sets up `role` for `account` function _setupRole(bytes32 role, address account) internal virtual { _hasRole[role][account] = true; emit RoleGranted(role, account, msg.sender); } /// @dev Revokes `role` from `account` function _revokeRole(bytes32 role, address account) internal virtual { _checkRole(role, account); delete _hasRole[role][account]; emit RoleRevoked(role, account, msg.sender); } /// @dev Checks `role` for `account`. Reverts with a message including the required role. function _checkRole(bytes32 role, address account) internal view virtual { if (!_hasRole[role][account]) { revert( string( abi.encodePacked( "Permissions: account ", TWStrings.toHexString(uint160(account), 20), " is missing role ", TWStrings.toHexString(uint256(role), 32) ) ) ); } } /// @dev Checks `role` for `account`. Reverts with a message including the required role. function _checkRoleWithSwitch(bytes32 role, address account) internal view virtual { if (!hasRoleWithSwitch(role, account)) { revert( string( abi.encodePacked( "Permissions: account ", TWStrings.toHexString(uint160(account), 20), " is missing role ", TWStrings.toHexString(uint256(role), 32) ) ) ); } } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./interface/IPermissionsEnumerable.sol"; import "./Permissions.sol"; /** * @title PermissionsEnumerable * @dev This contracts provides extending-contracts with role-based access control mechanisms. * Also provides interfaces to view all members with a given role, and total count of members. */ contract PermissionsEnumerable is IPermissionsEnumerable, Permissions { /** * @notice A data structure to store data of members for a given role. * * @param index Current index in the list of accounts that have a role. * @param members map from index => address of account that has a role * @param indexOf map from address => index which the account has. */ struct RoleMembers { uint256 index; mapping(uint256 => address) members; mapping(address => uint256) indexOf; } /// @dev map from keccak256 hash of a role to its members' data. See {RoleMembers}. mapping(bytes32 => RoleMembers) private roleMembers; /** * @notice Returns the role-member from a list of members for a role, * at a given index. * @dev Returns `member` who has `role`, at `index` of role-members list. * See struct {RoleMembers}, and mapping {roleMembers} * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param index Index in list of current members for the role. * * @return member Address of account that has `role` */ function getRoleMember(bytes32 role, uint256 index) external view override returns (address member) { uint256 currentIndex = roleMembers[role].index; uint256 check; for (uint256 i = 0; i < currentIndex; i += 1) { if (roleMembers[role].members[i] != address(0)) { if (check == index) { member = roleMembers[role].members[i]; return member; } check += 1; } else if (hasRole(role, address(0)) && i == roleMembers[role].indexOf[address(0)]) { check += 1; } } } /** * @notice Returns total number of accounts that have a role. * @dev Returns `count` of accounts that have `role`. * See struct {RoleMembers}, and mapping {roleMembers} * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * * @return count Total number of accounts that have `role` */ function getRoleMemberCount(bytes32 role) external view override returns (uint256 count) { uint256 currentIndex = roleMembers[role].index; for (uint256 i = 0; i < currentIndex; i += 1) { if (roleMembers[role].members[i] != address(0)) { count += 1; } } if (hasRole(role, address(0))) { count += 1; } } /// @dev Revokes `role` from `account`, and removes `account` from {roleMembers} /// See {_removeMember} function _revokeRole(bytes32 role, address account) internal override { super._revokeRole(role, account); _removeMember(role, account); } /// @dev Grants `role` to `account`, and adds `account` to {roleMembers} /// See {_addMember} function _setupRole(bytes32 role, address account) internal override { super._setupRole(role, account); _addMember(role, account); } /// @dev adds `account` to {roleMembers}, for `role` function _addMember(bytes32 role, address account) internal { uint256 idx = roleMembers[role].index; roleMembers[role].index += 1; roleMembers[role].members[idx] = account; roleMembers[role].indexOf[account] = idx; } /// @dev removes `account` from {roleMembers}, for `role` function _removeMember(bytes32 role, address account) internal { uint256 idx = roleMembers[role].indexOf[account]; delete roleMembers[role].members[idx]; delete roleMembers[role].indexOf[account]; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IPermissions { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./IPermissions.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IPermissionsEnumerable is IPermissions { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * [forum post](https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296) * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; /// @author thirdweb /** * @dev String operations. */ library TWStrings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: UNLICENSED /* *This code is subject to the Copyright License * Copyright (c) 2023 Sevenlinelabs * All rights reserved. */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@thirdweb-dev/contracts/extension/PermissionsEnumerable.sol"; import "./module/NTS-Multi.sol"; import "./module/NTS-UserManager.sol"; import "./module/RewardVault.sol"; contract TMHCRebornStakeR6 is PermissionsEnumerable, Initializable, ReentrancyGuard, NTStakeMulti{ // Staking pool onwer / admin address private owner; // Operation status of the Pool. bool public PauseStake; // Claim operation status of the Pool. bool public PauseClaim; /*/////////////////////////////////////////////////////////////// Constructor + initializer logic //////////////////////////////////////////////////////////////*/ constructor(IERC1155 _EditionToken, IERC721 _NFTtoken, NTSRewardVault _RewardVault, uint256 _rewardPerHour, address _owner) initializer { owner = _owner; _setupRole(DEFAULT_ADMIN_ROLE, _owner); tmhcToken = _EditionToken; momoToken = _NFTtoken; rewardVault = _RewardVault; rewardPerHour = _rewardPerHour; PauseStake = false; PauseClaim = false; } /*/////////////////////////////////////////////////////////////// Basic Staking Info //////////////////////////////////////////////////////////////*/ /** * @dev Returns an array of token IDs representing all the TMHC tokens staked by the caller. * @return stakedIds An array of token IDs representing all the staked TMHC tokens. */ function getStakedTMHC(address player) public view returns(uint16[] memory stakedIds){ return users[player].stakedtmhc; } /** * @dev Returns an array of token IDs representing all the MOMO tokens staked by the caller. * @return stakedIds An array of token IDs representing all the staked MOMO tokens. */ function getStakedMOMO(address player) public view returns(uint16[] memory stakedIds){ return users[player].stakedmomo; } /** * @dev Returns an array of token IDs representing all the team tokens staked by the caller. * @return stakedIds An array of token IDs representing all the staked team tokens. */ function getStakedTeam(address player) public view returns(uint16[] memory stakedIds){ return users[player].stakedteam; } /** * @dev Returns an array of boost IDs representing all the boosts for the specified team staked by the caller. * @param _staketeam The team ID whose boost IDs are being returned. * @return boostIds An array of boost IDs representing all the boosts for the specified team. */ function getBoostsRate(uint16 _staketeam) public view returns(uint16[] memory boostIds){ return inStakedteam[_staketeam].boostIds; } /*/////////////////////////////////////////////////////////////// Single Stake Interface //////////////////////////////////////////////////////////////*/ /** * @dev Stakes the specified tokens of the given token type for the caller. * @param _tokenType The type of the tokens to be staked (0 for TMHC, 1 for MOMO). * @param _tokenIds An array of token IDs to be staked. */ function stake(uint _tokenType, uint16[] calldata _tokenIds) external nonReentrant { require(!PauseStake, "Stacking pool is currently paused."); _stake(_tokenType, _tokenIds); } /** * @dev Claims the reward for the specified token of the given token type for the caller. * @param _tokenType The type of the token for which the reward is claimed (0 for TMHC, 1 for MOMO). * @param _tokenId The ID of the token for which the reward is claimed. */ function claim(uint _tokenType, uint16 _tokenId) external nonReentrant { require(!PauseClaim, "The claim is currently paused."); _claim(_tokenType, _tokenId); } /** * @dev Claims the rewards for all staked tokens of the caller. */ function claimAll() external nonReentrant { require(!PauseClaim, "The claim is currently paused."); _claimAll(); } /** * @dev Unstakes the specified tokens of the given token type for the caller. * @param _tokenType The type of the tokens to be unstaked (0 for TMHC, 1 for MOMO). * @param _tokenIds An array of token IDs to be unstaked. */ function unStake(uint _tokenType, uint16[] calldata _tokenIds) external nonReentrant { require(!PauseStake, "Stacking pool is currently paused."); _unStake(_tokenType, _tokenIds); } /** * @dev Calculates the reward for the specified token of the given token type for the caller. * @param _tokenType The type of the token for which the reward is to be calculated (0 for TMHC, 1 for MOMO). * @param _tokenId The ID of the token for which the reward is to be calculated. * @return _Reward The amount of reward for the specified token. */ function calReward(address player, uint _tokenType, uint16 _tokenId) external view returns(uint256 _Reward){ return _calReward(player, _tokenType, _tokenId); } /** * @dev Calculates the total reward for all staked tokens of the caller. * @return _totalReward The total reward amount for all staked tokens of the caller. */ function calRewardAll(address player) external view returns(uint256 _totalReward){ return _calRewardAll(player); } /*/////////////////////////////////////////////////////////////// Multi Stake Interface //////////////////////////////////////////////////////////////*/ /** * @dev Stakes the specified team leader and boosts for the caller. * @param _leaderId The ID of the team leader to be staked. * @param _boostIds An array of IDs of the boosts to be staked. */ function stakeTeam(uint16 _leaderId ,uint16[] calldata _boostIds) external nonReentrant{ require(!PauseStake, "Stacking pool is currently paused."); _stakeTeam(_leaderId, _boostIds); } /** * @dev Claims the reward for the specified team leader and all the boosts for the caller. * @param _leaderId The ID of the team leader for which the rewards are claimed. */ function claimTeam(uint16 _leaderId) external nonReentrant{ require(!PauseClaim, "The claim is currently paused."); _claimTeam(_leaderId); } /** * @dev Claims the rewards for all staked team leaders and their boosts for the caller. */ function calimTeamAll() external nonReentrant{ require(!PauseClaim, "The claim is currently paused."); _claimTeamAll(); } /** * @dev Unstakes the specified team leaders and boosts for the caller. * @param _leaderIds An array of IDs of the team leaders to be unstaked. */ function unStakeTeam(uint16[] calldata _leaderIds) external nonReentrant{ require(!PauseStake, "Stacking pool is currently paused."); _unStakeTeam(_leaderIds); } function refreshTeamAll() external nonReentrant{ _refreshAllTeam(); } /** * @dev Calculates the total reward for the specified staked team. * @param _staketeam The ID of the team for which the reward is to be calculated. * @return _TotalReward The total reward amount for the specified staked team. */ function calRewardTeam(address player, uint16 _staketeam) external view returns(uint256 _TotalReward){ return _calRewardTeam(player, _staketeam); } /** * @dev Calculates the total reward for all staked teams of the caller. * @return _TotalReward The total reward amount for all staked teams of the caller. */ function calRewardTeamAll(address player) external view returns (uint256 _TotalReward){ return _calRewardTeamAll(player); } /** * @dev Calculates the boost rate for the specified staked team. * @param _staketeam The ID of the team for which the boost rate is to be calculated. * @return _boostrate The boost rate for the specified staked team. */ function getTeamBoost(address player, uint16 _staketeam) external view returns(uint256 _boostrate){ return _getTeamBoost(player, _staketeam); } /*/////////////////////////////////////////////////////////////// Admin Function //////////////////////////////////////////////////////////////*/ /** * @dev Sets the MOMO grades to be used for calculating the bonus rate. * @param _momogrades An array of MOMO grades to be added to the existing grades. * Requirements: * - The function can only be called by an account with the DEFAULT_ADMIN_ROLE. */ function setAddMomoGrades(uint8[] calldata _momogrades) external onlyRole(DEFAULT_ADMIN_ROLE){ for(uint256 i = 0; i < _momogrades.length; i++){ momoGrades.push(_momogrades[i]); } } /** * @dev Sets the bonus rates for each token grade. * @param _gradesbonus An array of bonus rates for each token grade. * Requirements: * - The function can only be called by an account with the DEFAULT_ADMIN_ROLE. */ function setGradesBonus(uint8[10] calldata _gradesbonus) external onlyRole(DEFAULT_ADMIN_ROLE){ gradesBonus = _gradesbonus; } /** * @dev Sets the reward amount per hour for the stake. * @param _rewardPerHour The reward amount per hour. */ function setRewardPeHour(uint256 _rewardPerHour) external onlyRole(DEFAULT_ADMIN_ROLE){ rewardPerHour = _rewardPerHour; } /** * @dev Pauses the staking pool. * @param _status The status of the pause. */ function setPausePool(bool _status) external onlyRole(DEFAULT_ADMIN_ROLE){ PauseStake = _status; } /** * @dev Pauses the claim of rewards. * @param _status The status of the pause. */ function setPauseCalim(bool _status) external onlyRole(DEFAULT_ADMIN_ROLE){ PauseClaim = _status; } /*/////////////////////////////////////////////////////////////// View Function //////////////////////////////////////////////////////////////*/ /** * @dev Returns an array of all users who have interacted with the contract. * @return _userArray An array of addresses representing all the users who have interacted with the contract. */ function getUserArray() public view returns(address[] memory _userArray){ return usersArray; } /** * @dev Returns the count of all users who have interacted with the contract. * @return _userCount The count of all users who have interacted with the contract. */ function getUserCount() public view returns(uint256 _userCount){ return usersArray.length; } /** * @dev Returns the amount of claimed NTS tokens for the single staking pool. * @return _singleClaimed The amount of claimed NTS tokens for the single staking pool. */ function getSingleClaimed() public view returns(uint256 _singleClaimed){ return _getSingleClaimed(); } /** * @dev Returns the amount of unclaimed NTS tokens for the single staking pool. * @return _singleUnClaim The amount of unclaimed NTS tokens for the single staking pool. */ function getSingleUnClaim() public view returns(uint256 _singleUnClaim){ return _getSingleUnClaim(); } /** * @dev Returns the amount of claimed NTS tokens for the team staking pool. * @return _teamClaimed The amount of claimed NTS tokens for the team staking pool. */ function getTeamClaimed() public view returns(uint256 _teamClaimed){ return _getTeamClaimed(); } /** * @dev Returns the amount of unclaimed NTS tokens for the team staking pool. * @return _teamUnClaim The amount of unclaimed NTS tokens for the team staking pool. */ function getTeamUnClaim() public view returns(uint256 _teamUnClaim){ return _getTeamUnClaim(); } }
// SPDX-License-Identifier: UNLICENSED /* *This code is subject to the Copyright License * Copyright (c) 2023 Sevenlinelabs * All rights reserved. */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "./RewardVault.sol"; contract NTSBase { // Staking target ERC1155 NFT contract - TMHC IERC1155 public tmhcToken; // Staking target ERC721 NFT contract - MOMO IERC721 public momoToken; // Reward ERC20 Token contract NTSRewardVault public rewardVault; // Reward per each block (for eth, about 13~15 sec) uint256 public rewardPerHour; event Staked(address indexed user, uint tokenType, uint16 [] indexed tokenId); event unStaked(address indexed user, uint tokenType, uint16[] boostId); event RewardPaid(address indexed user, uint256 reward); }
// SPDX-License-Identifier: UNLICENSED /* *This code is subject to the Copyright License * Copyright (c) 2023 Sevenlinelabs * All rights reserved. */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./NTS-Single.sol"; import "./NTS-UserManager.sol"; import "./NTS-Base.sol"; contract NTStakeMulti is NTStakeSingle { // Event emitted when a user stakes their team. event StakedTeam(address indexed user, uint16 indexed leaderId, uint16[] boostId); // Event emitted when a user unstakes their team. event unStakedTeam(address indexed user, uint16 indexed leaderId); // Structure that represents a staked team. struct StakeTeam { address stakeowner; // Address of the team's stakeowner. uint16[] boostIds; // IDs of the team's boosts. uint256 lastUpdateBlock; // Block number of the last update to the team's stake. } // Array that stores all staked teams. StakeTeam[10000] public inStakedteam; // Array that stores all possible grades for the team. uint8[] public momoGrades; // Array that stores all grade bonuses for the team. uint8[10] public gradesBonus; uint256 internal teamStakeClaimed; /** * @dev Check if the player is the owner of the leader token. */ function chkLeaderOwner(address player, uint16 _leaderId) internal view returns (bool) { return tmhcToken.balanceOf(player, _leaderId) == 1; } /** * @dev Check if the player is the owner of the boost token. */ function chkBoostOwner(address player, uint16 _boostId) internal view returns (bool) { return momoToken.ownerOf(_boostId) == player; } /** * @dev Check if the player owns both the leader and boost tokens. */ function chkOwnerAll(address player, uint16 _leaderId, uint16[] memory _boostIds) internal view returns (bool){ if(chkLeaderOwner(player, _leaderId) == false){ return false;} for (uint16 i = 0; i < _boostIds.length; i++) { if(chkBoostOwner(player, _boostIds[i]) == false){ return false;} } return true; } function _getTeamBoost(address player, uint16 _staketeam) internal view returns (uint256 _boostRates) { uint16[] memory _boostIds = inStakedteam[_staketeam].boostIds; // Add bonus rewards for each boost owned by the team. for(uint16 i = 0; i < _boostIds.length; i++) { uint16 _boostId = _boostIds[i]; if(!chkBoostOwner(player, _boostId)) { _boostRates = 0; return _boostRates; } uint8 _boostGrade = momoGrades[_boostId]; uint8 _boostRate = gradesBonus[_boostGrade]; _boostRates = _boostRate; } return _boostRates; } /** * @dev Check if the player needs to refresh their staking status. */ function chkRefresh(address player, uint16 _staketeam) internal view returns (bool) { if(!chkLeaderOwner(player, _staketeam) && inStakedtmhc[_staketeam].stakeowner == player){ return true; } uint16[] memory _boostIds = inStakedteam[_staketeam].boostIds; for(uint16 i = 0; i < _boostIds.length; i++) { uint16 _boostId = _boostIds[i]; if(!chkBoostOwner(player, _boostId) && inStakedmomo[_boostId].stakeowner == player){ return true; } } return false; } /*/////////////////////////////////////////////////////////////// Team Stake / Rewards / unStake cycle //////////////////////////////////////////////////////////////*/ /** * @dev Stake a team by staking a leader NFT and booster NFTs. * @param _leaderId ID of the leader NFT to stake. * @param _boostIds Array of IDs of booster NFTs to stake. */ function _stakeTeam(uint16 _leaderId, uint16[] calldata _boostIds) public { require(chkOwnerAll(msg.sender, _leaderId, _boostIds), "Not NFT owner."); require(inStakedtmhc[_leaderId].stakeowner != msg.sender, "TMHC already staked."); require(_boostIds.length <= 5, "A maximum of 5 booster NFTs are available."); // Stake each booster NFT. for (uint16 i = 0; i < _boostIds.length; i++) { uint16 _boostId = _boostIds[i]; require(inStakedmomo[_boostId].stakeowner != msg.sender, "MOMO already staked."); inStakedmomo[_boostId].staketeam = _leaderId; inStakedmomo[_boostId].stakeowner = msg.sender; } // Stake the leader NFT. inStakedtmhc[_leaderId].staketeam = _leaderId; inStakedtmhc[_leaderId].stakeowner = msg.sender; // Add user to the user list. procAddUser(); // Add the staked team to the user's staked team list. users[msg.sender].stakedteam.push(_leaderId); // Add the staked team to the global staked team list. StakeTeam memory newTeam = StakeTeam(msg.sender, _boostIds, block.timestamp); inStakedteam[_leaderId] = newTeam; // Emit an event to indicate that a team has been staked. emit StakedTeam(msg.sender, _leaderId, _boostIds); } /** * @dev Calculates the reward for a staked team. * @param _staketeam The ID of the staked team to calculate the reward for. * @return _totalReward The calculated reward for the staked team. */ function _calRewardTeam(address player, uint16 _staketeam) internal view returns (uint256 _totalReward) { // If the sender is not the stakeowner of the team, return 0. if(!chkLeaderOwner(player, _staketeam)) { _totalReward=0; return _totalReward; } // Get the boost IDs and last update block for the staked team. uint256 _lastUpdateBlock = inStakedteam[_staketeam].lastUpdateBlock; // Calculate the base TMHC reward for the team. uint256 _tmhcReward = ((block.timestamp - _lastUpdateBlock) * rewardPerHour) / 3600; // Add bonus rewards for each boost owned by the team. uint256 _boostRate = _getTeamBoost(player, _staketeam); if(_boostRate == 0) { _totalReward=0; return _totalReward; } _boostRate = _boostRate / 100; _totalReward = _tmhcReward + (_tmhcReward * _boostRate); return _totalReward; } /** * @dev Calculates the total reward for all staked teams of the caller. * @return _TotalReward The total calculated reward for all staked teams of the caller. */ function _calRewardTeamAll(address player) internal view returns (uint256 _TotalReward) { // Get the IDs of all staked teams owned by the caller. uint16[] memory _myStakeTeam = users[player].stakedteam; uint256 _totalReward = 0; // Calculate the total reward for all owned staked teams. for(uint16 i = 0; i < _myStakeTeam.length; i++) { _totalReward = _totalReward + _calRewardTeam(player, _myStakeTeam[i]); } return _totalReward; } /** * @dev Unsets all boosts for a staked team when the team is unstaked. * @param _staketeam The ID of the staked team to unset boosts for. */ function _unsetAllBoost(uint16 _staketeam) internal { // Unset all boosts for the staked team. uint16[] memory _boostIds = inStakedteam[_staketeam].boostIds; for(uint16 i = 0; i < _boostIds.length; i++) { uint16 _boostId = _boostIds[i]; if(momoToken.ownerOf(_boostId) == msg.sender) { // If the caller is the owner of the boost, unset the boost's staked team. delete inStakedmomo[_boostId]; } } } function _refreshTeam(uint16 _staketeam) internal { if(chkRefresh(msg.sender, _staketeam)){ uint16[] memory _array = users[msg.sender].stakedteam; for(uint i = 0; i < _array.length; i++) { if(_array[i] == _staketeam) { users[msg.sender].stakedteam[i] = _array[_array.length - 1]; users[msg.sender].stakedteam.pop(); break; } } // If the caller has no staked teams, remove their stake from the users list. procDelUser(); }else{ return; } if(!chkLeaderOwner(msg.sender, _staketeam) && inStakedtmhc[_staketeam].stakeowner == msg.sender){ delete inStakedtmhc[_staketeam]; } uint16[] memory _boostIds = inStakedteam[_staketeam].boostIds; for(uint16 i = 0; i < _boostIds.length; i++) { uint16 _boostId = _boostIds[i]; if(!chkBoostOwner(msg.sender, _boostId) && inStakedmomo[_boostId].stakeowner == msg.sender){ delete inStakedmomo[_boostId]; } } } /** * @dev Refreshes all staked teams owned by the caller by verifying ownership and updating their boosts. */ function _refreshAllTeam() internal { // Get the IDs of all staked teams owned by the caller. uint16[] memory _myStakeTeam = users[msg.sender].stakedteam; // Refresh each staked team owned by the caller. for(uint16 i = 0; i < _myStakeTeam.length; i++) { _refreshTeam(_myStakeTeam[i]); } } /** * @dev Calculates the reward for the staked team with the given leader NFT ID, transfers the reward to the caller, updates the staked team's last update block, and emits a RewardPaid event. * @param _leaderId The ID of the staked team's leader NFT. */ function _claimTeam(uint16 _leaderId) internal { // Calculate the reward for the staked team. uint256 _myReward = _calRewardTeam(msg.sender, _leaderId); if(_myReward > 0){ // Transfer the reward to the caller. rewardVault.transferToken(msg.sender, _myReward); // Update the last update block for the staked team. inStakedteam[_leaderId].lastUpdateBlock = block.timestamp; // Emit a RewardPaid event to indicate that the reward has been paid. teamStakeClaimed = teamStakeClaimed + _myReward; emit RewardPaid(msg.sender, _myReward); } } /** * @dev Calculates the total reward for all staked teams owned by the caller, transfers the reward to the caller using the transferToken function of the ERC-20 reward token, updates the last update block for each staked team, and emits a RewardPaid event. */ function _claimTeamAll() internal { // claim for each staked team owned by the caller. uint16[] memory _myStakeTeam = users[msg.sender].stakedteam; for(uint16 i = 0; i < _myStakeTeam.length; i++) { _claimTeam(_myStakeTeam[i]); } } /** * @dev Unstakes the teams with the given leader NFT IDs owned by the caller, calculates the reward for each team, transfers the rewards to the caller, removes the staked teams and associated boosts from the caller's stakedteam array, and emits an unStakedTeam event for each team that was unstaked. * @param _leaderIds An array of leader NFT IDs corresponding to the staked teams to be unstaked. */ function _unStakeTeam(uint16[] calldata _leaderIds) internal { for(uint16 i = 0; i < _leaderIds.length; i++) { uint16 _leaderId = _leaderIds[i]; // Check that the caller is the owner of the TMHC NFT, is the owner of the staked team, and the TMHC NFT is on the staked team. require(tmhcToken.balanceOf(msg.sender, _leaderId) == 1, "not TMHC owner."); require(inStakedteam[_leaderId].stakeowner == msg.sender, "not Team owner."); require(inStakedtmhc[_leaderId].staketeam != 0 , "TMHC is not on the team."); // Delete TMHC data delete inStakedtmhc[_leaderId]; // Calculate the reward for the staked team. uint256 _myReward = _calRewardTeam(msg.sender, _leaderId); // Transfer the reward to the caller. rewardVault.transferToken(msg.sender, _myReward); // Emit a RewardPaid event to indicate that the reward has been paid. emit RewardPaid(msg.sender, _myReward); // Remove the staked team from the caller's stakedteam array. uint16[] memory _array = users[msg.sender].stakedteam; for (uint ii = 0; ii < _array.length; ii++) { if (_array[ii] == _leaderId) { users[msg.sender].stakedteam[ii] = _array[_array.length - 1]; users[msg.sender].stakedteam.pop(); break; } } // Unset all boosts associated with the staked team. _unsetAllBoost(_leaderId); // Delete the staked user from the user mapping if the user no longer has any staked teams. procDelUser(); // Emit an unStakedTeam event to indicate that the team has been unstaked. emit unStakedTeam(msg.sender, _leaderId); } } /** * @dev A function to get the total unclaimed rewards across all staking players. * @return _totalUnClaim The total amount of unclaimed rewards. */ function _getTeamUnClaim() internal view returns (uint256 _totalUnClaim) { address[] memory _usersArray = usersArray; for(uint256 i = 0; i < _usersArray.length; i++) { address _player = _usersArray[i]; _totalUnClaim = _totalUnClaim + _calRewardTeamAll(_player); } return _totalUnClaim; } /** * @dev Returns the total amount of rewards claimed for team staking. * @return _teamStakeClaimed The total amount of rewards claimed for team staking. */ function _getTeamClaimed() internal view returns(uint256 _teamStakeClaimed){ return teamStakeClaimed; } }
// SPDX-License-Identifier: UNLICENSED /* *This code is subject to the Copyright License * Copyright (c) 2023 Sevenlinelabs * All rights reserved. */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./NTS-UserManager.sol"; import "./NTS-Base.sol"; contract NTStakeSingle is NTSUserManager, NTSBase { // Stores staking information based on MOMO NFT ownership. struct StakeMOMO { address stakeowner; uint16 staketeam; uint256 lastUpdateBlock; } // Stores staking information based on TMHC NFT ownership. struct StakeTMHC { address stakeowner; uint16 staketeam; uint256 lastUpdateBlock; } // Arrays to store staking information for MOMO and TMHC NFTs respectively. StakeMOMO[10000] public inStakedmomo; StakeTMHC[10000] public inStakedtmhc; uint256 internal SingleStakeClaimed; /*/////////////////////////////////////////////////////////////// Single Stake / Rewards / unStake cycle //////////////////////////////////////////////////////////////*/ //Step1. Start single staking function _stake(uint _tokenType, uint16[] calldata _tokenIds) internal { // tokenType 0 is for TMHC, and 1 is for MOMO. require(_tokenType == 0 || _tokenType == 1, "Invalid tokentype."); if(_tokenType==0) { for (uint16 i = 0; i < _tokenIds.length; i++) { uint16 _tokenId = _tokenIds[i]; // TMHC // Check the ownership and the staking status of the token. require(tmhcToken.balanceOf(msg.sender, _tokenId) == 1, "not TMHC owner."); require(inStakedtmhc[_tokenId].staketeam == 0, "MOMO is part of the team."); require(inStakedtmhc[_tokenId].stakeowner != msg.sender, "TMHC already staked."); // Add the user to the system if they haven't staked before. procAddUser(); // Add the staking to the user's information. users[msg.sender].stakedtmhc.push(_tokenId); // Save the staking information. StakeTMHC memory _staketmhc = StakeTMHC(msg.sender, 0, block.timestamp); inStakedtmhc[_tokenId] = _staketmhc; } }else if(_tokenType==1){ for (uint16 i = 0; i < _tokenIds.length; i++) { uint16 _tokenId = _tokenIds[i]; // MOMO // Check the ownership and the staking status of the token. require(momoToken.ownerOf(_tokenId) == msg.sender, "not MOMO owner."); require(inStakedmomo[_tokenId].staketeam == 0, "MOMO is part of the team."); require(inStakedmomo[_tokenId].stakeowner != msg.sender, "MOMO already staked."); // Add the user to the system if they haven't staked before. procAddUser(); // Add the staking to the user's information. users[msg.sender].stakedmomo.push(_tokenId); // Save the staking information. StakeMOMO memory _stakemomo = StakeMOMO(msg.sender, 0, block.timestamp); inStakedmomo[_tokenId] = _stakemomo; } } emit Staked(msg.sender, _tokenType, _tokenIds); // Emit the staking event. } // Step2-1. Calculation reward /** * @dev Calculates the reward for a staked token. * @param _tokenType The type of the staked token (0 for TMHC, 1 for MOMO). * @param _tokenId The ID of the staked token. * @return _Reward The amount of reward for the staked token. */ function _calReward(address player, uint _tokenType, uint16 _tokenId) internal view returns (uint256 _Reward){ // The tokenType can be either 0 for TMHC or 1 for MOMO. uint256 _stakeTime = 0; if(_tokenType==0) { // TMHC // Check if the token is owned by the caller and if it is already staked. if(tmhcToken.balanceOf(player, _tokenId) == 1 && inStakedtmhc[_tokenId].stakeowner == player && inStakedtmhc[_tokenId].staketeam == 0){ // If the token is already staked, calculate the stake time. _stakeTime = _stakeTime + (block.timestamp - inStakedtmhc[_tokenId].lastUpdateBlock); }else{ // If the token is not owned by the caller or not staked, return 0 as the reward. return 0; } }else if(_tokenType==1){ // MOMO // Check if the token is owned by the caller and if it is already staked. if(momoToken.ownerOf(_tokenId) == player && inStakedmomo[_tokenId].stakeowner == player && inStakedmomo[_tokenId].staketeam == 0){ // If the token is already staked, calculate the stake time. _stakeTime = _stakeTime + (block.timestamp - inStakedmomo[_tokenId].lastUpdateBlock); }else{ // If the token is not owned by the caller or not staked, return 0 as the reward. return 0; } } // Calculate the reward based on the stake time and rewardPerHour. _Reward = ((_stakeTime * rewardPerHour) / 3600); return _Reward; } // Step2-2. Clculation rewalrd all stake /** * @dev Calculates the total reward for all staked tokens of the caller. * @return _totalReward The total reward amount for all staked tokens of the caller. */ function _calRewardAll(address player) internal view returns(uint256 _totalReward){ // Get the list of staked TMHC and MOMO tokens for the caller. uint16[] memory _sktaedtmhc = users[player].stakedtmhc; uint16[] memory _stakedmomo = users[player].stakedmomo; // Loop through all staked TMHC tokens and calculate the reward for each. for (uint16 i = 0; i < _sktaedtmhc.length; i++){ uint16 _tokenId = _sktaedtmhc[i]; _totalReward = _totalReward + _calReward(player, 0, _tokenId); } // Loop through all staked MOMO tokens and calculate the reward for each. for (uint16 i = 0; i < _stakedmomo.length; i++){ uint16 _tokenId = _stakedmomo[i]; _totalReward = _totalReward + _calReward(player, 1, _tokenId); } return _totalReward; } // Step3. Claim reward /** * @dev Claims the reward for a staked token and transfers it to the caller's address. * @param _tokenType The type of the staked token (0 for TMHC, 1 for MOMO). * @param _tokenId The ID of the staked token. */ function _claim(uint _tokenType, uint16 _tokenId) internal { // Calculate the reward for the staked token. uint256 _myReward = _calReward(msg.sender, _tokenType, _tokenId); if(_myReward > 0){ // Transfer the reward tokens to the caller using the transferToken function of the ERC-20 token. rewardVault.transferToken(msg.sender, _myReward); // Reset the last update block for the staked token. if(_tokenType==0){ inStakedtmhc[_tokenId].lastUpdateBlock = block.timestamp; }else if(_tokenType==1){ inStakedmomo[_tokenId].lastUpdateBlock = block.timestamp; } // Update the user's total rewards earned and store the reward payment information. users[msg.sender].rewardsEarned += _myReward; SingleStakeClaimed = SingleStakeClaimed + _myReward; // Emit an event to indicate that the reward has been paid. emit RewardPaid(msg.sender, _myReward); } } // Step4. Claim reward all stake /** * @dev Claims the rewards for all staked tokens of the caller and transfers them to the caller's address. */ function _claimAll() internal { // claim all staked tokens of the caller. uint16[] memory _stakedtmhc = users[msg.sender].stakedtmhc; uint16[] memory _stakedmomo = users[msg.sender].stakedmomo; for(uint16 i = 0; i < _stakedtmhc.length; i++) { _claim(0, _stakedtmhc[i]); } for(uint16 i = 0; i < _stakedmomo.length; i++) { _claim(1, _stakedmomo[i]); } } // Step5. unstake single staking /** * @dev Unstakes the specified tokens of the specified token type and transfers the rewards to the caller's address. * @param _tokenType The type of the tokens to unstake (0 for TMHC, 1 for MOMO). * @param _tokenIds An array of token IDs to unstake. */ function _unStake(uint _tokenType, uint16[] calldata _tokenIds) internal { require(_tokenType == 0 || _tokenType == 1, "Invalid tokentype."); // Token type 0 represents TMHC and 1 represents MOMO. if(_tokenType==0) { for (uint16 i = 0; i < _tokenIds.length; i++) { uint16 _tokenId = _tokenIds[i]; // TMHC // Check if the caller is the owner of the token and if the token is already staked. require(tmhcToken.balanceOf(msg.sender, _tokenId) == 1, "not TMHC owner."); require(inStakedtmhc[_tokenId].stakeowner == msg.sender, "TMHC not staked."); require(inStakedtmhc[_tokenId].staketeam == 0 , "TMHC is on the team."); // Claim the reward before unstaking the token. _claim(_tokenType, _tokenId); // Remove the staked token from the user's stakedtmhc array. uint16[] memory _array = users[msg.sender].stakedtmhc; for (uint ii = 0; ii < _array.length; ii++) { if (_array[ii] == _tokenId) { users[msg.sender].stakedtmhc[ii] = _array[_array.length - 1]; users[msg.sender].stakedtmhc.pop(); break; } } // Delete the staked token from the inStakedtmhc mapping. delete inStakedtmhc[_tokenId]; } }else if(_tokenType==1){ for (uint16 i = 0; i < _tokenIds.length; i++) { uint16 _tokenId = _tokenIds[i]; // MOMO // Check if the caller is the owner of the token and if the token is already staked. require(momoToken.ownerOf(_tokenId) == msg.sender, "not MOMO owner."); require(inStakedmomo[_tokenId].stakeowner == msg.sender, "MOMO not staked."); require(inStakedmomo[_tokenId].staketeam == 0 , "TMHC is on the team."); // Claim the reward before unstaking the token. _claim(_tokenType, _tokenId); // Remove the staked token from the user's stakedmomo array. uint16[] memory _array = users[msg.sender].stakedmomo; for (uint ii = 0; ii < _array.length; ii++) { if (_array[ii] == _tokenId) { users[msg.sender].stakedmomo[ii] = _array[_array.length - 1]; users[msg.sender].stakedmomo.pop(); break; } } // Delete the staked token from the inStakedmomo mapping. delete inStakedmomo[_tokenId]; } }else{ revert("Invalid tokentype."); } // Delete the user from the users mapping if they have no staked tokens. procDelUser(); // Emit an event to indicate that the tokens have been unstaked. emit unStaked(msg.sender, _tokenType, _tokenIds); } /** * @dev A function to get the total unclaimed rewards across all staking players. * @return _totalUnClaim The total amount of unclaimed rewards. */ function _getSingleUnClaim() internal view returns (uint256 _totalUnClaim) { address[] memory _usersArray = usersArray; for(uint256 i = 0; i < _usersArray.length; i++) { address _player = _usersArray[i]; _totalUnClaim = _totalUnClaim + _calRewardAll(_player); } return _totalUnClaim; } /** * @dev Returns the total amount of rewards claimed for single staking. * @return _SingleStakeClaimed The total amount of rewards claimed for single staking. */ function _getSingleClaimed() internal view returns(uint256 _SingleStakeClaimed){ return SingleStakeClaimed; } }
// SPDX-License-Identifier: UNLICENSED /* *This code is subject to the Copyright License * Copyright (c) 2023 Sevenlinelabs * All rights reserved. */ pragma solidity ^0.8.17; contract NTSUserManager { struct StakeUser{ uint256 rewardsEarned; uint16[] stakedteam; uint16[] stakedtmhc; uint16[] stakedmomo; } // Staking user array for cms. address[] public usersArray; mapping(address=>StakeUser) public users; /*/////////////////////////////////////////////////////////////// Internal Function //////////////////////////////////////////////////////////////*/ /** * @dev Adds the caller's address to the usersArray if they have no staked tokens. */ function procAddUser() internal { if(users[msg.sender].stakedtmhc.length == 0 && users[msg.sender].stakedmomo.length == 0 && users[msg.sender].stakedteam.length ==0){ usersArray.push(msg.sender); } } /** * @dev Deletes the caller's address from the usersArray if they have no staked tokens. */ function procDelUser() internal { if(users[msg.sender].stakedtmhc.length == 0 && users[msg.sender].stakedmomo.length == 0 && users[msg.sender].stakedteam.length ==0){ address[] memory _userArray = usersArray; for(uint256 i = 0; i <_userArray.length; i++){ if(_userArray[i] == msg.sender){ usersArray[i] = _userArray[_userArray.length-1]; usersArray.pop(); } } } } }
// SPDX-License-Identifier: UNLICENSED /* *This code is subject to the Copyright License * Copyright (c) 2023 Sevenlinelabs * All rights reserved. */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@thirdweb-dev/contracts/extension/PermissionsEnumerable.sol"; /** * @title NTSRewardVault * @dev Contract to manage the rewards tokens accepted and transferred in the system. */ contract NTSRewardVault is PermissionsEnumerable { using SafeERC20 for IERC20; IERC20 private _acceptedToken; /** * @dev Initializes the contract by setting the acceptedToken and granting the DEFAULT_ADMIN_ROLE to the deployer. * @param acceptedToken The token that will be accepted and transferred as reward. */ constructor(IERC20 acceptedToken) { _acceptedToken = acceptedToken; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); } /** * @dev Allows anyone to deposit tokens into the contract as a reward. * @param amount The amount of tokens to be transferred. */ function receiveToken(uint256 amount) external { _acceptedToken.safeTransferFrom(msg.sender, address(this), amount); } /** * @dev Allows the DEFAULT_ADMIN_ROLE to transfer tokens as rewards to a recipient. * @param recipient The address to which the tokens will be transferred. * @param amount The amount of tokens to be transferred. */ function transferToken(address recipient, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE){ _acceptedToken.safeTransfer(recipient, amount); } /** * @dev Returns the balance of the acceptedToken held in the contract. * @return The balance of the acceptedToken. */ function getTokenBalance() public view returns (uint256) { return _acceptedToken.balanceOf(address(this)); } /** * @dev Allows the DEFAULT_ADMIN_ROLE to set a new address to the DEFAULT_ADMIN_ROLE. * @param _address The address to which the DEFAULT_ADMIN_ROLE will be granted. */ function setRole(address _address) external onlyRole(DEFAULT_ADMIN_ROLE){ _setupRole(DEFAULT_ADMIN_ROLE, _address); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
[{"inputs":[{"internalType":"contract IERC1155","name":"_EditionToken","type":"address"},{"internalType":"contract IERC721","name":"_NFTtoken","type":"address"},{"internalType":"contract NTSRewardVault","name":"_RewardVault","type":"address"},{"internalType":"uint256","name":"_rewardPerHour","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenType","type":"uint256"},{"indexed":true,"internalType":"uint16[]","name":"tokenId","type":"uint16[]"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint16","name":"leaderId","type":"uint16"},{"indexed":false,"internalType":"uint16[]","name":"boostId","type":"uint16[]"}],"name":"StakedTeam","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenType","type":"uint256"},{"indexed":false,"internalType":"uint16[]","name":"boostId","type":"uint16[]"}],"name":"unStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint16","name":"leaderId","type":"uint16"}],"name":"unStakedTeam","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PauseClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PauseStake","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_leaderId","type":"uint16"},{"internalType":"uint16[]","name":"_boostIds","type":"uint16[]"}],"name":"_stakeTeam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"},{"internalType":"uint256","name":"_tokenType","type":"uint256"},{"internalType":"uint16","name":"_tokenId","type":"uint16"}],"name":"calReward","outputs":[{"internalType":"uint256","name":"_Reward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"}],"name":"calRewardAll","outputs":[{"internalType":"uint256","name":"_totalReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"},{"internalType":"uint16","name":"_staketeam","type":"uint16"}],"name":"calRewardTeam","outputs":[{"internalType":"uint256","name":"_TotalReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"}],"name":"calRewardTeamAll","outputs":[{"internalType":"uint256","name":"_TotalReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calimTeamAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenType","type":"uint256"},{"internalType":"uint16","name":"_tokenId","type":"uint16"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_leaderId","type":"uint16"}],"name":"claimTeam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_staketeam","type":"uint16"}],"name":"getBoostsRate","outputs":[{"internalType":"uint16[]","name":"boostIds","type":"uint16[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"member","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSingleClaimed","outputs":[{"internalType":"uint256","name":"_singleClaimed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSingleUnClaim","outputs":[{"internalType":"uint256","name":"_singleUnClaim","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"}],"name":"getStakedMOMO","outputs":[{"internalType":"uint16[]","name":"stakedIds","type":"uint16[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"}],"name":"getStakedTMHC","outputs":[{"internalType":"uint16[]","name":"stakedIds","type":"uint16[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"}],"name":"getStakedTeam","outputs":[{"internalType":"uint16[]","name":"stakedIds","type":"uint16[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"},{"internalType":"uint16","name":"_staketeam","type":"uint16"}],"name":"getTeamBoost","outputs":[{"internalType":"uint256","name":"_boostrate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTeamClaimed","outputs":[{"internalType":"uint256","name":"_teamClaimed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTeamUnClaim","outputs":[{"internalType":"uint256","name":"_teamUnClaim","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUserArray","outputs":[{"internalType":"address[]","name":"_userArray","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUserCount","outputs":[{"internalType":"uint256","name":"_userCount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"gradesBonus","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRoleWithSwitch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"inStakedmomo","outputs":[{"internalType":"address","name":"stakeowner","type":"address"},{"internalType":"uint16","name":"staketeam","type":"uint16"},{"internalType":"uint256","name":"lastUpdateBlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"inStakedteam","outputs":[{"internalType":"address","name":"stakeowner","type":"address"},{"internalType":"uint256","name":"lastUpdateBlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"inStakedtmhc","outputs":[{"internalType":"address","name":"stakeowner","type":"address"},{"internalType":"uint16","name":"staketeam","type":"uint16"},{"internalType":"uint256","name":"lastUpdateBlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"momoGrades","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"momoToken","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"refreshTeamAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerHour","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardVault","outputs":[{"internalType":"contract NTSRewardVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8[]","name":"_momogrades","type":"uint8[]"}],"name":"setAddMomoGrades","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8[10]","name":"_gradesbonus","type":"uint8[10]"}],"name":"setGradesBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"setPauseCalim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"setPausePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardPerHour","type":"uint256"}],"name":"setRewardPeHour","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenType","type":"uint256"},{"internalType":"uint16[]","name":"_tokenIds","type":"uint16[]"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_leaderId","type":"uint16"},{"internalType":"uint16[]","name":"_boostIds","type":"uint16[]"}],"name":"stakeTeam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tmhcToken","outputs":[{"internalType":"contract IERC1155","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenType","type":"uint256"},{"internalType":"uint16[]","name":"_tokenIds","type":"uint16[]"}],"name":"unStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"_leaderIds","type":"uint16[]"}],"name":"unStakeTeam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"users","outputs":[{"internalType":"uint256","name":"rewardsEarned","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"usersArray","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162005142380380620051428339810160408190526200003491620002fb565b6001600455600354610100900460ff16158080156200005a5750600354600160ff909116105b806200008a57506200007730620001e560201b620015a91760201c565b1580156200008a575060035460ff166001145b620000f25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6003805460ff19166001179055801562000116576003805461ff0019166101001790555b6201117f80546001600160a01b0319166001600160a01b03841617905562000140600083620001f4565b600780546001600160a01b038089166001600160a01b031992831617909255600880548884169083161790556009805492871692909116919091179055600a8390556201117f805461ffff60a01b191690558015620001d9576003805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505062000397565b6001600160a01b03163b151590565b6200020b82826200021b60201b620015b81760201c565b62000217828262000274565b5050565b6000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6000828152600260205260408120805491600191906200029583856200036f565b9091555050600092835260026020818152604080862084875260018101835281872080546001600160a01b039097166001600160a01b031990971687179055948652939091019052912055565b6001600160a01b0381168114620002f857600080fd5b50565b600080600080600060a086880312156200031457600080fd5b85516200032181620002e2565b60208701519095506200033481620002e2565b60408701519094506200034781620002e2565b6060870151608088015191945092506200036181620002e2565b809150509295509295909350565b808201808211156200039157634e487b7160e01b600052601160045260246000fd5b92915050565b614d9b80620003a76000396000f3fe608060405234801561001057600080fd5b506004361061030c5760003560e01c806391d148541161019d578063c051055d116100e9578063d547741f116100a2578063e8fb3bbf1161007c578063e8fb3bbf146106f9578063ee2522031461070c578063f2fde6351461071f578063fd54096e1461073257600080fd5b8063d547741f146106c0578063df19ea46146106d3578063e2daaf6e146106e657600080fd5b8063c051055d14610657578063c3bf3b391461066a578063ca15c8731461067f578063d1058e5914610692578063d3a0a88a1461069a578063d431b8f4146106ad57600080fd5b8063a87430ba11610156578063b5cb15f711610130578063b5cb15f714610621578063b6339c2514610629578063bdbb77651461063c578063be729c6d1461064457600080fd5b8063a87430ba146105be578063af6e0b88146105de578063b288573a146105e657600080fd5b806391d1485414610538578063960831271461054b578063a217fddf1461055e578063a32fa5b314610566578063a4c643cc14610579578063a59176c71461058c57600080fd5b806336568abe1161025c5780636d73d6b31161021557806388fd3d50116101ef57806388fd3d50146104ec5780638961345b146104ff5780638b1a3696146105125780639010d07c1461052557600080fd5b80636d73d6b3146104b057806373db4839146104c65780638282103b146104d957600080fd5b806336568abe146104405780633a2c67771461045357806342077914146104665780635296180b1461048c5780636141435814610494578063614c35cd1461049d57600080fd5b8063248a9ca3116102c95780632f57cf93116102a35780632f57cf93146103f25780632fae35c0146103fa578063302a39d014610425578063338d9d721461042d57600080fd5b8063248a9ca31461039f578063252d86e2146103bf5780632f2ff15d146103df57600080fd5b8063045b58011461031157806304fb37b21461033b57806308611468146103505780630c6939bb1461036657806311dc2caa14610379578063129545321461038c575b600080fd5b61032461031f366004614678565b610745565b60405160ff90911681526020015b60405180910390f35b61034e610349366004614691565b610771565b005b61035861079e565b604051908152602001610332565b61034e6103743660046146b3565b6107ad565b61035861038736600461470a565b6107cd565b61034e61039a366004614794565b6107e4565b6103586103ad366004614678565b60009081526001602052604090205490565b6103d26103cd3660046147e0565b610836565b60405161033291906147fb565b61034e6103ed366004614843565b6108d6565b61034e61096e565b61040d610408366004614678565b61098a565b6040516001600160a01b039091168152602001610332565b6103586109b4565b61035861043b366004614873565b6109c1565b61034e61044e366004614843565b6109d6565b60095461040d906001600160a01b031681565b6201117f5461047c90600160a01b900460ff1681565b6040519015158152602001610332565b610358610a38565b610358600a5481565b6103246104ab366004614678565b610a42565b6201117f5461047c90600160a81b900460ff1681565b61034e6104d43660046148a8565b610a78565b6103586104e7366004614873565b610ab7565b61034e6104fa366004614794565b610ac3565b61034e61050d3660046148e2565b610b02565b61034e610520366004614924565b610b93565b61040d610533366004614947565b610bdb565b61047c610546366004614843565b610cc8565b6103d2610559366004614969565b610cf1565b610358600081565b61047c610574366004614843565b610d62565b610358610587366004614969565b610db4565b61059f61059a366004614678565b610dbf565b604080516001600160a01b039093168352602083019190915201610332565b6103586105cc366004614969565b60066020526000908152604090205481565b610358610ded565b6105f96105f4366004614678565b610df9565b604080516001600160a01b03909416845261ffff909216602084015290820152606001610332565b600554610358565b61034e6106373660046147e0565b610e32565b61034e610e7c565b61034e6106523660046148e2565b610eb8565b60075461040d906001600160a01b031681565b610672610ef6565b6040516103329190614986565b61035861068d366004614678565b610f58565b61034e610fe1565b61034e6106a8366004614678565b61101d565b61034e6106bb3660046148a8565b61102f565b61034e6106ce366004614843565b611464565b6103d26106e1366004614969565b61147d565b61034e6106f4366004614691565b6114ee565b6103d2610707366004614969565b61151b565b61035861071a366004614969565b61158c565b60085461040d906001600160a01b031681565b6105f9610740366004614678565b611597565b6201117d81600a811061075757600080fd5b60209182820401919006915054906101000a900460ff1681565b600061077d8133611611565b506201117f8054911515600160a81b0260ff60a81b19909216919091179055565b60006107a861168f565b905090565b60006107b98133611611565b6107c86201117d83600a614536565b505050565b60006107da848484611747565b90505b9392505050565b6107ec6119b1565b6201117f54600160a01b900460ff16156108215760405162461bcd60e51b8152600401610818906149c7565b60405180910390fd5b61082c838383611a0a565b6107c86001600455565b6060619c4c8261ffff16612710811061085157610851614a09565b600302016001018054806020026020016040519081016040528092919081815260200182805480156108ca57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116108915790505b50505050509050919050565b6000828152600160205260409020546108ef9033611611565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156109605760405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c79206772616e7420746f206e6f6e20686f6c646572730000006044820152606401610818565b61096a828261223d565b5050565b6109766119b1565b61097e612251565b6109886001600455565b565b6005818154811061099a57600080fd5b6000918252602090912001546001600160a01b0316905081565b60006107a86201117e5490565b60006109cd8383612322565b90505b92915050565b336001600160a01b03821614610a2e5760405162461bcd60e51b815260206004820152601a60248201527f43616e206f6e6c792072656e6f756e636520666f722073656c660000000000006044820152606401610818565b61096a8282612491565b60006107a86124e7565b6201117c8181548110610a5457600080fd5b9060005260206000209060209182820401919006915054906101000a900460ff1681565b610a806119b1565b6201117f54600160a01b900460ff1615610aac5760405162461bcd60e51b8152600401610818906149c7565b61082c83838361102f565b60006109cd838361259a565b610acb6119b1565b6201117f54600160a01b900460ff1615610af75760405162461bcd60e51b8152600401610818906149c7565b61082c83838361264e565b6000610b0e8133611611565b60005b82811015610b8d576201117c848483818110610b2f57610b2f614a09565b9050602002016020810190610b449190614a1f565b81546001810183556000928352602092839020928104909201805460ff928316601f9094166101000a938402929093021990921617905580610b8581614a58565b915050610b11565b50505050565b610b9b6119b1565b6201117f54600160a81b900460ff1615610bc75760405162461bcd60e51b815260040161081890614a71565b610bd18282612c29565b61096a6001600455565b60008281526002602052604081205481805b82811015610cbf5760008681526002602090815260408083208484526001019091529020546001600160a01b031615610c6957848203610c575760008681526002602090815260408083209383526001909301905220546001600160a01b031692506109d0915050565b610c62600183614aa8565b9150610cad565b610c74866000610cc8565b8015610c9a57506000868152600260208181526040808420848052909201905290205481145b15610cad57610caa600183614aa8565b91505b610cb8600182614aa8565b9050610bed565b50505092915050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6001600160a01b0381166000908152600660209081526040918290206002018054835181840281018401909452808452606093928301828280156108ca576000918252602091829020805461ffff168452908202830192909160029101808411610891575094979650505050505050565b60008281526020818152604080832083805290915281205460ff16610dab57506000828152602081815260408083206001600160a01b038516845290915290205460ff166109d0565b50600192915050565b60006109d082612d6a565b619c4c816127108110610dd157600080fd5b6003020180546002909101546001600160a01b03909116915082565b60006107a8619c4b5490565b600b816127108110610e0a57600080fd5b6002020180546001909101546001600160a01b0382169250600160a01b90910461ffff169083565b610e3a6119b1565b6201117f54600160a81b900460ff1615610e665760405162461bcd60e51b815260040161081890614a71565b610e6f81612e57565b610e796001600455565b50565b610e846119b1565b6201117f54600160a81b900460ff1615610eb05760405162461bcd60e51b815260040161081890614a71565b61097e612f42565b610ec06119b1565b6201117f54600160a01b900460ff1615610eec5760405162461bcd60e51b8152600401610818906149c7565b610bd18282613013565b60606005805480602002602001604051908101604052809291908181526020018280548015610f4e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f30575b5050505050905090565b600081815260026020526040812054815b81811015610fbc5760008481526002602090815260408083208484526001019091529020546001600160a01b031615610faa57610fa7600184614aa8565b92505b610fb5600182614aa8565b9050610f69565b50610fc8836000610cc8565b15610fdb57610fd8600183614aa8565b91505b50919050565b610fe96119b1565b6201117f54600160a81b900460ff16156110155760405162461bcd60e51b815260040161081890614a71565b61097e6134ba565b60006110298133611611565b50600a55565b61106d338484848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061365892505050565b6110aa5760405162461bcd60e51b815260206004820152600e60248201526d2737ba1027232a1037bbb732b91760911b6044820152606401610818565b33614e2b61ffff851661271081106110c4576110c4614a09565b60020201546001600160a01b0316036111165760405162461bcd60e51b81526020600482015260146024820152732a26a4219030b63932b0b23c9039ba30b5b2b21760611b6044820152606401610818565b600581111561117a5760405162461bcd60e51b815260206004820152602a60248201527f41206d6178696d756d206f66203520626f6f73746572204e465473206172652060448201526930bb30b4b630b136329760b11b6064820152608401610818565b60005b61ffff81168211156112a657600083838361ffff168181106111a1576111a1614a09565b90506020020160208101906111b691906147e0565b905033600b61ffff831661271081106111d1576111d1614a09565b60020201546001600160a01b0316036112235760405162461bcd60e51b815260206004820152601460248201527326a7a6a79030b63932b0b23c9039ba30b5b2b21760611b6044820152606401610818565b84600b8261ffff16612710811061123c5761123c614a09565b60020201805461ffff60a01b1916600160a01b61ffff938416021790553390600b908316612710811061127157611271614a09565b6002020180546001600160a01b0319166001600160a01b0392909216919091179055508061129e81614abb565b91505061117d565b5082614e2b8461ffff1661271081106112c1576112c1614a09565b60020201805461ffff60a01b1916600160a01b61ffff938416021790553390614e2b90851661271081106112f7576112f7614a09565b6002020180546001600160a01b0319166001600160a01b03929092169190911790556113216136dc565b336000818152600660209081526040808320600190810180549182018155845282842060108204018054600f9092166002026101000a61ffff81810219909316928a160291909117905580516060810182529384528051858302808201840190925285815292939283830192909187918791829185019084908082843760009201919091525050509082525042602090910152905080619c4c61ffff861661271081106113d0576113d0614a09565b82516003919091029190910180546001600160a01b0319166001600160a01b03909216919091178155602080830151805161141192600185019201906145cc565b506040918201516002909101555161ffff85169033907fcacd35acda3652ab8f00e3007cee32b81cc7cdd7809e36b788553d0053675bb8906114569087908790614b1e565b60405180910390a350505050565b600082815260016020526040902054610a2e9033611611565b6001600160a01b0381166000908152600660209081526040918290206003018054835181840281018401909452808452606093928301828280156108ca576000918252602091829020805461ffff168452908202830192909160029101808411610891575094979650505050505050565b60006114fa8133611611565b506201117f8054911515600160a01b0260ff60a01b19909216919091179055565b6001600160a01b0381166000908152600660209081526040918290206001018054835181840281018401909452808452606093928301828280156108ca576000918252602091829020805461ffff168452908202830192909160029101808411610891575094979650505050505050565b60006109d082613771565b614e2b816127108110610e0a57600080fd5b6001600160a01b03163b151590565b6000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1661096a5761164d816001600160a01b03166014613958565b611658836020613958565b604051602001611669929190614b56565b60408051601f198184030181529082905262461bcd60e51b825261081891600401614bc3565b60008060058054806020026020016040519081016040528092919081815260200182805480156116e857602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116116ca575b5050505050905060005b815181101561174257600082828151811061170f5761170f614a09565b6020026020010151905061172281612d6a565b61172c9085614aa8565b935050808061173a90614a58565b9150506116f2565b505090565b60008083810361188257600754604051627eeac760e11b81526001600160a01b03878116600483015261ffff861660248301529091169062fdd58e90604401602060405180830381865afa1580156117a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c79190614bf6565b60011480156118045750846001600160a01b0316614e2b8461ffff1661271081106117f4576117f4614a09565b60020201546001600160a01b0316145b80156118365750614e2b8361ffff16612710811061182457611824614a09565b6002020154600160a01b900461ffff16155b1561187857614e2b8361ffff16612710811061185457611854614a09565b6002020160010154426118679190614c0f565b6118719082614aa8565b905061198d565b60009150506107dd565b8360010361198d576008546040516331a9108f60e11b815261ffff851660048201526001600160a01b03878116921690636352211e90602401602060405180830381865afa1580156118d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fc9190614c22565b6001600160a01b031614801561193f5750846001600160a01b0316600b8461ffff16612710811061192f5761192f614a09565b60020201546001600160a01b0316145b80156119705750600b8361ffff16612710811061195e5761195e614a09565b6002020154600160a01b900461ffff16155b1561187857600b8361ffff16612710811061185457611854614a09565b610e10600a548261199e9190614c3f565b6119a89190614c56565b95945050505050565b600260045403611a035760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610818565b6002600455565b821580611a175750826001145b611a335760405162461bcd60e51b815260040161081890614c78565b82600003611de75760005b61ffff8116821115611de157600083838361ffff16818110611a6257611a62614a09565b9050602002016020810190611a7791906147e0565b600754604051627eeac760e11b815233600482015261ffff831660248201529192506001600160a01b03169062fdd58e90604401602060405180830381865afa158015611ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aec9190614bf6565b600114611b0b5760405162461bcd60e51b815260040161081890614ca4565b33614e2b61ffff83166127108110611b2557611b25614a09565b60020201546001600160a01b031614611b735760405162461bcd60e51b815260206004820152601060248201526f2a26a421903737ba1039ba30b5b2b21760811b6044820152606401610818565b614e2b8161ffff166127108110611b8c57611b8c614a09565b6002020154600160a01b900461ffff1615611be05760405162461bcd60e51b81526020600482015260146024820152732a26a4219034b99037b7103a3432903a32b0b69760611b6044820152606401610818565b611bea8582612c29565b33600090815260066020908152604080832060020180548251818502810185019093528083529192909190830182828015611c6c57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411611c335790505b5050505050905060005b8151811015611d98578261ffff16828281518110611c9657611c96614a09565b602002602001015161ffff1603611d86578160018351611cb69190614c0f565b81518110611cc657611cc6614a09565b602002602001015160066000336001600160a01b03166001600160a01b031681526020019081526020016000206002018281548110611d0757611d07614a09565b600091825260208083206010830401805461ffff9586166002600f90951685026101000a908102960219169490941790935533825260069092526040902001805480611d5557611d55614ccd565b600082815260209020601060001990920191820401805461ffff6002600f8516026101000a02191690559055611d98565b80611d9081614a58565b915050611c76565b50614e2b8261ffff166127108110611db257611db2614a09565b6002020180546001600160b01b0319168155600060019091015550819050611dd981614abb565b915050611a3e565b506121eb565b826001036121d35760005b61ffff8116821115611de157600083838361ffff16818110611e1657611e16614a09565b9050602002016020810190611e2b91906147e0565b6008546040516331a9108f60e11b815261ffff8316600482015291925033916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea09190614c22565b6001600160a01b031614611ee85760405162461bcd60e51b815260206004820152600f60248201526e3737ba1026a7a6a79037bbb732b91760891b6044820152606401610818565b33600b61ffff83166127108110611f0157611f01614a09565b60020201546001600160a01b031614611f4f5760405162461bcd60e51b815260206004820152601060248201526f26a7a6a7903737ba1039ba30b5b2b21760811b6044820152606401610818565b600b8161ffff166127108110611f6757611f67614a09565b6002020154600160a01b900461ffff1615611fbb5760405162461bcd60e51b81526020600482015260146024820152732a26a4219034b99037b7103a3432903a32b0b69760611b6044820152606401610818565b611fc58582612c29565b3360009081526006602090815260408083206003018054825181850281018501909352808352919290919083018282801561204757602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff168152602001906002019060208260010104928301926001038202915080841161200e5790505b5050505050905060005b815181101561218b578261ffff1682828151811061207157612071614a09565b602002602001015161ffff16036121795781600183516120919190614c0f565b815181106120a1576120a1614a09565b602002602001015160066000336001600160a01b03166001600160a01b0316815260200190815260200160002060030182815481106120e2576120e2614a09565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff16021790555060066000336001600160a01b03166001600160a01b0316815260200190815260200160002060030180548061214857612148614ccd565b600082815260209020601060001990920191820401805461ffff6002600f8516026101000a0219169055905561218b565b8061218381614a58565b915050612051565b50600b8261ffff1661271081106121a4576121a4614a09565b6002020180546001600160b01b03191681556000600190910155508190506121cb81614abb565b915050611df2565b60405162461bcd60e51b815260040161081890614c78565b6121f3613af4565b336001600160a01b03167f5ab15ddadfed48a5ddebe9db9d3f58a92fe435095edeb60c3646341695a49d1584848460405161223093929190614ce3565b60405180910390a2505050565b61224782826115b8565b61096a8282613c90565b336000908152600660209081526040808320600101805482518185028101850190935280835291929091908301828280156122d357602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff168152602001906002019060208260010104928301926001038202915080841161229a5790505b5050505050905060005b81518161ffff16101561096a57612310828261ffff168151811061230357612303614a09565b6020026020010151613cfc565b8061231a81614abb565b9150506122dd565b600080619c4c8361ffff16612710811061233e5761233e614a09565b600302016001018054806020026020016040519081016040528092919081815260200182805480156123b757602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff168152602001906002019060208260010104928301926001038202915080841161237e5790505b5050505050905060005b81518161ffff161015612489576000828261ffff16815181106123e6576123e6614a09565b602002602001015190506123fa86826140a3565b61240a57600093505050506109d0565b60006201117c8261ffff168154811061242557612425614a09565b60009182526020808320908204015460ff601f9092166101000a90041691506201117d82600a811061245957612459614a09565b602081049091015460ff601f9092166101000a90041695508392506124819150829050614abb565b9150506123c1565b505092915050565b61249b828261412a565b60009182526002602081815260408085206001600160a01b0394909416808652928401808352818620805487526001909501835290852080546001600160a01b03191690559184525255565b600080600580548060200260200160405190810160405280929190818152602001828054801561254057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612522575b5050505050905060005b815181101561174257600082828151811061256757612567614a09565b6020026020010151905061257a81613771565b6125849085614aa8565b935050808061259290614a58565b91505061254a565b60006125a6838361418a565b6125b2575060006109d0565b6000619c4c8361ffff1661271081106125cd576125cd614a09565b600302016002015490506000610e10600a5483426125eb9190614c0f565b6125f59190614c3f565b6125ff9190614c56565b9050600061260d8686612322565b90508060000361262357600093505050506109d0565b61262e606482614c56565b905061263a8183614c3f565b6126449083614aa8565b9695505050505050565b82158061265b5750826001145b6126775760405162461bcd60e51b815260040161081890614c78565b826000036129175760005b61ffff811682111561291157600083838361ffff168181106126a6576126a6614a09565b90506020020160208101906126bb91906147e0565b600754604051627eeac760e11b815233600482015261ffff831660248201529192506001600160a01b03169062fdd58e90604401602060405180830381865afa15801561270c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127309190614bf6565b60011461274f5760405162461bcd60e51b815260040161081890614ca4565b614e2b8161ffff16612710811061276857612768614a09565b6002020154600160a01b900461ffff16156127c15760405162461bcd60e51b815260206004820152601960248201527826a7a6a79034b9903830b93a1037b3103a3432903a32b0b69760391b6044820152606401610818565b33614e2b61ffff831661271081106127db576127db614a09565b60020201546001600160a01b03160361282d5760405162461bcd60e51b81526020600482015260146024820152732a26a4219030b63932b0b23c9039ba30b5b2b21760611b6044820152606401610818565b6128356136dc565b336000818152600660209081526040808320600290810180546001810182559085528385206010820401805461ffff808a16600f9094169094026101000a838102940219169290921790915581516060810183529485529184019290925242918301919091528190614e2b9061271081106128b2576128b2614a09565b8251600291909102919091018054602084015161ffff16600160a01b026001600160b01b03199091166001600160a01b03909316929092179190911781556040909101516001909101555081905061290981614abb565b915050612682565b50612bd8565b82600103612bd85760005b61ffff8116821115612bd657600083838361ffff1681811061294657612946614a09565b905060200201602081019061295b91906147e0565b6008546040516331a9108f60e11b815261ffff8316600482015291925033916001600160a01b0390911690636352211e90602401602060405180830381865afa1580156129ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129d09190614c22565b6001600160a01b031614612a185760405162461bcd60e51b815260206004820152600f60248201526e3737ba1026a7a6a79037bbb732b91760891b6044820152606401610818565b600b8161ffff166127108110612a3057612a30614a09565b6002020154600160a01b900461ffff1615612a895760405162461bcd60e51b815260206004820152601960248201527826a7a6a79034b9903830b93a1037b3103a3432903a32b0b69760391b6044820152606401610818565b33600b61ffff83166127108110612aa257612aa2614a09565b60020201546001600160a01b031603612af45760405162461bcd60e51b815260206004820152601460248201527326a7a6a79030b63932b0b23c9039ba30b5b2b21760611b6044820152606401610818565b612afc6136dc565b33600081815260066020908152604080832060030180546001810182559084528284206010820401805461ffff8089166002600f909516949094026101000a84810291021990911617905581516060810183529485529184019290925242918301919091528190600b906127108110612b7757612b77614a09565b8251600291909102919091018054602084015161ffff16600160a01b026001600160b01b03199091166001600160a01b039093169290921791909117815560409091015160019091015550819050612bce81614abb565b915050612922565b505b8181604051612be8929190614cfd565b6040519081900381208482529033907f378577f8668646d27a377daa5740277a94a6458000f71232d9cffb4e9e6863f59060200160405180910390a3505050565b6000612c36338484611747565b905080156107c85760095460405163083965f560e11b8152336004820152602481018390526001600160a01b0390911690631072cbea90604401600060405180830381600087803b158015612c8a57600080fd5b505af1158015612c9e573d6000803e3d6000fd5b5050505082600003612cd45742614e2b8361ffff166127108110612cc457612cc4614a09565b6002020160010181905550612d01565b82600103612d015742600b8361ffff166127108110612cf557612cf5614a09565b60020201600101819055505b3360009081526006602052604081208054839290612d20908490614aa8565b9091555050619c4b54612d34908290614aa8565b619c4b5560405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048690602001612230565b6001600160a01b038116600090815260066020908152604080832060010180548251818502810185019093528083528493830182828015612df257602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411612db95790505b505050505090506000805b82518161ffff161015612e4f57612e3185848361ffff1681518110612e2457612e24614a09565b602002602001015161259a565b612e3b9083614aa8565b915080612e4781614abb565b915050612dfd565b509392505050565b6000612e63338361259a565b9050801561096a5760095460405163083965f560e11b8152336004820152602481018390526001600160a01b0390911690631072cbea90604401600060405180830381600087803b158015612eb757600080fd5b505af1158015612ecb573d6000803e3d6000fd5b5050505042619c4c8361ffff166127108110612ee957612ee9614a09565b6003020160020181905550806201117e54612f049190614aa8565b6201117e5560405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25050565b33600090815260066020908152604080832060010180548251818502810185019093528083529192909190830182828015612fc457602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411612f8b5790505b5050505050905060005b81518161ffff16101561096a57613001828261ffff1681518110612ff457612ff4614a09565b6020026020010151612e57565b8061300b81614abb565b915050612fce565b60005b61ffff81168211156107c857600083838361ffff1681811061303a5761303a614a09565b905060200201602081019061304f91906147e0565b600754604051627eeac760e11b815233600482015261ffff831660248201529192506001600160a01b03169062fdd58e90604401602060405180830381865afa1580156130a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c49190614bf6565b6001146130e35760405162461bcd60e51b815260040161081890614ca4565b33619c4c61ffff831661271081106130fd576130fd614a09565b60030201546001600160a01b03161461314a5760405162461bcd60e51b815260206004820152600f60248201526e3737ba102a32b0b69037bbb732b91760891b6044820152606401610818565b614e2b8161ffff16612710811061316357613163614a09565b6002020154600160a01b900461ffff166000036131c25760405162461bcd60e51b815260206004820152601860248201527f544d4843206973206e6f74206f6e20746865207465616d2e00000000000000006044820152606401610818565b614e2b8161ffff1661271081106131db576131db614a09565b6002020180546001600160b01b031916815560006001909101819055613201338361259a565b60095460405163083965f560e11b8152336004820152602481018390529192506001600160a01b031690631072cbea90604401600060405180830381600087803b15801561324e57600080fd5b505af1158015613262573d6000803e3d6000fd5b50506040518381523392507fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486915060200160405180910390a23360009081526006602090815260408083206001018054825181850281018501909352808352919290919083018282801561331d57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116132e45790505b5050505050905060005b8151811015613461578361ffff1682828151811061334757613347614a09565b602002602001015161ffff160361344f5781600183516133679190614c0f565b8151811061337757613377614a09565b602002602001015160066000336001600160a01b03166001600160a01b0316815260200190815260200160002060010182815481106133b8576133b8614a09565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff16021790555060066000336001600160a01b03166001600160a01b0316815260200190815260200160002060010180548061341e5761341e614ccd565b600082815260209020601060001990920191820401805461ffff6002600f8516026101000a02191690559055613461565b8061345981614a58565b915050613327565b5061346b8361420b565b613473613af4565b60405161ffff84169033907f6f8e5879a66c19f7fd819c5790bee9fee7763ae529aac9c6aefd30c5d34e8cbd90600090a350505080806134b290614abb565b915050613016565b3360009081526006602090815260408083206002018054825181850281018501909352808352919290919083018282801561353c57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116135035790505b5050336000908152600660209081526040808320600301805482518185028101850190935280835297985092969095509193509091508301828280156135c957602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116135905790505b5050505050905060005b82518161ffff16101561361a576136086000848361ffff16815181106135fb576135fb614a09565b6020026020010151612c29565b8061361281614abb565b9150506135d3565b5060005b81518161ffff1610156107c8576136466001838361ffff16815181106135fb576135fb614a09565b8061365081614abb565b91505061361e565b6000613664848461418a565b1515600003613675575060006107dd565b60005b82518161ffff1610156136d1576136ac85848361ffff168151811061369f5761369f614a09565b60200260200101516140a3565b15156000036136bf5760009150506107dd565b806136c981614abb565b915050613678565b506001949350505050565b3360009081526006602052604090206002015415801561370c575033600090815260066020526040902060030154155b8015613728575033600090815260066020526040902060010154155b1561098857600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b03191633179055565b6001600160a01b0381166000908152600660209081526040808320600201805482518185028101850190935280835284938301828280156137f957602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116137c05790505b505050506001600160a01b0385166000908152600660209081526040808320600301805482518185028101850190935280835295965092949093509083018282801561388c57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116138535790505b5050505050905060005b82518161ffff1610156138f1576000838261ffff16815181106138bb576138bb614a09565b602002602001015190506138d186600083611747565b6138db9086614aa8565b94505080806138e990614abb565b915050613896565b5060005b81518161ffff161015613950576000828261ffff168151811061391a5761391a614a09565b6020026020010151905061393086600183611747565b61393a9086614aa8565b945050808061394890614abb565b9150506138f5565b505050919050565b60606000613967836002614c3f565b613972906002614aa8565b67ffffffffffffffff81111561398a5761398a614d38565b6040519080825280601f01601f1916602001820160405280156139b4576020820181803683370190505b509050600360fc1b816000815181106139cf576139cf614a09565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106139fe576139fe614a09565b60200101906001600160f81b031916908160001a9053506000613a22846002614c3f565b613a2d906001614aa8565b90505b6001811115613aa5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613a6157613a61614a09565b1a60f81b828281518110613a7757613a77614a09565b60200101906001600160f81b031916908160001a90535060049490941c93613a9e81614d4e565b9050613a30565b5083156109cd5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610818565b33600090815260066020526040902060020154158015613b24575033600090815260066020526040902060030154155b8015613b40575033600090815260066020526040902060010154155b156109885760006005805480602002602001604051908101604052809291908181526020018280548015613b9d57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613b7f575b5050505050905060005b815181101561096a57336001600160a01b0316828281518110613bcc57613bcc614a09565b60200260200101516001600160a01b031603613c7e578160018351613bf19190614c0f565b81518110613c0157613c01614a09565b602002602001015160058281548110613c1c57613c1c614a09565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506005805480613c5b57613c5b614ccd565b600082815260209020810160001990810180546001600160a01b03191690550190555b80613c8881614a58565b915050613ba7565b600082815260026020526040812080549160019190613caf8385614aa8565b9091555050600092835260026020818152604080862084875260018101835281872080546001600160a01b039097166001600160a01b031990971687179055948652939091019052912055565b613d0633826143a2565b15610e795733600090815260066020908152604080832060010180548251818502810185019093528083529192909190830182828015613d8d57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411613d545790505b5050505050905060005b8151811015613ed1578261ffff16828281518110613db757613db7614a09565b602002602001015161ffff1603613ebf578160018351613dd79190614c0f565b81518110613de757613de7614a09565b602002602001015160066000336001600160a01b03166001600160a01b031681526020019081526020016000206001018281548110613e2857613e28614a09565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff16021790555060066000336001600160a01b03166001600160a01b03168152602001908152602001600020600101805480613e8e57613e8e614ccd565b600082815260209020601060001990920191820401805461ffff6002600f8516026101000a02191690559055613ed1565b80613ec981614a58565b915050613d97565b50613eda613af4565b50613ee5338261418a565b158015613f17575033614e2b61ffff83166127108110613f0757613f07614a09565b60020201546001600160a01b0316145b15613f5057614e2b8161ffff166127108110613f3557613f35614a09565b6002020180546001600160b01b031916815560006001909101555b6000619c4c8261ffff166127108110613f6b57613f6b614a09565b60030201600101805480602002602001604051908101604052809291908181526020018280548015613fe457602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411613fab5790505b5050505050905060005b81518161ffff1610156107c8576000828261ffff168151811061401357614013614a09565b6020026020010151905061402733826140a3565b158015614058575033600b61ffff8316612710811061404857614048614a09565b60020201546001600160a01b0316145b1561409057600b8161ffff16612710811061407557614075614a09565b6002020180546001600160b01b031916815560006001909101555b508061409b81614abb565b915050613fee565b6008546040516331a9108f60e11b815261ffff831660048201526000916001600160a01b0385811692911690636352211e90602401602060405180830381865afa1580156140f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141199190614c22565b6001600160a01b0316149392505050565b6141348282611611565b6000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600754604051627eeac760e11b81526001600160a01b03848116600483015261ffff84166024830152600092169062fdd58e90604401602060405180830381865afa1580156141dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142019190614bf6565b6001149392505050565b6000619c4c8261ffff16612710811061422657614226614a09565b6003020160010180548060200260200160405190810160405280929190818152602001828054801561429f57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116142665790505b5050505050905060005b81518161ffff1610156107c8576000828261ffff16815181106142ce576142ce614a09565b60209081029190910101516008546040516331a9108f60e11b815261ffff8316600482015291925033916001600160a01b0390911690636352211e90602401602060405180830381865afa15801561432a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061434e9190614c22565b6001600160a01b03160361438f57600b8161ffff16612710811061437457614374614a09565b6002020180546001600160b01b031916815560006001909101555b508061439a81614abb565b9150506142a9565b60006143ae838361418a565b1580156143e95750826001600160a01b0316614e2b8361ffff1661271081106143d9576143d9614a09565b60020201546001600160a01b0316145b156143f6575060016109d0565b6000619c4c8361ffff16612710811061441157614411614a09565b6003020160010180548060200260200160405190810160405280929190818152602001828054801561448a57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116144515790505b5050505050905060005b81518161ffff16101561452b576000828261ffff16815181106144b9576144b9614a09565b602002602001015190506144cd86826140a3565b1580156145075750856001600160a01b0316600b8261ffff1661271081106144f7576144f7614a09565b60020201546001600160a01b0316145b1561451857600193505050506109d0565b508061452381614abb565b915050614494565b506000949350505050565b6001830191839082156145bc5791602002820160005b8382111561458d57833560ff1683826101000a81548160ff021916908360ff160217905550926020019260010160208160000104928301926001030261454c565b80156145ba5782816101000a81549060ff021916905560010160208160000104928301926001030261458d565b505b506145c8929150614663565b5090565b82805482825590600052602060002090600f016010900481019282156145bc5791602002820160005b8382111561463557835183826101000a81548161ffff021916908361ffff16021790555092602001926002016020816001010492830192600103026145f5565b80156145ba5782816101000a81549061ffff0219169055600201602081600101049283019260010302614635565b5b808211156145c85760008155600101614664565b60006020828403121561468a57600080fd5b5035919050565b6000602082840312156146a357600080fd5b813580151581146109cd57600080fd5b60006101408083850312156146c757600080fd5b8381840111156146d657600080fd5b509092915050565b6001600160a01b0381168114610e7957600080fd5b803561ffff8116811461470557600080fd5b919050565b60008060006060848603121561471f57600080fd5b833561472a816146de565b92506020840135915061473f604085016146f3565b90509250925092565b60008083601f84011261475a57600080fd5b50813567ffffffffffffffff81111561477257600080fd5b6020830191508360208260051b850101111561478d57600080fd5b9250929050565b6000806000604084860312156147a957600080fd5b83359250602084013567ffffffffffffffff8111156147c757600080fd5b6147d386828701614748565b9497909650939450505050565b6000602082840312156147f257600080fd5b6109cd826146f3565b6020808252825182820181905260009190848201906040850190845b8181101561483757835161ffff1683529284019291840191600101614817565b50909695505050505050565b6000806040838503121561485657600080fd5b823591506020830135614868816146de565b809150509250929050565b6000806040838503121561488657600080fd5b8235614891816146de565b915061489f602084016146f3565b90509250929050565b6000806000604084860312156148bd57600080fd5b6148c6846146f3565b9250602084013567ffffffffffffffff8111156147c757600080fd5b600080602083850312156148f557600080fd5b823567ffffffffffffffff81111561490c57600080fd5b61491885828601614748565b90969095509350505050565b6000806040838503121561493757600080fd5b8235915061489f602084016146f3565b6000806040838503121561495a57600080fd5b50508035926020909101359150565b60006020828403121561497b57600080fd5b81356109cd816146de565b6020808252825182820181905260009190848201906040850190845b818110156148375783516001600160a01b0316835292840192918401916001016149a2565b60208082526022908201527f537461636b696e6720706f6f6c2069732063757272656e746c79207061757365604082015261321760f11b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215614a3157600080fd5b813560ff811681146109cd57600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201614a6a57614a6a614a42565b5060010190565b6020808252601e908201527f54686520636c61696d2069732063757272656e746c79207061757365642e0000604082015260600190565b808201808211156109d0576109d0614a42565b600061ffff808316818103614ad257614ad2614a42565b6001019392505050565b8183526000602080850194508260005b85811015614b135761ffff614b00836146f3565b1687529582019590820190600101614aec565b509495945050505050565b6020815260006107da602083018486614adc565b60005b83811015614b4d578181015183820152602001614b35565b50506000910152565b7402832b936b4b9b9b4b7b7399d1030b1b1b7bab73a1605d1b815260008351614b86816015850160208801614b32565b7001034b99036b4b9b9b4b733903937b6329607d1b6015918401918201528351614bb7816026840160208801614b32565b01602601949350505050565b6020815260008251806020840152614be2816040850160208701614b32565b601f01601f19169190910160400192915050565b600060208284031215614c0857600080fd5b5051919050565b818103818111156109d0576109d0614a42565b600060208284031215614c3457600080fd5b81516109cd816146de565b80820281158282048414176109d0576109d0614a42565b600082614c7357634e487b7160e01b600052601260045260246000fd5b500490565b60208082526012908201527124b73b30b634b2103a37b5b2b73a3cb8329760711b604082015260600190565b6020808252600f908201526e3737ba102a26a4219037bbb732b91760891b604082015260600190565b634e487b7160e01b600052603160045260246000fd5b8381526040602082015260006119a8604083018486614adc565b60008184825b85811015614d2d5761ffff614d17836146f3565b1683526020928301929190910190600101614d03565b509095945050505050565b634e487b7160e01b600052604160045260246000fd5b600081614d5d57614d5d614a42565b50600019019056fea2646970667358221220ebc96b93c747132b3a77220417f87c33edc5e1d00eab47a4db8d63281a979a3664736f6c634300081100330000000000000000000000007c112af466a00272895043f1a656d03496ff2294000000000000000000000000bc3356df814ce961819480adf96e421cc21aa7690000000000000000000000009b0332baf5175f47c92d4c3200f77698e58781bf000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000c39e79e490ba541b4f7fbfb81fbadd0c5efe4095
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000007c112af466a00272895043f1a656d03496ff2294000000000000000000000000bc3356df814ce961819480adf96e421cc21aa7690000000000000000000000009b0332baf5175f47c92d4c3200f77698e58781bf000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000c39e79e490ba541b4f7fbfb81fbadd0c5efe4095
-----Decoded View---------------
Arg [0] : _EditionToken (address): 0x7c112af466a00272895043f1a656d03496ff2294
Arg [1] : _NFTtoken (address): 0xbc3356df814ce961819480adf96e421cc21aa769
Arg [2] : _RewardVault (address): 0x9b0332baf5175f47c92d4c3200f77698e58781bf
Arg [3] : _rewardPerHour (uint256): 100000000000000000
Arg [4] : _owner (address): 0xc39e79e490ba541b4f7fbfb81fbadd0c5efe4095
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000007c112af466a00272895043f1a656d03496ff2294
Arg [1] : 000000000000000000000000bc3356df814ce961819480adf96e421cc21aa769
Arg [2] : 0000000000000000000000009b0332baf5175f47c92d4c3200f77698e58781bf
Arg [3] : 000000000000000000000000000000000000000000000000016345785d8a0000
Arg [4] : 000000000000000000000000c39e79e490ba541b4f7fbfb81fbadd0c5efe4095
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|