Skip to content

Repository files navigation

Launchpad Contract

A Hardhat-based smart contract project for a Launchpad platform that supports task publishing, reward distribution, and authorized withdrawals.

📋 Table of Contents

📖 Project Overview

Launchpad is an upgradeable smart contract that supports task publishing, reward distribution, authorized withdrawals, batch transfers, emergency exits, and permission management. The contract supports native tokens (OORT/BNB) and ERC20 tokens as reward assets.

Core Features

  • Task Management: Create tasks, set task status, fund refunds
  • Reward Distribution: Batch transfers, authorized withdrawals (based on EIP712 signatures)
  • Fee Management: Task creation fees, configurable fee collection address
  • Access Control: Multi-level permission management (Owner/Gov)
  • Emergency Exit: Extract contract assets in emergency situations
  • Upgradeability: Contract upgrades based on UUPS pattern

🛠 Tech Stack

  • Solidity: ^0.8.23
  • Hardhat: Development framework
  • OpenZeppelin: Contract library (upgradeable contracts, access control, security utilities)
  • EIP712: Structured data signing standard

📦 Requirements

  • Node.js: v22.18.0
  • npm or yarn

🚀 Installation & Usage

Install Dependencies

npm install

Compile Contracts

npm run compile

Run Tests

# Run all tests
npm test# Run tests with gas report
REPORT_GAS=true npm test# Run test coverage
npm run coverage

Deploy Contracts

# Deploy to BSC mainnet
npm run d:bsc
# Deploy to OORT mainnet
npm run d:oort
# Deploy to testnets
npm run d:test:bsc
npm run d:test:oort

🔧 Contract Features

Main Functions

Task Related

  • createTask: Create a task and deposit reward tokens

    • Supports native tokens (OORT/BNB) and ERC20 tokens
    • Automatically collects task creation fees
  • batchTransfer: Batch distribute rewards (Gov only)

    • Supports up to 100 recipients
    • Automatically checks total reward limits
  • setTaskStatus: Set task status (Gov only)

    • Status: 0=Active, 1=Completed
    • Can refund partial rewards simultaneously
  • fundsRefund: Fund refund (Gov only)

    • Only completed tasks can be refunded

Authorized Withdrawal

  • authorizedWithdraw: User withdrawal with Gov-signed authorization
    • Based on EIP712 structured data signing
    • Supports expiration time and nonce for replay protection
    • Automatically verifies signatures and reward limits

Permission Management

  • Owner Permissions:

    • setGov: Set governance address
    • emergencyExitForNative: Emergency extraction of native tokens
    • emergencyExitForToken: Emergency extraction of ERC20 tokens
    • _authorizeUpgrade: Authorize contract upgrades
  • Gov Permissions:

    • setWorkingStatus: Pause/resume contract
    • setFeeCollector: Set fee collection address
    • setFeeAmount: Set task creation fee
    • batchTransfer: Batch distribute rewards
    • setTaskStatus: Set task status
    • fundsRefund: Fund refund

Data Structures

Task

struct Task {
address publisher; // Task publisheraddress rewardToken; // Reward token addressuint256 totalRewardAmount; // Total reward amountuint256 systemTaskId; // System task IDuint8 status; // Task status (0=Active, 1=Completed)
}

WithdrawAuthorization

struct WithdrawAuthorization {
address user; // Authorized useraddress token; // Token addressuint256 amount; // Withdrawal amountuint256 systemTaskId; // System task IDuint256 deadline; // Authorization expiration timestampuint256 nonce; // Replay protection nonce
}

Events

  • TaskCreated: Task created
  • AuthorizedWithdraw: Authorized withdrawal
  • FundsRefund: Fund refund
  • FeeAmountUpdated: Fee updated
  • SetWorkingStatus: Working status changed

📍 Deployment Information

OORT Mainnet

Contract Address : 0xF10ae6Ccda20005F60Bb30d83ac6F713e890E3d0

 ============ BASIC INFO ============
✅ Current Network : mainnet
Network Url : https://mainnet-rpc.oortech.com
deployer address : 0xD5cBD0b230be7c6A3C3CAe8e6C238e3C71E83906
owner address : 0x07e2f006e078A8c69b932C743596C7f440175739
fee address : 0xF189e0a26Bb836636A0BD96cec4591d96ed88D8D
gov address : 0xF189e0a26Bb836636A0BD96cec4591d96ed88D8D
fee : 5000000000000000000n / 5.0 OORT
wort : 0xEAd29460881f38ADA079A38ac3D82E2D088930d9
------------ DEPLOY INFO ------------
Lunchpad address : 0xF10ae6Ccda20005F60Bb30d83ac6F713e890E3d0 ✅
============ DEPLOY END ============

BSC Mainnet

Contract Address : 0xF10ae6Ccda20005F60Bb30d83ac6F713e890E3d0

 ============ BASIC INFO ============
✅ Current Network : bsc_mainnet
Network Url : https://bsc-rpc.publicnode.com
deployer address : 0xD5cBD0b230be7c6A3C3CAe8e6C238e3C71E83906
owner address : 0x07e2f006e078A8c69b932C743596C7f440175739
fee address : 0xF189e0a26Bb836636A0BD96cec4591d96ed88D8D
gov address : 0xF189e0a26Bb836636A0BD96cec4591d96ed88D8D
fee : 5000000000000000n / 0.005 BNB
wort : 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c
------------ DEPLOY INFO ------------
Lunchpad address : 0xF10ae6Ccda20005F60Bb30d83ac6F713e890E3d0 ✅
============ DEPLOY END ============

🧪 Testing

The project includes a comprehensive test suite covering main functionalities:

# Run tests
npm test# View test coverage
npm run coverage

Test files are located in test/Launchpad.test.js, including:

  • Task creation tests
  • Batch transfer tests
  • Authorized withdrawal tests
  • Permission management tests
  • Edge case tests

📚 Documentation

For detailed contract documentation, please refer to: docs/index.md

The documentation includes:

  • Complete API reference
  • Method parameter descriptions
  • Error code explanations
  • Typical call flows
  • FAQ

🔒 Security Features

  • ✅ Reentrancy attack protection (ReentrancyGuard)
  • ✅ Permission separation (Owner/Gov)
  • ✅ EIP712 signature verification
  • ✅ Nonce replay attack protection
  • ✅ Emergency exit mechanism
  • ✅ Pausable functionality

📝 License

MIT License

👥 Contributors

This project is developed and maintained by Oort Team.


Note: Please ensure environment variables and network parameters are properly configured before deployment.

About

datahub launchpad contracts

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages