This project is a comprehensive smart contract implementation that replicates the core functionality of Pump.fun on EVM-compatible blockchains. It enables users to create, launch, and trade meme tokens with automated market making, liquidity management, and seamless Uniswap integration.
- ** Token Creation & Launch**: Deploy ERC20 tokens with customizable parameters
- ** Automated Liquidity Management**: Built-in AMM with virtual liquidity pools
- ** Token Trading**: Swap tokens for ETH with automated pricing
- ** Uniswap Integration**: Seamless migration to Uniswap V2 when market cap targets are reached
- ** Real-time Market Data**: Track price, market cap, volume, and liquidity metrics
- ** User Profiles**: Manage token portfolios and trading history
- ** Fee Management**: Configurable launch fees and referral rewards
- ** Security**: Built with OpenZeppelin contracts and reentrancy protection
The system consists of several interconnected smart contracts:
| Contract | Description | Purpose |
|---|---|---|
| PumpFun.sol | Main contract | Token launching, trading, and lifecycle management |
| TokenFactory.sol | Token deployment | Automated ERC20 token creation |
| Router.sol | Trading engine | Handles swaps and liquidity operations |
| Pair.sol | Liquidity pools | Manages token-ETH pairs and reserves |
| Token.sol | ERC20 implementation | Standard token with additional features |
- Launch Phase: Users create tokens with initial liquidity
- Trading Phase: Tokens trade on the internal AMM
- Migration Phase: Successful tokens migrate to Uniswap
- Uniswap Phase: Full decentralized trading on Uniswap V2
- Node.js >= 18.0.0
- npm or yarn
- Git
# Clone the repository
git clone https://github.com/AlphaFox000/PumpFun-EVM-Smart-Contract.git
cd pumpdotfun_evm_smart_contract
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your configurationCreate a .env file with the following variables:
PRIVATE_KEY=your_private_key_here
PRIVATE__KEY=your_private_key_here
SEPOLIA_API_URL=https://sepolia.infura.io/v3/your_project_id
MAINNET_API_URL=https://mainnet.infura.io/v3/your_project_id
ETHERSCAN_API_KEY=your_etherscan_api_key
BASE_API_KEY=your_basescan_api_key# Compile contracts
npx hardhat compile
# Run tests
npx hardhat test
# Deploy to testnet
npx hardhat run scripts/deploy.js --network base_sepolia- Ethereum Mainnet - Full production deployment
- Base Mainnet - Optimized for low fees
- Base Sepolia - Testnet deployment
- Sepolia - Ethereum testnet
| Contract | Address |
|---|---|
| Factory | 0x6C4390E6c7b9668DC4BBf0049aC346622c9ACB0f |
| Router | 0xc1A2116b647e9952FB743460EEFFc2B11a2bED33 |
| PumpFun | 0x99C8BC651f7bEF8320b7a985a0d869E2cc2B7E5b |
// Launch a new token
function launch(
string memory _name,
string memory _ticker,
string memory desc,
string memory img,
string[4] memory urls, // [twitter, telegram, youtube, website]
uint256 _supply,
uint maxTx
) public payable returns (address, address, uint)// Buy tokens with ETH
function swapETHForTokens(
address tk,
address to,
address referree
) public payable returns (bool)
// Sell tokens for ETH
function swapTokensForETH(
uint256 amountIn,
address tk,
address to,
address referree
) public returns (bool)- Reentrancy Protection: All external calls protected with OpenZeppelin's ReentrancyGuard
- Access Control: Owner-only functions for critical operations
- Input Validation: Comprehensive zero-address and parameter checks
- Safe Math: Built-in overflow protection with Solidity 0.8.24
- Audit Ready: Clean, well-documented code following best practices
- Bonding Curve: Automated price discovery based on supply and demand
- Virtual Liquidity: Initial liquidity provided by the protocol
- Market Cap Threshold: 100,000 ETH market cap triggers Uniswap migration
- Launch Fee: Configurable fee for token creation
- Trading Fee: Small percentage on each trade
- Referral Rewards: Up to 5% referral bonuses
- Liquidity Fee: 5% of launch fee goes to initial liquidity
This software is provided "as is" without warranty. Use at your own risk. Always conduct thorough testing before deploying to mainnet. Some implementation details may be omitted for security reasons.
For more detailed information, advanced configuration, or collaboration inquiries, please reach out to me directly. https://github.com/AlphaFox000/
If you find it useful! Your support helps us continue developing and improving this tool.