PresaleWidget - EVM Presale/ICO Widget with Wallet Connect, Caps, Vesting & Multi-Stage Sales
PresaleWidget - EVM Presale/ICO Widget with Wallet Connect,
Description
PresaleWidget — Owner-Managed EVM Presale/ICO Flow
Contract Reference: EVMPresaleWidget
License: MIT
Solidity Version: ^0.8.x
Verified on Etherscan: September 3, 2025
PresaleWidget is a lightweight, embeddable purchase flow for token presales and ICOs on any EVM-compatible chain.
Drop the widget into your website or dApp, configure your sale parameters, and let users contribute using native currency or approved ERC-20 tokens.
The UI is fast, responsive, fully brandable, and designed for maximum clarity — reducing friction and boosting conversion.
What This Contract Implements
| Feature | Description |
|---|---|
| Initialization | initializePresale(decimals, totalTokensforSale, rate, saleStatus) — sets token precision, total sale inventory, native-currency price (in smallest units), and whether the sale starts active. |
| Start/Stop Controls | activatePresale() and haltPresale() — toggle saleStatus on/off with owner-only access. |
| Accepted Assets & Pricing | Owner can:• Whitelist ERC-20s via registerPayableTokens(tokens, prices)• Toggle with updatePayableTokenStatus(token, status)• Adjust pricing via adjustTokenPricing(tokens, prices, rate) |
| Quoting Logic | calculateTokenAmount(token, amount) returns sale-token output using:amount * 10^saleTokenDec / priceWhere price is rate (native) or tokenPrices[token] (ERC-20), both in payer asset’s smallest units per 1 sale token. |
| Purchases | purchaseTokens(token, amount):• Forwards funds to owner immediately• Enforces inventory cap (totalTokensSold + out ≤ totalTokensforSale)• Tracks unique buyers• Accumulates purchased amounts per user |
| Owner Withdrawals | • withdraw(token, amt)• withdrawAll(token)• withdrawCurrency(amt) — for native ETH/BNB/etc. |
| Buyer Registry | getBuyersList(from, to) — returns paginated list of buyers and their purchased amounts |
Scope & Recommended Extensions
This reference contract delivers a simple, owner-managed sale with:
- Capped inventory
- Flexible payment options
- Full control over pricing and tokens
Does NOT include (by design):
- Allowlists
- Per-wallet limits
- Soft-cap refunds
- On-chain vesting/claims
Production-Ready Extensions (Recommended)
| Module | Purpose |
|---|---|
| Vesting/Claims Contract | Cliffs + linear schedules, callable by buyers post-sale |
| Allowlist & Tier Module | Private rounds, KYC tiers, wallet caps |
| Soft-Cap & Refund Logic | Refund contributors if goal not met |
The frontend widget is built to integrate seamlessly — just provide the ABI and contract address, and it auto-exposes claim buttons, round status, and user eligibility without touching the core sale logic.
Frontend & Developer Experience
Tech Stack
- Frontend: Node.js + React.js (modern hooks)
- On-Chain: Solidity
^0.8.x
Wallet Support
- MetaMask
- WalletConnect
- Coinbase Wallet
Customization
- Theming: Light / Dark modes + full CSS variable override
- Branding: Custom logos, colors, fonts
- i18n: Fully localizable copy (JSON-based)
Documentation Included
- End-to-end setup guide
- RPC & ABI wiring
- Pricing configuration examples
- ERC-20 approval flow
- Integration patterns for vesting, allowlists, and refunds
Operational Notes
| Note | Detail |
|---|---|
| Fund Flow | All funds (native & ERC-20) are forwarded to owner on purchase — contract holds zero balance |
| ERC-20 Payments | Users must approve the contract before calling purchaseTokens() |
| Pricing Precision | rate and tokenPrices must be in payer’s smallest units per 1 sale token (with saleTokenDec decimals) |
| Security | Audit and test thoroughly when composing with vesting/refund modules |
In Short
PresaleWidget = Clear UX + Auditable Core + Full Owner Control
Launch faster. Stay flexible. Extend securely.
Embed. Configure. Sell. Claim. Done.
Built for speed. Designed for trust. Ready for production.
Disclaimer: Web3.Market is a marketplace platform that facilitates the sale of digital products between independent sellers and buyers. We do not develop, endorse, or guarantee any product listed on this platform. All products are provided by third-party sellers and are sold "as is." Web3.Market assumes no responsibility or liability for the functionality, security, legality, or any use or misuse of products purchased through this platform. Buyers are solely responsible for evaluating the suitability of any product for their intended purpose and for ensuring compliance with all applicable laws and regulations. By purchasing, you acknowledge that Web3.Market shall not be held liable for any direct, indirect, incidental, or consequential damages arising from the use of any product.
One-time payment • Lifetime access
Product Info
RPC Providers
Need a reliable RPC endpoint for your dApp? Get started with these trusted providers: