Contract 0x1aDDE2eEa8c6c85923535DD9Bed202b94A2A8eA7 7

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x1b3a213e0dd920c6015d051a0daf97855a118f422383c21ee7409cb8448257770x60806040182124352022-08-04 17:14:1813 days 15 hrs ago0xb68d649f181bde8a8fee367535a606cc3c09fccd IN  Create: ERC721LockedStakingEmissionStream0 AVAX0.‍09328657525
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC721LockedStakingEmissionStream

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 6 runs

Other Settings:
default evmVersion, GNU AGPLv3 license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 28 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 2 of 28 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (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. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = _setInitializedVersion(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.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so 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.
     *
     * 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.
     */
    modifier reinitializer(uint8 version) {
        bool isTopLevelCall = _setInitializedVersion(version);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _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.
     */
    function _disableInitializers() internal virtual {
        _setInitializedVersion(type(uint8).max);
    }

    function _setInitializedVersion(uint8 version) private returns (bool) {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level
        // of initializers, because in other contexts the contract may have been reentered.
        if (_initializing) {
            require(
                version == 1 && !Address.isContract(address(this)),
                "Initializable: contract is already initialized"
            );
            return false;
        } else {
            require(_initialized < version, "Initializable: contract is already initialized");
            _initialized = version;
            return true;
        }
    }
}

File 3 of 28 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 4 of 28 : IERC20.sol
// 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);
}

File 5 of 28 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @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.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 6 of 28 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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 be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev 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);
}

File 7 of 28 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 8 of 28 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 9 of 28 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library 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 functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 10 of 28 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 11 of 28 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 12 of 28 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    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);
    }
}

File 13 of 28 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 14 of 28 : ERC165Storage.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)

pragma solidity ^0.8.0;

import "./ERC165.sol";

/**
 * @dev Storage based implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165Storage is ERC165 {
    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

File 15 of 28 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 16 of 28 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 17 of 28 : BitMaps.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/BitMaps.sol)
pragma solidity ^0.8.0;

/**
 * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
 * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
 */
library BitMaps {
    struct BitMap {
        mapping(uint256 => uint256) _data;
    }

    /**
     * @dev Returns whether the bit at `index` is set.
     */
    function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        return bitmap._data[bucket] & mask != 0;
    }

    /**
     * @dev Sets the bit at `index` to the boolean `value`.
     */
    function setTo(
        BitMap storage bitmap,
        uint256 index,
        bool value
    ) internal {
        if (value) {
            set(bitmap, index);
        } else {
            unset(bitmap, index);
        }
    }

    /**
     * @dev Sets the bit at `index`.
     */
    function set(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        bitmap._data[bucket] |= mask;
    }

    /**
     * @dev Unsets the bit at `index`.
     */
    function unset(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        bitmap._data[bucket] &= ~mask;
    }
}

File 18 of 28 : ERC721AutoIdMinterExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "./ERC721CollectionMetadataExtension.sol";

interface IERC721AutoIdMinterExtension {
    function setMaxSupply(uint256 newValue) external;

    function freezeMaxSupply() external;

    function totalSupply() external view returns (uint256);
}

/**
 * @dev Extension to add minting capability with an auto incremented ID for each token and a maximum supply setting.
 */
abstract contract ERC721AutoIdMinterExtension is
    IERC721AutoIdMinterExtension,
    ERC721CollectionMetadataExtension
{
    using SafeMath for uint256;

    uint256 public maxSupply;
    bool public maxSupplyFrozen;

    uint256 internal _currentTokenId = 0;

    function __ERC721AutoIdMinterExtension_init(uint256 _maxSupply)
        internal
        onlyInitializing
    {
        __ERC721AutoIdMinterExtension_init_unchained(_maxSupply);
    }

    function __ERC721AutoIdMinterExtension_init_unchained(uint256 _maxSupply)
        internal
        onlyInitializing
    {
        maxSupply = _maxSupply;

        _registerInterface(type(IERC721AutoIdMinterExtension).interfaceId);
        _registerInterface(type(IERC721).interfaceId);
    }

    /* ADMIN */

    function setMaxSupply(uint256 newValue) 
        public
        virtual
        override 
        onlyOwner 
    {
        require(!maxSupplyFrozen, "FROZEN");
        require(newValue >= totalSupply(), "LOWER_THAN_SUPPLY");
        maxSupply = newValue;
    }

    function freezeMaxSupply() external onlyOwner {
        maxSupplyFrozen = true;
    }

    /* PUBLIC */

    function totalSupply() public view returns (uint256) {
        return _currentTokenId;
    }

    /* INTERNAL */

    function _mintTo(address to, uint256 count) internal {
        require(totalSupply() + count <= maxSupply, "EXCEEDS_SUPPLY");

        for (uint256 i = 0; i < count; i++) {
            uint256 newTokenId = _currentTokenId;
            _safeMint(to, newTokenId);
            _incrementTokenId();
        }
    }

    /**
     * Increments the value of _currentTokenId
     */
    function _incrementTokenId() internal {
        _currentTokenId++;
    }
}

File 19 of 28 : ERC721CollectionMetadataExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";

interface IERC721CollectionMetadataExtension {
    function setContractURI(string memory newValue) external;

    function contractURI() external view returns (string memory);
}

/**
 * @dev Extension to allow configuring contract-level collection metadata URI.
 */
abstract contract ERC721CollectionMetadataExtension is
    Initializable,
    Ownable,
    ERC165Storage,
    ERC721
{
    string private _name;

    string private _symbol;

    string private _contractURI;

    function __ERC721CollectionMetadataExtension_init(
        string memory name_,
        string memory symbol_,
        string memory contractURI_
    ) internal onlyInitializing {
        __ERC721CollectionMetadataExtension_init_unchained(
            name_,
            symbol_,
            contractURI_
        );
    }

    function __ERC721CollectionMetadataExtension_init_unchained(
        string memory name_,
        string memory symbol_,
        string memory contractURI_
    ) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
        _contractURI = contractURI_;

        _registerInterface(
            type(IERC721CollectionMetadataExtension).interfaceId
        );
        _registerInterface(type(IERC721).interfaceId);
        _registerInterface(type(IERC721Metadata).interfaceId);
    }

    /* ADMIN */

    function setContractURI(string memory newValue) external onlyOwner {
        _contractURI = newValue;
    }

    /* PUBLIC */

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165Storage, ERC721)
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }

    function name() public view virtual override returns (string memory) {
        return _name;
    }

    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    function contractURI() public view returns (string memory) {
        return _contractURI;
    }
}

File 20 of 28 : ERC721LockableExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity ^0.8.9;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import "@openzeppelin/contracts/utils/structs/BitMaps.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./ERC721AutoIdMinterExtension.sol";

interface IERC721LockableExtension {
    function locked(uint256 tokenId) external view returns (bool);

    function lock(uint256 tokenId) external;

    function lock(uint256[] calldata tokenIds) external;

    function unlock(uint256 tokenId) external;

    function unlock(uint256[] calldata tokenIds) external;
}

/**
 * @dev Extension to allow locking NFTs, for use-cases like staking, without leaving holders wallet.
 */
abstract contract ERC721LockableExtension is
    IERC721LockableExtension,
    Initializable,
    ERC165Storage,
    ERC721AutoIdMinterExtension,
    ReentrancyGuard
{
    using BitMaps for BitMaps.BitMap;

    BitMaps.BitMap internal lockedTokens;

    function __ERC721LockableExtension_init() internal onlyInitializing {
        __ERC721LockableExtension_init_unchained();
    }

    function __ERC721LockableExtension_init_unchained()
        internal
        onlyInitializing
    {
        _registerInterface(type(IERC721LockableExtension).interfaceId);
    }

    // PUBLIC

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165Storage, ERC721CollectionMetadataExtension)
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }

    /**
     * Returns if a token is locked or not.
     */
    function locked(uint256 tokenId) public view virtual returns (bool) {
        return lockedTokens.get(tokenId);
    }

    function filterUnlocked(uint256[] calldata ticketTokenIds)
        public
        view
        returns (uint256[] memory)
    {
        uint256[] memory unlocked = new uint256[](ticketTokenIds.length);

        for (uint256 i = 0; i < ticketTokenIds.length; i++) {
            if (!locked(ticketTokenIds[i])) {
                unlocked[i] = ticketTokenIds[i];
            }
        }

        return unlocked;
    }

    /* INTERNAL */

    /**
     * At this moment staking is only possible from a certain address (usually a smart contract).
     *
     * This is because in almost all cases you want another contract to perform custom logic on lock and unlock operations,
     * without allowing users to directly unlock their tokens and sell them, for example.
     */
    function _lock(uint256 tokenId) internal virtual {
        require(!lockedTokens.get(tokenId), "LOCKED");
        lockedTokens.set(tokenId);
    }

    function _unlock(uint256 tokenId) internal virtual {
        require(lockedTokens.get(tokenId), "NOT_LOCKED");
        lockedTokens.unset(tokenId);
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override(ERC721) {
        require(!lockedTokens.get(tokenId), "LOCKED");
        super._beforeTokenTransfer(from, to, tokenId);
    }
}

File 21 of 28 : WithdrawExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

enum WithdrawMode {
    OWNER,
    RECIPIENT,
    ANYONE,
    NOBODY
}

interface IWithdrawExtension {
    function setWithdrawRecipient(address _withdrawRecipient) external;

    function lockWithdrawRecipient() external;

    function revokeWithdrawPower() external;

    function setWithdrawMode(WithdrawMode _withdrawMode) external;

    function lockWithdrawMode() external;

    function withdraw(
        address[] calldata claimTokens,
        uint256[] calldata amounts
    ) external;
}

