- About the Project
- Tech Stack
- Project Structure
- Smart Contracts
- Getting Started
- Available Scripts
- Deployment
- Contributing
Infinity Contracts is a Web3 project that implements an NFT-based promotion system for redeeming free tacos. The project consists of smart contracts for managing NFT promotions, a Next.js frontend for user interaction, and a subgraph for indexing blockchain data.
- 🎫 NFT-based promotion system
- 🌮 Redeemable tokens for free tacos
- 📊 Real-time blockchain data indexing
- 🔍 Block explorer functionality
- 🎨 Modern Web3 frontend interface
- 🔐 Secure smart contract architecture
- Language: Solidity ^0.8.0
- Framework: Hardhat
- Libraries: OpenZeppelin
- Framework: Next.js
- Web3 Integration: wagmi, RainbowKit
- Styling: Tailwind CSS
- Indexing: The Graph
- Query Language: GraphQL
- Language: TypeScript
- Testing: Hardhat Test Suite
- Linting: ESLint, Prettier
- Package Manager: Yarn
InfinityContracts/
├── packages/
│ ├── hardhat/ # Smart contract development
│ │ ├── contracts/ # Solidity smart contracts
│ │ ├── deploy/ # Deployment scripts
│ │ └── test/ # Contract tests
│ │
│ ├── nextjs/ # Frontend application
│ │ ├── app/ # Next.js pages & components
│ │ ├── components/ # Reusable components
│ │ └── hooks/ # Custom React hooks
│ │
│ └── subgraph/ # The Graph indexing
│ ├── src/ # GraphQL schema & mappings
│ └── tests/ # Subgraph tests
The main smart contract implementing the NFT-based promotion system:
contract InfinityPromotion is ERC721, Pausable, Ownable {
// Core functionality
function claimToken() external returns (uint256)
function redeemToken(uint256 tokenId) external
function isTokenRedeemed(uint256 tokenId) external view returns (bool)
// Admin functions
function pause() external onlyOwner
function unpause() external onlyOwner
function extendPromotion(uint256 extension) external onlyOwner
}Key Features:
- 🎟️ ERC721-based NFT tokens
- ⏱️ Time-limited promotions
- 🔒 Pausable functionality
- 📊 Token tracking system
- 🎫 Redemption management
node -v # >= 20.18.1
yarn -v # >= 3.2.3- Clone the repository
git clone https://github.com/your-org/infinity-contracts.git
cd infinity-contracts- Install dependencies
yarn install- Set up environment variables
# In packages/hardhat
cp .env.example .env
# In packages/nextjs
cp .env.example .env- Start local blockchain
yarn chain- Deploy contracts
yarn deploy- Start frontend
yarn start# Hardhat
yarn hardhat:compile # Compile contracts
yarn hardhat:test # Run tests
yarn hardhat:deploy # Deploy contracts
yarn hardhat:verify # Verify contracts
# Account management
yarn account # List accounts
yarn account:generate # Generate new account
yarn account:import # Import accountyarn start # Start Next.js dev server
yarn next:build # Build frontend
yarn next:serve # Serve production buildyarn subgraph:codegen # Generate types
yarn subgraph:build # Build subgraph
yarn subgraph:deploy # Deploy subgraph- Configure network in
hardhat.config.ts - Set deployment parameters in
.env - Deploy contracts:
yarn deploy --network <network-name>- Verify contracts:
yarn verify --network <network-name>- Configure environment variables
- Build and deploy:
yarn next:build
yarn vercel- Update subgraph manifest
- Deploy to The Graph:
yarn subgraph:deploy- Fork the repository
- Create your feature branch
git checkout -b feature/AmazingFeature
- Commit your changes
git commit -m 'Add some AmazingFeature' - Push to the branch
git push origin feature/AmazingFeature
- Open a Pull Request
- Follow Solidity style guide
- Use TypeScript for frontend code
- Write comprehensive tests
- Document all functions and components
- Follow existing naming conventions
