Contract 0xfa863605382a8a334ea2657ae4b0cf9d80c4c38c

Contract Overview

Balance:
0 MATIC
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0x5e7f1d7d6a241a8482f28d800d8b6221d5e569b5b14880642a6b05b711a2aaaf0x60806040313750432023-01-25 4:13:2165 days 11 hrs ago0xf478d89fde97e9719a5edd0e461dfabaccfc3f7d IN  Create: InstallmentNFT0 MATIC0.003919089039 1.500000015
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
InstallmentNFT

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 16 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 2 of 16 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 3 of 16 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 4 of 16 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 5 of 16 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // 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 6 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 7 of 16 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 8 of 16 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 9 of 16 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 16 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 16 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 12 of 16 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 13 of 16 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 14 of 16 : InstallmentNFT.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./utils/INFTVault.sol";
import "./utils/INFTRenting.sol";

contract InstallmentNFT is Ownable, AccessControl, ReentrancyGuard {
    using SafeERC20 for IERC20;

    address public nakaTokenAddress;
    address public rentingAddress;
    address public nftVaultAddress;
    bool internal _paused;

    bytes32 public constant WORKER_ROLE = keccak256("WORKER_ROLE");

    event OrderCreatedInstallmentNFT(bytes32 orderId, address indexed seller, address nftAddress ,uint256 tokenID ,uint256 price);
    event OrderCancelledInstallmentNFT(bytes32 orderId, address indexed seller, address nftAddress , uint256 tokenID, uint256 price);
    event EditOrderInstallmentNFT(bytes32 orderId,uint256 Price);
    
    event executedOrderInstallmentNFT(
    bytes32 billId, 
    address indexed buyer, 
    address indexed seller,
    address nftAddress
    );

    event executedOrderInstallmentNFT_Details(
    bytes32 billId, 
    uint256 price ,
    uint256 period,
    uint256 periodBalance,
    uint256 prePay,
    uint256 totalBill,
    uint256 billBalance,
    uint256 payByperiod
    );

    event PayBill(
    bytes32 billId, 
    address indexed buyer, 
    address indexed seller, 
    uint256 periodBalance,
    uint256 billBalance,
    uint256 nakaAmount
    );
    
    event BillCancelledInstallmentNFT(
    bytes32 billId, 
    address indexed buyer, 
    address indexed seller,
    address nftAddress,
    uint256 tokenID,
    uint256 price ,
    uint256 period,
    uint256 periodBalance,
    uint256 totalBill,
    uint256 billBalance,
    uint256 payByperiod
    );

    event InstallmentPaused();
    event InstallmentUnpaused();

    struct Order {
        bytes32 id;
        address nftAddress;
        uint256 tokenId;
        address seller;
        uint256 price;
    }
    mapping (address => mapping(bytes32 => Order)) public orderByOrderId;

    struct AddressOrderIdInstallmentNFT {
        bytes32 id;
        address seller;
    }

    mapping (address => mapping(uint256 => AddressOrderIdInstallmentNFT)) public orderIdByNFT;
    
    struct Bill {
        bytes32 billId;
        address buyer;
        address seller;
        address nftAddress;
        uint256 tokenId;
        uint256 price;
        uint256 period;
        uint256 periodBalance;
        uint256 prePay;
        uint256 totalBill;
        uint256 billBalance;
        uint256 payByperiod;
    } 
  
    mapping (address => mapping(bytes32 => Bill)) public billByBillId;

    struct AddressBillId {
        bytes32 billId;
        address buyer;
        address seller;
    }

    mapping (address => mapping(uint256 => AddressBillId)) public billIdByNFT;
    

    constructor(
        address _nakaTokenAddress,
        address _nftVaultAddress
    ) {
        nakaTokenAddress = _nakaTokenAddress;
        nftVaultAddress = _nftVaultAddress;
        _setupRole(DEFAULT_ADMIN_ROLE,msg.sender);
   }

    modifier checkOnRenting(address _nftAddress,uint256 _tokenID) {
        INFTRenting.CheckDetail  memory check = INFTRenting(rentingAddress).CheckDetails(_nftAddress,_tokenID);
        require(check.owner != msg.sender, "[Installment.checkOnRenting] NFT already listed on NFTRenting contract.");
        _;
    }
    /**
    * @dev Modifier to only allow the function to be executed when it isn't paused.
    */
    modifier whenInstallmentNotPaused() {
        require(!_paused, "[Installment.whenInstallmentNotPaused] Not Paused");
        _;
    }

    /**
    * @dev Modifier to only allow the function to be executed when it is paused.
    */
    modifier whenInstallmentPaused() {
        require(_paused, "[Installment.whenInstallmentPaused] Paused");
        _;
    }
    /**
     * @dev Create order for selling NFT installment
     * Emit details of createded Order.
     * Seller need to setApprovallForAll this contract in NFT contract for begin createOrder.
     * @param _nftAddress - NFT address for selling.
     * @param _tokenId - id NFT for selling.
     * @param _price - Naka token amount of each items user want to sell.
     */
    function createOrderInstallmentNFT (address _nftAddress,uint256 _tokenId, uint256 _price) external checkOnRenting(_nftAddress,_tokenId) whenInstallmentNotPaused {
            bytes32 _orderId = keccak256(
                abi.encodePacked(
                block.timestamp,
                msg.sender,
                _nftAddress,
                _tokenId,
                _price
            )
        );
        orderByOrderId[msg.sender][_orderId] = Order({
            id: _orderId,
            seller: msg.sender,
            nftAddress: _nftAddress,
            tokenId : _tokenId,
            price: _price
        });
        orderIdByNFT[_nftAddress][_tokenId] = AddressOrderIdInstallmentNFT({
            id: _orderId,
            seller: msg.sender
        });

        address Owner = msg.sender;
        INFTVault(nftVaultAddress).receivIn721(_nftAddress,_tokenId,Owner);
        IERC721(_nftAddress).safeTransferFrom(msg.sender,nftVaultAddress,_tokenId);
       
        emit OrderCreatedInstallmentNFT(_orderId, msg.sender, _nftAddress, _tokenId, _price);

    }
     /**
     * @dev execute NFT for buyer to want to buy NFT installment payment.
     * Emit details of purchase.
     * Buyer need to approve this contract in Naka token contract for buy NFT and prepay.
     * @param _sellerAccount - seller's address.
     * @param _orderId - order id of order.
     * @param _period - period of installment payment.
     */
    function executeOrderInstallmentNFT(address _sellerAccount, bytes32 _orderId , uint256 _period) external whenInstallmentNotPaused{
        Order memory order = orderByOrderId[_sellerAccount][_orderId];
        require(order.id != 0, "[Installment.purchaseInstallmentNFT] Order not found.");
        require(order.seller != msg.sender,"[Installment.purchaseInstallmentNFT] Can't buy this order.");
        require(_period % 3 == 0 &&  _period >= 6 && _period <= 24, "[Installment.purchaseInstallmentNFT] Period must be more than or equal to 6 and mod 3 = 0");
        uint periods = _period - 1;
        uint calculatedInterestRate;
        uint totalInterest;

        calculatedInterestRate = (_period / 3) + 3 + (4 * (_period - 6)/3);
        totalInterest = (order.price * calculatedInterestRate) / 100;

        uint totalbill = order.price + totalInterest;
        uint totalBillPayByperiod  = totalbill / _period;
        uint prepay = (totalBillPayByperiod * 40) /30;
        uint totalbillbalance = totalbill - prepay ;
         
        IERC20 token = IERC20(nakaTokenAddress);
        token.safeTransferFrom(msg.sender,order.seller,prepay);

        bytes32 _billId = keccak256(
                abi.encodePacked(
                block.timestamp,
                 msg.sender,
                 order.nftAddress,
                 order.tokenId,
                 order.price
            )
        );
        billByBillId[msg.sender][_billId] = Bill({
            billId : _billId,
            buyer : msg.sender,
            seller : _sellerAccount,
            nftAddress : order.nftAddress,
            tokenId: order.tokenId,
            price :order.price,
            period : _period,
            periodBalance:periods,
            prePay:prepay,
            totalBill:totalbill,
            billBalance:totalbillbalance,
            payByperiod:totalBillPayByperiod
        });
        billIdByNFT[order.nftAddress][order.tokenId] = AddressBillId({
            billId : _billId,
            buyer : msg.sender,
            seller : _sellerAccount
        });
        
        delete orderByOrderId[order.seller][_orderId];
        delete orderIdByNFT[order.nftAddress][order.tokenId];

        emit executedOrderInstallmentNFT(_billId, msg.sender, _sellerAccount, order.nftAddress);
        emit executedOrderInstallmentNFT_Details(_billId, order.price,_period, periods, prepay, totalbill, totalbillbalance, totalBillPayByperiod);
    }

    /**
     * @dev purchase NFT for buyer to want to buy NFT installment payment.
     * Emit details of purchase.
     * @param _billId - bill id of buyer for paybill.
     * @param _period - period of installment payment.
     */
    function payBillInstallmentNFT(bytes32 _billId , uint256 _period) external whenInstallmentNotPaused {
        Bill memory bill = billByBillId[msg.sender][_billId];

        require(bill.billId != 0, "[Installment.payBillInstallmentNFT] Bill not found.");
        require(_period != 0 , "[Installment.payBillInstallmentNFT] Period is not correct");
        require(bill.periodBalance >=  _period , "[Installment.payBillInstallmentNFT] Period is not correct");
        require(bill.buyer ==  msg.sender, "[Installment.payBillInstallmentNFT] Only buyer of installment contract can pay the bill");
        uint totalPay;
        IERC20 token = IERC20(nakaTokenAddress);

        if(bill.periodBalance == _period){
            totalPay = bill.billBalance;
            token.safeTransferFrom(msg.sender,bill.seller,totalPay);
        }else if(bill.periodBalance == 1 ){
            totalPay = bill.payByperiod - (bill.payByperiod*10)/30;
            token.safeTransferFrom(msg.sender,bill.seller,totalPay);
        } else{
            uint Pay = bill.payByperiod * _period;
            totalPay = Pay;
            token.safeTransferFrom(msg.sender,bill.seller,totalPay);
        }
        bill.billBalance -= totalPay;
        bill.periodBalance -= _period;
        emit PayBill(_billId, msg.sender ,bill.seller,bill.periodBalance,bill.billBalance,totalPay);
        if(bill.periodBalance == 0){
            INFTVault(nftVaultAddress).transferOut721(bill.nftAddress,bill.tokenId,bill.buyer);
            delete billByBillId[msg.sender][_billId];
            delete billIdByNFT[bill.nftAddress][bill.tokenId];
        }
    }
     /**
     * @dev Cancel order for seller want to cancel order.
     * Emit details of canceled Order.
     * @param _orderId - order id of order.
     */
     
    function cancelOrderInstallmentNFT(bytes32 _orderId) external  whenInstallmentNotPaused{
        Order memory order = orderByOrderId[msg.sender][_orderId];
        require(order.id != 0, "[Installment.cancelOrder] Order not found.");
        require(order.seller == msg.sender, "[Installment.cancelOrder] Unauthorized user.");
        INFTVault(nftVaultAddress).transferOut721(order.nftAddress,order.tokenId,order.seller);
        delete orderByOrderId[order.seller][_orderId];
        delete orderIdByNFT[order.nftAddress][order.tokenId];
        emit OrderCancelledInstallmentNFT(order.id, order.seller, order.nftAddress,order.tokenId,order.price);
    }

     function editOrderInstallmentNFT(bytes32 _orderId,uint256 _price) external  whenInstallmentNotPaused{
        Order memory order = orderByOrderId[msg.sender][_orderId];
        require(order.id != 0, "[Installment.cancelOrder] Order not found.");
        require(order.seller == msg.sender, "[Installment.cancelOrder] Unauthorized user.");
        order.price = _price;
        emit  EditOrderInstallmentNFT(_orderId,_price);
    }

      /**
     * @dev Cancel bill for seller or buyer want to cancel bill.
     * Emit details of canceled bill.
     * @param _buyerAccount - buyer's address.
     * @param _billId - bill id of buyer for paybill.
     */
      function cancelBillInstallmentNFT(address _buyerAccount ,bytes32 _billId) external onlyRole(WORKER_ROLE) whenInstallmentNotPaused {
        Bill memory bill = billByBillId[_buyerAccount][_billId];
        require(bill.billId != 0, "[Installment.cancelBill] Bill not found.");
        INFTVault(nftVaultAddress).transferOut721(bill.nftAddress,bill.tokenId,bill.seller);
        delete billByBillId[_buyerAccount][_billId];
        delete billIdByNFT[bill.nftAddress][bill.tokenId];
        emit BillCancelledInstallmentNFT(bill.billId,bill.buyer, bill.seller, bill.nftAddress,bill.tokenId,
        bill.price,bill.period,bill.periodBalance,bill.totalBill,bill.billBalance,bill.payByperiod);
    }

    function setRenting(address _rentingAddress) external onlyOwner{
        rentingAddress = _rentingAddress;
    }
    
    /**
    * @dev Function to pause functions in this contract.
    * can only be called by the creator of contract.
    */
    function pauseInstallment() external onlyOwner whenInstallmentNotPaused {
        _paused = true;
        emit InstallmentPaused();
    }

    /**
    * @dev Function to unpause functions in this contract.
    * can only be called by the creator of contract.
    */
    function unpauseInstallment() external onlyOwner whenInstallmentPaused {
        _paused = false;
        emit InstallmentUnpaused();
    }

 
}

