/stadeguard-evm

Time-bound Ticket Management System

Primary LanguageSolidityMIT LicenseMIT

🏟 StadeGuard

StadeGuard is a robust smart contract system designed for managing NFT collections with built-in expiration times and owner identification. It provides a secure and efficient way to handle time-sensitive digital assets, making it ideal for event tickets, temporary access passes, and other time-bound NFT use cases.

Key Features

  • Time-bound NFT management
  • Secure owner identification
  • Flexible collection deployment
  • Comprehensive access control
  • Gas-optimized operations

Project Structure

├── contracts/
│   ├── Interfaces/
│   │   ├── IStadeGuardCollection.sol
│   │   ├── IStadeGuardCollectionErrors.sol
│   │   ├── IStadeGuardCollectionEvents.sol
│   │   ├── IStadeGuardFactoryErrors.sol
│   │   ├── IStadeGuardFactoryEvents.sol
│   │   ├── StadeGuardCollection.sol
│   │   ├── StadeGuardFactory.sol
│   │   └── StadeGuardManager.sol
│   ├── script/
│   │   ├── StadeGuardCollection.deploy.s.sol
│   │   ├── StadeGuardCollection.manage.s.sol
│   │   ├── StadeGuardFactory.deploy.s.sol
│   │   ├── StadeGuardFactory.manage.s.sol
│   │   ├── StadeGuardManager.deploy.s.sol
│   │   └── StadeGuardManager.manage.s.sol
│   ├── test/
│   │   ├── InitState/
│   │   │   ├── InitStadeGuardCollection.sol
│   │   │   ├── InitStadeGuardFactory.sol
│   │   │   └── InitStadeGuardManager.sol
│   │   ├── Invariant/
│   │   │   ├── StadeGuardCollection.invariant.t.sol
│   │   │   ├── StadeGuardFactory.invariant.t.sol
│   │   │   └── StadeGuardManager.invariant.t.sol
│   │   ├── Regression/
│   │   │   └── StadeGuardRegression.t.sol
│   │   ├── Scenarios/
│   │   │   ├── StadeGuardAccessControl.t.sol
│   │   │   ├── StadeGuardCollectionManagement.t.sol
│   │   │   └── StadeGuardTicketLifecycle.t.sol
│   │   ├── Unit/
│   │   │   ├── StadeGuardFactory/
│   │   │   │   ├── StadeGuardFactory.Admin.state.t.sol
│   │   │   │   ├── StadeGuardFactory.DeployCollection.state.t.sol
│   │   │   │   ├── StadeGuardFactory.View.state.t.sol
│   │   │   │   └── StadeGuardFactory.constructor.state.t.sol
│   │   │   └── StadeGuardManager/
│   │   │   │   ├── StadeGuardManager.Admin.state.t.sol
│   │   │   └── StadeGuardManager.View.state.t.sol
│   │   └── utils/
│   │   │   ├── IStadeGuardErrors.sol
│   │   └── IStadeGuardEvents.sol
│   └── Makefile

Key Test Commands

The project includes several useful Makefile commands for testing and analysis:

# Run basic tests
make testq       # Quick test run
make testd       # Detailed test run with -vvvv verbosity
make testv       # Very detailed test run with -vvvvv verbosity
make testvg      # Very detailed test run with gas reporting

# Run specific test suites
make test_inv    # Run invariant tests
make test_reg    # Run regression tests
make test_sc     # Run scenario tests

# Generate test coverage report
make lcov        # Generates HTML coverage report and opens it

Test Suite Overview

  • Invariant Tests: Property-based tests that verify core system invariants
  • Regression Tests: Tests that verify specific bug fixes and edge cases
  • Scenario Tests: End-to-end tests of key user workflows
    • Access Control
    • Collection Management
    • Ticket Lifecycle
  • Unit Tests: Granular tests of individual contract functions

Coverage Report

The make lcov command:

  1. Generates coverage data
  2. Filters out test files and mock contracts
  3. Creates an HTML report with branch coverage
  4. Opens the report in your default browser

Development Commands

# Build contracts
make build      # Build with size reporting
make buildh     # Build only contract files

# Clean and rebuild
make clean      # Remove artifacts
make all        # Clean, install deps, build and test

# Format code
make fmt        # Format all Solidity files