Amoy Testnet

Contract

0xe19D79B31278B65Aa7b77F3AEA260A3e21A5a618

Overview

POL Balance

Polygon PoS Chain Amoy LogoPolygon PoS Chain Amoy LogoPolygon PoS Chain Amoy Logo0 POL

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Create Listing179288492025-02-11 1:47:4739 hrs ago1739238467IN
0xe19D79B3...e21A5a618
0 POL0.0087702660
Relist179126632025-02-10 15:51:592 days ago1739202719IN
0xe19D79B3...e21A5a618
0 POL0.0040246550
Create Listing177533722025-02-06 15:36:116 days ago1738856171IN
0xe19D79B3...e21A5a618
0 POL0.0087695460
Delete Listing177532222025-02-06 15:30:536 days ago1738855853IN
0xe19D79B3...e21A5a618
0 POL0.0025560
Relist177036682025-02-05 9:52:497 days ago1738749169IN
0xe19D79B3...e21A5a618
0 POL0.0416465500.00000001
Buy Room Batch175352052025-02-01 2:50:2711 days ago1738378227IN
0xe19D79B3...e21A5a618
0 POL0.0940475500.00000001
Create Listing174833422025-01-30 19:33:1712 days ago1738265597IN
0xe19D79B3...e21A5a618
0 POL0.0048981330.00000001
Create Listing174833172025-01-30 19:32:2512 days ago1738265545IN
0xe19D79B3...e21A5a618
0 POL0.0048981330.00000001
Create Listing174739222025-01-30 13:41:3513 days ago1738244495IN
0xe19D79B3...e21A5a618
0 POL0.0163271100
Create Listing173455402025-01-27 5:59:0916 days ago1737957549IN
0xe19D79B3...e21A5a618
0 POL0.0051630631.625
Create Listing173454192025-01-27 5:54:5116 days ago1737957291IN
0xe19D79B3...e21A5a618
0 POL0.0051630631.625
Create Listing173451062025-01-27 5:43:4716 days ago1737956627IN
0xe19D79B3...e21A5a618
0 POL0.0051634431.625
Delete Listing172877522025-01-25 18:54:1717 days ago1737831257IN
0xe19D79B3...e21A5a618
0 POL0.00947616222.96857676
Relist172876472025-01-25 18:50:3317 days ago1737831033IN
0xe19D79B3...e21A5a618
0 POL0.01857172222.96857676
Create Listing172876132025-01-25 18:49:2117 days ago1737830961IN
0xe19D79B3...e21A5a618
0 POL0.03640162222.96857676
Buy Room Batch171368762025-01-21 16:10:0122 days ago1737475801IN
0xe19D79B3...e21A5a618
0 POL0.0074805339.77
Buy Room Batch170613572025-01-19 18:39:4523 days ago1737311985IN
0xe19D79B3...e21A5a618
0 POL0.0065562334.85600001
Create Listing170556792025-01-19 15:02:5724 days ago1737298977IN
0xe19D79B3...e21A5a618
0 POL0.0061961337.95
Create Listing169857932025-01-17 21:27:5725 days ago1737149277IN
0xe19D79B3...e21A5a618
0 POL0.0077243847.31021257
Create Listing168457492025-01-14 10:26:1529 days ago1736850375IN
0xe19D79B3...e21A5a618
0 POL0.04226153258.86191427
Relist168416812025-01-14 8:02:0729 days ago1736841727IN
0xe19D79B3...e21A5a618
0 POL0.0056009567.24401303
Create Listing168416172025-01-14 7:59:5129 days ago1736841591IN
0xe19D79B3...e21A5a618
0 POL0.0135822683.18846973
Buy Room Batch167791192025-01-12 18:59:5530 days ago1736708395IN
0xe19D79B3...e21A5a618
0 POL0.04094807217.6988907
Buy Room Batch166307472025-01-09 1:51:5334 days ago1736387513IN
0xe19D79B3...e21A5a618
0 POL0.0056428530
Create Listing166176832025-01-08 17:59:2734 days ago1736359167IN
0xe19D79B3...e21A5a618
0 POL0.0048977730.00000001
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Marketplace

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 19 : Marketplace.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;

import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";
import { Context } from "@openzeppelin/contracts/utils/Context.sol";
import { IMarketplace } from "contracts/Marketplace/IMarketplace.sol";
import { IBukProtocol } from "contracts/BukProtocol/IBukProtocol.sol";
import { IBukNFTs } from "contracts/BukNFTs/IBukNFTs.sol";
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { Pausable } from "@openzeppelin/contracts/security/Pausable.sol";

contract Marketplace is Context, IMarketplace, AccessControl, Pausable {
    // Using safeERC20
    using SafeERC20 for IERC20;

    /**
     * @dev Constant for the role of the admin
     * @notice its a hash of keccak256("ADMIN_ROLE")
     */
    bytes32 public constant ADMIN_ROLE =
        0xa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775;

    /**
     * @dev Constant for the role of the Buk Protocol contract
     * @notice its a hash of keccak256("BUK_PROTOCOL_ROLE")
     */
    bytes32 public constant BUK_PROTOCOL_ROLE =
        0xc90056e279113999fe5438fedaf4c98ded59812067ad79dd0c968b1a84dc7c97;

    /// @dev Constant address Buk Protocol contract
    IBukProtocol private _bukProtocolContract;

    /// @dev Constant address Buk NFT contract
    IBukNFTs private _bukNFTContract;

    /// @dev Currency used for transaction
    IERC20 private _stableToken;

    /**
     * @dev mapping(uint256 => ListingDetails) _listedNFT  Captures listed bookings for sale
     */
    mapping(uint256 => ListingDetails) private _listedNFT;

    /**
     * @dev Constructor to initialize the contract
     * @param _bukProtocolAddress address of Buk protocol
     * @param _bukNFTAddress address of Buk NFT
     * @param _tokenAddress address of the stable token
     */
    constructor(
        address _bukProtocolAddress,
        address _bukNFTAddress,
        address _tokenAddress
    ) {
        _setStableToken(_tokenAddress);
        _setBukProtocol(_bukProtocolAddress);
        _setBukNFT(_bukNFTAddress);

        // Updating permission
        _grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
        _grantRole(ADMIN_ROLE, _msgSender());
    }

    /// @dev See {IMarketplace-pause}.
    function pause() external onlyRole(ADMIN_ROLE) {
        _pause();
    }

    /// @dev See {IMarketplace-unpause}.
    function unpause() external onlyRole(ADMIN_ROLE) {
        _unpause();
    }

    /// @dev Refer {IMarketplace-createListing}.
    function createListing(
        uint256 _tokenId,
        uint256 _price
    ) external whenNotPaused {
        require(!isBookingListed(_tokenId), "NFT already listed");
        IBukProtocol.Booking memory bookingDetails = _bukProtocolContract
            .getBookingDetails(_tokenId);
        require(
            _price >= bookingDetails.minSalePrice,
            "Minimum price requirement not met"
        );
        require(
            bookingDetails.status == IBukProtocol.BookingStatus.confirmed &&
                bookingDetails.tradeable,
            "Only tradable if available"
        );
        require(
            _bukNFTContract.balanceOf(_msgSender(), _tokenId) == 1,
            "Only owner can list"
        );
        require(
            _bukNFTContract.isApprovedForAll(_msgSender(), address(this)),
            "Approve marketplace for trade"
        );
        require(
            block.timestamp <
                (bookingDetails.checkin -
                    (bookingDetails.tradeTimeLimit * 3600)),
            "Trade limit time crossed"
        );
        _listedNFT[_tokenId] = ListingDetails(
            _price,
            _msgSender(),
            _listedNFT[_tokenId].index + 1,
            ListingStatus.active
        );

        emit ListingCreated(_msgSender(), _tokenId, _price);
    }

    /// @dev Refer {IMarketplace-deleteListing}.
    function deleteListing(uint256 _tokenId) external whenNotPaused {
        require(isBookingListed(_tokenId), "NFT not listed");
        require(
            _bukNFTContract.balanceOf(_msgSender(), _tokenId) == 1 ||
                hasRole(BUK_PROTOCOL_ROLE, _msgSender()),
            "Owner or Buk protocol can delete"
        );
        uint256 listingIndex = _listedNFT[_tokenId].index;
        delete _listedNFT[_tokenId];
        _listedNFT[_tokenId].index = listingIndex + 1;
        emit DeletedListing(_tokenId);
    }

    /// @dev Refer {IMarketplace-relist}.
    function relist(
        uint256 _tokenId,
        uint256 _newPrice
    ) external whenNotPaused {
        require(isBookingListed(_tokenId), "NFT not listed");
        IBukProtocol.Booking memory bookingDetails = _bukProtocolContract
            .getBookingDetails(_tokenId);
        require(
            _bukNFTContract.balanceOf(_msgSender(), _tokenId) == 1,
            "Only owner can relist"
        );
        require(
            bookingDetails.status == IBukProtocol.BookingStatus.confirmed,
            "Tradeable if available"
        );
        require(
            _newPrice >= bookingDetails.minSalePrice,
            "Minimum price requirement not met"
        );
        uint256 oldPrice = _listedNFT[_tokenId].price;
        _listedNFT[_tokenId].status = ListingStatus.active;
        _listedNFT[_tokenId].price = _newPrice;
        _listedNFT[_tokenId].index = _listedNFT[_tokenId].index + 1;
        emit Relisted(_tokenId, oldPrice, _newPrice);
    }

    /// @dev Refer {IMarketplace-buyRoom}.
    function buyRoom(uint256 _tokenId) external whenNotPaused {
        require(
            _listedNFT[_tokenId].status == ListingStatus.active,
            "NFT not listed"
        );
        _buy(_tokenId);
    }

    /// @dev Refer {IMarketplace-buyRoomBatch}.
    function buyRoomBatch(uint256[] calldata _tokenIds) external whenNotPaused {
        uint256 len = _tokenIds.length;
        for (uint256 i = 0; i < len; ) {
            require(
                _listedNFT[_tokenIds[i]].status == ListingStatus.active,
                "NFT not listed"
            );
            _buy(_tokenIds[i]);
            unchecked {
                i += 1;
            }
        }
    }

    /// @dev Refer {IMarketplace-setBukProtocol}.
    function setBukProtocol(
        address _bukProtocol
    ) external onlyRole(ADMIN_ROLE) {
        _setBukProtocol(_bukProtocol);
    }

    /// @dev Refer {IMarketplace-setBukNFT}.
    function setBukNFT(address _bukNFT) external onlyRole(ADMIN_ROLE) {
        _setBukNFT(_bukNFT);
    }

    /// @dev Refer {IMarketplace-setStableToken}.
    function setStableToken(
        address _tokenAddress
    ) external onlyRole(ADMIN_ROLE) {
        _setStableToken(_tokenAddress);
    }

    /// @dev Refer {IMarketplace-getStableToken}.
    function getStableToken() external view returns (address) {
        return address(_stableToken);
    }

    /// @dev Refer {IMarketplace-getBukProtocol}.
    function getBukProtocol() external view returns (address) {
        return address(_bukProtocolContract);
    }

    /// @dev Refer {IMarketplace-getBukNFT}.
    function getBukNFT() external view returns (address) {
        return address(_bukNFTContract);
    }

    /// @dev Refer {IMarketplace-getListingDetails}.
    function getListingDetails(
        uint256 _tokenId
    ) external view returns (ListingDetails memory) {
        return _listedNFT[_tokenId];
    }

    /// @dev Refer {IMarketplace-isBookingListed}.
    function isBookingListed(uint256 _tokenId) public view returns (bool) {
        return _listedNFT[_tokenId].price > 0 ? true : false;
    }

    /// @dev Function sets new Buk NFT address
    function _setBukNFT(address _bukNFT) private {
        require(_bukNFT != address(0), "Invalid address");
        _bukNFTContract = IBukNFTs(_bukNFT);

        emit BukNFTSet(_bukNFT);
    }

    /**
     * @dev Function sets new Buk protocol address
     * @param _bukProtocol New Buk protocol address
     */
    function _setBukProtocol(address _bukProtocol) private {
        require(_bukProtocol != address(0), "Invalid address");
        address oldAddress = address(_bukProtocolContract);
        _bukProtocolContract = IBukProtocol(_bukProtocol);

        _grantRole(BUK_PROTOCOL_ROLE, address(_bukProtocol));
        _revokeRole(BUK_PROTOCOL_ROLE, address(oldAddress));

        emit BukProtocolSet(_bukProtocol);
    }

    /// @param _tokenAddress New stable token address
    function _setStableToken(address _tokenAddress) private {
        require(_tokenAddress != address(0), "Invalid address");
        _stableToken = IERC20(_tokenAddress);

        emit StableTokenSet(_tokenAddress);
    }

    /**
     * @dev Safe transfer NFT/Booking to buyer and transfer the price to owner wallet and buk treasury
     * @dev Transfer sale price and royalties
     * @param _tokenId, NFT/Booking ID
     */
    function _buy(uint256 _tokenId) private {
        IBukProtocol.Booking memory bookingDetails = _bukProtocolContract
            .getBookingDetails(_tokenId);
        require(
            bookingDetails.status == IBukProtocol.BookingStatus.confirmed &&
                bookingDetails.tradeable,
            "Tradeable if available"
        );
        require(
            block.timestamp <
                (bookingDetails.checkin -
                    (bookingDetails.tradeTimeLimit * 3600)),
            "Trade limit time crossed"
        );
        require(
            (_stableToken.allowance(_msgSender(), address(this)) >=
                _listedNFT[_tokenId].price),
            "Check the allowance"
        );
        address nftOwner = _listedNFT[_tokenId].owner;
        uint256 totalPrice = _listedNFT[_tokenId].price;
        require(
            _bukNFTContract.balanceOf(nftOwner, _tokenId) == 1,
            "NFT owner mismatch"
        );
        (address royaltyAddress, uint256 royaltyAmount) = _bukNFTContract
            .royaltyInfo(_tokenId, _listedNFT[_tokenId].price);

        _stableToken.safeTransferFrom(
            _msgSender(),
            royaltyAddress,
            royaltyAmount
        );
        _stableToken.safeTransferFrom(
            _msgSender(),
            nftOwner,
            _listedNFT[_tokenId].price - royaltyAmount
        );
        _bukNFTContract.safeTransferFrom(
            address(nftOwner),
            _msgSender(),
            _tokenId,
            1,
            ""
        );
        uint256 listingIndex = _listedNFT[_tokenId].index;
        delete _listedNFT[_tokenId];
        _listedNFT[_tokenId].index = listingIndex + 1;
        emit RoomBought(_tokenId, nftOwner, _msgSender(), totalPrice);
    }
}