File 15 of 16 : INFTRenting.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;

interface INFTRenting{

    struct CheckDetail {
        bytes32 orderIdRentingNFT;
        address owner;
    }
    function CheckDetails (address _nftAddres ,uint256 _tokenId) external view returns (CheckDetail  memory);

}

File 16 of 16 : INFTVault.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;

interface INFTVault{

 function receivIn721(address _NftAddress,uint256 _tokenID,address _owner) external ;
 function transferOut721(address _NftAddress,uint256 _tokenID,address _to) external ;
 function getOwner721(address NftAddress,uint256 tokenID) external view returns (address);
 function receivIn1155(address _NftAddress, uint256 _tokenID, uint256 _amount ,address _owner,bytes memory _data) external ;
 function transferOut1155(address _NftAddress, uint256 _tokenID,uint256 _amount,address _to, bytes memory _data) external ;
 function receivBatchIn1155(address _NftAddress, uint256[] memory _tokenID, uint256[] memory _amount, bytes memory _data, address _owner) external;
 function transferBatchOut1155(address _NftAddress, address _to, uint256[] memory _tokenID, uint256[] memory _amount, bytes memory _data) external ;
 function getOwner1155(address NftAddress,uint256 tokenID) external view returns (address);
 
 

     
 

}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_nakaTokenAddress","type":"address"},{"internalType":"address","name":"_nftVaultAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"billId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"periodBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBill","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"billBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"payByperiod","type":"uint256"}],"name":"BillCancelledInstallmentNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"Price","type":"uint256"}],"name":"EditOrderInstallmentNFT","type":"event"},{"anonymous":false,"inputs":[],"name":"InstallmentPaused","type":"event"},{"anonymous":false,"inputs":[],"name":"InstallmentUnpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"OrderCancelledInstallmentNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"OrderCreatedInstallmentNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"billId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"uint256","name":"periodBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"billBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nakaAmount","type":"uint256"}],"name":"PayBill","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"billId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"}],"name":"executedOrderInstallmentNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"billId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"periodBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"prePay","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBill","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"billBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"payByperiod","type":"uint256"}],"name":"executedOrderInstallmentNFT_Details","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WORKER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"billByBillId","outputs":[{"internalType":"bytes32","name":"billId","type":"bytes32"},{"internalType":"address","name":"buyer","type":"address"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"periodBalance","type":"uint256"},{"internalType":"uint256","name":"prePay","type":"uint256"},{"internalType":"uint256","name":"totalBill","type":"uint256"},{"internalType":"uint256","name":"billBalance","type":"uint256"},{"internalType":"uint256","name":"payByperiod","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"billIdByNFT","outputs":[{"internalType":"bytes32","name":"billId","type":"bytes32"},{"internalType":"address","name":"buyer","type":"address"},{"internalType":"address","name":"seller","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_buyerAccount","type":"address"},{"internalType":"bytes32","name":"_billId","type":"bytes32"}],"name":"cancelBillInstallmentNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_orderId","type":"bytes32"}],"name":"cancelOrderInstallmentNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftAddress","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"createOrderInstallmentNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_orderId","type":"bytes32"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"editOrderInstallmentNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sellerAccount","type":"address"},{"internalType":"bytes32","name":"_orderId","type":"bytes32"},{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"executeOrderInstallmentNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nakaTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftVaultAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"orderByOrderId","outputs":[{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"orderIdByNFT","outputs":[{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"address","name":"seller","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseInstallment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_billId","type":"bytes32"},{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"payBillInstallmentNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rentingAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rentingAddress","type":"address"}],"name":"setRenting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseInstallment","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162002deb38038062002deb83398101604081905262000034916200018e565b6200003f3362000089565b6001600255600380546001600160a01b038085166001600160a01b031992831617909255600580549284169290911691909117905562000081600033620000d9565b5050620001c6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620000e58282620000e9565b5050565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff16620000e55760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b80516001600160a01b03811681146200018957600080fd5b919050565b60008060408385031215620001a257600080fd5b620001ad8362000171565b9150620001bd6020840162000171565b90509250929050565b612c1580620001d66000396000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c80637b8695f8116100f9578063a397e91611610097578063d547741f11610071578063d547741f14610581578063f2fde38b14610594578063f4d4316c146105a7578063f9fca0d0146105ba57600080fd5b8063a397e9161461050e578063c9ffe9f414610521578063cef0015a1461057957600080fd5b80639161e08f116100d35780639161e08f1461047557806391d14854146104e05780639b88be9b146104f3578063a217fddf1461050657600080fd5b80637b8695f8146103635780638da5cb5b146104515780638e59a2341461046257600080fd5b806336568abe11610166578063634252dc11610140578063634252dc146102f657806365d2e3061461031d578063715018a61461033057806371d8d2fe1461033857600080fd5b806336568abe1461024b578063427f01151461025e57806347d1c4c41461027157600080fd5b806301ffc9a7146101ae57806302a7196b146101d657806308376d71146101e057806310fc439c146101f3578063248a9ca3146102065780632f2ff15d14610238575b600080fd5b6101c16101bc3660046126a0565b6105cd565b60405190151581526020015b60405180910390f35b6101de610604565b005b6101de6101ee3660046126ca565b61069f565b6101de610201366004612701565b6107b9565b61022a61021436600461271e565b6000908152600160208190526040909120015490565b6040519081526020016101cd565b6101de610246366004612737565b610805565b6101de610259366004612737565b610831565b6101de61026c366004612767565b6108af565b6102c461027f36600461279c565b60066020908152600092835260408084209091529082529020805460018201546002830154600384015460049094015492936001600160a01b03928316939192169085565b604080519586526001600160a01b0394851660208701528501929092529091166060830152608082015260a0016101cd565b61022a7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc781565b6101de61032b3660046126ca565b610ce2565b6101de6111b6565b60035461034b906001600160a01b031681565b6040516001600160a01b0390911681526020016101cd565b6103e961037136600461279c565b6008602081815260009384526040808520909152918352912080546001820154600283015460038401546004850154600586015460068701546007880154988801546009890154600a8a0154600b909a0154989a6001600160a01b039889169a9789169996909816979496939592949391929091908c565b604080519c8d526001600160a01b039b8c1660208e0152998b16998c01999099529890961660608a0152608089019490945260a088019290925260c087015260e0860152610100850152610120840152610140830191909152610160820152610180016101cd565b6000546001600160a01b031661034b565b60045461034b906001600160a01b031681565b6104bb61048336600461279c565b600960209081526000928352604080842090915290825290208054600182015460029092015490916001600160a01b03908116911683565b604080519384526001600160a01b0392831660208501529116908201526060016101cd565b6101c16104ee366004612737565b6111ec565b6101de61050136600461271e565b611217565b61022a600081565b60055461034b906001600160a01b031681565b61055c61052f36600461279c565b6007602090815260009283526040808420909152908252902080546001909101546001600160a01b031682565b604080519283526001600160a01b039091166020830152016101cd565b6101de61144d565b6101de61058f366004612737565b61151b565b6101de6105a2366004612701565b611542565b6101de6105b5366004612767565b6115dd565b6101de6105c836600461279c565b611d6f565b60006001600160e01b03198216637965db0b60e01b14806105fe57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000546001600160a01b031633146106375760405162461bcd60e51b815260040161062e906127c8565b60405180910390fd5b600554600160a01b900460ff16156106615760405162461bcd60e51b815260040161062e906127fd565b6005805460ff60a01b1916600160a01b1790556040517fdd33f107c2ec6a6efa77c0268de5e55848c9539539e88acfb9972d67b2f01fd290600090a1565b600554600160a01b900460ff16156106c95760405162461bcd60e51b815260040161062e906127fd565b3360009081526006602090815260408083208584528252808320815160a081018352815480825260018301546001600160a01b0390811695830195909552600283015493820193909352600382015490931660608401526004015460808301529091036107485760405162461bcd60e51b815260040161062e9061284e565b60608101516001600160a01b031633146107745760405162461bcd60e51b815260040161062e90612898565b6080810182905260408051848152602081018490527f5f61441f892c4f35cf8fdb64a6cea8009b34d2139e2d101fb64b6947c453cb10910160405180910390a1505050565b6000546001600160a01b031633146107e35760405162461bcd60e51b815260040161062e906127c8565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152600160208190526040909120015461082281336120cd565b61082c8383612131565b505050565b6001600160a01b03811633146108a15760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161062e565b6108ab828261219c565b5050565b600480546040516316036d3360e01b81526001600160a01b038087169382019390935260248101859052859285926000929116906316036d33906044016040805180830381865afa158015610908573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092c91906128fa565b9050336001600160a01b031681602001516001600160a01b0316036109c95760405162461bcd60e51b815260206004820152604760248201527f5b496e7374616c6c6d656e742e636865636b4f6e52656e74696e675d204e465460448201527f20616c7265616479206c6973746564206f6e204e465452656e74696e6720636f606482015266373a3930b1ba1760c91b608482015260a40161062e565b600554600160a01b900460ff16156109f35760405162461bcd60e51b815260040161062e906127fd565b60004233888888604051602001610a0e95949392919061295e565b6040516020818303038152906040528051906020012090506040518060a00160405280828152602001886001600160a01b03168152602001878152602001336001600160a01b031681526020018681525060066000336001600160a01b03166001600160a01b0316815260200190815260200160002060008381526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506040820151816002015560608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550608082015181600401559050506040518060400160405280828152602001336001600160a01b031681525060076000896001600160a01b03166001600160a01b0316815260200190815260200160002060008881526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050506000339050600560009054906101000a90046001600160a01b03166001600160a01b0316639abe68538989846040518463ffffffff1660e01b8152600401610be893929190612997565b600060405180830381600087803b158015610c0257600080fd5b505af1158015610c16573d6000803e3d6000fd5b5050600554604051632142170760e11b81523360048201526001600160a01b039182166024820152604481018b9052908b1692506342842e0e9150606401600060405180830381600087803b158015610c6e57600080fd5b505af1158015610c82573d6000803e3d6000fd5b5050604080518581526001600160a01b038c1660208201529081018a9052606081018990523392507f9ebc565863d5b5df12b50a1817cf519d221fbd3a6b4db96e4cd8bb1c3e60d5b6915060800160405180910390a25050505050505050565b600554600160a01b900460ff1615610d0c5760405162461bcd60e51b815260040161062e906127fd565b3360009081526008602081815260408084208685528252808420815161018081018352815480825260018301546001600160a01b039081169583019590955260028301548516938201939093526003820154909316606084015260048101546080840152600581015460a0840152600681015460c0840152600781015460e0840152928301546101008301526009830154610120830152600a830154610140830152600b909201546101608201529103610e245760405162461bcd60e51b815260206004820152603360248201527f5b496e7374616c6c6d656e742e70617942696c6c496e7374616c6c6d656e744e604482015272232a2e902134b636103737ba103337bab7321760691b606482015260840161062e565b81600003610e445760405162461bcd60e51b815260040161062e906129ba565b818160e001511015610e685760405162461bcd60e51b815260040161062e906129ba565b60208101516001600160a01b03163314610f105760405162461bcd60e51b815260206004820152605760248201527f5b496e7374616c6c6d656e742e70617942696c6c496e7374616c6c6d656e744e60448201527f46545d204f6e6c79206275796572206f6620696e7374616c6c6d656e7420636f60648201527f6e74726163742063616e20706179207468652062696c6c000000000000000000608482015260a40161062e565b60035460e08201516000916001600160a01b031690849003610f56576101408301516040840151909250610f51906001600160a01b03831690339085612203565b610fe6565b8260e00151600103610faf57601e836101600151600a610f769190612a2d565b610f809190612a5a565b836101600151610f909190612a6e565b6040840151909250610f51906001600160a01b03831690339085612203565b600084846101600151610fc29190612a2d565b6040850151909350839150610fe4906001600160a01b03841690339084612203565b505b818361014001818151610ff99190612a6e565b90525060e083018051859190611010908390612a6e565b90525060408381015160e085015161014086015183518981526020810192909252818401526060810185905291516001600160a01b039091169133917f35457995c78ea12c99be33bc41458a087c4aa0481f9711443511b572aa452cbf9181900360800190a38260e001516000036111af57600554606084015160808501516020860151604051637419d1a360e01b81526001600160a01b0390941693637419d1a3936110c39390929091600401612997565b600060405180830381600087803b1580156110dd57600080fd5b505af11580156110f1573d6000803e3d6000fd5b50503360009081526008602081815260408084208b85528252808420848155600180820180546001600160a01b0319908116909155600280840180548316905560038401805483169055600484018890556005840188905560068401889055600784018890559583018790556009808401889055600a8401889055600b90930187905560608c01516001600160a01b0316875291845282862060808c0151875290935290842093845590830180548216905591018054909116905550505b5050505050565b6000546001600160a01b031633146111e05760405162461bcd60e51b815260040161062e906127c8565b6111ea6000612263565b565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600554600160a01b900460ff16156112415760405162461bcd60e51b815260040161062e906127fd565b3360009081526006602090815260408083208484528252808320815160a081018352815480825260018301546001600160a01b0390811695830195909552600283015493820193909352600382015490931660608401526004015460808301529091036112c05760405162461bcd60e51b815260040161062e9061284e565b60608101516001600160a01b031633146112ec5760405162461bcd60e51b815260040161062e90612898565b600554602082015160408084015160608501519151637419d1a360e01b81526001600160a01b0390941693637419d1a39361132c93909291600401612997565b600060405180830381600087803b15801561134657600080fd5b505af115801561135a573d6000803e3d6000fd5b5050506060820180516001600160a01b0390811660009081526006602090815260408083208884528252808320838155600180820180546001600160a01b03199081169091556002830186905560038301805482169055600490920185905583890180518716865260078552838620848b018051885295528386209586559401805490911690559351865192519151608088015195519190941695507fac9c8ec260895e4ddbeb3fbda003317b2438a6f6d31c901efaf7c984e453cb879461144194919384526001600160a01b039290921660208401526040830152606082015260800190565b60405180910390a25050565b6000546001600160a01b031633146114775760405162461bcd60e51b815260040161062e906127c8565b600554600160a01b900460ff166114e35760405162461bcd60e51b815260206004820152602a60248201527f5b496e7374616c6c6d656e742e7768656e496e7374616c6c6d656e74506175736044820152691959174814185d5cd95960b21b606482015260840161062e565b6005805460ff60a01b191690556040517f98ce2079ce85809d9a97d5c599d0fb5a6cf14fcd06b9850c2c2d7cd2df065bd890600090a1565b6000828152600160208190526040909120015461153881336120cd565b61082c838361219c565b6000546001600160a01b0316331461156c5760405162461bcd60e51b815260040161062e906127c8565b6001600160a01b0381166115d15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062e565b6115da81612263565b50565b600554600160a01b900460ff16156116075760405162461bcd60e51b815260040161062e906127fd565b6001600160a01b0380841660009081526006602090815260408083208684528252808320815160a0810183528154808252600183015487169482019490945260028201549281019290925260038101549094166060820152600490930154608084015290036116d65760405162461bcd60e51b815260206004820152603560248201527f5b496e7374616c6c6d656e742e7075726368617365496e7374616c6c6d656e7460448201527427232a2e9027b93232b9103737ba103337bab7321760591b606482015260840161062e565b336001600160a01b031681606001516001600160a01b0316036117615760405162461bcd60e51b815260206004820152603a60248201527f5b496e7374616c6c6d656e742e7075726368617365496e7374616c6c6d656e7460448201527f4e46545d2043616e2774206275792074686973206f726465722e000000000000606482015260840161062e565b61176c600383612a81565b15801561177a575060068210155b8015611787575060188211155b61181f5760405162461bcd60e51b815260206004820152605960248201527f5b496e7374616c6c6d656e742e7075726368617365496e7374616c6c6d656e7460448201527f4e46545d20506572696f64206d757374206265206d6f7265207468616e206f7260648201527f20657175616c20746f203620616e64206d6f642033203d203000000000000000608482015260a40161062e565b600061182c600184612a6e565b9050600080600361183e600687612a6e565b611849906004612a2d565b6118539190612a5a565b61185e600387612a5a565b611869906003612a95565b6118739190612a95565b915060648285608001516118879190612a2d565b6118919190612a5a565b905060008185608001516118a59190612a95565b905060006118b38783612a5a565b90506000601e6118c4836028612a2d565b6118ce9190612a5a565b905060006118dc8285612a6e565b60035460608a01519192506001600160a01b0316906118ff908290339086612203565b600042338b602001518c604001518d6080015160405160200161192695949392919061295e565b604051602081830303815290604052805190602001209050604051806101800160405280828152602001336001600160a01b031681526020018e6001600160a01b031681526020018b602001516001600160a01b031681526020018b6040015181526020018b6080015181526020018c81526020018a81526020018581526020018781526020018481526020018681525060086000336001600160a01b03166001600160a01b0316815260200190815260200160002060008381526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b01559050506040518060600160405280828152602001336001600160a01b031681526020018e6001600160a01b0316815250600960008c602001516001600160a01b03166001600160a01b0316815260200190815260200160002060008c6040015181526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550905050600660008b606001516001600160a01b03166001600160a01b0316815260200190815260200160002060008d81526020019081526020016000206000808201600090556001820160006101000a8154906001600160a01b03021916905560028201600090556003820160006101000a8154906001600160a01b03021916905560048201600090555050600760008b602001516001600160a01b03166001600160a01b0316815260200190815260200160002060008b6040015181526020019081526020016000206000808201600090556001820160006101000a8154906001600160a01b03021916905550508c6001600160a01b0316336001600160a01b03167fdf6f700531b14b91a457002d7310a33865f16743cd4131fb8b5dabd90d58ed8f838d60200151604051611cee9291909182526001600160a01b0316602082015260400190565b60405180910390a36080808b015160408051848152602081019290925281018d9052606081018b905290810185905260a0810187905260c0810184905260e081018690527f68cfaaf31187477db51aafc6d30b3617f109dc6a5295f1b7c0bb451d8442e11a906101000160405180910390a150505050505050505050505050565b7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc7611d9a81336120cd565b600554600160a01b900460ff1615611dc45760405162461bcd60e51b815260040161062e906127fd565b6001600160a01b03808416600090815260086020818152604080842087855282528084208151610180810183528154808252600183015488169482019490945260028201548716928101929092526003810154909516606082015260048501546080820152600585015460a0820152600685015460c0820152600785015460e0820152918401546101008301526009840154610120830152600a840154610140830152600b90930154610160820152919003611ed35760405162461bcd60e51b815260206004820152602860248201527f5b496e7374616c6c6d656e742e63616e63656c42696c6c5d2042696c6c206e6f6044820152673a103337bab7321760c11b606482015260840161062e565b600554606082015160808301516040808501519051637419d1a360e01b81526001600160a01b0390941693637419d1a393611f149390929091600401612997565b600060405180830381600087803b158015611f2e57600080fd5b505af1158015611f42573d6000803e3d6000fd5b5050506001600160a01b0380861660009081526008602081815260408084208985528252808420848155600180820180546001600160a01b0319908116909155600280840180548316905560038401805483169055600484018890556005840188905560068401889055600784018890559583018790556009808401889055600a8401889055600b90930187905560608a0180518916885292855283872060808b0180518952908652848820978855918701805482169055959094018054909516909455868101519187015187519451935160a089015160c08a015160e08b01516101208c01516101408d01516101608e01519751988c169c5095909a16997f01c5e0798075d68fa6a9f0aceecc835f5f7b2b19a2ae9315ebcab75e0562d835996120bf99909890979596949593949293919291909889526001600160a01b0397909716602089015260408801959095526060870193909352608086019190915260a085015260c084015260e08301526101008201526101200190565b60405180910390a350505050565b6120d782826111ec565b6108ab576120ef816001600160a01b031660146122b3565b6120fa8360206122b3565b60405160200161210b929190612acc565b60408051601f198184030181529082905262461bcd60e51b825261062e91600401612b41565b61213b82826111ec565b6108ab5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6121a682826111ec565b156108ab5760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261225d908590612456565b50505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606060006122c2836002612a2d565b6122cd906002612a95565b67ffffffffffffffff8111156122e5576122e56128e4565b6040519080825280601f01601f19166020018201604052801561230f576020820181803683370190505b509050600360fc1b8160008151811061232a5761232a612b74565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061235957612359612b74565b60200101906001600160f81b031916908160001a905350600061237d846002612a2d565b612388906001612a95565b90505b6001811115612400576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106123bc576123bc612b74565b1a60f81b8282815181106123d2576123d2612b74565b60200101906001600160f81b031916908160001a90535060049490941c936123f981612b8a565b905061238b565b50831561244f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161062e565b9392505050565b60006124ab826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125289092919063ffffffff16565b80519091501561082c57808060200190518101906124c99190612ba1565b61082c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161062e565b6060612537848460008561253f565b949350505050565b6060824710156125a05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161062e565b843b6125ee5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161062e565b600080866001600160a01b0316858760405161260a9190612bc3565b60006040518083038185875af1925050503d8060008114612647576040519150601f19603f3d011682016040523d82523d6000602084013e61264c565b606091505b509150915061265c828286612667565b979650505050505050565b6060831561267657508161244f565b8251156126865782518084602001fd5b8160405162461bcd60e51b815260040161062e9190612b41565b6000602082840312156126b257600080fd5b81356001600160e01b03198116811461244f57600080fd5b600080604083850312156126dd57600080fd5b50508035926020909101359150565b6001600160a01b03811681146115da57600080fd5b60006020828403121561271357600080fd5b813561244f816126ec565b60006020828403121561273057600080fd5b5035919050565b6000806040838503121561274a57600080fd5b82359150602083013561275c816126ec565b809150509250929050565b60008060006060848603121561277c57600080fd5b8335612787816126ec565b95602085013595506040909401359392505050565b600080604083850312156127af57600080fd5b82356127ba816126ec565b946020939093013593505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f5b496e7374616c6c6d656e742e7768656e496e7374616c6c6d656e744e6f7450604082015270185d5cd9591748139bdd0814185d5cd959607a1b606082015260800190565b6020808252602a908201527f5b496e7374616c6c6d656e742e63616e63656c4f726465725d204f72646572206040820152693737ba103337bab7321760b11b606082015260800190565b6020808252602c908201527f5b496e7374616c6c6d656e742e63616e63656c4f726465725d20556e6175746860408201526b37b934bd32b2103ab9b2b91760a11b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b60006040828403121561290c57600080fd5b6040516040810181811067ffffffffffffffff8211171561293d57634e487b7160e01b600052604160045260246000fd5b604052825181526020830151612952816126ec565b60208201529392505050565b9485526bffffffffffffffffffffffff19606094851b811660208701529290931b90911660348401526048830152606882015260880190565b6001600160a01b0393841681526020810192909252909116604082015260600190565b60208082526039908201527f5b496e7374616c6c6d656e742e70617942696c6c496e7374616c6c6d656e744e60408201527f46545d20506572696f64206973206e6f7420636f727265637400000000000000606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176105fe576105fe612a17565b634e487b7160e01b600052601260045260246000fd5b600082612a6957612a69612a44565b500490565b818103818111156105fe576105fe612a17565b600082612a9057612a90612a44565b500690565b808201808211156105fe576105fe612a17565b60005b83811015612ac3578181015183820152602001612aab565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612b04816017850160208801612aa8565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612b35816028840160208801612aa8565b01602801949350505050565b6020815260008251806020840152612b60816040850160208701612aa8565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603260045260246000fd5b600081612b9957612b99612a17565b506000190190565b600060208284031215612bb357600080fd5b8151801515811461244f57600080fd5b60008251612bd5818460208701612aa8565b919091019291505056fea2646970667358221220ecba051a75e80c28e2c822995b5f37cdb346435a6867c63e2ac3bdb2e16e015c64736f6c634300081100330000000000000000000000002b7623690fc399cdce28f4a60dfb64e75697db8d000000000000000000000000721ffa26b1b484cfb857a4b4687289b579ab1b2d

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

0000000000000000000000002b7623690fc399cdce28f4a60dfb64e75697db8d000000000000000000000000721ffa26b1b484cfb857a4b4687289b579ab1b2d

-----Decoded View---------------
Arg [0] : _nakaTokenAddress (address): 0x2b7623690fc399cdce28f4a60dfb64e75697db8d
Arg [1] : _nftVaultAddress (address): 0x721ffa26b1b484cfb857a4b4687289b579ab1b2d

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000002b7623690fc399cdce28f4a60dfb64e75697db8d
Arg [1] : 000000000000000000000000721ffa26b1b484cfb857a4b4687289b579ab1b2d


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading