// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "../Order.sol";

/// @title IMarketplace
/// @author filkny
/// @author nazariyv
/// @notice Marketplace interface for the RKL Marketplace
interface IMarketplace {
    /// @notice Emitted when all orders below a certain nonce are cancelled for a user
    /// @param user The address for which the orders have been cancelled
    /// @param newMinNonce The nonce below which all orders are cancelled for the user
    event CancelAllOrdersForUser(address indexed user, uint256 indexed newMinNonce);

    /// @notice Emitted when multiple orders corresponding to specific nonces are cancelled
    /// @param user The address for which the orders have been cancelled
    /// @param orderNonces The nonces of the orders that have been cancelled
    event CancelMultipleOrders(address indexed user, uint256[] indexed orderNonces);

    /// @notice Emitted when an order is successfully fulfilled
    /// @param from The seller
    /// @param to The buyer
    /// @param collection The address of the collection of the ERC721/1155 token(s) being sold
    /// @param tokenId The tokenId of the token being sold
    /// @param currency The currency being used to pay the seller
    /// @param price The total amount of currenct to be payed for the sal
    event OrderFulfilled(
        address indexed from,
        address indexed to,
        address indexed collection,
        uint256 tokenId,
        uint256 amount,
        address currency,
        uint256 price
    );

    /// @notice Fulfills an order created and signed off-chain.
    /// Call must be made by the address intending to buy in case
    /// of an ask, and the address intending to sell in the case of
    /// bid.
    ///
    /// @dev Emits a {OrderFulfilled} event.
    ///
    /// Requirements:
    /// - order.signer must be signer of the signature composed by order.r
    /// order.s and order.v
    ///
    /// @param orders The orders to be fuliflled
    function fulfillOrder(Orders.Order[] calldata orders) external;

    /// @notice Cancels multiple orders corresponding to the provided nonces
    /// @param orderNonces An array of nonces corresponding to the orders to
    /// be cancelled
    function cancelMultipleOrders(uint256[] calldata orderNonces) external;

    /// @notice Cancels all orders with nonce up until minNonce for the caller
    /// @param minNonce the nonce that the caller's minNonce should be set to
    function cancelAllOrdersForSender(uint256 minNonce) external;
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InterfaceNotSupported","type":"error"},{"inputs":[],"name":"InvalidChain","type":"error"},{"inputs":[],"name":"InvalidMerkleProof","type":"error"},{"inputs":[],"name":"InvalidNonce","type":"error"},{"inputs":[],"name":"InvalidParameterS","type":"error"},{"inputs":[],"name":"InvalidParameterV","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"MarketplaceNotActive","type":"error"},{"inputs":[],"name":"OrderExpired","type":"error"},{"inputs":[],"name":"OrderNotActive","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"newMinNonce","type":"uint256"}],"name":"CancelAllOrdersForUser","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256[]","name":"orderNonces","type":"uint256[]"}],"name":"CancelMultipleOrders","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"currency","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"OrderFulfilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SALT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"active","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256[]","name":"nonces","type":"uint256[]"}],"internalType":"struct Marketplace.UserNonce[]","name":"userNonces","type":"tuple[]"}],"name":"areUserNoncesValid","outputs":[{"internalType":"bool[][]","name":"","type":"bool[][]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"minNonce","type":"uint256"}],"name":"cancelAllOrdersForSender","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"orderNonces","type":"uint256[]"}],"name":"cancelMultipleOrders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bool","name":"isAsk","type":"bool"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct Orders.Order[]","name":"orders","type":"tuple[]"}],"name":"fulfillOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"add","type":"address"}],"name":"getCurrentMinNonceForAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDomainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"add","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"getIsUserOrderNonceExecutedOrCanceled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"protocolFee","type":"uint256"}],"name":"setProtocolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"protocolFeeReciever","type":"address"}],"name":"setProtocolFeeReciever","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]