Inspiration

Traditional group buys often fail because organizers can disappear with funds, deal terms change after contributions are locked in, or vendors never formally commit to the deal.
I was inspired to build a trust‑minimized solution that eliminates treasurer risk, enforces vendor commitments, and gives contributors a credible exit option.

What it does

TierPool is a smart contract–based group‑buy escrow on the MNEE token.
Contributors pool MNEE toward tiered funding goals. Vendors must attest their quotes on‑chain before any contributions are accepted.
The contract enforces a post‑deadline cooldown window during which contributors can exit (rage‑quit), and it automatically refunds contributions if no tier is both funded and validly attested.
If a tier is fully funded and the attestation remains valid past the cooldown, anyone can finalize the pool, triggering a payout to the vendor.

How I built it

I designed a finite state machine with six states—PENDING, ACTIVE, COOLDOWN, PAYABLE, PAID, and REFUNDING—and derived the current state dynamically based on funding levels and attestation validity.
The smart contract is written in Solidity 0.8.20 without proxies or upgrade patterns; it sets the MNEE token address immutably in the constructor.
I used the Foundry toolchain (forge, cast, anvil) for building, testing, and local forking.
Over 55 tests validate pool creation, attestation edge cases, state transitions, contribution accounting, exit and refund flows, and security properties like reentrancy resistance.
For the demo, I run a mainnet fork with pre‑funded accounts and interact with the real MNEE token.
On the frontend, I created views to list pools, display tier progress and state badges with iconography, and provide context‑aware actions (contribute, exit, finalize, claim refund).

Challenges I ran into

Designing a state machine that accurately reflects attestation validity and dynamic funding levels was non‑trivial.
I had to enforce that vendors attest quotes before accepting contributions and ensure that the attestation validity period covers the entire contribution window plus cooldown.
The dynamic nature of the payable tier meant that exits during cooldown could cause the pool to flip from COOLDOWN to REFUNDING, which required careful state computation.
Handling fee‑on‑transfer tokens in contributions led me to adopt a balance‑delta pattern.
On the UI side, conveying the pool’s state clearly while meeting WCAG 2.1 accessibility guidelines (color with icons and text labels) was a challenge.
Writing comprehensive tests for every edge case and security scenario was time‑consuming but critical.

Accomplishments that I'm proud of

I delivered a fully functional group‑buy escrow that eliminates trust in organizers.
The contract passes an extensive test suite, including edge cases like attestation expiry, reentrancy attempts, and contributions with fee‑on‑transfer tokens.
I documented the design thoroughly in a product requirements document and provided guidance for developers in the repository.
The frontend uses intuitive badges and progress indicators to help users understand the pool state.
Automatic refunds and direct exit paths ensure contributors always retain control over their funds.

What I learned

This project taught me how to design robust smart contracts with dynamic state derivation and enforce off‑chain commitments on‑chain.
I gained deep experience with the Foundry toolchain, gas optimization, and static analysis.
I learned to think carefully about user experience when presenting complex state machines to non‑technical users.
The importance of accessibility (icons and descriptive text rather than color alone) became clear.
I also learned to plan ahead through detailed PRDs and design decision logs.

What's next for TierPool — Verifiable Group‑Buy Coordinator

Future versions could add support for multiple tokens, partial exits, and tier upgrades, and implement optional organizer fees or community governance.
A keeper‑network integration could incentivize prompt finalization.
I also plan to incorporate feedback from users to further simplify the UI and extend accessibility.
Overall, TierPool lays the foundation for a new generation of verifiable, trustless group‑buy experiences.

Built With

Share this project:

Updates

Submission history