PresaleWidget - EVM Presale/ICO Widget with Wallet Connect, Caps, Vesting & Multi-Stage Sales

(2 Reviews)
7 Sales Recently Updated
Trending
PresaleWidget - EVM Presale/ICO Widget with Wallet Connect, Caps, Vesting & Multi-Stage Sales

PresaleWidget — Owner-Managed EVM Presale/ICO Flow

Contract reference: EVMPresaleWidget (MIT, Solidity ^0.8.x). Submitted for verification on Etherscan: Sep 3, 2025.

PresaleWidget is a lightweight, embeddable purchase flow for token sales on EVM chains. Drop the widget into your site or dApp, connect your sale parameters, and let users contribute in either native currency or approved ERC-20s. The UI is fast, responsive, brandable, and designed for clarity.

What This Contract Implements

  • Initialization: initializePresale(decimals, totalTokensforSale, rate, saleStatus) sets token precision, total sale inventory, the native-currency price (in smallest units), and whether the sale starts active.
  • Start/Stop Controls: activatePresale() and haltPresale() flip saleStatus on/off.
  • Accepted Assets & Pricing: Owner can whitelist ERC-20s via registerPayableTokens(tokens, prices), toggle them with updatePayableTokenStatus(token, status), and adjust both native and ERC-20 pricing with adjustTokenPricing(tokens, prices, rate).
  • Quoting Logic: calculateTokenAmount(token, amount) returns the sale-token output using amount * 10saleTokenDec / price, where price is either rate (native) or the per-token value from tokenPrices (ERC-20), both expressed in the payer asset’s smallest units per 1 sale token (with saleTokenDec decimals).
  • Purchases: purchaseTokens(token, amount) forwards funds to the owner, enforces inventory (totalTokensSold + out ≤ totalTokensforSale), records unique buyers, and accumulates purchased amounts.
  • Owner Withdrawals: withdraw(token, amt), withdrawAll(token), and withdrawCurrency(amt).
  • Buyer Registry: getBuyersList(from, to) returns a windowed list of buyers and their purchased amounts.

Scope & Recommended Extensions

This reference contract focuses on a simple, owner-managed sale with capped inventory and flexible payments. It does not include allowlists, per-wallet limits, soft-cap refunds, or on-chain vesting/claims. For production launches, pair it with:

  • A vesting/claims contract (cliffs + linear schedules), callable by buyers post-sale.
  • Optional allowlist/per-wallet limit module for private or tiered rounds.
  • Soft-cap & refund logic if your sale economics require it.

The frontend widget already anticipates these integrations: when endpoints/ABIs are provided, the UI exposes claim actions and round-state awareness without changing the core sale contract.

Frontend & Dev Experience

  • Tech stack: Node.js + React.js (modern hooks) for the UI; Solidity ^0.8.x on-chain.
  • Wallets: MetaMask, WalletConnect, and Coinbase Wallet.
  • Theming & i18n: light/dark modes, custom colors, and fully localizable copy.
  • Docs included: end-to-end setup (RPC, ABI wiring), pricing configuration, ERC-20 approvals, and integration patterns for vesting and allowlists.

Operational Notes

  • Funds are forwarded to the owner on each purchase; the contract keeps an accounting of buyer totals but does not custody claims.
  • For ERC-20 payments, buyers must approve the contract before calling purchaseTokens().
  • Ensure your rate and tokenPrices are expressed in the payer asset’s smallest units per one sale token (with saleTokenDec decimals) to avoid mispricing.
  • Audit and test carefully when composing with vesting/refund modules.

In short, PresaleWidget gives you a clear, brandable purchase UX with a lean, auditable on-chain core. Extend with vesting and round controls as needed, and launch faster without compromising ownership of your sale mechanics.

BlockShark's items

Your Code Belongs on Web3

Ship smarter dApps, plug into our marketplace, and grow with the next wave of the internet.