Concepts

Pool lifecycle

Every pool has three phases: open, expired, and released. Withdraw rules change at each boundary.

Phase 1 — Open (now ≤ expiresAt)

  • Funders may call fund() (ETH) or fundERC20(token, amount). Contributions below the USD minimum revert.
  • Any owner may call withdraw(amount) or cheaperWithdraw() (full balance) for ETH, and withdrawTokenAmount(token, amount) or withdrawToken(token) (full balance) for ERC-20s.
  • Events: Funded, FundedERC20, Withdrawn, WithdrawnToken.

Phase 2 — Expired (now > expiresAt, not yet released)

  • New funding reverts with CommunityPool__PoolExpired.
  • Owner withdraws revert with CommunityPool__WithdrawDisabledAfterExpiry.
  • Anyone may call releaseExpiredFundsToDeployer(), which sweeps all ETH and whitelisted ERC-20 balances to the original deployer.

Phase 3 — Released

After release, the contract has zero balance in the tracked assets. Per-funder totals are not stored on-chain — capture Funded and FundedERC20 events off-chain if you need historical attribution.

Partial vs. full withdraws

The current contract supports both partial (withdraw(amount), withdrawTokenAmount(token, amount)) and full (cheaperWithdraw(), withdrawToken(token)) withdraws while the pool is open.

Who can call what

FunctionPhaseCaller
fund / fundERC20OpenAnyone
withdraw / cheaperWithdrawOpenAny owner
withdrawToken / withdrawTokenAmountOpenAny owner
releaseExpiredFundsToDeployerExpiredAnyone

Related