Skip to content

miracle709/d4l-contracts

Repository files navigation

D4L Contracts

Smart contracts for a meme coin launch system with bonding-curve trading and a competitive fighting arena with USDC betting.

Overview

This repository contains:

  • A factory that deploys meme coins, manages buy/sell flow on a bonding curve, and migrates liquidity to a Uniswap V2-compatible router when a market-cap threshold is reached.
  • A fighting arena where migrated meme coins register for weekly/custom tournaments and users place USDC bets on round outcomes.
  • Supporting libraries, mocks, tests, and Hardhat Ignition deployment modules.

Core Contracts

  • contracts/MemeCoinFactory.sol
    • Deploys MemeCoin tokens with metadata.
    • Enforces minimum initial buy in POLY (derived from Chainlink price feed).
    • Supports token creation fees in POLY or USDC.
    • Handles buy/sell using a linear pricing model.
    • Migrates token liquidity to a Uniswap V2 router when market-cap goal is reached.
    • Optionally auto-registers migrated tokens in the fighting arena.
  • contracts/MemeCoin.sol
    • ERC-20 token used for each launched meme coin.
    • Stores social/metadata fields provided at creation.
  • contracts/MemeCoinFightingArena.sol
    • Weekly and custom tournaments (monthly, quarterly, annual championship).
    • Level progression for winning tokens.
    • Overflow queue for registrations above participant cap.
    • USDC round betting with fee collection and daily limits.
    • Wildcard logic based on post-elimination market-cap performance.
  • contracts/MemeCoinFightingArenaView.sol
    • Additional read-focused view helpers for arena data.

Libraries

  • contracts/libraries/TournamentLibrary.sol
  • contracts/libraries/TournamentManagementLibrary.sol
  • contracts/libraries/BettingLibrary.sol
  • contracts/libraries/ViewFunctionsLibrary.sol
  • contracts/libraries/AdminFunctionsLibrary.sol

Tech Stack

  • Solidity 0.8.28 (plus compatibility compilers for imported contracts)
  • Hardhat + TypeScript
  • OpenZeppelin contracts
  • Chainlink price feed integration
  • Uniswap V2-style router/factory interfaces

Getting Started

Prerequisites

  • Node.js 18+
  • npm (or yarn)

Install

npm install

Environment Variables

Copy .env.example to .env and fill required values:

INFURA_API_KEY=...
PRIVATE_KEY=...
ETHERSCAN_API_KEY=...
USDC_ADDRESS=...
UNISWAP_ROUTER=...
WPOLY=...
PRICE_FEED=...

Compile

npx hardhat compile

Test

npx hardhat test

Run a specific suite:

npx hardhat test test/MemeCoinFactory.test.ts
npx hardhat test test/FightingSystem.test.ts

Optional gas report:

REPORT_GAS=true npx hardhat test

Deployment (Hardhat Ignition)

Available modules:

  • ignition/modules/MemeCoinFactory.ts
  • ignition/modules/MemeCoinFightingArena.ts
  • ignition/modules/MockERC20.ts
  • ignition/modules/ProxyWalletFactory.ts

Example:

npx hardhat ignition deploy ./ignition/modules/MemeCoinFactory.ts --network sepolia

Then deploy arena with factory address parameter:

npx hardhat ignition deploy ./ignition/modules/MemeCoinFightingArena.ts --network sepolia

Note: verify deployment module constructor parameters match current contract constructors before production deployment.

Key Defaults

Factory

  • Initial supply: 54,321,777,100 tokens (18 decimals)
  • Minimum initial buy: 1 USD equivalent in POLY
  • Market-cap migration goal: 54,321 USD

Arena

  • Max weekly participants: 128
  • Round duration: 24h
  • Betting window: 18h
  • Buffer time: 6h
  • Min/Max bet: 1 to 100 USDC
  • Betting fee: 2%

Project Structure

  • contracts/ Solidity contracts and libraries
  • test/ Hardhat test suites
  • ignition/modules/ deployment modules
  • ignition/deployments/ saved deployment artifacts
  • FIGHTING_SYSTEM.md deeper arena behavior notes

License

MIT

About

Meme coin launchpad smart contracts with bonding-curve trading, Uniswap migration, and a USDC-powered tournament fighting arena.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors