This repository contains the smart contracts for the Ticket module of the HostIt Protocol, a decentralized event and ticketing platform. The Ticket contracts manage the lifecycle of event tickets, including creation, sales, fee management, check-in, and administrative controls. The system is modular, upgradeable, and designed for extensibility and security.
The Ticket contracts are implemented using the EIP-2535 Diamond Standard for modular and upgradeable smart contracts. The core logic is split into several "facets," each responsible for a specific domain:
- FactoryFacet: Handles ticket creation, updates, and querying ticket data.
- MarketplaceFacet: Manages ticket sales, fee configuration, withdrawals, and marketplace logic.
- CheckInFacet: Supports ticket check-in and admin management for events.
- Init: Handles protocol initialization and configuration.
Supporting libraries and storage contracts are used to manage state and reusable logic.
src/facets/FactoryFacet.sol: Ticket creation, update, and admin queries.src/facets/MarketplaceFacet.sol: Ticket minting, fee management, and withdrawals.src/facets/CheckInFacet.sol: Check-in logic and admin controls.src/inits/HostItInit.sol: Initialization logic for protocol deployment.src/interfaces/IMarketplace.sol: Interface for marketplace operations.
- Modular architecture for upgradeability and separation of concerns
- Fee management: Multi-fee support per ticket, including HostIt platform fees
- Ticket minting: Secure, on-chain ticket sales
- Check-in system: On-chain proof of attendance
- Admin roles: Fine-grained admin controls per ticket
- Upgradeable: Built on the Diamond Standard for future-proofing
/contract-root
βββ src/
β βββ facets/
β β βββ FactoryFacet.sol
β β βββ MarketplaceFacet.sol
β β βββ CheckInFacet.sol
β βββ inits/
β β βββ HostItInit.sol
β βββ interfaces/
β β βββ IMarketplace.sol
β βββ libs/
β βββ ...
βββ script/
β βββ ...
βββ test/
β βββ ...
βββ ...
- Foundry (for Solidity development and testing)
- Node.js (for scripting, if needed)
- An Ethereum-compatible wallet and testnet access
- Clone this repository
- Install dependencies:
forge install
forge buildforge testDeployment scripts are located in the /script directory. Example:
forge script script/DeployHostItTickets.s.sol --rpc-url <YOUR_RPC_URL> --private-key <YOUR_PRIVATE_KEY> --broadcastThe inline // {unit} comments throughout the Solidity source annotate dimensional types to prevent unit-mismatch bugs.
| Unit | Meaning |
|---|---|
{tok} |
Token amounts (ETH or ERC20), in the smallest unit of the payment token selected via FeeType |
{s} |
Timestamps and durations in seconds (Unix epoch for timestamps, raw seconds for durations) |
{1} |
Dimensionless quantities (basis-point ratios, boolean flags, counters) |
{ticket} |
Ticket token IDs and counts (NFT minting counters, maxTickets, soldTickets) |
{ticketId} |
Ticket type identifiers (sequential uint64 IDs assigned by the factory) |
{day} |
Day index offset from event start (used in check-in tracking, derived from seconds) |
{addr} |
Ethereum addresses (token, admin, buyer) |
| Unit | Meaning |
|---|---|
{1/1} |
Fee fraction: HOSTIT_FEE_BPS / FEE_BASIS_POINTS = 300 / 10,000 = 0.03 |
- BPS -- Basis points (1/10,000).
FEE_BASIS_POINTS = 10_000,HOSTIT_FEE_BPS = 300(3%).
- All contracts are licensed under AGPL-3.0-only.
- Uses OpenZeppelin libraries and patterns for security.
- Modular upgradeable architecture to enable rapid patching.
Pull requests, issues, and suggestions are welcome! Please see CONTRIBUTING.md if available.
For more information, visit hostit.events or contact the maintainers.