An open API service indexing awesome lists of open source software.

https://github.com/mathuo/erc20-token

Example ERC20 Token
https://github.com/mathuo/erc20-token

Last synced: 7 months ago
JSON representation

Example ERC20 Token

Awesome Lists containing this project

README

          

# ๐Ÿš€ DeFi Token Suite

A comprehensive monorepo for DeFi token management with smart contracts and web interface.

![](website.png)

## ๐Ÿ“‹ Overview

This monorepo contains:
- **Smart Contracts**: ERC-20 tokens with advanced airdrop functionality
- **Web Interface**: Next.js frontend for token management
- **Multi-Network Support**: Ethereum, Base, and testnets
- **Complete DeFi Stack**: Airdrops, liquidity, bridging, treasury

## ๐Ÿ—๏ธ Project Structure

```
defi-token-suite/
โ”œโ”€โ”€ packages/
โ”‚ โ”œโ”€โ”€ contracts/ # Smart contracts (Hardhat)
โ”‚ โ”‚ โ”œโ”€โ”€ contracts/ # Solidity contracts
โ”‚ โ”‚ โ”œโ”€โ”€ scripts/ # Deployment & management scripts
โ”‚ โ”‚ โ”œโ”€โ”€ test/ # Contract tests
โ”‚ โ”‚ โ””โ”€โ”€ deployments/ # Deployment artifacts
โ”‚ โ””โ”€โ”€ frontend/ # Web interface (Next.js)
โ”‚ โ”œโ”€โ”€ src/
โ”‚ โ”‚ โ”œโ”€โ”€ app/ # Next.js app router
โ”‚ โ”‚ โ”œโ”€โ”€ components/ # React components
โ”‚ โ”‚ โ”œโ”€โ”€ lib/ # Utilities & ABIs
โ”‚ โ”‚ โ””โ”€โ”€ hooks/ # Custom React hooks
โ”‚ โ””โ”€โ”€ public/ # Static assets
โ”œโ”€โ”€ package.json # Root workspace config
โ””โ”€โ”€ README.md # This file
```

## โšก Quick Start

### Prerequisites
- Node.js 18+
- npm 8+
- Git

### Installation

```bash
# Clone the repository
git clone https://github.com/your-username/defi-token-suite.git
cd defi-token-suite

# Install all dependencies
npm run install:all

# Or install individually
npm install # Root workspace
npm run install:contracts # Contracts only
npm run install:frontend # Frontend only
```

### Development

```bash
# Start both contracts and frontend in development mode
npm run dev

# Or start individually
npm run dev:contracts # Local Hardhat node
npm run dev:frontend # Next.js dev server
```

### Build & Test

```bash
# Build everything
npm run build

# Test everything
npm test

# Or build/test individually
npm run build:contracts # Compile contracts
npm run build:frontend # Build Next.js app
npm run test:contracts # Run contract tests
npm run test:frontend # Run frontend tests
```

## ๐Ÿ—๏ธ Smart Contracts

### Core Contracts

- **MyToken.sol**: ERC-20 token with minting, burning, and treasury
- **BatchAirdrop.sol**: Direct batch token distribution
- **MerkleAirdrop.sol**: Scalable merkle tree-based airdrops
- **PublicAirdrop.sol**: Open claim airdrops with conditions
- **ConditionalAirdrop.sol**: Advanced conditional claim logic
- **SwapHelper.sol**: Uniswap V3 integration utilities

### Deployment

```bash
# Deploy to testnets
npm run deploy:sepolia
npm run deploy:base-sepolia

# Deploy to mainnets
npm run deploy:ethereum
npm run deploy:base
```

### Contract Management

```bash
# Navigate to contracts package
cd packages/contracts

# Airdrop operations
npm run deploy-airdrop # Deploy airdrop contracts
npm run batch-airdrop # Execute batch airdrop
npm run create-merkle-airdrop # Create merkle campaign
npm run create-public-campaign # Create public claim campaign

# Liquidity operations
npm run create-pool:base # Create Uniswap pool
npm run add-liquidity:base # Add liquidity

# Bridge operations
npm run bridge-deposit # Bridge to Base
npm run bridge-withdraw # Bridge to Ethereum

# Status monitoring
npm run airdrop-status # Check airdrop status
npm run public-airdrop-status # Check public campaigns
```

## ๐Ÿ–ฅ๏ธ Web Interface

### Tech Stack
- **Next.js 14**: React framework with app router
- **TypeScript**: Type-safe development
- **Tailwind CSS**: Utility-first styling
- **Wagmi**: React hooks for Ethereum
- **RainbowKit**: Wallet connection UI
- **Ethers.js**: Ethereum library

### Features

- ๐Ÿ”— **Wallet Connection**: MetaMask, WalletConnect, and more
- ๐Ÿช™ **Token Management**: Deploy, mint, burn, transfer
- ๐ŸŽ **Airdrop Interface**: All airdrop types with UI
- ๐Ÿ’ง **Liquidity Tools**: Uniswap V3 position management
- ๐ŸŒ‰ **Bridge Interface**: Cross-chain token transfers
- ๐Ÿ“Š **Analytics Dashboard**: Token metrics and history
- ๐ŸŽจ **Responsive Design**: Mobile-first interface

