feat(dao): add PreIPODistributor subscription contract - #118
Conversation
Escrow subscription contract for a two-round pre-IPO sale: - Whitelist round gated by an OZ MerkleProof whitelist root (leaf = keccak256(abi.encode(chainid, account)), reusable across sales) - Public round, opened by the manager after the whitelist round - Per-user delivery tranche, locked at first deposit and inherited on top-ups - Deposits are locked (top-up only, no user withdrawal) - UUPS upgradeable; MANAGER role for sale management + emergency withdraw Includes Foundry tests (26 cases) covering sale config, both deposit rounds, tranche locking, access control, and upgrade authorization. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pull Request ReviewThis Solidity PR adds an upgradeable Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Pull Request ReviewThis Solidity PR adds an upgradeable Sensitive ContentNo sensitive content detected. Security Issues🟠 [HIGH] Deposit accounting trusts the requested amount rather than tokens received
Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Pull Request ReviewThis PR adds an upgradeable Solidity escrow contract for two-round pre-IPO subscriptions, supporting Merkle-gated whitelist deposits, public deposits, persistent tranche selection, role-based administration, pausing, and emergency withdrawals. It also adds Foundry tests covering initialization, access control, sale configuration, deposit behavior, tranche locking, and UUPS upgrades. Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Deploys the subscription contract and grants roles to both the deployer (temporary, for setup) and the real admin/manager/bot holders. createSale and deployer-role revocation are handled by separate scripts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pull Request ReviewThis PR adds an upgradeable Solidity escrow contract for two-round pre-IPO subscriptions, including Merkle-gated whitelist deposits, public deposits, tranche selection, role-based management, and emergency withdrawals. It also adds Foundry tests and a BSC mainnet deployment script that configures the proxy and production role holders. Sensitive ContentNo sensitive content detected. Security Issues🟠 [HIGH] Deployment leaves the deployer with upgrade and withdrawal privileges
Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Summary
Adds
PreIPODistributor— an escrow subscription contract for a two-round pre-IPO / launchpad sale. Users deposit an ERC-20 (e.g. USDT) into escrow during a whitelist round and an optional public round; each address picks a delivery tranche at its first deposit. Scoring, weighting and the final pro-rata + cap + waterfall allocation are computed off-chain — this contract is a pure escrow ledger. Settlement, refunds and token delivery are intentionally out of scope and land in a follow-up upgrade.What's included
contracts/dao/PreIPODistributor.sol— the contracttest/dao/PreIPODistributor.t.sol— Foundry tests (26 cases, all passing)Design
MerkleProofwhitelist root. Leaf =keccak256(abi.encode(chainid, account)); it proves membership only (no sale id, no tier/weight), so a single whitelist tree can be reused across sales. First deposit verifies the proof; top-ups skip it.setPublicRound(must start strictly after the whitelist round ends). Open to everyone, tracked in a separate accounting pool.TRANCHE_UNLOCKED/TRANCHE_LOCKED) at its first deposit; it is locked for the whole sale and inherited by top-ups across both rounds. The tranche does not affect accounting, only the recorded delivery choice.MANAGERmanages sales (create / update / open public round / pause) and holds theemergencyWithdrawsafety valve;DEFAULT_ADMIN_ROLEauthorizes UUPS upgrades._authorizeUpgraderestricted toDEFAULT_ADMIN_ROLE;ReentrancyGuard+ CEI on deposits.Testing
forge test --match-contract PreIPODistributorTest