Introduction
GatePass uses a modular smart contract system built on Solidity 0.8.24 and deployed on Polygon for fast, low-cost transactions. The architecture consists of three main contracts that work together to provide a complete event ticketing solution.EventTicketFactory
Deploys event contracts using minimal proxy clones for gas efficiency
EventTicket
ERC721 NFT tickets with sales, check-in, and access control
ProofOfAttendance
Soulbound ERC721 NFTs minted upon event check-in
Contract Architecture
The GatePass smart contract system follows a factory pattern with minimal proxy clones to optimize gas costs for event organizers.Factory Pattern
TheEventTicketFactory uses OpenZeppelin’s Clones library to deploy minimal proxy contracts, reducing deployment costs by ~90% compared to deploying full contracts.
Why use minimal proxies?
Why use minimal proxies?
Minimal proxies (EIP-1167) are lightweight contracts that delegate all calls to an implementation contract. This means:
- Lower gas costs: Deployment costs ~20-30
- Consistent implementation: All events use the same audited code
- Upgradeable pattern: Factory can deploy new versions while keeping old events functional
Key Features
Ticket Sales
- ERC721 NFT tickets with configurable supply and pricing
- Time-gated sales with customizable start and end times
- Wallet limits to prevent scalping (default: 5 tickets per wallet)
- Allowlist support using Merkle proofs for presales
- Automatic refunds for excess payment
Check-In System
- Self check-in: Ticket holders can check themselves in after event starts
- Organizer check-in: Event organizers can assist with check-in
- Single-use tickets: Tickets are marked as used to prevent double entry
- POA minting: Proof of Attendance NFTs automatically minted on check-in
Revenue Management
- Platform fees: Configurable fee (default 2.5%) collected by GatePass
- Delayed withdrawal: Organizers can withdraw funds only after event date
- Automatic fee distribution: Platform fees and organizer revenue split automatically
Security Features
- ReentrancyGuard: Protection against reentrancy attacks
- Pausable: Emergency pause functionality for organizers
- Ownable: Access control for critical functions
- MerkleProof verification: Secure allowlist implementation
Network Deployment
Polygon Configuration
Why Polygon?
Low Transaction Costs
Low Transaction Costs
Polygon transactions cost fractions of a cent, making it affordable for both organizers and attendees to mint tickets and check in.
Fast Confirmation
Fast Confirmation
~2 second block times mean instant ticket minting and check-in confirmations.
EVM Compatible
EVM Compatible
Full Ethereum compatibility means easy integration with existing tools and wallets like MetaMask.
Strong Ecosystem
Strong Ecosystem
Polygon has robust infrastructure, block explorers, and developer tools.
Contract Interactions
Creating an Event
Ticket Purchase Flow
Check-In Flow
OpenZeppelin Dependencies
GatePass contracts are built on audited OpenZeppelin libraries:- ERC721: Standard NFT implementation
- ERC721Enumerable: Enable token enumeration
- Ownable: Access control
- ReentrancyGuard: Reentrancy protection
- Pausable: Emergency stop mechanism
- MerkleProof: Allowlist verification
- Clones: Minimal proxy pattern
Gas Optimization
The contracts implement several gas optimization techniques:Next Steps
Deploy Contracts
Learn how to deploy the contract system
EventTicket Reference
Detailed documentation of the EventTicket contract
Factory Reference
Learn about the factory pattern implementation
POA Reference
Documentation for Proof of Attendance NFTs