abstract contract WithdrawExtension is
    IWithdrawExtension,
    Initializable,
    Ownable,
    ERC165Storage
{
    using Address for address;
    using Address for address payable;

    event WithdrawPowerRevoked();
    event Withdrawn(address[] claimTokens, uint256[] amounts);

    address public withdrawRecipient;
    bool public withdrawRecipientLocked;

    bool public withdrawPowerRevoked;

    WithdrawMode public withdrawMode;
    bool public withdrawModeLocked;

    /* INTERNAL */

    function __WithdrawExtension_init(
        address _withdrawRecipient,
        WithdrawMode _withdrawMode
    ) internal onlyInitializing {
        __WithdrawExtension_init_unchained(_withdrawRecipient, _withdrawMode);
    }

    function __WithdrawExtension_init_unchained(
        address _withdrawRecipient,
        WithdrawMode _withdrawMode
    ) internal onlyInitializing {
        _registerInterface(type(IWithdrawExtension).interfaceId);

        withdrawRecipient = _withdrawRecipient;
        withdrawMode = _withdrawMode;
    }

    /* ADMIN */

    function setWithdrawRecipient(address _withdrawRecipient)
        external
        onlyOwner
    {
        require(!withdrawRecipientLocked, "LOCKED");
        withdrawRecipient = _withdrawRecipient;
    }

    function lockWithdrawRecipient() external onlyOwner {
        require(!withdrawRecipientLocked, "LOCKED");
        withdrawRecipientLocked = true;
    }

    function setWithdrawMode(WithdrawMode _withdrawMode) external onlyOwner {
        require(!withdrawModeLocked, "LOCKED");
        withdrawMode = _withdrawMode;
    }

    function lockWithdrawMode() external onlyOwner {
        require(!withdrawModeLocked, "OCKED");
        withdrawModeLocked = true;
    }

    /* PUBLIC */

    function withdraw(
        address[] calldata claimTokens,
        uint256[] calldata amounts
    ) external {
        /**
         * We are using msg.sender for smaller attack surface when evaluating
         * the sender of the function call. If in future we want to handle "withdraw"
         * functionality via meta transactions, we should consider using `_msgSender`
         */
        _assertWithdrawAccess(msg.sender);

        require(withdrawRecipient != address(0), "WITHDRAW/NO_RECIPIENT");
        require(!withdrawPowerRevoked, "WITHDRAW/EMERGENCY_POWER_REVOKED");

        for (uint256 i = 0; i < claimTokens.length; i++) {
            if (claimTokens[i] == address(0)) {
                payable(withdrawRecipient).sendValue(amounts[i]);
            } else {
                IERC20(claimTokens[i]).transfer(withdrawRecipient, amounts[i]);
            }
        }

        emit Withdrawn(claimTokens, amounts);
    }

    function revokeWithdrawPower() external onlyOwner {
        withdrawPowerRevoked = true;
        emit WithdrawPowerRevoked();
    }

    /* INTERNAL */

    function _assertWithdrawAccess(address account) internal view {
        if (withdrawMode == WithdrawMode.NOBODY) {
            revert("WITHDRAW/LOCKED");
        } else if (withdrawMode == WithdrawMode.ANYONE) {
            return;
        } else if (withdrawMode == WithdrawMode.RECIPIENT) {
            require(withdrawRecipient == account, "WITHDRAW/ONLY_RECIPIENT");
        } else if (withdrawMode == WithdrawMode.OWNER) {
            require(owner() == account, "WITHDRAW/ONLY_OWNER");
        }
    }
}

File 22 of 28 : ERC721MultiTokenStream.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

interface IERC721MultiTokenStream {
    // Claim native currency for a single ticket token
    function claim(uint256 ticketTokenId) external;

    // Claim an erc20 claim token for a single ticket token
    function claim(uint256 ticketTokenId, address claimToken) external;

    // Claim native currency for multiple ticket tokens (only if all owned by sender)
    function claim(uint256[] calldata ticketTokenIds) external;

    // Claim native or erc20 tokens for multiple ticket tokens (only if all owned by `owner`)
    function claim(
        uint256[] calldata ticketTokenIds,
        address claimToken,
        address owner
    ) external;

    // Total native currency ever supplied to this stream
    function streamTotalSupply() external view returns (uint256);

    // Total erc20 token ever supplied to this stream by claim token address
    function streamTotalSupply(address claimToken)
        external
        view
        returns (uint256);

    // Total native currency ever claimed from this stream
    function streamTotalClaimed() external view returns (uint256);

    // Total erc20 token ever claimed from this stream by claim token address
    function streamTotalClaimed(address claimToken)
        external
        view
        returns (uint256);

    // Total native currency ever claimed for a single ticket token
    function streamTotalClaimed(uint256 ticketTokenId)
        external
        view
        returns (uint256);

    // Total native currency ever claimed for multiple token IDs
    function streamTotalClaimed(uint256[] calldata ticketTokenIds)
        external
        view
        returns (uint256);

    // Total erc20 token ever claimed for multiple token IDs
    function streamTotalClaimed(
        uint256[] calldata ticketTokenIds,
        address claimToken
    ) external view returns (uint256);

    // Calculate currently claimable amount for a specific ticket token ID and a specific claim token address
    // Pass 0x0000000000000000000000000000000000000000 as claim token to represent native currency
    function streamClaimableAmount(uint256 ticketTokenId, address claimToken)
        external
        view
        returns (uint256 claimableAmount);
}

abstract contract ERC721MultiTokenStream is
    IERC721MultiTokenStream,
    Initializable,
    Ownable,
    ERC165Storage,
    ReentrancyGuard
{
    using Address for address;
    using Address for address payable;

    struct Entitlement {
        uint256 totalClaimed;
        uint256 lastClaimedAt;
    }

    // Config
    address public ticketToken;

    // Locks changing the config until this timestamp is reached
    uint64 public lockedUntilTimestamp;

    // Map of ticket token ID -> claim token address -> entitlement
    mapping(uint256 => mapping(address => Entitlement)) public entitlements;

    // Map of claim token address -> Total amount claimed by all holders
    mapping(address => uint256) internal _streamTotalClaimed;

    /* EVENTS */

    event Claim(
        address operator,
        address beneficiary,
        uint256 ticketTokenId,
        address claimToken,
        uint256 releasedAmount
    );

    event ClaimMany(
        address operator,
        address beneficiary,
        uint256[] ticketTokenIds,
        address claimToken,
        uint256 releasedAmount
    );

    function __ERC721MultiTokenStream_init(
        address _ticketToken,
        uint64 _lockedUntilTimestamp
    ) internal onlyInitializing {
        __ERC721MultiTokenStream_init_unchained(
            _ticketToken,
            _lockedUntilTimestamp
        );
    }

    function __ERC721MultiTokenStream_init_unchained(
        address _ticketToken,
        uint64 _lockedUntilTimestamp
    ) internal onlyInitializing {
        ticketToken = _ticketToken;
        lockedUntilTimestamp = _lockedUntilTimestamp;

        _registerInterface(type(IERC721MultiTokenStream).interfaceId);
    }

    /* ADMIN */

    function lockUntil(uint64 newValue) public onlyOwner {
        require(newValue > lockedUntilTimestamp, "CANNOT_REWIND");
        lockedUntilTimestamp = newValue;
    }

    /* PUBLIC */

    receive() external payable {
        require(msg.value > 0);
    }

    function claim(uint256 ticketTokenId) public {
        claim(ticketTokenId, address(0));
    }

    function claim(uint256 ticketTokenId, address claimToken)
        public
        nonReentrant
    {
        /* CHECKS */
        address beneficiary = _msgSender();
        _beforeClaim(ticketTokenId, claimToken, beneficiary);

        uint256 claimable = streamClaimableAmount(ticketTokenId, claimToken);
        require(claimable > 0, "NOTHING_TO_CLAIM");

        /* EFFECTS */

        entitlements[ticketTokenId][claimToken].totalClaimed += claimable;
        entitlements[ticketTokenId][claimToken].lastClaimedAt = block.timestamp;

        _streamTotalClaimed[claimToken] += claimable;

        /* INTERACTIONS */

        if (claimToken == address(0)) {
            payable(address(beneficiary)).sendValue(claimable);
        } else {
            IERC20(claimToken).transfer(beneficiary, claimable);
        }

        /* LOGS */

        emit Claim(
            _msgSender(),
            beneficiary,
            ticketTokenId,
            claimToken,
            claimable
        );
    }

    function claim(uint256[] calldata ticketTokenIds) public {
        claim(ticketTokenIds, address(0), _msgSender());
    }

    function claim(
        uint256[] calldata ticketTokenIds,
        address claimToken,
        address beneficiary
    ) public nonReentrant {
        uint256 totalClaimable;

        for (uint256 i = 0; i < ticketTokenIds.length; i++) {
            _beforeClaim(ticketTokenIds[i], claimToken, beneficiary);

            /* EFFECTS */
            uint256 claimable = streamClaimableAmount(
                ticketTokenIds[i],
                claimToken
            );

            if (claimable > 0) {
                entitlements[ticketTokenIds[i]][claimToken]
                    .totalClaimed += claimable;
                entitlements[ticketTokenIds[i]][claimToken]
                    .lastClaimedAt = block.timestamp;

                totalClaimable += claimable;
            }
        }

        _streamTotalClaimed[claimToken] += totalClaimable;

        /* INTERACTIONS */

        if (claimToken == address(0)) {
            payable(address(beneficiary)).sendValue(totalClaimable);
        } else {
            IERC20(claimToken).transfer(beneficiary, totalClaimable);
        }

        /* LOGS */

        emit ClaimMany(
            _msgSender(),
            beneficiary,
            ticketTokenIds,
            claimToken,
            totalClaimable
        );
    }

    /* READ ONLY */

    function streamTotalSupply() public view returns (uint256) {
        return streamTotalSupply(address(0));
    }

    function streamTotalSupply(address claimToken)
        public
        view
        returns (uint256)
    {
        if (claimToken == address(0)) {
            return _streamTotalClaimed[claimToken] + address(this).balance;
        }

        return
            _streamTotalClaimed[claimToken] +
            IERC20(claimToken).balanceOf(address(this));
    }

    function streamTotalClaimed() public view returns (uint256) {
        return _streamTotalClaimed[address(0)];
    }

    function streamTotalClaimed(address claimToken)
        public
        view
        returns (uint256)
    {
        return _streamTotalClaimed[claimToken];
    }

    function streamTotalClaimed(uint256 ticketTokenId)
        public
        view
        returns (uint256)
    {
        return entitlements[ticketTokenId][address(0)].totalClaimed;
    }

    function streamTotalClaimed(uint256 ticketTokenId, address claimToken)
        public
        view
        returns (uint256)
    {
        return entitlements[ticketTokenId][claimToken].totalClaimed;
    }

    function streamTotalClaimed(uint256[] calldata ticketTokenIds)
        public
        view
        returns (uint256)
    {
        return streamTotalClaimed(ticketTokenIds, address(0));
    }

    function streamTotalClaimed(
        uint256[] calldata ticketTokenIds,
        address claimToken
    ) public view returns (uint256) {
        uint256 claimed = 0;

        for (uint256 i = 0; i < ticketTokenIds.length; i++) {
            claimed += entitlements[ticketTokenIds[i]][claimToken].totalClaimed;
        }

        return claimed;
    }

    function streamClaimableAmount(
        uint256[] calldata ticketTokenIds,
        address claimToken
    ) public view returns (uint256) {
        uint256 claimable = 0;

        for (uint256 i = 0; i < ticketTokenIds.length; i++) {
            claimable += streamClaimableAmount(ticketTokenIds[i], claimToken);
        }

        return claimable;
    }

    function streamClaimableAmount(uint256 ticketTokenId)
        public
        view
        returns (uint256)
    {
        return streamClaimableAmount(ticketTokenId, address(0));
    }

    function streamClaimableAmount(uint256 ticketTokenId, address claimToken)
        public
        view
        virtual
        returns (uint256)
    {
        uint256 totalReleased = _totalTokenReleasedAmount(
            _totalStreamReleasedAmount(
                streamTotalSupply(claimToken),
                ticketTokenId,
                claimToken
            ),
            ticketTokenId,
            claimToken
        );

        return
            totalReleased -
            entitlements[ticketTokenId][claimToken].totalClaimed;
    }

    function _totalStreamReleasedAmount(
        uint256 streamTotalSupply_,
        uint256 ticketTokenId_,
        address claimToken_
    ) internal view virtual returns (uint256);

    function _totalTokenReleasedAmount(
        uint256 totalReleasedAmount_,
        uint256 ticketTokenId_,
        address claimToken_
    ) internal view virtual returns (uint256);

    /* INTERNAL */

    function _beforeClaim(
        uint256 ticketTokenId_,
        address claimToken_,
        address beneficiary_
    ) internal virtual {
        require(
            IERC721(ticketToken).ownerOf(ticketTokenId_) == beneficiary_,
            "NOT_NFT_OWNER"
        );
    }
}

