ESHStoreRentals

ESHStoreRentals

Shop for rentals of services or properties using the USDT as payment and your ESH Coin as a stock and rewards

  • Publish Date

    Jan 25, 2026

  • Licenses

    MIT,

ESHStoreRentals Smart Contract

A specialized Solidity-based rental management system designed for time-based product leasing. This contract handles the financial logic for rentals, automated reward burning/distribution, and issues time-locked NFTs as digital keys or rental proofs through an integrated invoice system.


🚀 Key Features

  • Time-Locked Rentals: Integrates with mintNFTWithTimer to issue NFTs that represent a rental period (calculated based on the amount/days purchased).
  • Inventory & Leasing: Manage a catalog of rentable items with real-time quantity tracking and category filtering.
  • Secure Authorization: Uses ECDSA signature verification to ensure rentals are pre-approved by a backend server (preventing unauthorized price manipulation).
  • Automated Reward Logic: Features a dynamic reward pool that transfers and burns tokens to buyers based on rental volume.
  • Stakeholder Distributions: Advanced multi-call mechanism to distribute store revenue to stakeholders with built-in fee handling (5%).
  • Financial Safety: Protected by ReentrancyGuard and a 14-day escrow-style refund window.

🏗 Workflow Diagram


🛠 Contract Architecture

Core Components

  • Rental Interface: Interacts with IInvoiceRenting to manage NFTs that automatically expire or track time.
  • Signer Verification: A serverSigner must authorize every purchaseProduct (rental) call to validate the user and the terms off-chain.
  • Internal Handlers: Modularized logic for payments (handlePaymentAndReceipt), rewards (handleRewardDistribution), and minting (handleNFTMinting).

Important Constants

  • Refund Period: 14 days (funds are held in a "pending" state before being released to the store balance).
  • Rental Time Calculation: _amount * 24 * 60 * 60 (converts quantity units into daily unix timestamps).

📖 Function Reference

For the Store Owner

FunctionDescription
addProductAdds a new rentable item to the store with price and initial stock.
batchReleaseFundsFinalizes the store balance by withdrawing funds from receipts older than 14 days.
payWorkerAfterFeeTransfers 95% of a specific amount to a worker and 5% to the treasury.
distributeQuarterlyBalanceInitiates a profit-sharing distribution via the IESH interface.
updateProductQuantityAdjusts available rental stock for a specific barcode.

For the Renter

FunctionDescription
purchaseProductThe rental entry point. Processes payment, rewards, and mints a timed NFT.
getNFTsForReceiptReturns the ID of the timed NFT associated with a specific rental receipt.
getAllCategoriesReturns a unique list of all product categories available for rent.

🔒 Security & Roles

  • Owner Privileges: Only the contractOwner can adjust pricing, manage inventory, or withdraw from the rewards pool.
  • Server Authentication: The serverSigner prevents "direct-to-contract" interactions that bypass your platform's business logic or database.
  • Refund Guard: refundClient checks isWithdrawn to ensure the owner hasn't already moved those funds to the main balance, and isRefunded to prevent double-spending.

📦 Deployment & Setup

  1. Deployment Parameters:
  • _ERCUltra: The address of the reward/governance token.
  • _invoices: The address of the IInvoiceRenting NFT contract.
  • _contractOwner: The administrative wallet address.
  1. Initial Funding: The owner should call depositToRewardPool if they wish to offer rental rewards immediately.
  2. Default Signer: The contract defaults to 0xcb93DAe6611967Ee16D67A3eE0DCfad05d578575 but can be updated via setServerSigner.

📄 Events

  • NewReceipt: Emitted when a rental is successfully processed.
  • ClientRefunded: Logged when a rental is cancelled and funds are returned.
  • AmountPurchasedMoreInfo: Captures additional rental metadata for off-chain indexing.
  • WorkerGotPayed: Tracks internal payroll distributions.

1.1.8 Release Notes

Added Escrow for refunds in 14 day

Balance

view

No inputs required