Express and Next.js middleware that checks NFT ownership or subscription status on-chain before granting API/page access. Supports ERC-721, ERC-1155, and custom subscription contract verification with caching.
Category: middleware
Files: 12
Chains: Ethereum, Arbitrum, Base, Optimism, Polygon
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /// @title Access Gate Middleware /// @notice Express/Next.js middleware checking NFT ownership for access. contract AccessGateMiddleware { address public immutable owner; uint256 public constant VERSION = 1; event Initialized(address indexed deployer); constructor() { owner = msg.sender; emit Initialized(msg.sender); } // ... full implementation in purchased package }