File 23 of 28 : ERC721EmissionReleaseExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import "../base/ERC721MultiTokenStream.sol";

interface IERC721EmissionReleaseExtension {
    function hasERC721EmissionReleaseExtension() external view returns (bool);

    function setEmissionRate(uint256 newValue) external;

    function setEmissionTimeUnit(uint64 newValue) external;

    function setEmissionStart(uint64 newValue) external;

    function setEmissionEnd(uint64 newValue) external;

    function releasedAmountUntil(uint64 calcUntil)
        external
        view
        returns (uint256);

    function emissionAmountUntil(uint64 calcUntil)
        external
        view
        returns (uint256);

    function rateByToken(uint256[] calldata tokenIds)
        external
        view
        returns (uint256);
}

/**
 * @author Flair (https://flair.finance)
 */
abstract contract ERC721EmissionReleaseExtension is
    IERC721EmissionReleaseExtension,
    Initializable,
    Ownable,
    ERC165Storage,
    ERC721MultiTokenStream
{
    // Number of tokens released every `emissionTimeUnit`
    uint256 public emissionRate;

    // Time unit to release tokens, users can only claim once every `emissionTimeUnit`
    uint64 public emissionTimeUnit;

    // When emission and calculating tokens starts
    uint64 public emissionStart;

    // When to stop calculating the tokens released
    uint64 public emissionEnd;

    /* INIT */

    function __ERC721EmissionReleaseExtension_init(
        uint256 _emissionRate,
        uint64 _emissionTimeUnit,
        uint64 _emissionStart,
        uint64 _emissionEnd
    ) internal onlyInitializing {
        __ERC721EmissionReleaseExtension_init_unchained(
            _emissionRate,
            _emissionTimeUnit,
            _emissionStart,
            _emissionEnd
        );
    }

    function __ERC721EmissionReleaseExtension_init_unchained(
        uint256 _emissionRate,
        uint64 _emissionTimeUnit,
        uint64 _emissionStart,
        uint64 _emissionEnd
    ) internal onlyInitializing {
        emissionRate = _emissionRate;
        emissionTimeUnit = _emissionTimeUnit;
        emissionStart = _emissionStart;
        emissionEnd = _emissionEnd;

        _registerInterface(type(IERC721EmissionReleaseExtension).interfaceId);
    }

    /* ADMIN */

    function setEmissionRate(uint256 newValue) public onlyOwner {
        require(lockedUntilTimestamp < block.timestamp, "CONFIG_LOCKED");
        emissionRate = newValue;
    }

    function setEmissionTimeUnit(uint64 newValue) public onlyOwner {
        require(lockedUntilTimestamp < block.timestamp, "CONFIG_LOCKED");
        emissionTimeUnit = newValue;
    }

    function setEmissionStart(uint64 newValue) public onlyOwner {
        require(lockedUntilTimestamp < block.timestamp, "CONFIG_LOCKED");
        emissionStart = newValue;
    }

    function setEmissionEnd(uint64 newValue) public onlyOwner {
        require(lockedUntilTimestamp < block.timestamp, "CONFIG_LOCKED");
        emissionEnd = newValue;
    }

    /* PUBLIC */

    function hasERC721EmissionReleaseExtension() external pure returns (bool) {
        return true;
    }

    function releasedAmountUntil(uint64 calcUntil)
        public
        view
        virtual
        returns (uint256)
    {
        return
            emissionRate *
            // Intentionally rounded down:
            ((calcUntil - emissionStart) / emissionTimeUnit);
    }

    function emissionAmountUntil(uint64 calcUntil)
        public
        view
        virtual
        returns (uint256)
    {
        return ((calcUntil - emissionStart) * emissionRate) / emissionTimeUnit;
    }

    function rateByToken(uint256[] calldata tokenIds)
        public
        view
        virtual
        returns (uint256);

    /* INTERNAL */

    function _totalStreamReleasedAmount(
        uint256 streamTotalSupply_,
        uint256 ticketTokenId_,
        address claimToken_
    ) internal view virtual override returns (uint256) {
        streamTotalSupply_;
        ticketTokenId_;
        claimToken_;

        if (block.timestamp < emissionStart) {
            return 0;
        } else if (emissionEnd > 0 && block.timestamp > emissionEnd) {
            return releasedAmountUntil(emissionEnd);
        } else {
            return releasedAmountUntil(uint64(block.timestamp));
        }
    }

    function _beforeClaim(
        uint256 ticketTokenId_,
        address claimToken_,
        address beneficiary_
    ) internal virtual override {
        beneficiary_;

        require(emissionStart < block.timestamp, "NOT_STARTED");

        require(
            entitlements[ticketTokenId_][claimToken_].lastClaimedAt <
                block.timestamp - emissionTimeUnit,
            "TOO_EARLY"
        );
    }
}

File 24 of 28 : ERC721EqualSplitExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import "../base/ERC721MultiTokenStream.sol";

interface IERC721EqualSplitExtension {
    function hasERC721EqualSplitExtension() external view returns (bool);

    function setTotalTickets(uint256 newValue) external;
}

abstract contract ERC721EqualSplitExtension is
    IERC721EqualSplitExtension,
    Initializable,
    Ownable,
    ERC165Storage,
    ERC721MultiTokenStream
{
    // Total number of ERC721 tokens to calculate their equal split share
    uint256 public totalTickets;

    /* INTERNAL */

    function __ERC721EqualSplitExtension_init(uint256 _totalTickets)
        internal
        onlyInitializing
    {
        __ERC721EqualSplitExtension_init_unchained(_totalTickets);
    }

    function __ERC721EqualSplitExtension_init_unchained(uint256 _totalTickets)
        internal
        onlyInitializing
    {
        totalTickets = _totalTickets;

        _registerInterface(type(IERC721EqualSplitExtension).interfaceId);
    }

    /* ADMIN */

    function setTotalTickets(uint256 newValue) public onlyOwner {
        require(lockedUntilTimestamp < block.timestamp, "CONFIG_LOCKED");
        totalTickets = newValue;
    }

    /* PUBLIC */

    function hasERC721EqualSplitExtension() external pure returns (bool) {
        return true;
    }

    /* INTERNAL */

    function _totalTokenReleasedAmount(
        uint256 totalReleasedAmount_,
        uint256 ticketTokenId_,
        address claimToken_
    ) internal view virtual override returns (uint256) {
        ticketTokenId_;
        claimToken_;

        return totalReleasedAmount_ / totalTickets;
    }
}

File 25 of 28 : ERC721LockableClaimExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import "../base/ERC721MultiTokenStream.sol";

interface IERC721LockableClaimExtension {
    function hasERC721LockableClaimExtension() external view returns (bool);

    function setClaimLockedUntil(uint64 newValue) external;
}

abstract contract ERC721LockableClaimExtension is
    IERC721LockableClaimExtension,
    Initializable,
    Ownable,
    ERC165Storage,
    ERC721MultiTokenStream
{
    // Claiming is only possible after this time (unix timestamp)
    uint64 public claimLockedUntil;

    /* INTERNAL */

    function __ERC721LockableClaimExtension_init(uint64 _claimLockedUntil)
        internal
        onlyInitializing
    {
        __ERC721LockableClaimExtension_init_unchained(_claimLockedUntil);
    }

    function __ERC721LockableClaimExtension_init_unchained(
        uint64 _claimLockedUntil
    ) internal onlyInitializing {
        claimLockedUntil = _claimLockedUntil;

        _registerInterface(type(IERC721LockableClaimExtension).interfaceId);
    }

    /* ADMIN */

    function setClaimLockedUntil(uint64 newValue) public onlyOwner {
        require(lockedUntilTimestamp < block.timestamp, "CONFIG_LOCKED");
        claimLockedUntil = newValue;
    }

    /* PUBLIC */

    function hasERC721LockableClaimExtension() external pure returns (bool) {
        return true;
    }

    /* INTERNAL */

    function _beforeClaim(
        uint256 ticketTokenId_,
        address claimToken_,
        address beneficiary_
    ) internal virtual override {
        ticketTokenId_;
        claimToken_;
        beneficiary_;

        require(claimLockedUntil < block.timestamp, "CLAIM_LOCKED");
    }
}

File 26 of 28 : ERC721LockedStakingExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import {IERC721LockableExtension} from "../../../collections/ERC721/extensions/ERC721LockableExtension.sol";

import "./ERC721StakingExtension.sol";

/**
 * @author Flair (https://flair.finance)
 */
interface IERC721LockedStakingExtension {
    function hasERC721LockedStakingExtension() external view returns (bool);
}

/**
 * @author Flair (https://flair.finance)
 */
abstract contract ERC721LockedStakingExtension is
    IERC721LockedStakingExtension,
    ERC721StakingExtension
{
    /* INIT */

    function __ERC721LockedStakingExtension_init(
        uint64 _minStakingDuration,
        uint64 _maxStakingTotalDurations
    ) internal onlyInitializing {
        __ERC721LockedStakingExtension_init_unchained();
        __ERC721StakingExtension_init_unchained(
            _minStakingDuration,
            _maxStakingTotalDurations
        );
    }

    function __ERC721LockedStakingExtension_init_unchained()
        internal
        onlyInitializing
    {
        _registerInterface(type(IERC721LockedStakingExtension).interfaceId);
    }

    /* PUBLIC */

    function hasERC721LockedStakingExtension() external pure returns (bool) {
        return true;
    }

    function stake(uint256 tokenId) public virtual override {
        ERC721StakingExtension.stake(tokenId);
        IERC721LockableExtension(ticketToken).lock(tokenId);
    }

    function stake(uint256[] calldata tokenIds) public virtual override {
        ERC721StakingExtension.stake(tokenIds);
        IERC721LockableExtension(ticketToken).lock(tokenIds);
    }

    function unstake(uint256 tokenId) public virtual override {
        ERC721StakingExtension.unstake(tokenId);
        IERC721LockableExtension(ticketToken).unlock(tokenId);
    }

    function unstake(uint256[] calldata tokenIds) public virtual override {
        ERC721StakingExtension.unstake(tokenIds);
        IERC721LockableExtension(ticketToken).unlock(tokenIds);
    }

    function _stake(
        address operator,
        uint64 currentTime,
        uint256 tokenId
    ) internal virtual override {
        require(
            operator == IERC721(ticketToken).ownerOf(tokenId),
            "NOT_TOKEN_OWNER"
        );
        ERC721StakingExtension._stake(operator, currentTime, tokenId);
    }

    function _unstake(
        address operator,
        uint64 currentTime,
        uint256 tokenId
    ) internal virtual override {
        require(
            operator == IERC721(ticketToken).ownerOf(tokenId),
            "NOT_TOKEN_OWNER"
        );
        ERC721StakingExtension._unstake(operator, currentTime, tokenId);
    }
}

