DEV Community

Cover image for How We Built the $TASK Presale Dapp on Base
Project Lead at TaskForce
Project Lead at TaskForce

Posted on • Edited on

How We Built the $TASK Presale Dapp on Base

πŸ› οΈ How We Built the $TASK Presale Dapp on Base
When we set out to build TaskForce β€” a 0% fee Web3 platform for freelancers β€” we knew we needed more than a whitepaper. We needed a working product. The first step: building a secure, transparent, and fully on-chain presale for our native token, $TASK.

Here’s how we built and deployed our presale Dapp β€” live now on Base Mainnet.

🎯 Goals for the Presale
We designed our smart contract to support:

βœ… 4 Phases with dynamic pricing
βœ… Hard cap / soft cap enforcement
βœ… Refunds if soft cap not met
βœ… 50% unlocked + 50% vested claiming
βœ… ETH withdrawal to treasury
βœ… Unsold token recovery
βœ… Fully trackable via the frontend (no backend)

Built using Solidity + Hardhat, with a modern frontend stack powered by Next.js, WAGMI, and Viem, all deployed to Base (L2 by Coinbase).

🧱 Smart Contract Overview
Our TaskTokenPresale contract:
Accepts ETH based on current phase pricing
Calculates token entitlement on buy (not direct mint)
Implements vesting logic after presale ends
Provides refunds if soft cap is unmet
Enforces admin withdrawal rules post-sale
Key claim logic example:

function claimTokens() public {
    require(block.timestamp > presaleEndTime, "Presale not ended");
    require(!initialClaimed[msg.sender], "Already claimed");
    uint256 claimAmount = tokenEntitlement[msg.sender] / 2;
    initialClaimed[msg.sender] = true;
    token.transfer(msg.sender, claimAmount);
}
Enter fullscreen mode Exit fullscreen mode

All presale-related minting is temporary and strictly time-locked.

🌐 Frontend Stack
βš›οΈ Next.js App Router
πŸ”Œ WAGMI + Viem
🎨 TailwindCSS
πŸ” .env.production for Base Mainnet
πŸ”„ Automatic chain detection and wallet switching

Features:
Real-time phase countdown
ETH contribution input + transaction toasts
Dynamic claim / refund button logic
Smart contract reads via useReadContract() to stay trustless

πŸ§ͺ Testing Strategy
Ran full test cycles on Base Sepolia
Simulated phase time shifts with Hardhat
Verified claim/refund conditions across wallets
Ensured cross-wallet UX: MetaMask, Trust Wallet, WalletConnect

πŸš€ Deployment Process
Deployed upgraded $TASK token on Base
Minted 30M $TASK to presale contract
Final presale config:
4 phases
Soft cap: 30 ETH
Hard cap: 200 ETH
Phase 1 discount: 56%
Final Mainnet addresses:
Token: 0x516e09011C082d34f4EB795ebac3efBAD6D753F0
Presale: 0x18E0B87Fc62D1349d060E79843e55b8658B8f2D9

πŸ’‘ Lessons Learned
Wrong-chain wallet detection is crucial
ENS lookups fail on Base Sepolia, watch out
Mobile WalletConnect needs fallback explorer links
We used Vanta.js backgrounds β€” beautiful, but tricky with SSR hydration

🧭 What’s Coming Next
Add β€œAdd $TASK to Wallet” feature
Submit for BaseScan verification
Begin staking Dapp and DAO module
Open source the codebase

πŸ”— Try It Yourself
🌍 Website: https://taskforceweb3.com
πŸ›’ Join the Presale: https://taskforceweb3.com/#presale
πŸ“œ Whitepaper: https://taskforceweb3.com/whitepaper
πŸ“’ Twitter: https://twitter.com/TeamTaskweb3

Top comments (0)