XZERIUM Presale Smart Contract: A Secure & Feature-Packed Token Sale Solution
🚀 Introduction
The XZERIUM Presale Smart Contract is a highly secure, multi-phase token sale platform built for the XZERIUM project. Developed on Ethereum using Solidity, it combines advanced security mechanisms, live price feeds, and flexible sale options to ensure a fair and transparent fundraising process.
🔒 Security Features
1️⃣ Reentrancy Protection
✔ Uses OpenZeppelin’s ReentrancyGuard
to prevent reentrancy attacks.✔ Critical functions (purchases, refunds) are secured with nonReentrant
.
2️⃣ Oracle Security
✔ Chainlink Price Feeds (ETH, BNB, USDT) for real-time pricing.✔ Checks for:
-
Stale data (reverts if older than
ORACLE_TIMEOUT
). -
Invalid prices (negative/zero values rejected).
-
Complete rounds (ensures fresh data).
3️⃣ Gas Price Protection
✔ Minimum gas price (minGasPrice
) prevents frontrunning.✔ Gas limit (purchaseGasLimit
) enforced during network congestion.
4️⃣ Pausable Mechanism
✔ Owner can pause/unpause the sale in emergencies.✔ Prevents transactions during critical updates.
5️⃣ Timelock for Critical Changes
✔ Changes to fundsRecipient
require a 24-hour timelock.✔ Prevents sudden unauthorized withdrawals.
6️⃣ Vesting & Refund Safeguards
✔ Vesting: Tokens unlock linearly over 180 days (prevents dumping).✔ Refunds: If soft cap isn’t met, investors get USDT refunds.
💵 Live Price Integration
Supported Payment Methods
🔹 ETH (Ethereum)
-
Oracle: Chainlink ETH/USD
-
Usage: Direct purchases with ETH.
🔹 BNB (Binance Coin)
-
Oracle: Chainlink BNB/USD
-
Usage: Cross-chain compatibility.
🔹 USDT (Tether)
-
Oracle: Chainlink USDT/USD
-
Usage: Stablecoin option (1 USDT ≈ 1 USD).
How It Works
- ETH/BNB Purchases:
-
Fetches live price from Chainlink.
-
Converts token amount to USD value.
-
Calculates required ETH/BNB based on current rate.
2. USDT Purchases:
-
Fixed-rate conversion (1 USDT = $1).
-
Transfers USDT directly to
fundsRecipient
.
Example:
uint256 ethPrice = getPriceInUSD(Asset.ETH); // $3,000
uint256 costETH = (amount * tokenPrice) / ethPrice;
🔥 Key Features
1️⃣ Multi-Phase Presale
-
🔒 Private Sale:
-
Fixed price: $0.015 per token.
-
0.3% burn on every purchase (deflationary).
-
Whitelist-only (optional).
-
🌍 Public Sale (3 Rounds):
-
Increasing prices ($0.02 → $0.025 → $0.03).
-
Early-bird bonus (+5% tokens in first 48 hours).
2️⃣ Deflationary Tokenomics
-
🔥 Automatic Burns:
-
Unsold tokens burned after presale.
-
Private sales trigger 0.3% burn per tx.
-
⚡ Controlled Team Burns:
-
Team can burn up to 0.5% of holdings at a time.
3️⃣ Flexible Admin Controls
-
📝 Whitelist Management:
-
Add/remove addresses in batches.
-
Toggle whitelist requirement (
useWhitelist
). -
⚙️ Dynamic Adjustments:
-
Update vesting duration.
-
Modify gas limits & min gas prices.
-
Adjust sale timings (with safeguards).
4️⃣ Investor Protections
-
🧳 Wallet Limits:
-
Max 5,000 tokens per wallet.
-
Min 50 tokens per purchase.
-
💸 Refund System:
-
If soft cap isn’t met, USDT refunds are issued.
✅ Why This Contract Stands Out
✔ Secure: Reentrancy protection, oracle checks, pausability.
✔ Flexible: Supports ETH, BNB, USDT with live pricing.
✔ Fair: Vesting prevents dumping, burns reduce supply.
✔ Transparent: All parameters adjustable with safeguards.
评论 (0)