File 27 of 28 : ERC721StakingExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import "../base/ERC721MultiTokenStream.sol";

/**
 * @author Flair (https://flair.finance)
 */
interface IERC721StakingExtension {
    function hasERC721StakingExtension() external view returns (bool);

    function stake(uint256 tokenId) external;

    function stake(uint256[] calldata tokenIds) external;
}

/**
 * @author Flair (https://flair.finance)
 */
abstract contract ERC721StakingExtension is
    IERC721StakingExtension,
    Initializable,
    Ownable,
    ERC165Storage,
    ERC721MultiTokenStream
{
    // Minimum seconds that token must be staked before unstaking.
    uint64 public minStakingDuration;

    // Maximum sum total of all durations staking that will be counted (across all stake/unstakes for each token). Staked durations beyond this number is ignored.
    uint64 public maxStakingTotalDurations;

    // Map of token ID to the time of last staking
    mapping(uint256 => uint64) public lastStakingTime;

    // Map of token ID to the sum total of all previous staked durations
    mapping(uint256 => uint64) public savedStakedDurations;

    /* INIT */

    function __ERC721StakingExtension_init(
        uint64 _minStakingDuration,
        uint64 _maxStakingTotalDurations
    ) internal onlyInitializing {
        __ERC721StakingExtension_init_unchained(
            _minStakingDuration,
            _maxStakingTotalDurations
        );
    }

    function __ERC721StakingExtension_init_unchained(
        uint64 _minStakingDuration,
        uint64 _maxStakingTotalDurations
    ) internal onlyInitializing {
        minStakingDuration = _minStakingDuration;
        maxStakingTotalDurations = _maxStakingTotalDurations;

        _registerInterface(type(IERC721StakingExtension).interfaceId);
    }

    /* ADMIN */

    function setMinStakingDuration(uint64 newValue) public onlyOwner {
        require(lockedUntilTimestamp < block.timestamp, "CONFIG_LOCKED");
        minStakingDuration = newValue;
    }

    function setMaxStakingTotalDurations(uint64 newValue) public onlyOwner {
        require(lockedUntilTimestamp < block.timestamp, "CONFIG_LOCKED");
        maxStakingTotalDurations = newValue;
    }

    /* PUBLIC */

    function hasERC721StakingExtension() external pure returns (bool) {
        return true;
    }

    function stake(uint256 tokenId) public virtual {
        _stake(_msgSender(), uint64(block.timestamp), tokenId);
    }

    function stake(uint256[] calldata tokenIds) public virtual {
        address operator = _msgSender();
        uint64 currentTime = uint64(block.timestamp);

        for (uint256 i = 0; i < tokenIds.length; i++) {
            _stake(operator, currentTime, tokenIds[i]);
        }
    }

    function unstake(uint256 tokenId) public virtual {
        _unstake(_msgSender(), uint64(block.timestamp), tokenId);
    }

    function unstake(uint256[] calldata tokenIds) public virtual {
        address operator = _msgSender();
        uint64 currentTime = uint64(block.timestamp);

        for (uint256 i = 0; i < tokenIds.length; i++) {
            _unstake(operator, currentTime, tokenIds[i]);
        }
    }

    function totalStakedDuration(uint256[] calldata ticketTokenIds)
        public
        view
        virtual
        returns (uint64)
    {
        uint64 totalDurations = 0;

        for (uint256 i = 0; i < ticketTokenIds.length; i++) {
            totalDurations += totalStakedDuration(ticketTokenIds[i]);
        }

        return totalDurations;
    }

    function totalStakedDuration(uint256 ticketTokenId)
        public
        view
        virtual
        returns (uint64)
    {
        uint64 total = savedStakedDurations[ticketTokenId];

        if (lastStakingTime[ticketTokenId] > 0) {
            uint64 targetTime = _stakingTimeLimit();

            if (targetTime > block.timestamp) {
                targetTime = uint64(block.timestamp);
            }

            if (lastStakingTime[ticketTokenId] > 0) {
                if (targetTime > lastStakingTime[ticketTokenId]) {
                    total += (targetTime - lastStakingTime[ticketTokenId]);
                }
            }
        }

        if (total > maxStakingTotalDurations) {
            total = maxStakingTotalDurations;
        }

        return total;
    }

    function unlockingTime(uint256 ticketTokenId)
        public
        view
        returns (uint256)
    {
        return
            lastStakingTime[ticketTokenId] > 0
                ? lastStakingTime[ticketTokenId] + minStakingDuration
                : 0;
    }

    function unlockingTime(uint256[] calldata ticketTokenIds)
        public
        view
        returns (uint256[] memory)
    {
        uint256[] memory unlockedAt = new uint256[](ticketTokenIds.length);

        for (uint256 i = 0; i < ticketTokenIds.length; i++) {
            unlockedAt[i] = unlockingTime(ticketTokenIds[i]);
        }

        return unlockedAt;
    }

    /* INTERNAL */

    function _stakingTimeLimit() internal view virtual returns (uint64) {
        return 18_446_744_073_709_551_615; // max(uint64)
    }

    function _stake(
        address operator,
        uint64 currentTime,
        uint256 tokenId
    ) internal virtual {
        require(
            totalStakedDuration(tokenId) < maxStakingTotalDurations,
            "MAX_DURATION_EXCEEDED"
        );

        lastStakingTime[tokenId] = currentTime;
    }

    function _unstake(
        address operator,
        uint64 currentTime,
        uint256 tokenId
    ) internal virtual {
        operator;

        require(lastStakingTime[tokenId] > 0, "NOT_STAKED");

        require(
            currentTime >= lastStakingTime[tokenId] + minStakingDuration,
            "NOT_STAKED_LONG_ENOUGH"
        );

        savedStakedDurations[tokenId] = totalStakedDuration(tokenId);

        lastStakingTime[tokenId] = 0;
    }
}

File 28 of 28 : ERC721LockedStakingEmissionStream.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import "../../../common/WithdrawExtension.sol";
import "../extensions/ERC721EmissionReleaseExtension.sol";
import "../extensions/ERC721EqualSplitExtension.sol";
import "../extensions/ERC721LockedStakingExtension.sol";
import "../extensions/ERC721LockableClaimExtension.sol";

/**
 * @author Flair (https://flair.finance)
 */
