// File: contracts/marketplace/NFTingCharge.sol



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

import "../utilities/NFTingErrors.sol";

contract NFTingCharge {
    address payable public treasury;
    uint256 public chargeAmount = 25; // initial buy fee is 0.25%, 10000 basis

    event Charge(address indexed user, uint256 amount);

    constructor() {
        treasury = payable(msg.sender);
    }

    modifier onlyOwner() {
        require(msg.sender == treasury, "Only contract owner can call this function");
        _;
    }

    function setChargeAmount(uint256 amount) external onlyOwner {
        chargeAmount = amount;
    }

    function charge() external payable {
        (bool success, ) = treasury.call{value: msg.value}(""); // Transfer the charged amount to the contract owner
        require(success, "Transfer failed.");

        emit Charge(msg.sender, msg.value);
    }

    function updateTreasury(address newTreasury) external onlyOwner {
        if (newTreasury == address(0)) {
            revert ZeroAddress();
        }
        treasury = payable(newTreasury);
    }
}
// File: contracts/utilities/NFTingErrors.sol



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

// Common Errors
error ZeroAddress();
error WithdrawalFailed();
error NoTrailingSlash(string _uri);
error InvalidArgumentsProvided();
error PriceMustBeAboveZero(uint256 _price);
error PermissionDenied();
error InvalidTokenId(uint256 _tokenId);
error TransferFailed(address recipient, uint amount);

// NFTing Base Contract
error NotTokenOwnerOrInsufficientAmount();
error NotApprovedMarketplace();
error ZeroAmountTransfer();
error TransactionError();
error InvalidAddressProvided(address _invalidAddress);

// PreAuthorization Contract
error NoAuthorizedOperator();

// Auction Contract
error NotExistingAuction(uint256 _auctionId);
error NotExistingBidder(address _bidder);
error NotEnoughPriceToBid();
error SelfBid();
error ExpiredAuction(uint256 _auctionId);
error RunningAuction(uint256 _auctionId);
error NotAuctionCreatorOrOwner();
error InvalidAmountOfTokens(uint256 _amount);
error AlreadyWithdrawn(uint256 _auctionId, address _bidder);
error NotBidder(uint256 _auctionId, address _bidder);

// Offer Contract
error NotExistingOffer(uint256 _offerId);
error PriceMustBeDifferent(uint256 _price);
error InsufficientETHProvided(uint256 _value);
error InvalidOfferState();

// Marketplace Contract
error NotListed();
error NotEnoughEthProvided(uint256 providedEth, uint256 requiredEth);
error NotTokenOwner();
error NotTokenSeller();
error TokenSeller();
error InvalidBasisProvided(uint256 _newBasis);

// NFTing Single Token Contract
error MaxBatchMintLimitExceeded();
error AlreadyExistentToken();
error NotApprovedOrOwner();
error MaxMintLimitExceeded();

// NFTing Token Manager Contract
error AlreadyRegisteredAddress();

// NFTingSignature
error HashUsed(bytes32 _hash);
error SignatureFailed(address _signatureAddress, address _signer);