DeAlStoreNFTInvoices

ERCUltraStoreNFTInvoices

Special ERCUltraStore which gives NFT as invoice when purchasing products or when you refund your clients

  • Publish Date

    Sep 01, 2024

  • Licenses

    MIT, Copyright (c) 2024 ultimatedeal.net Osher Haim Glick.

  • Gives NFTs as invoice when client purchase product
  • Has all the normal ERCUltraStore abilities + The NFT invoices
  • Because of the NFT invoices, can be used to sell Apartments, or anything that can use the NFT to proceed

For example

  • Lock of apartment that opens only with the NFT of the invoice
  • Service that works only with the NFT of the invoice
  • 1.2.5 is for selling properties and services for unlimited time
  • 1.2.6 is for rentals of properties and services for a limited time

You can sell whatever you wish!

  • Note: We recommend to list on Ultimatedeal.net for best frontend that works best with those smartcontracts

  • After deployment, you need to set the store contract at your ERCUltra to enable it to distribute dividends

Note: You can use up to two stores on the same ERCUltra stock

  • After deployment, you need to set the store contract at your invoices contract to enable it to mint invoices and burn them if needed

5% of all income goes automatically to the developer of the contract

ERCUltraStoreNFTInvoices Smart Contract

The ERCUltraStoreNFTInvoices smart contract is a robust and feature-rich contract designed for managing product sales, client registrations, invoicing, and distribution of funds within a decentralized store environment. It also incorporates reward mechanisms and the handling of NFTs for receipts. Below is a detailed description of its functionalities and components:

Key Components
  1. Structures:

    • DistributionStatus: Represents the status of a distribution, including whether it exists, is completed, or finalized, and tracks the amounts related to the distribution.
    • Product: Contains details of a product, including its name, barcode, price, quantity, images, description, discount percentage, and category.
    • Client: Holds client information such as their wallet address, name, email, phone number, and physical address.
    • Receipt: Stores receipt details including the index, timestamp, client address, product barcode, amount paid, and refund status.
  2. State Variables:

    • distributions: A mapping from distribution IDs to DistributionStatus structs, tracking the details of each distribution.
    • contractOwner: The address of the contract owner, who has special permissions.
    • paymentTokenDecimals & rewardTokenDecimals: Decimals for the payment and reward tokens.
    • invoices: An interface to handle invoice-related functionality.
    • tokenContract & rewardToken: Interfaces for the payment and reward ERC20 tokens.
    • rewardsPool: Tracks the total rewards pool balance.
    • Balance & total: Track the contract's balance and total amount of tokens handled.
    • productBarcodes: An array of product barcodes for easy lookup.
    • products: A mapping of product barcodes to Product structs.
    • clients: A mapping of client addresses to Client structs.
    • receipts: A mapping of receipt IDs to Receipt structs.
    • receiptCounter: A counter for assigning unique IDs to receipts.
    • receiptNFTs: A mapping of receipt IDs to an array of NFT IDs associated with that receipt.
Key Functionalities
  1. Owner Management:

    • changeOwner(address _newOwner): Allows the current owner to transfer ownership of the contract.
  2. Product Management:

    • addProduct(string memory _name, string memory _barcode, uint256 _priceInNormalNumber, uint256 _quantity, string[] memory _productImages, string memory _productDescription, uint256 _discountPercentage, string memory _category)
      : Adds a new product to the store, including details like price, quantity, images, and more.
  3. Client Management:

    • registerClient(string memory _name, string memory _email, string memory _phoneNum, string memory _physicalAddress)
      : Registers a new client with the store, storing their contact and physical information.
    • isClient(address _address): Checks if an address is registered as a client.
  4. Receipt Management:

    • verifyReceipt(address client, uint256 receiptId): Verifies that a specific receipt belongs to a client.
    • verifySpecificReceiptOfSpecificProduct(address client, uint256 receiptId, string memory productBarcode)
      : Verifies a receipt for a specific product.
    • getNFTsForReceipt(uint256 _receiptId): Retrieves all NFTs associated with a particular receipt.
  5. Fund and Payment Management:

    • deposit(uint256 _amount): Allows clients to deposit funds into the contract.
    • payWorkerAfterFeeFromStoreBalance(address worker, uint256 amount): Pays a worker from the store balance after deducting a 5% fee.
    • refundClient(address _client, uint256 _receiptId): Refunds a client for a specific receipt and burns associated NFTs.
    • depositToRewardPool(uint256 amount): Deposits tokens into the rewards pool.
    • withdrawRewardsPool(): Withdraws all tokens from the rewards pool to the owner.
  6. Distribution Management:

    • distributeQuarterlyBalance(uint256 percentageToDistribute, uint256 maxCalls): Distributes a percentage of the store's balance to clients, with the remaining balance and a fee sent to the owner.
    • finalizeDistribution(bytes32 distributionId): Finalizes a distribution, transferring the fee and owner amounts, and updating the distribution status.
    • continueDistribution(bytes32 distributionId, uint256 maxCalls): Continues an incomplete distribution process.
  7. Utility Functions:

    • getProductPics(string memory _barcode): Retrieves product images for a given barcode.
    • getAllCategories(): Returns all unique categories of products available in the store.
Events
  • BalanceDistributed(uint256 totalBalance): Emitted when the balance is distributed.
  • WorkerGotPayed(uint256 amount, address workerAddress): Emitted when a worker is paid.
  • ClientRefunded(address client, uint256 receiptId, uint256 refundAmount, string clientEmail): Emitted when a client is refunded.
  • DistributionStarted(bytes32 indexed distributionId, uint256 amountToDistribute, uint256 feeAmount, uint256 amountForOwner): Emitted when a new distribution starts.
  • ProductAdded(string name, string barcode, uint256 price, uint256 quantity, uint256 discountPercentage, string description, string[] allClientsEmails): Emitted when a new product is added.
  • newClientRegistered(address clientAddress, string clientName, string clientEmail, string clientPhone, string clientPhysicalAddress): Emitted when a new client registers.
  • NewReceipt(uint256 receiptId, uint256 timestamp, address clientAddress, string encryptedClientName, string encryptedClientEmail, string productBarcode, uint256 amountPaid, string encryptedPhysicalAddress, string phoneNum, string ProductDesc): Emitted when a new receipt is generated.
Contract Overview

The ERCUltraStoreNFTInvoices contract provides a comprehensive solution for managing a decentralized store with NFT-based invoicing. It supports product listings, client management, and various financial operations such as payments, refunds, and distribution of rewards. The contract owner has privileged control over key functions, ensuring the secure and efficient operation of the store.

This smart contract is suitable for any decentralized marketplace looking to integrate NFT receipts, automated distribution of store profits, and robust client and product management features.

1.2.6 Release Notes

  • Integrated the new MELEH Coin to the shop as default payment

Balance

view

No inputs required