contract ERC721LockedStakingEmissionStream is
    Initializable,
    Ownable,
    ERC721EmissionReleaseExtension,
    ERC721EqualSplitExtension,
    ERC721LockedStakingExtension,
    ERC721LockableClaimExtension,
    WithdrawExtension
{
    using Address for address;
    using Address for address payable;

    string public constant name = "ERC721 Locked Staking Emission Stream";

    string public constant version = "0.1";

    struct Config {
        // Base
        address ticketToken;
        uint64 lockedUntilTimestamp;
        // Locked staking extension
        uint64 minStakingDuration; // in seconds. Minimum time the NFT must stay locked before unstaking.
        uint64 maxStakingTotalDurations; // in seconds. Maximum sum total of all durations staking that will be counted (across all stake/unstakes for each token).
        // Emission release extension
        uint256 emissionRate;
        uint64 emissionTimeUnit;
        uint64 emissionStart;
        uint64 emissionEnd;
        // Equal split extension
        uint256 totalTickets;
        // Lockable claim extension
        uint64 claimLockedUntil;
    }

    /* INTERNAL */

    constructor(Config memory config) {
        initialize(config, msg.sender);
    }

    function initialize(Config memory config, address deployer)
        public
        initializer
    {
        _transferOwnership(deployer);

        __WithdrawExtension_init(deployer, WithdrawMode.OWNER);
        __ERC721MultiTokenStream_init(
            config.ticketToken,
            config.lockedUntilTimestamp
        );
        __ERC721LockedStakingExtension_init(
            config.minStakingDuration,
            config.maxStakingTotalDurations
        );
        __ERC721EmissionReleaseExtension_init(
            config.emissionRate,
            config.emissionTimeUnit,
            config.emissionStart,
            config.emissionEnd
        );
        __ERC721EqualSplitExtension_init(config.totalTickets);
        __ERC721LockableClaimExtension_init(config.claimLockedUntil);
    }

    function _totalStreamReleasedAmount(
        uint256 streamTotalSupply_,
        uint256 ticketTokenId_,
        address claimToken_
    )
        internal
        view
        virtual
        override(ERC721MultiTokenStream, ERC721EmissionReleaseExtension)
        returns (uint256)
    {
        // Removing the logic from emission extension because it is irrevelant when staking.
        return 0;
    }

    function _totalTokenReleasedAmount(
        uint256 totalReleasedAmount_,
        uint256 ticketTokenId_,
        address claimToken_
    )
        internal
        view
        virtual
        override(ERC721MultiTokenStream, ERC721EqualSplitExtension)
        returns (uint256)
    {
        totalReleasedAmount_;
        ticketTokenId_;
        claimToken_;

        // Get the rate per token to calculate based on stake duration
        return
            (emissionRate / totalTickets) *
            // Intentionally rounded down
            (totalStakedDuration(ticketTokenId_) / emissionTimeUnit);
    }

    function _stakingTimeLimit()
        internal
        view
        virtual
        override
        returns (uint64)
    {
        if (emissionEnd > 0) {
            return emissionEnd;
        }

        return super._stakingTimeLimit();
    }

    function _beforeClaim(
        uint256 ticketTokenId_,
        address claimToken_,
        address beneficiary_
    )
        internal
        override(
            ERC721MultiTokenStream,
            ERC721EmissionReleaseExtension,
            ERC721LockableClaimExtension
        )
    {
        ERC721MultiTokenStream._beforeClaim(
            ticketTokenId_,
            claimToken_,
            beneficiary_
        );
        ERC721LockableClaimExtension._beforeClaim(
            ticketTokenId_,
            claimToken_,
            beneficiary_
        );
        ERC721EmissionReleaseExtension._beforeClaim(
            ticketTokenId_,
            claimToken_,
            beneficiary_
        );
    }

    /* PUBLIC */

    function stake(uint256 tokenId) public override nonReentrant {
        require(uint64(block.timestamp) >= emissionStart, "NOT_STARTED_YET");

        super.stake(tokenId);
    }

    function stake(uint256[] calldata tokenIds) public override nonReentrant {
        require(uint64(block.timestamp) >= emissionStart, "NOT_STARTED_YET");

        super.stake(tokenIds);
    }

    function unstake(uint256 tokenId) public override nonReentrant {
        super.unstake(tokenId);
    }

    function unstake(uint256[] calldata tokenIds) public override nonReentrant {
        super.unstake(tokenIds);
    }

    function rateByToken(uint256[] calldata tokenIds)
        public
        view
        virtual
        override
        returns (uint256)
    {
        uint256 staked;

        for (uint256 i = 0; i < tokenIds.length; i++) {
            if (lastStakingTime[tokenIds[i]] > 0) {
                staked++;
            }
        }

        return (emissionRate * staked) / totalTickets;
    }

    function rewardAmountByToken(uint256 ticketTokenId)
        public
        view
        virtual
        returns (uint256)
    {
        return
            ((emissionRate * totalStakedDuration(ticketTokenId)) /
                totalTickets) / emissionTimeUnit;
    }

    function rewardAmountByToken(uint256[] calldata ticketTokenIds)
        public
        view
        virtual
        returns (uint256 total)
    {
        for (uint256 i = 0; i < ticketTokenIds.length; i++) {
            total += rewardAmountByToken(ticketTokenIds[i]);
        }
    }
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 6
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"components":[{"internalType":"address","name":"ticketToken","type":"address"},{"internalType":"uint64","name":"lockedUntilTimestamp","type":"uint64"},{"internalType":"uint64","name":"minStakingDuration","type":"uint64"},{"internalType":"uint64","name":"maxStakingTotalDurations","type":"uint64"},{"internalType":"uint256","name":"emissionRate","type":"uint256"},{"internalType":"uint64","name":"emissionTimeUnit","type":"uint64"},{"internalType":"uint64","name":"emissionStart","type":"uint64"},{"internalType":"uint64","name":"emissionEnd","type":"uint64"},{"internalType":"uint256","name":"totalTickets","type":"uint256"},{"internalType":"uint64","name":"claimLockedUntil","type":"uint64"}],"internalType":"struct ERC721LockedStakingEmissionStream.Config","name":"config","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"ticketTokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"claimToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"releasedAmount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ticketTokenIds","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"claimToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"releasedAmount","type":"uint256"}],"name":"ClaimMany","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[],"name":"WithdrawPowerRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"claimTokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"uint256","name":"ticketTokenId","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ticketTokenIds","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"ticketTokenId","type":"uint256"},{"internalType":"address","name":"claimToken","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ticketTokenIds","type":"uint256[]"},{"internalType":"address","name":"claimToken","type":"address"},{"internalType":"address","name":"beneficiary","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimLockedUntil","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"calcUntil","type":"uint64"}],"name":"emissionAmountUntil","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emissionEnd","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emissionRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emissionStart","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emissionTimeUnit","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"entitlements","outputs":[{"internalType":"uint256","name":"totalClaimed","type":"uint256"},{"internalType":"uint256","name":"lastClaimedAt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasERC721EmissionReleaseExtension","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"hasERC721EqualSplitExtension","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"hasERC721LockableClaimExtension","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"hasERC721LockedStakingExtension","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"hasERC721StakingExtension","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"ticketToken","type":"address"},{"internalType":"uint64","name":"lockedUntilTimestamp","type":"uint64"},{"internalType":"uint64","name":"minStakingDuration","type":"uint64"},{"internalType":"uint64","name":"maxStakingTotalDurations","type":"uint64"},{"internalType":"uint256","name":"emissionRate","type":"uint256"},{"internalType":"uint64","name":"emissionTimeUnit","type":"uint64"},{"internalType":"uint64","name":"emissionStart","type":"uint64"},{"internalType":"uint64","name":"emissionEnd","type":"uint64"},{"internalType":"uint256","name":"totalTickets","type":"uint256"},{"internalType":"uint64","name":"claimLockedUntil","type":"uint64"}],"internalType":"struct ERC721LockedStakingEmissionStream.Config","name":"config","type":"tuple"},{"internalType":"address","name":"deployer","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastStakingTime","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"newValue","type":"uint64"}],"name":"lockUntil","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockWithdrawMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockWithdrawRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockedUntilTimestamp","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxStakingTotalDurations","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minStakingDuration","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"rateByToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"calcUntil","type":"uint64"}],"name":"releasedAmountUntil","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revokeWithdrawPower","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ticketTokenIds","type":"uint256[]"}],"name":"rewardAmountByToken","outputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ticketTokenId","type":"uint256"}],"name":"rewardAmountByToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"savedStakedDurations","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"newValue","type":"uint64"}],"name":"setClaimLockedUntil","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"newValue","type":"uint64"}],"name":"setEmissionEnd","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setEmissionRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"newValue","type":"uint64"}],"name":"setEmissionStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"newValue","type":"uint64"}],"name":"setEmissionTimeUnit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"newValue","type":"uint64"}],"name":"setMaxStakingTotalDurations","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"newValue","type":"uint64"}],"name":"setMinStakingDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setTotalTickets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum WithdrawMode","name":"_withdrawMode","type":"uint8"}],"name":"setWithdrawMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_withdrawRecipient","type":"address"}],"name":"setWithdrawRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ticketTokenIds","type":"uint256[]"},{"internalType":"address","name":"claimToken","type":"address"}],"name":"streamClaimableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ticketTokenId","type":"uint256"}],"name":"streamClaimableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ticketTokenId","type":"uint256"},{"internalType":"address","name":"claimToken","type":"address"}],"name":"streamClaimableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ticketTokenIds","type":"uint256[]"},{"internalType":"address","name":"claimToken","type":"address"}],"name":"streamTotalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"streamTotalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ticketTokenIds","type":"uint256[]"}],"name":"streamTotalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ticketTokenId","type":"uint256"},{"internalType":"address","name":"claimToken","type":"address"}],"name":"streamTotalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"claimToken","type":"address"}],"name":"streamTotalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ticketTokenId","type":"uint256"}],"name":"streamTotalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"streamTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"claimToken","type":"address"}],"name":"streamTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ticketToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ticketTokenId","type":"uint256"}],"name":"totalStakedDuration","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ticketTokenIds","type":"uint256[]"}],"name":"totalStakedDuration","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTickets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ticketTokenIds","type":"uint256[]"}],"name":"unlockingTime","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ticketTokenId","type":"uint256"}],"name":"unlockingTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"claimTokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawMode","outputs":[{"internalType":"enum WithdrawMode","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawModeLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawPowerRevoked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawRecipientLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b50604051620046963803806200469683398101604081905262000034916200078e565b6200003f3362000057565b6001600255620000508133620000b2565b506200090a565b600080546001600160a01b038381166201000081810262010000600160b01b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b6000620000c06001620001b0565b90508015620000d9576000805461ff0019166101001790555b620000e48262000057565b620000f182600062000262565b825160208401516200010491906200029c565b6200011e83604001518460600151620002d260201b60201c565b6200014283608001518460a001518560c001518660e001516200031260201b60201c565b610100830151620001539062000350565b610120830151620001649062000388565b8015620001ab576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60008054610100900460ff161562000219578160ff166001148015620001e95750620001e730620003bd60201b620024971760201c565b155b620002115760405162461bcd60e51b815260040162000208906200085b565b60405180910390fd5b506000919050565b60005460ff808416911610620002435760405162461bcd60e51b815260040162000208906200085b565b506000805460ff191660ff92909216919091179055600190565b919050565b600054610100900460ff166200028c5760405162461bcd60e51b81526004016200020890620008a9565b620002988282620003cc565b5050565b600054610100900460ff16620002c65760405162461bcd60e51b81526004016200020890620008a9565b62000298828262000473565b600054610100900460ff16620002fc5760405162461bcd60e51b81526004016200020890620008a9565b62000306620004dd565b6200029882826200051b565b600054610100900460ff166200033c5760405162461bcd60e51b81526004016200020890620008a9565b6200034a8484848462000584565b50505050565b600054610100900460ff166200037a5760405162461bcd60e51b81526004016200020890620008a9565b62000385816200060f565b50565b600054610100900460ff16620003b25760405162461bcd60e51b81526004016200020890620008a9565b620003858162000650565b6001600160a01b03163b151590565b600054610100900460ff16620003f65760405162461bcd60e51b81526004016200020890620008a9565b6200040863ac2ba33360e01b620006a2565b600c8054600160401b600160e01b03198116680100000000000000006001600160a01b038616029081178355839291600160401b62ff000160e01b03191660ff60f01b1990911617600160f01b8360038111156200046a576200046a620008f4565b02179055505050565b600054610100900460ff166200049d5760405162461bcd60e51b81526004016200020890620008a9565b600380546001600160401b038316600160a01b026001600160e01b03199091166001600160a01b0385161717905562000298631ba050e960e21b620006a2565b600054610100900460ff16620005075760405162461bcd60e51b81526004016200020890620008a9565b6200051963d664280160e01b620006a2565b565b600054610100900460ff16620005455760405162461bcd60e51b81526004016200020890620008a9565b600980546001600160401b0383811668010000000000000000026001600160801b03199092169085161717905562000298633a41ba5360e11b620006a2565b600054610100900460ff16620005ae5760405162461bcd60e51b81526004016200020890620008a9565b6006849055600780546001600160401b03838116600160801b02600160801b600160c01b031986831668010000000000000000026001600160801b03199094169288169290921792909217161790556200034a63c9f600a960e01b620006a2565b600054610100900460ff16620006395760405162461bcd60e51b81526004016200020890620008a9565b600881905562000385632d5305cb60e21b620006a2565b600054610100900460ff166200067a5760405162461bcd60e51b81526004016200020890620008a9565b600c80546001600160401b0319166001600160401b038316179055620003856317b2ef4360e31b5b6001600160e01b03198082161415620006fe5760405162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015260640162000208565b6001600160e01b0319166000908152600160208190526040909120805460ff19169091179055565b60405161014081016001600160401b03811182821017156200075857634e487b7160e01b600052604160045260246000fd5b60405290565b80516001600160a01b03811681146200025d57600080fd5b80516001600160401b03811681146200025d57600080fd5b60006101408284031215620007a257600080fd5b620007ac62000726565b620007b7836200075e565b8152620007c76020840162000776565b6020820152620007da6040840162000776565b6040820152620007ed6060840162000776565b6060820152608083015160808201526200080a60a0840162000776565b60a08201526200081d60c0840162000776565b60c08201526200083060e0840162000776565b60e082015261010083810151908201526101206200085081850162000776565b908201529392505050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b613d7c806200091a6000396000f3fe60806040526004361061033a5760003560e01c80630191c0af1461035357806301ffc9a71461038657806306fdde03146103b657806308289dbe146103d857806308ae7e54146104265780630c805a44146104465780630fbf0a931461047c57806314427a961461049c5780631bc51b26146104bc5780631c725fdc146104d057806325289bad146104f05780632890d033146105175780632c0e13131461052c5780632c2330671461054c5780632d00b5871461056c5780632e17de781461059a57806333abcdbd146105ba578063379607f5146105da5780633a73f7d6146105fa5780633b3f12e21461061a5780633d2dded51461063a57806349561cb9146106775780634abb4c4914610698578063513da948146106c557806354fd4d50146106ec57806357dc48c81461071b5780636057e0ec1461076f57806361949636146107905780636ba4c138146107b0578063715018a6146107d057806378b094ca146107e5578063790c0c73146108055780638368909c14610825578063837fe1401461084c57806384fd5ae01461086157806389c6b815146108815780638da5cb5b146108a15780639199690b146104bc578063968d9b2c146108c357806396afc450146108e35780639edfe830146108f9578063a1bdb15e14610919578063a1cf649314610939578063a5549bc61461097c578063a5b23be71461099c578063a694fc3a146109bc578063a86b21e8146109dc578063a8a67c8c146109fc578063aaf2f99914610a1c578063ae890c0a14610a3c578063af121f5414610a5c578063c088184914610a7d578063c0bb38ff14610ab3578063c723955a14610ad3578063d0d6641d14610ae8578063d1335b69146104bc578063d4244f2414610b08578063d5ed4d5a14610b2f578063d6642801146104bc578063d97314f514610b4f578063da82b22714610b6f578063dcbe353f14610b84578063dd11247e14610bab578063dda8820f146104bc578063ddd5e1b214610bc1578063de6d6d9614610be1578063de76a67614610c01578063e449f34114610c21578063f2fde38b14610c41578063f389b6e414610c61578063f4415ad614610c81578063f593dfc814610cb9578063f66e38c214610cd957600080fd5b3661034e576000341161034c57600080fd5b005b600080fd5b34801561035f57600080fd5b5061037361036e366004613489565b610cf9565b6040519081526020015b60405180910390f35b34801561039257600080fd5b506103a66103a13660046134df565b610d4f565b604051901515815260200161037d565b3480156103c257600080fd5b506103cb610d8f565b60405161037d9190613509565b3480156103e457600080fd5b5061040e6103f336600461355e565b600b602052600090815260409020546001600160401b031681565b6040516001600160401b03909116815260200161037d565b34801561043257600080fd5b5060095461040e906001600160401b031681565b34801561045257600080fd5b5061040e61046136600461355e565b600a602052600090815260409020546001600160401b031681565b34801561048857600080fd5b5061034c610497366004613577565b610dab565b3480156104a857600080fd5b50600c5461040e906001600160401b031681565b3480156104c857600080fd5b5060016103a6565b3480156104dc57600080fd5b5061034c6104eb3660046135cf565b610e24565b3480156104fc57600080fd5b5060035461040e90600160a01b90046001600160401b031681565b34801561052357600080fd5b50610373610ed4565b34801561053857600080fd5b5061034c6105473660046135cf565b610ee5565b34801561055857600080fd5b5061034c6105673660046135ea565b610f68565b34801561057857600080fd5b50600c5461058d90600160f01b900460ff1681565b60405161037d9190613621565b3480156105a657600080fd5b5061034c6105b536600461355e565b610fee565b3480156105c657600080fd5b5061040e6105d536600461355e565b611025565b3480156105e657600080fd5b5061034c6105f536600461355e565b61111a565b34801561060657600080fd5b50610373610615366004613577565b611128565b34801561062657600080fd5b50610373610635366004613489565b61117a565b34801561064657600080fd5b506000805260056020527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc54610373565b34801561068357600080fd5b50600c546103a690600160f81b900460ff1681565b3480156106a457600080fd5b506106b86106b3366004613577565b6111f8565b60405161037d9190613649565b3480156106d157600080fd5b5060075461040e90600160401b90046001600160401b031681565b3480156106f857600080fd5b506103cb60405180604001604052806003815260200162302e3160e81b81525081565b34801561072757600080fd5b5061075a61073636600461368d565b60046020908152600092835260408084209091529082529020805460019091015482565b6040805192835260208301919091520161037d565b34801561077b57600080fd5b50600c546103a690600160e01b900460ff1681565b34801561079c57600080fd5b5060075461040e906001600160401b031681565b3480156107bc57600080fd5b5061034c6107cb366004613577565b6112a3565b3480156107dc57600080fd5b5061034c6112b4565b3480156107f157600080fd5b5061034c6108003660046135cf565b6112ef565b34801561081157600080fd5b506103736108203660046136bd565b61137c565b34801561083157600080fd5b5060075461040e90600160801b90046001600160401b031681565b34801561085857600080fd5b5061034c61144f565b34801561086d57600080fd5b5061037361087c366004613577565b6114bd565b34801561088d57600080fd5b5061037361089c366004613577565b611550565b3480156108ad57600080fd5b506108b6611565565b60405161037d91906136da565b3480156108cf57600080fd5b506103736108de36600461355e565b61157a565b3480156108ef57600080fd5b5061037360065481565b34801561090557600080fd5b506103736109143660046135cf565b611587565b34801561092557600080fd5b5061034c61093436600461355e565b6115cc565b34801561094557600080fd5b5061037361095436600461368d565b60009182526004602090815260408084206001600160a01b0393909316845291905290205490565b34801561098857600080fd5b5061034c6109973660046135cf565b611632565b3480156109a857600080fd5b506103736109b736600461355e565b6116b5565b3480156109c857600080fd5b5061034c6109d736600461355e565b6116fb565b3480156109e857600080fd5b506103736109f73660046135cf565b611761565b348015610a0857600080fd5b5061034c610a1736600461373b565b61179d565b348015610a2857600080fd5b5061034c610a373660046135cf565b61187c565b348015610a4857600080fd5b5061034c610a5736600461355e565b611909565b348015610a6857600080fd5b50600c546103a690600160e81b900460ff1681565b348015610a8957600080fd5b50610373610a983660046136bd565b6001600160a01b031660009081526005602052604090205490565b348015610abf57600080fd5b5061034c610ace3660046136bd565b61196f565b348015610adf57600080fd5b5061034c6119f4565b348015610af457600080fd5b50610373610b0336600461355e565b611a7c565b348015610b1457600080fd5b5060095461040e90600160401b90046001600160401b031681565b348015610b3b57600080fd5b506003546108b6906001600160a01b031681565b348015610b5b57600080fd5b5061034c610b6a3660046135cf565b611ad6565b348015610b7b57600080fd5b5061034c611b59565b348015610b9057600080fd5b50600c546108b690600160401b90046001600160a01b031681565b348015610bb757600080fd5b5061037360085481565b348015610bcd57600080fd5b5061034c610bdc36600461368d565b611bc6565b348015610bed57600080fd5b5061034c610bfc36600461381c565b611dcf565b348015610c0d57600080fd5b5061040e610c1c366004613577565b61202d565b348015610c2d57600080fd5b5061034c610c3c366004613577565b612079565b348015610c4d57600080fd5b5061034c610c5c3660046136bd565b6120a9565b348015610c6d57600080fd5b5061034c610c7c366004613887565b612146565b348015610c8d57600080fd5b50610373610c9c36600461355e565b600090815260046020908152604080832083805290915290205490565b348015610cc557600080fd5b5061034c610cd43660046135cf565b6123bb565b348015610ce557600080fd5b50610373610cf436600461368d565b612448565b600080805b84811015610d4657610d28868683818110610d1b57610d1b6138ee565b9050602002013585612448565b610d32908361391a565b915080610d3e81613932565b915050610cfe565b50949350505050565b60006301ffc9a760e01b6001600160e01b031983161480610d8957506001600160e01b0319821660009081526001602052604090205460ff165b92915050565b604051806060016040528060258152602001613d226025913981565b600280541415610dd65760405162461bcd60e51b8152600401610dcd9061394d565b60405180910390fd5b600280556007546001600160401b03600160401b9091048116429091161015610e115760405162461bcd60e51b8152600401610dcd90613984565b610e1b82826124a6565b50506001600255565b33610e2d611565565b6001600160a01b031614610e535760405162461bcd60e51b8152600401610dcd906139ad565b6003546001600160401b03600160a01b909104811690821611610ea85760405162461bcd60e51b815260206004820152600d60248201526c10d0539393d517d49155d25391609a1b6044820152606401610dcd565b600380546001600160401b03909216600160a01b02600160a01b600160e01b0319909216919091179055565b6000610ee0600061137c565b905090565b33610eee611565565b6001600160a01b031614610f145760405162461bcd60e51b8152600401610dcd906139ad565b60035442600160a01b9091046001600160401b031610610f465760405162461bcd60e51b8152600401610dcd906139e2565b600c80546001600160401b0319166001600160401b0392909216919091179055565b33610f71611565565b6001600160a01b031614610f975760405162461bcd60e51b8152600401610dcd906139ad565b600c54600160f81b900460ff1615610fc15760405162461bcd60e51b8152600401610dcd90613a09565b600c805482919060ff60f01b1916600160f01b836003811115610fe657610fe661360b565b021790555050565b6002805414156110105760405162461bcd60e51b8152600401610dcd9061394d565b6002805561101d81612518565b506001600255565b6000818152600b6020908152604080832054600a9092528220546001600160401b039182169116156110e257600061105b612583565b905042816001600160401b031611156110715750425b6000848152600a60205260409020546001600160401b0316156110e0576000848152600a60205260409020546001600160401b0390811690821611156110e0576000848152600a60205260409020546110d3906001600160401b031682613a29565b6110dd9083613a51565b91505b505b6009546001600160401b03600160401b90910481169082161115610d895750600954600160401b90046001600160401b031692915050565b611125816000611bc6565b50565b6000805b8281101561117357611155848483818110611149576111496138ee565b905060200201356116b5565b61115f908361391a565b91508061116b81613932565b91505061112c565b5092915050565b600080805b84811015610d46576004600087878481811061119d5761119d6138ee565b9050602002013581526020019081526020016000206000856001600160a01b03166001600160a01b0316815260200190815260200160002060000154826111e4919061391a565b9150806111f081613932565b91505061117f565b60606000826001600160401b03811115611214576112146136ee565b60405190808252806020026020018201604052801561123d578160200160208202803683370190505b50905060005b8381101561129b5761126c858583818110611260576112606138ee565b90506020020135611a7c565b82828151811061127e5761127e6138ee565b60209081029190910101528061129381613932565b915050611243565b509392505050565b6112b08282600033612146565b5050565b336112bd611565565b6001600160a01b0316146112e35760405162461bcd60e51b8152600401610dcd906139ad565b6112ed60006125c1565b565b336112f8611565565b6001600160a01b03161461131e5760405162461bcd60e51b8152600401610dcd906139ad565b60035442600160a01b9091046001600160401b0316106113505760405162461bcd60e51b8152600401610dcd906139e2565b600780546001600160401b03909216600160801b02600160801b600160c01b0319909216919091179055565b60006001600160a01b0382166113b0576001600160a01b038216600090815260056020526040902054610d8990479061391a565b6040516370a0823160e01b81526001600160a01b038316906370a08231906113dc9030906004016136da565b60206040518083038186803b1580156113f457600080fd5b505afa158015611408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142c9190613a7c565b6001600160a01b038316600090815260056020526040902054610d89919061391a565b33611458611565565b6001600160a01b03161461147e5760405162461bcd60e51b8152600401610dcd906139ad565b600c54600160e01b900460ff16156114a85760405162461bcd60e51b8152600401610dcd90613a09565b600c805460ff60e01b1916600160e01b179055565b60008060005b8381101561152c576000600a60008787858181106114e3576114e36138ee565b60209081029290920135835250810191909152604001600020546001600160401b0316111561151a578161151681613932565b9250505b8061152481613932565b9150506114c3565b506008548160065461153e9190613a95565b6115489190613aca565b949350505050565b600061155e8383600061117a565b9392505050565b6000546201000090046001600160a01b031690565b6000610d89826000612448565b6007546000906001600160401b03808216916115ac91600160401b9091041684613a29565b6115b69190613ade565b6001600160401b0316600654610d899190613a95565b336115d5611565565b6001600160a01b0316146115fb5760405162461bcd60e51b8152600401610dcd906139ad565b60035442600160a01b9091046001600160401b03161061162d5760405162461bcd60e51b8152600401610dcd906139e2565b600655565b3361163b611565565b6001600160a01b0316146116615760405162461bcd60e51b8152600401610dcd906139ad565b60035442600160a01b9091046001600160401b0316106116935760405162461bcd60e51b8152600401610dcd906139e2565b600980546001600160401b0319166001600160401b0392909216919091179055565b6007546008546000916001600160401b0316906116d184611025565b6001600160401b03166006546116e79190613a95565b6116f19190613aca565b610d899190613aca565b60028054141561171d5760405162461bcd60e51b8152600401610dcd9061394d565b600280556007546001600160401b03600160401b90910481164290911610156117585760405162461bcd60e51b8152600401610dcd90613984565b61101d8161261c565b6007546006546000916001600160401b03808216929161178a91600160401b9091041685613a29565b6001600160401b03166116f19190613a95565b60006117a96001612656565b905080156117c1576000805461ff0019166101001790555b6117ca826125c1565b6117d58260006126ea565b6117e78360000151846020015161271b565b6117f98360400151846060015161274c565b61181583608001518460a001518560c001518660e00151612785565b6118238361010001516127be565b6118318361012001516127ee565b8015611877576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b33611885611565565b6001600160a01b0316146118ab5760405162461bcd60e51b8152600401610dcd906139ad565b60035442600160a01b9091046001600160401b0316106118dd5760405162461bcd60e51b8152600401610dcd906139e2565b600780546001600160401b03909216600160401b02600160401b600160801b0319909216919091179055565b33611912611565565b6001600160a01b0316146119385760405162461bcd60e51b8152600401610dcd906139ad565b60035442600160a01b9091046001600160401b03161061196a5760405162461bcd60e51b8152600401610dcd906139e2565b600855565b33611978611565565b6001600160a01b03161461199e5760405162461bcd60e51b8152600401610dcd906139ad565b600c54600160e01b900460ff16156119c85760405162461bcd60e51b8152600401610dcd90613a09565b600c80546001600160a01b03909216600160401b02600160401b600160e01b0319909216919091179055565b336119fd611565565b6001600160a01b031614611a235760405162461bcd60e51b8152600401610dcd906139ad565b600c54600160f81b900460ff1615611a655760405162461bcd60e51b815260206004820152600560248201526413d0d2d15160da1b6044820152606401610dcd565b600c80546001600160f81b0316600160f81b179055565b6000818152600a60205260408120546001600160401b0316611a9f576000611ac7565b6009546000838152600a6020526040902054611ac7916001600160401b039081169116613a51565b6001600160401b031692915050565b33611adf611565565b6001600160a01b031614611b055760405162461bcd60e51b8152600401610dcd906139ad565b60035442600160a01b9091046001600160401b031610611b375760405162461bcd60e51b8152600401610dcd906139e2565b600780546001600160401b0319166001600160401b0392909216919091179055565b33611b62611565565b6001600160a01b031614611b885760405162461bcd60e51b8152600401610dcd906139ad565b600c805460ff60e81b1916600160e81b1790556040517fa24423a69b45c25c0479663125e48b482e71d85eae416f589545243bafaf3c9590600090a1565b600280541415611be85760405162461bcd60e51b8152600401610dcd9061394d565b6002805533611bf883838361281e565b6000611c048484612448565b905060008111611c495760405162461bcd60e51b815260206004820152601060248201526f4e4f5448494e475f544f5f434c41494d60801b6044820152606401610dcd565b60008481526004602090815260408083206001600160a01b038716845290915281208054839290611c7b90849061391a565b909155505060008481526004602090815260408083206001600160a01b0387168452825280832042600190910155600590915281208054839290611cc090849061391a565b90915550506001600160a01b038316611ceb57611ce66001600160a01b0383168261283f565b611d6d565b60405163a9059cbb60e01b81526001600160a01b0384169063a9059cbb90611d199085908590600401613b04565b602060405180830381600087803b158015611d3357600080fd5b505af1158015611d47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6b9190613b1d565b505b604080513381526001600160a01b038481166020830152818301879052851660608201526080810183905290517fa2d3c4c1fc934d6d2d8f9e862df90c01ae4eb0e920cd8957d242ba26b8dc40789181900360a00190a1505060016002555050565b611dd833612955565b600c54600160401b90046001600160a01b0316611e2f5760405162461bcd60e51b815260206004820152601560248201527415d2551211149055cbd393d7d49150d25412515395605a1b6044820152606401610dcd565b600c54600160e81b900460ff1615611e895760405162461bcd60e51b815260206004820181905260248201527f57495448445241572f454d455247454e43595f504f5745525f5245564f4b45446044820152606401610dcd565b60005b83811015611fe9576000858583818110611ea857611ea86138ee565b9050602002016020810190611ebd91906136bd565b6001600160a01b03161415611f0957611f04838383818110611ee157611ee16138ee565b600c546001600160a01b03600160401b909104169260209091020135905061283f565b611fd7565b848482818110611f1b57611f1b6138ee565b9050602002016020810190611f3091906136bd565b600c546001600160a01b039182169163a9059cbb91600160401b900416858585818110611f5f57611f5f6138ee565b905060200201356040518363ffffffff1660e01b8152600401611f83929190613b04565b602060405180830381600087803b158015611f9d57600080fd5b505af1158015611fb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fd59190613b1d565b505b80611fe181613932565b915050611e8c565b507fd40c399a83caf67d15628b821aa7c7bd940e563c57a047e2bd3b8c602bcaf5a58484848460405161201f9493929190613b75565b60405180910390a150505050565b600080805b8381101561129b5761205b85858381811061204f5761204f6138ee565b90506020020135611025565b6120659083613a51565b91508061207181613932565b915050612032565b60028054141561209b5760405162461bcd60e51b8152600401610dcd9061394d565b60028055610e1b8282612ae6565b336120b2611565565b6001600160a01b0316146120d85760405162461bcd60e51b8152600401610dcd906139ad565b6001600160a01b03811661213d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610dcd565b611125816125c1565b6002805414156121685760405162461bcd60e51b8152600401610dcd9061394d565b600280556000805b848110156122985761219b86868381811061218d5761218d6138ee565b90506020020135858561281e565b60006121bf8787848181106121b2576121b26138ee565b9050602002013586612448565b905080156122855780600460008989868181106121de576121de6138ee565b9050602002013581526020019081526020016000206000876001600160a01b03166001600160a01b031681526020019081526020016000206000016000828254612228919061391a565b9091555042905060046000898986818110612245576122456138ee565b6020908102929092013583525081810192909252604090810160009081206001600160a01b038a168252909252902060010155612282818461391a565b92505b508061229081613932565b915050612170565b506001600160a01b038316600090815260056020526040812080548392906122c190849061391a565b90915550506001600160a01b0383166122ec576122e76001600160a01b0383168261283f565b61236e565b60405163a9059cbb60e01b81526001600160a01b0384169063a9059cbb9061231a9085908590600401613b04565b602060405180830381600087803b15801561233457600080fd5b505af1158015612348573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236c9190613b1d565b505b7fd84a5c424a4f777bcf4f645712b8e5ebfc550f42bde444fa822fe98ee1b132b13383878787866040516123a796959493929190613bd8565b60405180910390a150506001600255505050565b336123c4611565565b6001600160a01b0316146123ea5760405162461bcd60e51b8152600401610dcd906139ad565b60035442600160a01b9091046001600160401b03161061241c5760405162461bcd60e51b8152600401610dcd906139e2565b600980546001600160401b03909216600160401b02600160401b600160801b0319909216919091179055565b60008061246761246061245a8561137c565b50600090565b8585612b22565b60008581526004602090815260408083206001600160a01b03881684529091529020549091506115489082613c17565b6001600160a01b03163b151590565b6124b08282612b67565b6003546040516342cb086360e11b81526001600160a01b039091169063859610c6906124e29085908590600401613c2e565b600060405180830381600087803b1580156124fc57600080fd5b505af1158015612510573d6000803e3d6000fd5b505050505050565b61252181612ba9565b600354604051636198e33960e01b8152600481018390526001600160a01b0390911690636198e339906024015b600060405180830381600087803b15801561256857600080fd5b505af115801561257c573d6000803e3d6000fd5b5050505050565b600754600090600160801b90046001600160401b0316156125b55750600754600160801b90046001600160401b031690565b506001600160401b0390565b600080546001600160a01b038381166201000081810262010000600160b01b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b61262581612bb4565b6003546040516337519c1960e21b8152600481018390526001600160a01b039091169063dd4670649060240161254e565b60008054610100900460ff16156126a4578160ff166001148015612680575061267e30612497565b155b61269c5760405162461bcd60e51b8152600401610dcd90613c42565b506000919050565b60005460ff8084169116106126cb5760405162461bcd60e51b8152600401610dcd90613c42565b506000805460ff191660ff92909216919091179055600190565b919050565b600054610100900460ff166127115760405162461bcd60e51b8152600401610dcd90613c90565b6112b08282612bbf565b600054610100900460ff166127425760405162461bcd60e51b8152600401610dcd90613c90565b6112b08282612c59565b600054610100900460ff166127735760405162461bcd60e51b8152600401610dcd90613c90565b61277b612cbe565b6112b08282612cf5565b600054610100900460ff166127ac5760405162461bcd60e51b8152600401610dcd90613c90565b6127b884848484612d54565b50505050565b600054610100900460ff166127e55760405162461bcd60e51b8152600401610dcd90613c90565b61112581612dd5565b600054610100900460ff166128155760405162461bcd60e51b8152600401610dcd90613c90565b61112581612e11565b612829838383612e63565b612834838383612f27565b611877838383612f72565b8047101561288f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610dcd565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146128dc576040519150601f19603f3d011682016040523d82523d6000602084013e6128e1565b606091505b50509050806118775760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b6064820152608401610dcd565b6003600c54600160f01b900460ff1660038111156129755761297561360b565b14156129b55760405162461bcd60e51b815260206004820152600f60248201526e15d2551211149055cbd313d0d2d151608a1b6044820152606401610dcd565b6002600c54600160f01b900460ff1660038111156129d5576129d561360b565b14156129de5750565b6001600c54600160f01b900460ff1660038111156129fe576129fe61360b565b1415612a6257600c546001600160a01b03828116600160401b90920416146111255760405162461bcd60e51b815260206004820152601760248201527615d2551211149055cbd3d3931657d49150d25412515395604a1b6044820152606401610dcd565b6000600c54600160f01b900460ff166003811115612a8257612a8261360b565b141561112557806001600160a01b0316612a9a611565565b6001600160a01b0316146111255760405162461bcd60e51b81526020600482015260136024820152722ba4aa24222920ab97a7a7262cafa7aba722a960691b6044820152606401610dcd565b612af08282613037565b600354604051635d36598f60e01b81526001600160a01b0390911690635d36598f906124e29085908590600401613c2e565b6007546000906001600160401b0316612b3a84611025565b612b449190613ade565b6001600160401b0316600854600654612b5d9190613aca565b6115489190613a95565b334260005b8381101561257c57612b978383878785818110612b8b57612b8b6138ee565b90506020020135613079565b80612ba181613932565b915050612b6c565b611125334283613130565b611125334283613079565b600054610100900460ff16612be65760405162461bcd60e51b8152600401610dcd90613c90565b612bf663ac2ba33360e01b6131e7565b600c8054600160401b600160e01b03198116600160401b6001600160a01b038616029081178355839291600160401b62ff000160e01b03191660ff60f01b1990911617600160f01b836003811115612c5057612c5061360b565b02179055505050565b600054610100900460ff16612c805760405162461bcd60e51b8152600401610dcd90613c90565b600380546001600160401b038316600160a01b026001600160e01b03199091166001600160a01b038516171790556112b0631ba050e960e21b6131e7565b600054610100900460ff16612ce55760405162461bcd60e51b8152600401610dcd90613c90565b6112ed63d664280160e01b6131e7565b600054610100900460ff16612d1c5760405162461bcd60e51b8152600401610dcd90613c90565b600980546001600160401b03838116600160401b026001600160801b0319909216908516171790556112b0633a41ba5360e11b6131e7565b600054610100900460ff16612d7b5760405162461bcd60e51b8152600401610dcd90613c90565b6006849055600780546001600160401b03838116600160801b02600160801b600160c01b0319868316600160401b026001600160801b03199094169288169290921792909217161790556127b863c9f600a960e01b6131e7565b600054610100900460ff16612dfc5760405162461bcd60e51b8152600401610dcd90613c90565b6008819055611125632d5305cb60e21b6131e7565b600054610100900460ff16612e385760405162461bcd60e51b8152600401610dcd90613c90565b600c80546001600160401b0319166001600160401b0383161790556111256317b2ef4360e31b6131e7565b6003546040516331a9108f60e11b8152600481018590526001600160a01b03838116921690636352211e9060240160206040518083038186803b158015612ea957600080fd5b505afa158015612ebd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ee19190613cdb565b6001600160a01b0316146118775760405162461bcd60e51b815260206004820152600d60248201526c2727aa2fa7232a2fa7aba722a960991b6044820152606401610dcd565b600c54426001600160401b03909116106118775760405162461bcd60e51b815260206004820152600c60248201526b10d310525357d313d0d2d15160a21b6044820152606401610dcd565b60075442600160401b9091046001600160401b031610612fc25760405162461bcd60e51b815260206004820152600b60248201526a1393d517d4d5105495115160aa1b6044820152606401610dcd565b600754612fd8906001600160401b031642613c17565b60008481526004602090815260408083206001600160a01b0387168452909152902060010154106118775760405162461bcd60e51b8152602060048201526009602482015268544f4f5f4541524c5960b81b6044820152606401610dcd565b334260005b8381101561257c57613067838387878581811061305b5761305b6138ee565b90506020020135613130565b8061307181613932565b91505061303c565b6003546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e9060240160206040518083038186803b1580156130bd57600080fd5b505afa1580156130d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130f59190613cdb565b6001600160a01b0316836001600160a01b0316146131255760405162461bcd60e51b8152600401610dcd90613cf8565b611877838383613268565b6003546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e9060240160206040518083038186803b15801561317457600080fd5b505afa158015613188573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131ac9190613cdb565b6001600160a01b0316836001600160a01b0316146131dc5760405162461bcd60e51b8152600401610dcd90613cf8565b611877838383613301565b6001600160e01b031980821614156132405760405162461bcd60e51b815260206004820152601c60248201527b115490cc4d8d4e881a5b9d985b1a59081a5b9d195c999858d9481a5960221b6044820152606401610dcd565b6001600160e01b0319166000908152600160208190526040909120805460ff19169091179055565b600954600160401b90046001600160401b031661328482611025565b6001600160401b0316106132d25760405162461bcd60e51b815260206004820152601560248201527413505617d1155490551253d397d15610d151511151605a1b6044820152606401610dcd565b6000908152600a6020526040902080546001600160401b0319166001600160401b039290921691909117905550565b6000818152600a60205260409020546001600160401b03166133525760405162461bcd60e51b815260206004820152600a6024820152691393d517d4d51052d15160b21b6044820152606401610dcd565b6009546000828152600a602052604090205461337a916001600160401b039081169116613a51565b6001600160401b0316826001600160401b031610156133d45760405162461bcd60e51b815260206004820152601660248201527509c9ea8bea6a882968a88be989e9c8ebe8a9c9eaa8e960531b6044820152606401610dcd565b6133dd81611025565b6000918252600b6020908152604080842080546001600160401b03949094166001600160401b0319948516179055600a909152909120805490911690555050565b60008083601f84011261343057600080fd5b5081356001600160401b0381111561344757600080fd5b6020830191508360208260051b850101111561346257600080fd5b9250929050565b6001600160a01b038116811461112557600080fd5b80356126e581613469565b60008060006040848603121561349e57600080fd5b83356001600160401b038111156134b457600080fd5b6134c08682870161341e565b90945092505060208401356134d481613469565b809150509250925092565b6000602082840312156134f157600080fd5b81356001600160e01b03198116811461155e57600080fd5b600060208083528351808285015260005b818110156135365785810183015185820160400152820161351a565b81811115613548576000604083870101525b50601f01601f1916929092016040019392505050565b60006020828403121561357057600080fd5b5035919050565b6000806020838503121561358a57600080fd5b82356001600160401b038111156135a057600080fd5b6135ac8582860161341e565b90969095509350505050565b80356001600160401b03811681146126e557600080fd5b6000602082840312156135e157600080fd5b61155e826135b8565b6000602082840312156135fc57600080fd5b81356004811061155e57600080fd5b634e487b7160e01b600052602160045260246000fd5b602081016004831061364357634e487b7160e01b600052602160045260246000fd5b91905290565b6020808252825182820181905260009190848201906040850190845b8181101561368157835183529284019291840191600101613665565b50909695505050505050565b600080604083850312156136a057600080fd5b8235915060208301356136b281613469565b809150509250929050565b6000602082840312156136cf57600080fd5b813561155e81613469565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b60405161014081016001600160401b038111828210171561373557634e487b7160e01b600052604160045260246000fd5b60405290565b60008082840361016081121561375057600080fd5b6101408082121561376057600080fd5b613768613704565b91506137738561347e565b8252613781602086016135b8565b6020830152613792604086016135b8565b60408301526137a3606086016135b8565b6060830152608085013560808301526137be60a086016135b8565b60a08301526137cf60c086016135b8565b60c08301526137e060e086016135b8565b60e083015261010085810135908301526101206137fe8187016135b8565b818401525081935061381181860161347e565b925050509250929050565b6000806000806040858703121561383257600080fd5b84356001600160401b038082111561384957600080fd5b6138558883890161341e565b9096509450602087013591508082111561386e57600080fd5b5061387b8782880161341e565b95989497509550505050565b6000806000806060858703121561389d57600080fd5b84356001600160401b038111156138b357600080fd5b6138bf8782880161341e565b90955093505060208501356138d381613469565b915060408501356138e381613469565b939692955090935050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000821982111561392d5761392d613904565b500190565b600060001982141561394657613946613904565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252600f908201526e1393d517d4d5105495115117d65155608a1b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c10d3d3919251d7d313d0d2d151609a1b604082015260600190565b6020808252600690820152651313d0d2d15160d21b604082015260600190565b60006001600160401b0383811690831681811015613a4957613a49613904565b039392505050565b60006001600160401b03828116848216808303821115613a7357613a73613904565b01949350505050565b600060208284031215613a8e57600080fd5b5051919050565b6000816000190483118215151615613aaf57613aaf613904565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613ad957613ad9613ab4565b500490565b60006001600160401b0383811680613af857613af8613ab4565b92169190910492915050565b6001600160a01b03929092168252602082015260400190565b600060208284031215613b2f57600080fd5b8151801515811461155e57600080fd5b81835260006001600160fb1b03831115613b5857600080fd5b8260051b8083602087013760009401602001938452509192915050565b6040808252810184905260008560608301825b87811015613bb8578235613b9b81613469565b6001600160a01b0316825260209283019290910190600101613b88565b508381036020850152613bcc818688613b3f565b98975050505050505050565b600060018060a01b038089168352808816602084015260a06040840152613c0360a084018789613b3f565b941660608301525060800152949350505050565b600082821015613c2957613c29613904565b500390565b602081526000611548602083018486613b3f565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215613ced57600080fd5b815161155e81613469565b6020808252600f908201526e2727aa2faa27a5a2a72fa7aba722a960891b60408201526060019056fe455243373231204c6f636b6564205374616b696e6720456d697373696f6e2053747265616da264697066735822122012b358ac49e4db0b56601c48b81ddb3611b24ec109f9fe554a8e8640f799647164736f6c634300080900330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : config (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.