### Development

```bash
cd packages/frontend

# Environment setup
cp .env.example .env.local
# Edit .env.local with your configuration

# Development server
npm run dev

# Build for production
npm run build
npm run start
```

## ๐ŸŒ Supported Networks

| Network | Chain ID | Status | Features |
|---------|----------|--------|----------|
| Ethereum | 1 | โœ… Production | All features |
| Base | 8453 | โœ… Production | All features |
| Sepolia | 11155111 | โœ… Testnet | All features |
| Base Sepolia | 84532 | โœ… Testnet | All features |
| Localhost | 31337 | ๐Ÿ”ง Development | All features |

## ๐ŸŽฏ Airdrop Types

### 1. Batch Airdrops
- Direct token distribution to recipients
- Owner pays all gas costs
- Best for: < 500 recipients

### 2. Merkle Airdrops
- Recipients claim using merkle proofs
- Cryptographically verified eligibility
- Best for: > 1000 recipients

### 3. Public Airdrops
- Anyone can claim (with conditions)
- No pre-defined recipient list
- Best for: Community building

## ๐Ÿ” Environment Configuration

### Contracts (.env)
```bash
# Network RPCs
ETHEREUM_RPC_URL=https://eth-mainnet.alchemyapi.io/v2/your-key
BASE_RPC_URL=https://mainnet.base.org
SEPOLIA_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com

# Deployment
PRIVATE_KEY=your_private_key_without_0x_prefix
ETHERSCAN_API_KEY=your_etherscan_key
BASESCAN_API_KEY=your_basescan_key

# Token Configuration
TOKEN_NAME=MyToken
TOKEN_SYMBOL=MTK
MAX_SUPPLY=1000000000
INITIAL_SUPPLY=200000000
```

### Frontend (.env.local)
```bash
# WalletConnect
NEXT_PUBLIC_PROJECT_ID=your_walletconnect_project_id

# Contract Addresses (auto-populated after deployment)
NEXT_PUBLIC_TOKEN_ADDRESS_ETHEREUM=0x...
NEXT_PUBLIC_TOKEN_ADDRESS_BASE=0x...
NEXT_PUBLIC_BATCH_AIRDROP_ADDRESS=0x...
NEXT_PUBLIC_MERKLE_AIRDROP_ADDRESS=0x...
```

## ๐Ÿ“š Documentation

- **Contracts**: See `packages/contracts/README.md`
- **Frontend**: See `packages/frontend/README.md`
- **Guides**:
- `UNISWAP_GUIDE.md` - Liquidity management
- `BRIDGE_GUIDE.md` - Cross-chain bridging
- `TREASURY_GUIDE.md` - Treasury operations
- `CLAUDE.md` - Development workflow

## ๐Ÿงช Testing

### Contract Tests
```bash
cd packages/contracts
npm test # All tests
npx hardhat test # Hardhat test runner
npm run coverage # Coverage report
```

### Frontend Tests
```bash
cd packages/frontend
npm test # Jest tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage report
```

## ๐Ÿš€ Deployment Guide

### 1. Contract Deployment
```bash
# 1. Configure environment
cp packages/contracts/.env.example packages/contracts/.env
# Edit packages/contracts/.env

# 2. Deploy contracts
npm run deploy:sepolia # Test deployment
npm run deploy:ethereum # Production deployment

# 3. Export ABIs for frontend
cd packages/contracts
npm run export-abis
```

### 2. Frontend Deployment
```bash
# 1. Configure environment
cp packages/frontend/.env.example packages/frontend/.env.local
# Edit packages/frontend/.env.local with contract addresses

# 2. Build and deploy
npm run build:frontend
# Deploy to Vercel, Netlify, or your hosting provider
```

## ๐Ÿค Contributing

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/amazing-feature`
3. Commit changes: `git commit -m 'Add amazing feature'`
4. Push to branch: `git push origin feature/amazing-feature`
5. Open a Pull Request

### Development Workflow
1. Make changes in appropriate package
2. Run tests: `npm test`
3. Build: `npm run build`
4. Lint: `npm run lint` (in frontend package)
5. Commit with clear messages

## ๐Ÿ“„ License

MIT License - see [LICENSE](LICENSE) file for details.

## ๐Ÿ†˜ Support

- **Documentation**: Check package-specific READMEs
- **Issues**: Open GitHub issue with detailed description
- **Discord**: Join our community (link coming soon)

## ๐Ÿ”— Links

- **Live Demo**: https://defi-token-suite.vercel.app (coming soon)
- **Contract Addresses**: See deployment files in `packages/contracts/deployments/`
- **Block Explorers**:
- [Ethereum](https://etherscan.io)
- [Base](https://basescan.org)
- [Sepolia](https://sepolia.etherscan.io)

---

**Built with โค๏ธ for the DeFi community**