File 2 of 19 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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:
 *
 * ```solidity
 * 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}:
 *
 * ```solidity
 * 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. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
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);
        _;
    }

    /**
     * @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 virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @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 virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " 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 virtual 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.
     *
     * May emit a {RoleGranted} event.
     */
    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.
     *
     * May emit a {RoleRevoked} event.
     */
    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`.
     *
     * May emit a {RoleRevoked} event.
     */
    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.
     *
     * May emit a {RoleGranted} event.
     *
     * [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.
     *
     * May emit a {RoleGranted} event.
     */
    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.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 19 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 4 of 19 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        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 19 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] calldata accounts,
        uint256[] calldata ids
    ) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 6 of 19 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 7 of 19 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 8 of 19 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 13 of 19 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

File 14 of 19 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 15 of 19 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 16 of 19 : IBukNFTs.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;

import { IERC1155 } from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

/**
 * @title Interface to define the BUK NFTs
 * @author BUK Technology Inc
 * @dev Collection of all procedures related to the BUK NFTs.
 */
interface IBukNFTs is IERC1155 {
    /// @dev Emitted when Buk Protocol Address is updated.
    event SetBukProtocol(
        address oldBukProtocolContract,
        address newBukProtocolContract
    );

    /// @dev Emitted when treasury is updated.
    event SetBukTreasury(
        address oldTreasuryContract,
        address newTreasuryContract
    );

    /// @dev Emitted when marketplace role is granted.
    event SetMarketplace(address marketplaceContract);

    /// @dev Event to set NFT contract role
    event SetNFTPOSContractRole(
        address oldNFTPOSContractAddr,
        address newNFTPOSContractAddr
    );

    /// @dev Event to set token URI
    event SetURI(uint256 id, string oldUri, string newUri);

    /**
     * @dev Function to set the Buk Protocol Contract address.
     * @param _bukProtocolContract Address of the Buk Protocol Contract.
     * @notice This function can only be called by addresses with `ADMIN_ROLE`
     */
    function setBukProtocol(address _bukProtocolContract) external;

    /**
     * @dev Function to set the treasury address.
     * @param _bukTreasuryContract Address of the treasury.
     * @notice This function can only be called by addresses with `ADMIN_ROLE`
     */
    function setBukTreasury(address _bukTreasuryContract) external;

    /**
     * @dev Function to set the marketplace address.
     * @param _marketplaceContract Address of the marketplace.
     * @notice This function can only be called by addresses with `ADMIN_ROLE`
     */
    function setMarketplaceRole(address _marketplaceContract) external;

    /**
     * @dev Function to set the BukPOSNFT to the contract
     * @param _nftPOSContract address: The address of the NFT contract
     * @notice This function can only be called by a contract with `ADMIN_ROLE`
     */
    function setBukPOSNFTRole(address _nftPOSContract) external;

    /**
     * @dev Sets the URI for a specific token ID.
     * @param _id - The ID of the token.
     * @param _newuri - The new URI for the token.
     * @notice This function can only be called by a contract with `ADMIN_ROLE`
     */
    function setURI(uint256 _id, string memory _newuri) external;

    /**
     * @dev Mint a new NFT with a specific token ID, account, amount, and data.
     * @param _id - The token ID to mint the NFT with.
     * @param _account - The account to mint the NFT to.
     * @param _amount - The amount of NFTs to mint.
     * @param _data - The data to store with the NFT.
     * @param _uri - The URI to associate with the NFT.
     * @return uint256 - The token ID of the newly minted NFT.
     * @notice This function can only be called by a contract with `BUK_PROTOCOL_ROLE`
     */
    function mint(
        uint256 _id,
        address _account,
        uint256 _amount,
        bytes calldata _data,
        string calldata _uri
    ) external returns (uint256);

    /**
     * @dev Burn a specific NFT.
     * @param _account - The account to burn the NFT from.
     * @param _id - The token ID of the NFT to burn.
     * @param _amount - The amount of NFTs to burn.
     * @param _mintPOS - Whether or not to call the Buk POS NFTs contract to burn the NFT.
     * @notice This function can only be called by a contract with `BUK_PROTOCOL_ROLE`
     */
    function burn(
        address _account,
        uint256 _id,
        uint256 _amount,
        bool _mintPOS
    ) external;

    /**
     * @dev Transfers ownership of an NFT token from one address to another.
     * @param _from - The current owner of the NFT.
     * @param _to - The address to transfer the ownership to.
     * @param _id - The ID of the NFT token.
     * @param _amount - Count of ERC1155 token of token ID.
     * @param _data - Additional data to include in the transfer.
     * @notice This function checks if the NFT is tranferable or not.
     * @notice This function can only be called by a contract with `MARKETPLACE_CONTRACT_ROLE`
     */
    function safeTransferFrom(
        address _from,
        address _to,
        uint256 _id,
        uint256 _amount,
        bytes memory _data
    ) external;

    /**
     * @dev Transfers ownership of multiple NFT tokens from one address to another.
     * @param _from - The current owner of the NFTs.
     * @param _to - The address to transfer the ownership to.
     * @param _ids - The IDs of the NFT tokens.
     * @param _amounts - Count of ERC1155 tokens of the respective token IDs.
     * @param _data - Additional data to include in the transfer.
     * @notice This function checks if the NFTs are tranferable or not.
     * @notice This function can only be called by a contract with `MARKETPLACE_CONTRACT_ROLE`
     */
    function safeBatchTransferFrom(
        address _from,
        address _to,
        uint256[] memory _ids,
        uint256[] memory _amounts,
        bytes memory _data
    ) external;

    /**
     * @dev To retrieve information about the royalties associated with a specific token.
     * @param _tokenId - The token ID of the NFT.
     * @param _salePrice - The price at which the token is being sold.
     * @return receiver - The address of the royalty receiver.
     * @return royaltyAmount - The amount of royalty to be paid.
     */
    function royaltyInfo(
        uint256 _tokenId,
        uint256 _salePrice
    ) external view returns (address receiver, uint256 royaltyAmount);

    /**
     * @dev Returns the URI associated with the token ID.
     * @param _id - The token ID to retrieve the URI for.
     * @return string - The URI associated with the token ID.
     */
    function uri(uint256 _id) external view returns (string memory);
}

File 17 of 19 : IBukProtocol.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;
import { IBukRoyalties } from "../BukRoyalties/IBukRoyalties.sol";

/**
 * @title Interface to define the BUK protocol
 * @author BUK Technology Inc
 * @dev Collection of all procedures related to the BUK protocol
 * @dev This interface is used by the other child contract to interact with the BukProtocol contract.
 */
interface IBukProtocol {
    /**
     * @dev Enum for booking statuses.
     * @var BookingStatus.nil         Booking has not yet been initiated.
     * @var BookingStatus.booked      Booking has been initiated but not yet confirmed.
     * @var BookingStatus.confirmed   Booking has been confirmed.
     * @var BookingStatus.cancelled   Booking has been cancelled.
     * @var BookingStatus.checkedin   Booking has been checked-in.
     * @var BookingStatus.checkedout  Booking has been checked-out.
     */
    enum BookingStatus {
        nil,
        booked,
        confirmed,
        cancelled,
        checkedin,
        checkedout
    }

    /**
     * @dev Struct for booking details.
     * @param uint256 id                Booking ID.
     * @param uint256 tokenId           Token ID.
     * @param bytes32 propertyId        Property ID.
     * @param BookingStatus status      Booking status.
     * @param uint256 adult[]             Number of adults.
     * @param uint256 child[]             Number of children.
     * @param address owner             Address of the booking owner.
     * @param uint256 checkin           Check-in date.
     * @param uint256 checkout          Check-out date.
     * @param uint256 total             Total price.
     * @param uint256 baseRate          Base rate.
     * @param uint256 commission        Buk commission.
     * @param uint256 minSalePrice      Min Sale Price.
     * @param uint256 tradeTimeLimit    Buy will excecute if tradeLimitTime is not crossed (in hours)
     * @param bool tradeable            Is the NFT Tradeable.
     */
    struct Booking {
        uint256 id;
        uint256 tokenId;
        bytes32 propertyId;
        BookingStatus status;
        uint256 adult;
        uint256 child;
        address firstOwner;
        uint256 checkin;
        uint256 checkout;
        uint256 total;
        uint256 baseRate;
        uint256 commission;
        uint256 minSalePrice;
        uint256 tradeTimeLimit;
        bool tradeable;
    }

    /**
     * @dev Struct for booking details.
     * @param uint256 total             Total price.
     * @param uint256 baseRate          Base rate.
     * @param uint256 minSalePrice      Min Sale Price.
     * @param uint256 adult[]             Number of adults.
     * @param uint256 child[]             Number of children.
     * @param bytes32 propertyId        Property ID.
     * @param uint256 checkin           Check-in date.
     * @param uint256 checkout          Check-out date.
     * @param uint256 tradeTimeLimit    Buy will excecute if tradeLimitTime is not crossed (in hours)
     * @param bool tradeable            Is the NFT Tradeable.
     * @param address user             Address of the booking owner.
     */
    struct BookingList {
        uint256[] total;
        uint256[] baseRate;
        uint256[] minSalePrice;
        uint256[] adult;
        uint256[] child;
        bytes32 propertyId;
        uint256 checkIn;
        uint256 checkOut;
        uint256 tradeTimeLimit;
        bool tradeable;
        address user;
    }

    /// @dev Emitted when the admin wallet is set.
    event SetAdminWallet(address newAdminWallet);

    /// @dev Emitted when the commission is set.
    event SetCommission(uint256 newCommission);

    /// @dev Emitted when BukNFTs contract address is updated.
    event SetBukNFTs(address newNFTContract);

    /// @dev Emitted when BukPOSNFTs contract address is updated.
    event SetBukPOSNFTs(address newNFTPOSContract);

    /// @dev Emitted when BukRoyalties contract address is updated.
    event SetRoyaltiesContract(address newRoyaltiesContract);

    /// @dev Emitted when signer verifier is updated.
    event SetSignerVerifier(address newSignerVerifier);

    /// @dev Emitted when Buk treasury is updated.
    event SetBukTreasury(address newTreasuryContract);

    /// @dev Emitted when Buk Wallet is updated.
    event SetBukWallet(address newBukWalletContract);

    /// @dev Emitted when stable token is updated.
    event SetStableToken(address newStableToken);

    /**
     * @dev Emitted when the tradeability of a Buk NFT is toggled.
     * @param tokenId Token Id whose tradeability is being toggled.
     * @param tradeable Is the NFT tradeable.
     */
    event ToggleTradeability(uint256 indexed tokenId, bool indexed tradeable);

    /// @dev Emitted when single room is booked.
    event BookRoom(
        uint256 indexed booking,
        bytes32 indexed propertyId,
        uint256 checkin,
        uint256 checkout,
        uint256 adult,
        uint256 child
    );

    /// @dev Emitted when booking refund is done.
    event BookingRefund(uint256 total, address owner);

    /// @dev Emitted when room bookings are confirmed.
    event MintedBookingNFT(uint256[] bookings, bool status);

    /// @dev Emitted when room bookings are checked in.
    event CheckinRooms(uint256[] bookings, bool status);

    /// @dev Emitted when room bookings are checked out.
    event CheckoutRooms(uint256[] bookings, bool status);

    /// @dev Emitted when room bookings are cancelled.
    event CancelRoom(
        uint256[] bookingIds,
        uint256 indexed total,
        bool indexed status
    );

    /// @dev Emitted when room bookings are cancelled.
    event EmergencyCancellation(uint256 indexed bookingId, bool indexed status);

    /**
     * @dev Sets the admin wallet address.
     * @param _adminAddr The new admin wallet address to be set.
     * @notice This function can only be called by admin
     */
    function setAdmin(address _adminAddr) external;

    /**
     * @dev This function is used to set the address of the signature verifier contract.
     * @param _signatureVerifier The address of the signature verifier contract.
     * @notice This function can only be called by admin
     */
    function setSignatureVerifier(address _signatureVerifier) external;

    /**
     * @dev Function to update the treasury address.
     * @param _bukTreasuryContract Address of the treasury.
     * @notice This function can only be called by admin
     */
    function setBukTreasury(address _bukTreasuryContract) external;

    /**
     * @dev Function to update the Buk Wallet address to collect commission.
     * @param _bukWalletContract Address of the Buk Wallet.
     * @notice This function can only be called by admin
     */
    function setBukWallet(address _bukWalletContract) external;

    /**
     * @dev Function to update the stable token address.
     * @param _stableToken Address of the stable token contract.
     * @notice This function can only be called by admin
     */
    function setStableToken(address _stableToken) external;

    /**
     * @dev Function to update the BukNFTs contract address.
     * @param _nftContractAddr Address of the BukNFTs contract.
     * @notice This function can only be called by admin
     */
    function setBukNFTs(address _nftContractAddr) external;

    /**
     * @dev Function to update the BukPOSNFTs contract address.
     * @param _nftPOSContractAddr Address of the BukPOSNFTs contract.
     * @notice This function can only be called by admin
     */
    function setBukPOSNFTs(address _nftPOSContractAddr) external;

    /**
     * @dev Sets the Buk royalties contract address.
     * Can only be called by accounts with the ADMIN_ROLE.
     * @param _royaltiesContract The new royaltiesContract address to set.
     * @notice This function updates the royaltiesContract address and emits an event.
     * @dev If {_royaltiesContract} is the zero address, the function will revert.
     * @dev Emits a {SetRoyaltiesContract} event with the previous royaltiesContract address and the new address.
     */
    function setRoyaltiesContract(address _royaltiesContract) external;

    /**
     * @dev Function to set the Buk commission percentage.
     * @param _commission Commission percentage.
     * @notice This function can only be called by admin
     */
    function setCommission(uint256 _commission) external;

    /**
     * @dev Function to toggle the tradeability of an asset.
     * @param _tokenId Token Id whose tradeability is being toggled.
     * @notice This function can only be called by admin
     */
    function toggleTradeability(uint256 _tokenId) external;

    /**
     * @dev Function to pause the contract.
     * @notice This function can only be called by admin
     */
    function pause() external;

    /**
     * @dev Function to unpause the contract.
     * @notice This function can only be called by admin
     */
    function unpause() external;

    /**
     * @dev Function to book rooms.
     * @param _total Total amount to be paid.
     * @param _baseRate Base rate of the room.
     * @param _minSalePrice Minimum sale price for the booking.
     * @param _adult Number of adults.
     * @param _child Number of children.
     * @param _propertyId Property ID.
     * @param _checkin Checkin date.
     * @param _checkout Checkout date.
     * @param _tradeTimeLimit Trade Limit of NFT based on Checkin time.
     * @param _tradeable Is the booking NFT tradeable.
     * @return ids IDs of the bookings.
     */
    function bookRooms(
        uint256[] memory _total,
        uint256[] memory _baseRate,
        uint256[] memory _minSalePrice,
        uint256[] memory _adult,
        uint256[] memory _child,
        bytes32 _propertyId,
        uint256 _checkin,
        uint256 _checkout,
        uint256 _tradeTimeLimit,
        bool _tradeable
    ) external returns (bool);

    /**
     * @dev Function to book rooms.
     * @param _total Total amount to be paid.
     * @param _baseRate Base rate of the room.
     * @param _minSalePrice Minimum sale price for the booking.
     * @param _adult Number of adults.
     * @param _child Number of children.
     * @param _propertyId Property ID.
     * @param _checkin Checkin date.
     * @param _checkout Checkout date.
     * @param _tradeTimeLimit Trade Limit of NFT based on Checkin time.
     * @param _tradeable Is the booking NFT tradeable.
     * @param _user Address of user which we are booking.
     * @return ids IDs of the bookings.
     * @notice This function can only be called by admin
     * @notice This function is used to book rooms on behalf of the user.
     */
    function bookRoomsOwner(
        uint256[] memory _total,
        uint256[] memory _baseRate,
        uint256[] memory _minSalePrice,
        uint256[] memory _adult,
        uint256[] memory _child,
        bytes32 _propertyId,
        uint256 _checkin,
        uint256 _checkout,
        uint256 _tradeTimeLimit,
        bool _tradeable,
        address _user
    ) external returns (bool);

    /**
     * @dev Allows the admin to refund a booking by canceling it and transferring the amount to the owner.
     * @param _ids An array of booking IDs that need to be refunded.
     * @param _owner The address of the owner of the bookings.
     * @notice This function is usually executed when the booking is unsuccessful from the hotel's end.
     * @notice This function can only be called by admin
     */
    function bookingRefund(uint256[] memory _ids, address _owner) external;

    /**
     * @dev Function to mint new BukNFT tokens based on the provided booking IDs and URIs.
     * @param _ids An array of booking IDs representing the unique identifier for each BukNFT token.
     * @param _uri An array of URIs corresponding to each booking ID, which will be associated with the Buk NFTs.
     * @param _user Address of user which we are minting.
     * @notice Only the owner of the booking can book the NFTs and confirm the rooms.
     * @notice The number of bookings and URIs should be same.
     * @notice The booking status should be booked to confirm it.
     * @notice The NFTs are minted to the owner of the booking.
     * @notice This function can only be called by admin
     */
    function mintBukNFTOwner(
        uint256[] memory _ids,
        string[] memory _uri,
        address _user
    ) external;

    /**
     * @dev Function to checkin the rooms.
     * @param _ids An array of booking IDs representing the unique identifier for each BukNFT token.
     * @notice The booking status should be confirmed to checkin it.
     * @notice Once checkedin the NFT becomes non-tradeable.
     * @notice This function can only be called by admin or the owner of the booking NFT
     */
    function checkin(uint256[] memory _ids) external;

    /**
     * @dev Function to checkout the rooms.
     * @param _ids IDs of the bookings.
     * @param _recipients Owner address of tokens of the bookings.
     * @notice Only the admin can checkout the rooms.
     * @notice The booking status should be checkedin to checkout it.
     * @notice The Active Booking NFTs are burnt from the owner's account.
     * @notice The Utility NFTs are minted to the owner of the booking.
     * @notice This function can only be called by admin
     * @notice POSR NFT will be minted to recipients address.
     */
    function checkout(
        uint256[] memory _ids,
        address[] memory _recipients
    ) external;

    /**
     * @dev Function to cancel the room bookings.
     * @param _ids Array of booking.
     * @param _penalties Array of penalty amount to be refunded.
     * @param _refunds Array of refund amount to be refunded.
     * @param _charges Array of charges amount to be deducted.
     * @param _bookingOwner Owner of the booking.
     * @notice Only the admin can cancel the rooms.
     * @notice The booking status should be confirmed to cancel it.
     * @notice The Active Booking NFTs are burnt from the owner's account.
     * @notice Buk commission is non-refundable.
     * @notice This function can only be called by admin
     */
    function cancelRooms(
        uint256[] memory _ids,
        uint256[] memory _penalties,
        uint256[] memory _refunds,
        uint256[] memory _charges,
        address _bookingOwner,
        bytes memory _signature
    ) external;

    /**
     * @dev Function to perform an emergency cancellation of a booking.
     * @param _id The ID of the booking to be cancelled.
     * @param _refund The amount to be refunded to the booking owner.
     * @param _charges The charges associated with the cancellation(if any).
     * @param _bookingOwner The address of the booking owner.
     * @notice This function can only be called by admin
     * @notice Total refund amount and charges should be less than or equal to the total amount (Total = total booking amount + buk commission).
     */
    function emergencyCancellation(
        uint256 _id,
        uint256 _refund,
        uint256 _charges,
        address _bookingOwner
    ) external;

    /**
     * Function to get wallet addresses
     * @return nftContract The address of the nft contract
     * @return nftPOSContract The address of the nftPOS contract
     * @return royaltiesContract The address of the royalties contract
     * @return signatureVerifier The address of the signature verifier contract
     * @return bukTreasury The address of the bukTreasury contract
     * @return stableToken The address of the stable token contract
     * @return bukWallet The address of the bukWallet contract
     * @return admin The address of the stable token contract
     */
    function getWallets()
        external
        view
        returns (
            address nftContract,
            address nftPOSContract,
            address royaltiesContract,
            address signatureVerifier,
            address bukTreasury,
            address stableToken,
            address bukWallet,
            address admin
        );

    /**
     * @dev To get the booking details
     * @param _tokenId ID of the booking.
     */
    function getBookingDetails(
        uint256 _tokenId
    ) external view returns (Booking memory);

    /**
     * @dev Function to retrieve royalty information.
     * @param _tokenId ID of the token
     * @notice Token ID and Booking ID are same.
     */
    function getRoyaltyInfo(
        uint256 _tokenId
    ) external view returns (IBukRoyalties.Royalty[] memory);
}

File 18 of 19 : IBukRoyalties.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;

/**
 * @title Interface to define the BUK royalties.
 * @author BUK Technology Inc
 * @dev Collection of all functions related to the BUK Royalties.
 */
interface IBukRoyalties {
    /**
     * @dev Struct named Royalty to store royalty information.
     * @param address receiver           The address of the receiver who will receive the royalty
     * @param uint96 royaltyFraction     The fraction of the royalty to be paid, expressed as an unsigned 96-bit integer
     */
    struct Royalty {
        address receiver;
        uint96 royaltyFraction;
    }

    /**
     * @dev Emitted when new buk protocol address has been updated
     * @param oldBukProtocol, old buk protocol address
     * @param newBukProtocol, new buk protocol address
     */
    event SetBukProtocol(
        address oldBukProtocol,
        address newBukProtocol
    );

    /**
     * @dev Emitted when new Buk royalty has been updated
     * @param oldRoyalty, old buk royalty
     * @param newRoyalty, new buk royalty
     * @notice This event is used when Buk royalty is updated
     */
    event SetBukRoyalty(uint96 oldRoyalty, uint96 newRoyalty);

    /**
     * @dev Emitted when Hotel royalty has been updated
     * @param oldRoyalty, old buk royalty
     * @param newRoyalty, new buk royalty
     * @notice This event is used when Hotel royalty is updated
     */
    event SetHotelRoyalty(uint96 oldRoyalty, uint96 newRoyalty);

    /**
     * @dev Emitted when First Owner royalty has been updated
     * @param oldRoyalty, old buk royalty
     * @param newRoyalty, new buk royalty
     * @notice This event is used when First Owner royalty is updated
     */
    event SetFirstOwnerRoyalty(uint96 oldRoyalty, uint96 newRoyalty);

    /**
     * @dev Emitted when other royalties are updated
     * @param oldRoyalty, array of old royalties
     * @param newRoyalty, array od new royalties
     */
    event SetOtherRoyalties(uint96[] oldRoyalty, uint96[] newRoyalty);

    /**
     * @dev Sets the Buk Protocol address.
     * Can only be called by accounts with the ADMIN_ROLE.
     * @param _bukProtocolContract The new Buk Protocol address to set.
     * @dev If {_bukProtocolContract} is the zero address, the function will revert.
     * @dev Emits a {SetBukProtocol} event with the previous Buk Protocol address and the new address.
     * @notice This function updates the Buk Protocol address and emits an event.
     * @notice This function can only be called by `ADMIN_ROLE`
     */
    function setBukProtocolContract(address _bukProtocolContract) external;

    /**
     * @dev Function to define the royalty Fraction for Buk.
     * @param _recipient Recipient address.
     * @param _royaltyFraction Royalty Fraction.
     * @notice This function can only be called by `ADMIN_ROLE`
     */
    function setBukRoyaltyInfo(
        address _recipient,
        uint96 _royaltyFraction
    ) external;

    /**
     * @dev Function to define the royalty Fraction for Hotel.
     * @param _recipient Recipient address.
     * @param _royaltyFraction Royalty Fraction.
     * @notice This function can only be called by `ADMIN_ROLE`
     */
    function setHotelRoyaltyInfo(
        address _recipient,
        uint96 _royaltyFraction
    ) external;

    /**
     * @dev Function to define the royalty Fraction for the First Owners.
     * @param _royaltyFraction Royalty Fraction.
     * @notice This function can only be called by `ADMIN_ROLE`
     */
    function setFirstOwnerRoyaltyInfo(uint96 _royaltyFraction) external;

    /**
     * @dev Function to define the royalties.
     * @param _recipients Array of recipients of royalties
     * @param _royaltyFractions Array of percentages for each recipients in the _recipients[] order.
     * @notice This function can only be called by `ADMIN_ROLE`
     */
    function setOtherRoyaltyInfo(
        address[] memory _recipients,
        uint96[] memory _royaltyFractions
    ) external;

    /**
     * @dev Function to retrieve royalty information.
     * @param _tokenId ID of the token
     * @notice Token ID and Booking ID are same.
     */
    function getRoyaltyInfo(
        uint256 _tokenId
    ) external view returns (Royalty[] memory);
}

File 19 of 19 : IMarketplace.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;

/**
 * @title Interface to define the BUK marketplace
 * @author BUK Technology Inc
 * @dev Collection of all procedures related to the marketplace
 */
interface IMarketplace {
    /**
     * @title Struct to define the booking/room listing details
     * @param price, price of room/booking
     * @param owner, Owner of room/booking
     * @param status, status of listing
     */
    struct ListingDetails {
        uint256 price;
        address owner;
        uint256 index;
        ListingStatus status;
    }

    /**
     * @dev Enum for listing statuses.
     * @var ListingStatus.inactive   Listing has been inactive
     * @var ListingStatus.active     Listing has been active.
     */
    enum ListingStatus {
        inactive,
        active
    }

    /**
     * @dev Emitted when room/booking NFT bought
     * @param tokenId, TokenId of the bought booking
     * @param previousOwner, Address of the previous owner
     * @param newOwner, Address of the new owner
     * @param price, Price of the bought booking
     */
    event RoomBought(
        uint256 indexed tokenId,
        address previousOwner,
        address newOwner,
        uint256 price
    );

    /**
     * @dev Emitted when a room/booking NFT is listed for sale
     * @param owner, Address of the initial owner
     * @param tokenId, tokenId is the unique identifier of booking NFT
     * @param price, Sale price of room/booking
     */
    event ListingCreated(address owner, uint256 indexed tokenId, uint256 price);

    /**
     * @dev Emitted when a booking/room NFT is relisted
     * @param tokenId, unique ID of the booking NFT
     * @param oldPrice, old price of the room/booking
     * @param newPrice, new price of the room/booking
     */
    event Relisted(uint256 indexed tokenId, uint256 oldPrice, uint256 newPrice);

    /**
     * @dev Emitted when a booking/room is deleted from list
     * @param tokenId, unique ID of the booking NFT
     */
    event DeletedListing(uint256 indexed tokenId);

    /**
     * @dev Emitted when new BukProtocol address has been updated
     * @param newAddress, Address of the new bukProtocol
     */
    event BukProtocolSet(address newAddress);

    /**
     * @dev Emitted when new BukNFT address has been updated
     * @param newAddress, Address of the new bukNFT
     */
    event BukNFTSet(address newAddress);

    /**
     * @dev Emitted when new Stable token address has been updated
     * @param newAddress, Address of the new address
     */
    event StableTokenSet(address newAddress);

    /**
     * @dev Function to pause the contract.
     * @notice This function can only be called by admin
     */
    function pause() external;

    /**
     * @dev Function to unpause the contract.
     * @notice This function can only be called by admin
     */
    function unpause() external;

    /**
     * @dev Function will create a listing of Booking/Room NFT
     * @dev Seller has to approve marketplace to execute transfer before listing
     * @notice Only NFT owner can list
     * @param _tokenId room/booking NFT id
     * @param _price  Sale price of room/booking
     * @notice Will validate with room has not been checkedin and tradable shuld be true
     * @notice Price shouldn't be lessthan minimum sale price
     * @notice Trade time limit hours not crossed. Ex:Only able to trade before 12 hours of checkin
     */
    function createListing(uint256 _tokenId, uint256 _price) external;

    /**
     * @dev Function will delete listing
     * @dev NFT owner or BukProtocol can delete lisitng
     * @notice When user checkin, Buk protocol can call this function
     * @param _tokenId Unique ID
     */
    function deleteListing(uint256 _tokenId) external;

    /**
     * @dev Function will update price and status for listed NFT
     * @dev Only NFT owner can update
     * @param _tokenId Unique ID
     * @param _newPrice New price for NFT/Room
     */
    function relist(uint256 _tokenId, uint256 _newPrice) external;

    /**
     * @dev Function will enable user to buy this room/booking NFT
     * @param _tokenId room/booking NFT id
     * @dev Gets royalty details from BUK NFT and transfer the royalties
     * @dev NFT Owner should give approve marketplace to transfer booking
     * @dev Buyer should have approve marketplace to transfer its ERC20 tokens to pay price and royalties
     * @dev Only Marketplace contract can excecute transfer
     * @notice Buy will excecute only if, tradeLimitTime is not crossed and in active status and not checkedin bookings
     * @notice Will delete a entry once bought
     */
    function buyRoom(uint256 _tokenId) external;

    /**
     * @dev Function will enable user to buy multiple room/booking NFT
     * @param _tokenId Array of room/booking NFT id's
     * @dev Gets royalty details from BUK NFT and transfer the royalties
     * @dev NFT Owner should give approve marketplace to transfer booking
     * @dev Buyer should have approve marketplace to transfer its ERC20 tokens to pay price and royalties
     * @dev Only Marketplace contract can excecute transfer
     * @notice Buy will excecute only if, tradeLimitTime is not crossed and in active status and not checkedin bookings
     * @notice Will delete a entry once bought
     */
    function buyRoomBatch(uint256[] calldata _tokenId) external;

    /**
     * @dev Function will set new BUK protocol address
     * @param _bukProtocol address of new BUK protocol
     */
    function setBukProtocol(address _bukProtocol) external;

    /**
     * @dev Function will set new BUK NFT address
     * @param _bukNFT address of new BUK protocol
     */
    function setBukNFT(address _bukNFT) external;

    /**
     * @dev Function will set new stable token address
     * @param _tokenAddress address of new token address
     * @notice This token is used for transaction to make payments
     */
    function setStableToken(address _tokenAddress) external;

    /**
     * @dev Gets stable token address
     * @return address, Address of the stable token contract
     */
    function getStableToken() external view returns (address);

    /**
     * @dev Gets current BUK protocol address
     * @return address, Address of the BUK protocol contract
     */
    function getBukProtocol() external view returns (address);

    /**
     * @dev Gets current BUK NFT address
     * @return address, Address of the BUK NFT contract
     */
    function getBukNFT() external view returns (address);

    /**
     * @dev Function will provide Lisiting details of booking
     * @param _tokenId room/booking NFT id
     */
    function getListingDetails(
        uint256 _tokenId
    ) external view returns (ListingDetails calldata);

    /**
     * @dev Function check is NFT/Booking listed
     * @param _tokenId TokenID of booking
     */
    function isBookingListed(uint256 _tokenId) external view returns (bool);
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_bukProtocolAddress","type":"address"},{"internalType":"address","name":"_bukNFTAddress","type":"address"},{"internalType":"address","name":"_tokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"BukNFTSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"BukProtocolSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"DeletedListing","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"ListingCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"Relisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"RoomBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"StableTokenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BUK_PROTOCOL_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"buyRoom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"buyRoomBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"createListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"deleteListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getBukNFT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBukProtocol","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getListingDetails","outputs":[{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"enum IMarketplace.ListingStatus","name":"status","type":"uint8"}],"internalType":"struct IMarketplace.ListingDetails","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStableToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isBookingListed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_newPrice","type":"uint256"}],"name":"relist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bukNFT","type":"address"}],"name":"setBukNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bukProtocol","type":"address"}],"name":"setBukProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"setStableToken","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":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162002e4938038062002e49833981016040819052620000349162000426565b6001805460ff191690556200004981620000a1565b620000548362000144565b6200005f826200024f565b6200006c600033620002e8565b620000987fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177533620002e8565b50505062000470565b6001600160a01b038116620000ef5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b60448201526064015b60405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f119a23392e161a0bc5f9d5f3e2a6040c45b40d43a36973e10ea1de916f3d8a8a906020015b60405180910390a150565b6001600160a01b0381166200018e5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401620000e6565b600180546001600160a01b03838116610100908102610100600160a81b031984161790935591900416620001e37fc90056e279113999fe5438fedaf4c98ded59812067ad79dd0c968b1a84dc7c9783620002e8565b6200020f7fc90056e279113999fe5438fedaf4c98ded59812067ad79dd0c968b1a84dc7c978262000389565b6040516001600160a01b03831681527fb79d40049846bf0044c190df5a20c79147437c7c473117c4350d0e96ab71e3f09060200160405180910390a15050565b6001600160a01b038116620002995760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401620000e6565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f42eaa58024a20c114b9c6dc33efef570a993fb2ec74732ef81d660d652d33a119060200162000139565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000385576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620003443390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff161562000385576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b80516001600160a01b03811681146200042157600080fd5b919050565b6000806000606084860312156200043c57600080fd5b620004478462000409565b9250620004576020850162000409565b9150620004676040850162000409565b90509250925092565b6129c980620004806000396000f3fe608060405234801561001057600080fd5b50600436106101a35760003560e01c806391d14854116100ee578063cb60327511610097578063e183834411610071578063e18383441461039f578063e6282c6e146103b5578063ed8f9cf9146103c8578063fb05da2e146103db57600080fd5b8063cb60327514610366578063d547741f14610379578063db1bc87b1461038c57600080fd5b8063a79123a9116100c8578063a79123a91461032d578063b54d3cb314610340578063cae8ef4d1461035357600080fd5b806391d14854146102c7578063a05ce05e146102fe578063a217fddf1461032557600080fd5b80633f4ba83a1161015057806375b238fc1161012a57806375b238fc146102855780638456cb59146102ac578063872aed22146102b457600080fd5b80633f4ba83a1461026157806353979f34146102695780635c975abb1461027a57600080fd5b80633425fb7e116101815780633425fb7e1461021657806335262fd81461022957806336568abe1461024e57600080fd5b806301ffc9a7146101a8578063248a9ca3146101d05780632f2ff15d14610201575b600080fd5b6101bb6101b63660046123dd565b6103fb565b60405190151581526020015b60405180910390f35b6101f36101de36600461241f565b60009081526020819052604090206001015490565b6040519081526020016101c7565b61021461020f36600461244d565b610494565b005b61021461022436600461247d565b6104be565b6003546001600160a01b03165b6040516001600160a01b0390911681526020016101c7565b61021461025c36600461244d565b61059c565b610214610628565b6002546001600160a01b0316610236565b60015460ff166101bb565b6101f37fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b61021461065d565b6102146102c23660046124f2565b61068f565b6101bb6102d536600461244d565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6101f37fc90056e279113999fe5438fedaf4c98ded59812067ad79dd0c968b1a84dc7c9781565b6101f3600081565b61021461033b3660046124f2565b6109d1565b6101bb61034e36600461241f565b610f0b565b610214610361366004612514565b610f2d565b610214610374366004612514565b610f60565b61021461038736600461244d565b610f93565b61021461039a366004612514565b610fb8565b60015461010090046001600160a01b0316610236565b6102146103c336600461241f565b610feb565b6102146103d636600461241f565b611208565b6103ee6103e936600461241f565b61128e565b6040516101c79190612560565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061048e57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6000828152602081905260409020600101546104af8161132f565b6104b98383611339565b505050565b6104c66113d7565b8060005b81811015610596576001600460008686858181106104ea576104ea6125d2565b602090810292909201358352508101919091526040016000206003015460ff16600181111561051b5761051b612531565b1461056d5760405162461bcd60e51b815260206004820152600e60248201527f4e4654206e6f74206c697374656400000000000000000000000000000000000060448201526064015b60405180910390fd5b61058e848483818110610582576105826125d2565b9050602002013561142c565b6001016104ca565b50505050565b6001600160a01b038116331461061a5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610564565b61062482826119ec565b5050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756106528161132f565b61065a611a6b565b50565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756106878161132f565b61065a611abd565b6106976113d7565b6106a082610f0b565b6106ec5760405162461bcd60e51b815260206004820152600e60248201527f4e4654206e6f74206c69737465640000000000000000000000000000000000006044820152606401610564565b6001546040517f8db3ed600000000000000000000000000000000000000000000000000000000081526004810184905260009161010090046001600160a01b031690638db3ed60906024016101e060405180830381865afa158015610755573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077991906126b0565b6002549091506001600160a01b031662fdd58e336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03909116600482015260248101869052604401602060405180830381865afa1580156107f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610814919061277e565b6001146108635760405162461bcd60e51b815260206004820152601560248201527f4f6e6c79206f776e65722063616e2072656c69737400000000000000000000006044820152606401610564565b60028160600151600581111561087b5761087b612531565b146108c85760405162461bcd60e51b815260206004820152601660248201527f547261646561626c6520696620617661696c61626c65000000000000000000006044820152606401610564565b8061018001518210156109435760405162461bcd60e51b815260206004820152602160248201527f4d696e696d756d20707269636520726571756972656d656e74206e6f74206d6560448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610564565b6000838152600460205260409020805460038201805460ff19166001908117909155848355600290920154909161097a91906127c6565b60008581526004602090815260409182902060020192909255805183815291820185905285917f8f64f76a77541a65f4fe8ad487c2e0989e17239b21e7516a54b5f8b8fb86b4f6910160405180910390a250505050565b6109d96113d7565b6109e282610f0b565b15610a2f5760405162461bcd60e51b815260206004820152601260248201527f4e465420616c7265616479206c697374656400000000000000000000000000006044820152606401610564565b6001546040517f8db3ed600000000000000000000000000000000000000000000000000000000081526004810184905260009161010090046001600160a01b031690638db3ed60906024016101e060405180830381865afa158015610a98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abc91906126b0565b9050806101800151821015610b395760405162461bcd60e51b815260206004820152602160248201527f4d696e696d756d20707269636520726571756972656d656e74206e6f74206d6560448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610564565b600281606001516005811115610b5157610b51612531565b148015610b605750806101c001515b610bac5760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c79207472616461626c6520696620617661696c61626c650000000000006044820152606401610564565b6002546001600160a01b031662fdd58e336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03909116600482015260248101869052604401602060405180830381865afa158015610c20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c44919061277e565b600114610c935760405162461bcd60e51b815260206004820152601360248201527f4f6e6c79206f776e65722063616e206c697374000000000000000000000000006044820152606401610564565b6002546001600160a01b031663e985e9c5336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015610d07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2b91906127d9565b610d775760405162461bcd60e51b815260206004820152601d60248201527f417070726f7665206d61726b6574706c61636520666f722074726164650000006044820152606401610564565b6101a0810151610d8990610e106127f4565b8160e00151610d98919061280b565b4210610de65760405162461bcd60e51b815260206004820152601860248201527f5472616465206c696d69742074696d652063726f7373656400000000000000006044820152606401610564565b6040518060800160405280838152602001610dfe3390565b6001600160a01b03168152600085815260046020908152604090912060020154910190610e2c9060016127c6565b815260016020918201819052600086815260048352604090819020845181559284015183830180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03909216919091179055830151600283015560608301516003830180549192909160ff1916908381811115610eb457610eb4612531565b0217905550905050827f204bc022fa26366a9c1a614f0418b5d7a017e73cb2404f70a9a696f110334e51610ee53390565b604080516001600160a01b039092168252602082018690520160405180910390a2505050565b600081815260046020526040812054610f2557600061048e565b600192915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610f578161132f565b61062482611af8565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610f8a8161132f565b61062482611bbb565b600082815260208190526040902060010154610fae8161132f565b6104b983836119ec565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610fe28161132f565b61062482611ce5565b610ff36113d7565b610ffc81610f0b565b6110485760405162461bcd60e51b815260206004820152600e60248201527f4e4654206e6f74206c69737465640000000000000000000000000000000000006044820152606401610564565b6002546001600160a01b031662fdd58e336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03909116600482015260248101849052604401602060405180830381865afa1580156110bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e0919061277e565b6001148061111c57503360009081527f3223ed8e4c0e58571c5d9298a38beb8683f85cf3d2cd764e149f222bef155f80602052604090205460ff165b6111685760405162461bcd60e51b815260206004820181905260248201527f4f776e6572206f722042756b2070726f746f636f6c2063616e2064656c6574656044820152606401610564565b6000818152600460205260408120600281018054838355600180840180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055939091556003909101805460ff19169055906111c79082906127c6565b60008381526004602052604080822060020192909255905183917f6921c1c11458b3c56889eff3268f22e3fc2e08f7b627c815a92d6ca8eb0c651891a25050565b6112106113d7565b600160008281526004602052604090206003015460ff16600181111561123857611238612531565b146112855760405162461bcd60e51b815260206004820152600e60248201527f4e4654206e6f74206c69737465640000000000000000000000000000000000006044820152606401610564565b61065a8161142c565b6112b66040805160808101825260008082526020820181905291810182905290606082015290565b6000828152600460209081526040918290208251608081018452815481526001808301546001600160a01b03169382019390935260028201549381019390935260038101549091606084019160ff169081111561131557611315612531565b600181111561132657611326612531565b90525092915050565b61065a8133611da1565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610624576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556113933390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60015460ff161561142a5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610564565b565b6001546040517f8db3ed600000000000000000000000000000000000000000000000000000000081526004810183905260009161010090046001600160a01b031690638db3ed60906024016101e060405180830381865afa158015611495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b991906126b0565b90506002816060015160058111156114d3576114d3612531565b1480156114e25750806101c001515b61152e5760405162461bcd60e51b815260206004820152601660248201527f547261646561626c6520696620617661696c61626c65000000000000000000006044820152606401610564565b6101a081015161154090610e106127f4565b8160e0015161154f919061280b565b421061159d5760405162461bcd60e51b815260206004820152601860248201527f5472616465206c696d69742074696d652063726f7373656400000000000000006044820152606401610564565b6000828152600460205260409020546003546001600160a01b031663dd62ed3e336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015611620573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611644919061277e565b10156116925760405162461bcd60e51b815260206004820152601360248201527f436865636b2074686520616c6c6f77616e6365000000000000000000000000006044820152606401610564565b6000828152600460208190526040918290206001810154905460025493517efdd58e0000000000000000000000000000000000000000000000000000000081526001600160a01b03928316938101849052602481018790529293909291169062fdd58e90604401602060405180830381865afa158015611716573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061173a919061277e565b6001146117895760405162461bcd60e51b815260206004820152601260248201527f4e4654206f776e6572206d69736d6174636800000000000000000000000000006044820152606401610564565b60025460008581526004602081905260408083205490517f2a55205a0000000000000000000000000000000000000000000000000000000081529182018890526024820152909182916001600160a01b0390911690632a55205a906044016040805180830381865afa158015611803573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611827919061281e565b915091506118496118353390565b6003546001600160a01b0316908484611e32565b61187d33600088815260046020526040902054869061186990859061280b565b6003546001600160a01b0316929190611e32565b6002546001600160a01b031663f242432a85336040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b03928316600482015291166024820152604481018990526001606482015260a06084820152600060a482015260c401600060405180830381600087803b15801561190c57600080fd5b505af1158015611920573d6000803e3d6000fd5b5050506000878152600460205260408120600281018054838355600180840180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055939091556003909101805460ff1916905591506119839082906127c6565b600088815260046020526040902060020155867f32e781b519b2c8e4d313cac98c8137727bf4ce23f3984b8b168c3ea4546bbc478633604080516001600160a01b039384168152929091166020830152810187905260600160405180910390a250505050505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610624576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b611a73611eba565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611ac56113d7565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611aa0565b6001600160a01b038116611b4e5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610564565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f42eaa58024a20c114b9c6dc33efef570a993fb2ec74732ef81d660d652d33a11906020015b60405180910390a150565b6001600160a01b038116611c115760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610564565b600180546001600160a01b038381166101009081027fffffffffffffffffffffff0000000000000000000000000000000000000000ff84161790935591900416611c7b7fc90056e279113999fe5438fedaf4c98ded59812067ad79dd0c968b1a84dc7c9783611339565b611ca57fc90056e279113999fe5438fedaf4c98ded59812067ad79dd0c968b1a84dc7c97826119ec565b6040516001600160a01b03831681527fb79d40049846bf0044c190df5a20c79147437c7c473117c4350d0e96ab71e3f09060200160405180910390a15050565b6001600160a01b038116611d3b5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610564565b600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f119a23392e161a0bc5f9d5f3e2a6040c45b40d43a36973e10ea1de916f3d8a8a90602001611bb0565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1661062457611dd281611f0c565b611ddd836020611f1e565b604051602001611dee929190612870565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262461bcd60e51b8252610564916004016128f1565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261059690859061214e565b60015460ff1661142a5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610564565b606061048e6001600160a01b03831660145b60606000611f2d8360026127f4565b611f389060026127c6565b67ffffffffffffffff811115611f5057611f50612601565b6040519080825280601f01601f191660200182016040528015611f7a576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611fb157611fb16125d2565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612014576120146125d2565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006120508460026127f4565b61205b9060016127c6565b90505b60018111156120f8577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061209c5761209c6125d2565b1a60f81b8282815181106120b2576120b26125d2565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936120f181612942565b905061205e565b5083156121475760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610564565b9392505050565b60006121a3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122369092919063ffffffff16565b90508051600014806121c45750808060200190518101906121c491906127d9565b6104b95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610564565b6060612245848460008561224d565b949350505050565b6060824710156122c55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610564565b600080866001600160a01b031685876040516122e19190612977565b60006040518083038185875af1925050503d806000811461231e576040519150601f19603f3d011682016040523d82523d6000602084013e612323565b606091505b50915091506123348783838761233f565b979650505050505050565b606083156123ae5782516000036123a7576001600160a01b0385163b6123a75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610564565b5081612245565b61224583838151156123c35781518083602001fd5b8060405162461bcd60e51b815260040161056491906128f1565b6000602082840312156123ef57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461214757600080fd5b60006020828403121561243157600080fd5b5035919050565b6001600160a01b038116811461065a57600080fd5b6000806040838503121561246057600080fd5b82359150602083013561247281612438565b809150509250929050565b6000806020838503121561249057600080fd5b823567ffffffffffffffff808211156124a857600080fd5b818501915085601f8301126124bc57600080fd5b8135818111156124cb57600080fd5b8660208260051b85010111156124e057600080fd5b60209290920196919550909350505050565b6000806040838503121561250557600080fd5b50508035926020909101359150565b60006020828403121561252657600080fd5b813561214781612438565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000608082019050825182526001600160a01b036020840151166020830152604083015160408301526060830151600281106125c5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8060608401525092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516101e0810167ffffffffffffffff8111828210171561267b577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405290565b80516006811061269057600080fd5b919050565b805161269081612438565b8051801515811461269057600080fd5b60006101e082840312156126c357600080fd5b6126cb612630565b8251815260208301516020820152604083015160408201526126ef60608401612681565b60608201526080830151608082015260a083015160a082015261271460c08401612695565b60c082015260e08381015190820152610100808401519082015261012080840151908201526101408084015190820152610160808401519082015261018080840151908201526101a080840151908201526101c06127738185016126a0565b908201529392505050565b60006020828403121561279057600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561048e5761048e612797565b6000602082840312156127eb57600080fd5b612147826126a0565b808202811582820484141761048e5761048e612797565b8181038181111561048e5761048e612797565b6000806040838503121561283157600080fd5b825161283c81612438565b6020939093015192949293505050565b60005b8381101561286757818101518382015260200161284f565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516128a881601785016020880161284c565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516128e581602884016020880161284c565b01602801949350505050565b602081526000825180602084015261291081604085016020870161284c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008161295157612951612797565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b6000825161298981846020870161284c565b919091019291505056fea2646970667358221220411d85d8f898676bf231042a36280393b96f9cf2fe6596c951bda75b006426c864736f6c6343000813003300000000000000000000000032a20c3f1386cdac2103056e26b5e9b4b8501e5f00000000000000000000000069af5dc57172f33aef58e10944f33f98e8203d2c00000000000000000000000090a38d725cdc8b8622795bc0776ab72396868c2f

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101a35760003560e01c806391d14854116100ee578063cb60327511610097578063e183834411610071578063e18383441461039f578063e6282c6e146103b5578063ed8f9cf9146103c8578063fb05da2e146103db57600080fd5b8063cb60327514610366578063d547741f14610379578063db1bc87b1461038c57600080fd5b8063a79123a9116100c8578063a79123a91461032d578063b54d3cb314610340578063cae8ef4d1461035357600080fd5b806391d14854146102c7578063a05ce05e146102fe578063a217fddf1461032557600080fd5b80633f4ba83a1161015057806375b238fc1161012a57806375b238fc146102855780638456cb59146102ac578063872aed22146102b457600080fd5b80633f4ba83a1461026157806353979f34146102695780635c975abb1461027a57600080fd5b80633425fb7e116101815780633425fb7e1461021657806335262fd81461022957806336568abe1461024e57600080fd5b806301ffc9a7146101a8578063248a9ca3146101d05780632f2ff15d14610201575b600080fd5b6101bb6101b63660046123dd565b6103fb565b60405190151581526020015b60405180910390f35b6101f36101de36600461241f565b60009081526020819052604090206001015490565b6040519081526020016101c7565b61021461020f36600461244d565b610494565b005b61021461022436600461247d565b6104be565b6003546001600160a01b03165b6040516001600160a01b0390911681526020016101c7565b61021461025c36600461244d565b61059c565b610214610628565b6002546001600160a01b0316610236565b60015460ff166101bb565b6101f37fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b61021461065d565b6102146102c23660046124f2565b61068f565b6101bb6102d536600461244d565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6101f37fc90056e279113999fe5438fedaf4c98ded59812067ad79dd0c968b1a84dc7c9781565b6101f3600081565b61021461033b3660046124f2565b6109d1565b6101bb61034e36600461241f565b610f0b565b610214610361366004612514565b610f2d565b610214610374366004612514565b610f60565b61021461038736600461244d565b610f93565b61021461039a366004612514565b610fb8565b60015461010090046001600160a01b0316610236565b6102146103c336600461241f565b610feb565b6102146103d636600461241f565b611208565b6103ee6103e936600461241f565b61128e565b6040516101c79190612560565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061048e57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6000828152602081905260409020600101546104af8161132f565b6104b98383611339565b505050565b6104c66113d7565b8060005b81811015610596576001600460008686858181106104ea576104ea6125d2565b602090810292909201358352508101919091526040016000206003015460ff16600181111561051b5761051b612531565b1461056d5760405162461bcd60e51b815260206004820152600e60248201527f4e4654206e6f74206c697374656400000000000000000000000000000000000060448201526064015b60405180910390fd5b61058e848483818110610582576105826125d2565b9050602002013561142c565b6001016104ca565b50505050565b6001600160a01b038116331461061a5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610564565b61062482826119ec565b5050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756106528161132f565b61065a611a6b565b50565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756106878161132f565b61065a611abd565b6106976113d7565b6106a082610f0b565b6106ec5760405162461bcd60e51b815260206004820152600e60248201527f4e4654206e6f74206c69737465640000000000000000000000000000000000006044820152606401610564565b6001546040517f8db3ed600000000000000000000000000000000000000000000000000000000081526004810184905260009161010090046001600160a01b031690638db3ed60906024016101e060405180830381865afa158015610755573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077991906126b0565b6002549091506001600160a01b031662fdd58e336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03909116600482015260248101869052604401602060405180830381865afa1580156107f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610814919061277e565b6001146108635760405162461bcd60e51b815260206004820152601560248201527f4f6e6c79206f776e65722063616e2072656c69737400000000000000000000006044820152606401610564565b60028160600151600581111561087b5761087b612531565b146108c85760405162461bcd60e51b815260206004820152601660248201527f547261646561626c6520696620617661696c61626c65000000000000000000006044820152606401610564565b8061018001518210156109435760405162461bcd60e51b815260206004820152602160248201527f4d696e696d756d20707269636520726571756972656d656e74206e6f74206d6560448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610564565b6000838152600460205260409020805460038201805460ff19166001908117909155848355600290920154909161097a91906127c6565b60008581526004602090815260409182902060020192909255805183815291820185905285917f8f64f76a77541a65f4fe8ad487c2e0989e17239b21e7516a54b5f8b8fb86b4f6910160405180910390a250505050565b6109d96113d7565b6109e282610f0b565b15610a2f5760405162461bcd60e51b815260206004820152601260248201527f4e465420616c7265616479206c697374656400000000000000000000000000006044820152606401610564565b6001546040517f8db3ed600000000000000000000000000000000000000000000000000000000081526004810184905260009161010090046001600160a01b031690638db3ed60906024016101e060405180830381865afa158015610a98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abc91906126b0565b9050806101800151821015610b395760405162461bcd60e51b815260206004820152602160248201527f4d696e696d756d20707269636520726571756972656d656e74206e6f74206d6560448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610564565b600281606001516005811115610b5157610b51612531565b148015610b605750806101c001515b610bac5760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c79207472616461626c6520696620617661696c61626c650000000000006044820152606401610564565b6002546001600160a01b031662fdd58e336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03909116600482015260248101869052604401602060405180830381865afa158015610c20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c44919061277e565b600114610c935760405162461bcd60e51b815260206004820152601360248201527f4f6e6c79206f776e65722063616e206c697374000000000000000000000000006044820152606401610564565b6002546001600160a01b031663e985e9c5336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015610d07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2b91906127d9565b610d775760405162461bcd60e51b815260206004820152601d60248201527f417070726f7665206d61726b6574706c61636520666f722074726164650000006044820152606401610564565b6101a0810151610d8990610e106127f4565b8160e00151610d98919061280b565b4210610de65760405162461bcd60e51b815260206004820152601860248201527f5472616465206c696d69742074696d652063726f7373656400000000000000006044820152606401610564565b6040518060800160405280838152602001610dfe3390565b6001600160a01b03168152600085815260046020908152604090912060020154910190610e2c9060016127c6565b815260016020918201819052600086815260048352604090819020845181559284015183830180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03909216919091179055830151600283015560608301516003830180549192909160ff1916908381811115610eb457610eb4612531565b0217905550905050827f204bc022fa26366a9c1a614f0418b5d7a017e73cb2404f70a9a696f110334e51610ee53390565b604080516001600160a01b039092168252602082018690520160405180910390a2505050565b600081815260046020526040812054610f2557600061048e565b600192915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610f578161132f565b61062482611af8565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610f8a8161132f565b61062482611bbb565b600082815260208190526040902060010154610fae8161132f565b6104b983836119ec565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610fe28161132f565b61062482611ce5565b610ff36113d7565b610ffc81610f0b565b6110485760405162461bcd60e51b815260206004820152600e60248201527f4e4654206e6f74206c69737465640000000000000000000000000000000000006044820152606401610564565b6002546001600160a01b031662fdd58e336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03909116600482015260248101849052604401602060405180830381865afa1580156110bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e0919061277e565b6001148061111c57503360009081527f3223ed8e4c0e58571c5d9298a38beb8683f85cf3d2cd764e149f222bef155f80602052604090205460ff165b6111685760405162461bcd60e51b815260206004820181905260248201527f4f776e6572206f722042756b2070726f746f636f6c2063616e2064656c6574656044820152606401610564565b6000818152600460205260408120600281018054838355600180840180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055939091556003909101805460ff19169055906111c79082906127c6565b60008381526004602052604080822060020192909255905183917f6921c1c11458b3c56889eff3268f22e3fc2e08f7b627c815a92d6ca8eb0c651891a25050565b6112106113d7565b600160008281526004602052604090206003015460ff16600181111561123857611238612531565b146112855760405162461bcd60e51b815260206004820152600e60248201527f4e4654206e6f74206c69737465640000000000000000000000000000000000006044820152606401610564565b61065a8161142c565b6112b66040805160808101825260008082526020820181905291810182905290606082015290565b6000828152600460209081526040918290208251608081018452815481526001808301546001600160a01b03169382019390935260028201549381019390935260038101549091606084019160ff169081111561131557611315612531565b600181111561132657611326612531565b90525092915050565b61065a8133611da1565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610624576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556113933390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60015460ff161561142a5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610564565b565b6001546040517f8db3ed600000000000000000000000000000000000000000000000000000000081526004810183905260009161010090046001600160a01b031690638db3ed60906024016101e060405180830381865afa158015611495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b991906126b0565b90506002816060015160058111156114d3576114d3612531565b1480156114e25750806101c001515b61152e5760405162461bcd60e51b815260206004820152601660248201527f547261646561626c6520696620617661696c61626c65000000000000000000006044820152606401610564565b6101a081015161154090610e106127f4565b8160e0015161154f919061280b565b421061159d5760405162461bcd60e51b815260206004820152601860248201527f5472616465206c696d69742074696d652063726f7373656400000000000000006044820152606401610564565b6000828152600460205260409020546003546001600160a01b031663dd62ed3e336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015611620573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611644919061277e565b10156116925760405162461bcd60e51b815260206004820152601360248201527f436865636b2074686520616c6c6f77616e6365000000000000000000000000006044820152606401610564565b6000828152600460208190526040918290206001810154905460025493517efdd58e0000000000000000000000000000000000000000000000000000000081526001600160a01b03928316938101849052602481018790529293909291169062fdd58e90604401602060405180830381865afa158015611716573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061173a919061277e565b6001146117895760405162461bcd60e51b815260206004820152601260248201527f4e4654206f776e6572206d69736d6174636800000000000000000000000000006044820152606401610564565b60025460008581526004602081905260408083205490517f2a55205a0000000000000000000000000000000000000000000000000000000081529182018890526024820152909182916001600160a01b0390911690632a55205a906044016040805180830381865afa158015611803573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611827919061281e565b915091506118496118353390565b6003546001600160a01b0316908484611e32565b61187d33600088815260046020526040902054869061186990859061280b565b6003546001600160a01b0316929190611e32565b6002546001600160a01b031663f242432a85336040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b03928316600482015291166024820152604481018990526001606482015260a06084820152600060a482015260c401600060405180830381600087803b15801561190c57600080fd5b505af1158015611920573d6000803e3d6000fd5b5050506000878152600460205260408120600281018054838355600180840180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055939091556003909101805460ff1916905591506119839082906127c6565b600088815260046020526040902060020155867f32e781b519b2c8e4d313cac98c8137727bf4ce23f3984b8b168c3ea4546bbc478633604080516001600160a01b039384168152929091166020830152810187905260600160405180910390a250505050505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610624576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b611a73611eba565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611ac56113d7565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611aa0565b6001600160a01b038116611b4e5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610564565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f42eaa58024a20c114b9c6dc33efef570a993fb2ec74732ef81d660d652d33a11906020015b60405180910390a150565b6001600160a01b038116611c115760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610564565b600180546001600160a01b038381166101009081027fffffffffffffffffffffff0000000000000000000000000000000000000000ff84161790935591900416611c7b7fc90056e279113999fe5438fedaf4c98ded59812067ad79dd0c968b1a84dc7c9783611339565b611ca57fc90056e279113999fe5438fedaf4c98ded59812067ad79dd0c968b1a84dc7c97826119ec565b6040516001600160a01b03831681527fb79d40049846bf0044c190df5a20c79147437c7c473117c4350d0e96ab71e3f09060200160405180910390a15050565b6001600160a01b038116611d3b5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610564565b600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f119a23392e161a0bc5f9d5f3e2a6040c45b40d43a36973e10ea1de916f3d8a8a90602001611bb0565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1661062457611dd281611f0c565b611ddd836020611f1e565b604051602001611dee929190612870565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262461bcd60e51b8252610564916004016128f1565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261059690859061214e565b60015460ff1661142a5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610564565b606061048e6001600160a01b03831660145b60606000611f2d8360026127f4565b611f389060026127c6565b67ffffffffffffffff811115611f5057611f50612601565b6040519080825280601f01601f191660200182016040528015611f7a576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611fb157611fb16125d2565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612014576120146125d2565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006120508460026127f4565b61205b9060016127c6565b90505b60018111156120f8577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061209c5761209c6125d2565b1a60f81b8282815181106120b2576120b26125d2565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936120f181612942565b905061205e565b5083156121475760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610564565b9392505050565b60006121a3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122369092919063ffffffff16565b90508051600014806121c45750808060200190518101906121c491906127d9565b6104b95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610564565b6060612245848460008561224d565b949350505050565b6060824710156122c55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610564565b600080866001600160a01b031685876040516122e19190612977565b60006040518083038185875af1925050503d806000811461231e576040519150601f19603f3d011682016040523d82523d6000602084013e612323565b606091505b50915091506123348783838761233f565b979650505050505050565b606083156123ae5782516000036123a7576001600160a01b0385163b6123a75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610564565b5081612245565b61224583838151156123c35781518083602001fd5b8060405162461bcd60e51b815260040161056491906128f1565b6000602082840312156123ef57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461214757600080fd5b60006020828403121561243157600080fd5b5035919050565b6001600160a01b038116811461065a57600080fd5b6000806040838503121561246057600080fd5b82359150602083013561247281612438565b809150509250929050565b6000806020838503121561249057600080fd5b823567ffffffffffffffff808211156124a857600080fd5b818501915085601f8301126124bc57600080fd5b8135818111156124cb57600080fd5b8660208260051b85010111156124e057600080fd5b60209290920196919550909350505050565b6000806040838503121561250557600080fd5b50508035926020909101359150565b60006020828403121561252657600080fd5b813561214781612438565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000608082019050825182526001600160a01b036020840151166020830152604083015160408301526060830151600281106125c5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8060608401525092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516101e0810167ffffffffffffffff8111828210171561267b577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405290565b80516006811061269057600080fd5b919050565b805161269081612438565b8051801515811461269057600080fd5b60006101e082840312156126c357600080fd5b6126cb612630565b8251815260208301516020820152604083015160408201526126ef60608401612681565b60608201526080830151608082015260a083015160a082015261271460c08401612695565b60c082015260e08381015190820152610100808401519082015261012080840151908201526101408084015190820152610160808401519082015261018080840151908201526101a080840151908201526101c06127738185016126a0565b908201529392505050565b60006020828403121561279057600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561048e5761048e612797565b6000602082840312156127eb57600080fd5b612147826126a0565b808202811582820484141761048e5761048e612797565b8181038181111561048e5761048e612797565b6000806040838503121561283157600080fd5b825161283c81612438565b6020939093015192949293505050565b60005b8381101561286757818101518382015260200161284f565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516128a881601785016020880161284c565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516128e581602884016020880161284c565b01602801949350505050565b602081526000825180602084015261291081604085016020870161284c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008161295157612951612797565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b6000825161298981846020870161284c565b919091019291505056fea2646970667358221220411d85d8f898676bf231042a36280393b96f9cf2fe6596c951bda75b006426c864736f6c63430008130033

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

00000000000000000000000032a20c3f1386cdac2103056e26b5e9b4b8501e5f00000000000000000000000069af5dc57172f33aef58e10944f33f98e8203d2c00000000000000000000000090a38d725cdc8b8622795bc0776ab72396868c2f

-----Decoded View---------------
Arg [0] : _bukProtocolAddress (address): 0x32a20C3f1386CDAC2103056E26b5e9B4b8501E5F
Arg [1] : _bukNFTAddress (address): 0x69aF5dC57172F33AEF58E10944F33F98E8203d2c
Arg [2] : _tokenAddress (address): 0x90A38d725Cdc8B8622795bc0776aB72396868C2f

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000032a20c3f1386cdac2103056e26b5e9b4b8501e5f
Arg [1] : 00000000000000000000000069af5dc57172f33aef58e10944f33f98e8203d2c
Arg [2] : 00000000000000000000000090a38d725cdc8b8622795bc0776ab72396868c2f


Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.