A Hardhat-based smart contract project for a Launchpad platform that supports task publishing, reward distribution, and authorized withdrawals.
- Project Overview
- Tech Stack
- Requirements
- Installation & Usage
- Contract Features
- Deployment Information
- Testing
- Documentation
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.
- β 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
- Solidity: ^0.8.23
- Hardhat: Development framework
- OpenZeppelin: Contract library (upgradeable contracts, access control, security utilities)
- EIP712: Structured data signing standard
- Node.js: v22.18.0
- npm or yarn
npm installnpm run compile# Run all tests
npm test
# Run tests with gas report
REPORT_GAS=true npm test
# Run test coverage
npm run coverage# 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-
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
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
-
Owner Permissions:
setGov: Set governance addressemergencyExitForNative: Emergency extraction of native tokensemergencyExitForToken: Emergency extraction of ERC20 tokens_authorizeUpgrade: Authorize contract upgrades
-
Gov Permissions:
setWorkingStatus: Pause/resume contractsetFeeCollector: Set fee collection addresssetFeeAmount: Set task creation feebatchTransfer: Batch distribute rewardssetTaskStatus: Set task statusfundsRefund: Fund refund
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)
}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
}TaskCreated: Task createdAuthorizedWithdraw: Authorized withdrawalFundsRefund: Fund refundFeeAmountUpdated: Fee updatedSetWorkingStatus: Working status changed
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 ============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 ============The project includes a comprehensive test suite covering main functionalities:
# Run tests
npm test
# View test coverage
npm run coverageTest files are located in test/Launchpad.test.js, including:
- Task creation tests
- Batch transfer tests
- Authorized withdrawal tests
- Permission management tests
- Edge case tests
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
- β Reentrancy attack protection (ReentrancyGuard)
- β Permission separation (Owner/Gov)
- β EIP712 signature verification
- β Nonce replay attack protection
- β Emergency exit mechanism
- β Pausable functionality
MIT License
This project is developed and maintained by Oort Team.
Note: Please ensure environment variables and network parameters are properly configured before deployment.