Project Overview
The work, in context.
A Web3 startup with a founding team of experienced DeFi traders wanted to launch their own protocol: a dual-pool staking and yield farming system with a governance token, designed to attract liquidity from existing DeFi communities. They had a clear economic model but needed an engineering team who understood smart contract security, front-end Web3 UX, and community-driven launch mechanics.
The Challenge
The Problem
DeFi protocol launches have the highest engineering stakes of any category we work in. A single smart contract vulnerability can result in complete fund loss. In a space with sophisticated adversarial actors (MEV bots, flash loan attackers), the margin for error is zero. The client also needed to launch with community trust in a market that had seen numerous rug pulls and exploits.
- Smart contract exploits had drained billions from DeFi in 2023, and trust was at a low
- Existing smart contract drafts had 3 critical vulnerabilities in a preliminary review
- Frontend needed to abstract wallet complexity for non-crypto-native users
- Token launch mechanics required precise timing and on-chain coordination
- MEV bot activity needed to be mitigated from the liquidity pool architecture
Our Solution
Our Approach
We took a security-first, then UX approach. No code shipped to mainnet without Hardhat fuzzing, Slither static analysis, and an external audit from a specialist Web3 security firm.
Security-First Smart Contract Architecture
Rewrote the contract suite from scratch with reentrancy guards, pull-payment patterns, time-locks on admin functions, and emergency pause mechanisms. Ran 2,000+ Foundry fuzz test cases before any review.
External Security Audit
Engaged a specialist Web3 security firm for a full smart contract audit. Three critical and four medium findings from the original drafts were resolved. The final contracts passed with zero critical findings.
MEV-Resistant Liquidity Design
Implemented anti-sandwich bot measures in the AMM swap function, launch whitelist with commit-reveal for token launch, and a graduated liquidity unlock schedule to prevent immediate price dumping.
Web3 Frontend
Built a React frontend with Wagmi and Ethers.js, supporting MetaMask, WalletConnect, and Coinbase Wallet. Gas estimation, transaction status, and error handling were all surfaced clearly.
Execution Timeline
Our Step-by-Step Process
01 / Weeks 1-4
Smart Contract Design
Drafting dual-pool staking contracts, yield farms, and governance tokens using Solidity.
02 / Weeks 5-8
Local testing & Fuzzing
Writing 2,000+ Foundry unit tests, executing static audits, and refining gas consumption.
03 / Weeks 9-12
Auditing & Optimizations
Submitting contract drafts to third-party security firm, repairing vulnerabilities.
04 / Weeks 13-16
Integrations & Mainnet
Writing Ethers.js, Wagmi connection code, configuring wallet adapters, and launching mainnet.
Tech Stack
Built with
- Solidity
- Hardhat
- Foundry
- OpenZeppelin
- Ethereum Mainnet
- React
- Wagmi
- Ethers.js
- The Graph (indexing)
- Chainlink (price feeds)
- IPFS (governance metadata)
Results
Measurable impact and verified outcomes
Contracts in the suite
Roughly 1,800 lines of Solidity, rewritten from the client's original drafts
Design to mainnet
Contract design, fuzz testing, audit preparation and wallet integration
Core staking contracts
No proxy, no admin upgrade path. This removes admin-key compromise as an attack surface
Governance time-lock
Reward-rate and lock-period changes are visible on-chain before they take effect
Retrospective
Lessons Learned & Refinements
Anti-Sandwich Measures
Adding dynamic slippage calculations protected early stakers from front-running MEV bots.
Non-Upgradeable Design
Keeping core contracts immutable built instant community trust over multi-sig configurations.
Frequently Asked
Trending Questions & FAQs
What was the cost of the security audit?
Audit cost scales with the size and complexity of the contract suite. In this case four contracts of roughly 1,800 lines of Solidity. We quote it as a separate line item rather than absorbing it into the build, because it is paid to an independent firm and the client should see what they are buying. We treat an external audit as a non-negotiable cost for any protocol that holds user funds.
How did you protect against MEV bots during the token launch?
We used a commit-reveal scheme for the initial token distribution. Users committed a hash of their intent before the reveal window opened. This prevents front-running bots from seeing the transaction and getting in ahead. The AMM also had a 3-block delay on large swaps during the first 48 hours.
Is the protocol upgradeable?
The core staking contracts are non-upgradeable by design. This removes a major attack surface (admin key compromise). Governance parameters (reward rates, lock periods) are adjustable via a 48-hour time-locked multi-sig, so the community can see changes before they take effect.
