Skip to content

oort-tech/launchpad-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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 publisher
    address rewardToken;      // Reward token address
    uint256 totalRewardAmount; // Total reward amount
    uint256 systemTaskId;     // System task ID
    uint8 status;             // Task status (0=Active, 1=Completed)
}

WithdrawAuthorization

struct WithdrawAuthorization {
    address user;            // Authorized user
    address token;           // Token address
    uint256 amount;          // Withdrawal amount
    uint256 systemTaskId;    // System task ID
    uint256 deadline;        // Authorization expiration timestamp
    uint256 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

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •