{"id":29213988,"url":"https://github.com/0xheartcode/nftmarketplace-subgraph","last_synced_at":"2025-07-02T23:35:50.601Z","repository":{"id":297795247,"uuid":"986335370","full_name":"0xheartcode/NFTMarketplace-Subgraph","owner":"0xheartcode","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-07T14:20:56.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-07T14:35:36.480Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xheartcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-19T13:05:48.000Z","updated_at":"2025-06-07T14:21:00.000Z","dependencies_parsed_at":"2025-06-07T14:47:43.850Z","dependency_job_id":null,"html_url":"https://github.com/0xheartcode/NFTMarketplace-Subgraph","commit_stats":null,"previous_names":["0xheartcode/nftmarketplace-subgraph"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/0xheartcode/NFTMarketplace-Subgraph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xheartcode%2FNFTMarketplace-Subgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xheartcode%2FNFTMarketplace-Subgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xheartcode%2FNFTMarketplace-Subgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xheartcode%2FNFTMarketplace-Subgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xheartcode","download_url":"https://codeload.github.com/0xheartcode/NFTMarketplace-Subgraph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xheartcode%2FNFTMarketplace-Subgraph/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263234034,"owners_count":23434890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-02T23:35:37.767Z","updated_at":"2025-07-02T23:35:50.584Z","avatar_url":"https://github.com/0xheartcode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NFT Marketplace Subgraph\n\nA comprehensive subgraph implementation for tracking NFT marketplace activities, supporting ERC721, ERC1155, and ERC6909 tokens. This subgraph indexes contract events to provide real-time insights into NFT creations, listings, bids, and sales.\n\n## Features\n\n- Multi-token standard support (ERC721, ERC1155 \u0026 ERC6909)\n- Factory contract tracking for NFT deployments\n- Comprehensive marketplace activity monitoring:\n  - Listing creation and management\n  - Bidding system with timeouts\n  - Sales tracking with multiple currencies\n  - Token ownership and transfer history\n  - Balance tracking for ERC1155 tokens\n\n## Prerequisites\n\nThe following tools are required to run this subgraph:\n\n- Node.js \u003e= 14\n- PNPM package manager\n- Docker and Docker Compose\n- Graph CLI (`@graphprotocol/graph-cli`)\n- Foundry's Anvil (for local chain)\n\n## Project Structure\n\n```\n├── schema.graphql              # GraphQL schema definition\n├── subgraph.template.yaml     # Subgraph manifest template\n├── Makefile                   # Build and deployment automation\n├── src/\n│   ├── abis/                  # Contract ABIs\n│   ├── helpers.ts             # Utility functions\n│   ├── marketplace.ts         # Marketplace event handlers\n│   ├── nft1155-factory.ts     # ERC1155 factory handlers\n│   └── nft721-factory.ts      # ERC721 factory handlers\n└── tests/                     # Test files\n```\n\n## Environment Setup\n\n1. Create a `.env` file in the project root with the following variables:\n\n```env\nNETWORK=localhost\nNFT721_FACTORY_ADDRESS=\nNFT1155_FACTORY_ADDRESS=\nNFT6909_FACTORY_ADDRESS=\nNFT_MARKETPLACE_ADDRESS=\nSTART_BLOCK=\nRPC_URL=\n```\n\n## Development Workflow\n\nThis project uses a Makefile to automate common development tasks. Here are the key commands:\n\n### Basic Commands\n\n```bash\n# Check environment and dependencies\nmake check-env\n\n# Install project dependencies\nmake install\n\n# Clean up directories and containers\nmake clean\n\n# View all available commands\nmake help\n```\n\n### Development Setup\n\n```bash\n# Complete development setup (recommended)\nmake dev\n\n# This command runs:\n# - Cleans previous build\n# - Checks environment\n# - Installs dependencies\n# - Sets up directories\n# - Starts Anvil node\n# - Prepares subgraph\n# - Deploys subgraph\n# - Monitors logs\n```\n\n### Individual Components\n\n```bash\n# Start Anvil node for local development\nmake start-anvil\n\n# Start Graph Node and required services\nmake start-graph-node\n\n# Prepare subgraph files\nmake prepare\n\n# Deploy subgraph to local Graph Node\nmake deploy\n\n# Monitor Graph Node logs\nmake monitor\n```\n\n## Monitoring and Debugging\n\n- GraphQL Endpoint: `http://localhost:8000/subgraphs/name/nft-marketplace`\n- GraphiQL Interface: `http://localhost:8000/subgraphs/name/nft-marketplace/graphql`\n\n### Example GraphQL Query\n\n```graphql\n{\n  # Query NFT contract deployments\n  factories {\n    id\n    type\n    nftCount\n  }\n  \n  # Query active marketplace listings\n  listings(where: { status: \"ACTIVE\" }) {\n    id\n    seller\n    tokenAddress\n    tokenId\n    amount\n    price\n    currency\n  }\n  \n  # Query token balances\n  tokenBalances(first: 5) {\n    owner\n    amount\n    instance {\n      tokenId\n      collection {\n        name\n        symbol\n      }\n    }\n  }\n}\n```\n\n## CI/CD and Deployment\n\nThe project supports both local development and production deployment workflows through different Make commands and Docker configurations.\n\n### Development Workflow\n\nFor local development, use:\n```bash\n# Start local development environment\nmake dev     # Runs full development setup with local Graph Node\n# OR\nmake all     # Similar to dev but without continuous monitoring\n```\n\nThis will:\n- Clean existing environment\n- Install dependencies\n- Start local Anvil node\n- Deploy and run local Graph Node services\n- Deploy subgraph\n\n### Production/Testnet Deployment\n\nFor production or testnet deployment:\n```bash\n# Set your environment first\ncp .env.example .env\n# Edit .env to set:\n# NETWORK=testnet    # For testnet deployment\n# NETWORK=localhost     # For local deployment\n# START_BLOCK=\u003cyour-start-block\u003e\n# RPC_URL=\u003cyour-rpc-url\u003e\n\n# Deploy to selected environment\nmake deploy-prodtestnet\n```\n\nThis command:\n- Cleans up existing deployment\n- Builds and deploys using environment-specific Docker configurations\n- Automatically starts Anvil if using localhost network\n- Uses appropriate Graph Node configuration for the target network\n\n### Directory Structure\n\n```\ndockerfiles/\n├── core/                          # Core service configurations\n│   ├── localhost.docker-compose.yml    # Local development services\n│   └── testnet.docker-compose.yml      # Testnet services\n└── ci_cd/                        # Deployment configurations\n    ├── localhost.docker-compose.yml    # Local deployment\n    └── testnet.docker-compose.yml      # Testnet deployment\n```\n\n### Useful Commands\n\n```bash\n# Monitor logs\nmake monitor   # Shows logs based on NETWORK setting\n\n# Clean environment\nmake clean     # Removes containers, volumes, and build artifacts\n\n# Check configuration\nmake check-env # Validates environment settings\n```\n\n### Environment Variables\n\nKey environment variables for deployment:\n- `NETWORK`: Target network (`localhost` or `testnet`)\n- `START_BLOCK`: Starting block number for indexing\n- `RPC_URL`: RPC endpoint for the network\n\n### Health Checks\n\nThe deployment process includes built-in health checks that:\n- Verify Graph Node availability\n- Ensure IPFS is accessible\n- Confirm database connectivity\n\nHealth check endpoints:\n- Graph Node: `http://localhost:8030` (local) or `http://graph-node:8030` (container)\n- IPFS: `http://localhost:5001` (local) or `http://ipfs:5001` (container)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xheartcode%2Fnftmarketplace-subgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xheartcode%2Fnftmarketplace-subgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xheartcode%2Fnftmarketplace-subgraph/lists"}