Skip to main content

Overview

Prepool enables community-pooled token launches. Contributors pool ETH together, and when conditions are met, the prepool deploys a token + bonding curve via the factory. All pooled ETH becomes the initial buy (equal footing for all contributors). After graduation, the prepool holds the Uniswap V4 LP position and acts as a V4 hook, distributing trading fees to contributors forever. Each Prepool is a minimal proxy clone (EIP-1167) that also implements IHooks for the Uniswap V4 afterSwap callback.

Deployment Addresses

Implementation contract (clones are created per-prepool by LaunchFactory):
NetworkAddress
EthereumComing soon
BaseComing soon
BNB ChainComing soon
SepoliaComing soon

Write Functions

function contribute(address to) external payable
Join the prepool. to is the credited address. Reverts if below minContribution or already deployed/cancelled.
function deploy(bytes32 curveSalt) external
Permissionless once conditions are met (minBalance reached and before deployTime expiry). Creates the token and bonding curve via the factory. All pooled ETH is used as the initial buy.
function withdrawTokens() external
Available after 48-hour lockup. Withdraws the caller’s proportional share of tokens. Permanently exits fee earnings — the caller forfeits all future fee rights.
function claimFees() external
Claims accumulated ETH fees. Only for active contributors (those who haven’t withdrawn tokens).
function cancel() external
Anyone can cancel if the expiry deadline (deployTime) has passed. Creator or Makx team can cancel anytime before deployment. Releases the symbol reservation via LaunchFactory.releaseSymbol().
function refund() external
Returns full contribution after cancellation.
function collectLPFees(address positionManager) external
Collects fees from the Uniswap V4 LP position. ETH fees distributed 50/50 (Makx team / contributors). Token fees accumulate for Makx team.
function distributeAccumulatedFees() external
Distributes any undistributed hook ETH fees that arrived via the afterSwap hook or the receive() fallback.
function withdrawTokenFees() external
Withdraws accumulated token-side fees to makxTeam. Only callable after migration and once all contributors have exited.

View Functions

function earned(address user) external view returns (uint256)  // pending ETH fees
function canDeploy() external view returns (bool)

Key State

mapping(address => uint256) public contributions;
uint256 public totalContributed;
uint256 public contributorCount;

bool    public deployed;
bool    public cancelled;
address public bondingCurve;
address public token;
uint256 public lpTokenId;
uint256 public deployedAt;
uint256 public initialTokenBalance;

Fee Distribution

Uses the Synthetix RewardPerToken pattern for gas-efficient proportional fee distribution.
ConstantValue
TOKEN_LOCKUP48 hours
MAKX_FEE_BPS5000 (50%)
HOOK_FEE_BPS100 (1% of swap output)
Fee sources:
  1. Hook fee — 1% of swap output on every post-graduation Uniswap V4 trade
  2. LP fees — Collected from the Uniswap V4 LP position
  3. Platform fees — Sent directly by the bonding curve during trading
All ETH fees are split 50/50 between Makx team and active contributors. Token-side fees accumulate for Makx team withdrawal.

V4 Hook

The Prepool implements afterSwap to take a 1% fee on swap output. The hook address must have the correct V4 flag bits set (bit 6: AFTER_SWAP, bit 2: AFTER_SWAP_RETURNS_DELTA), which is enforced by salt-mining during createPrepool.

Events

event Contributed(address indexed contributor, uint256 amount, uint256 totalContributed)
event Deployed(address indexed token, address indexed bondingCurve, uint256 ethUsed)
event TokensWithdrawn(address indexed contributor, uint256 tokenAmount)
event FeesClaimed(address indexed contributor, uint256 amount)
event Cancelled()
event Refunded(address indexed contributor, uint256 amount)
event FeesReceived(uint256 amount)
event TokenFeesWithdrawn(address indexed recipient, uint256 amount)

Errors

ErrorCondition
AlreadyDeployedAction not valid after deployment
NotDeployedAction requires deployment first
AlreadyCancelledAlready cancelled
NotCancelledRefund before cancellation
BelowMinContributionBelow minimum
DeployConditionsNotMetConditions not satisfied
TokensLocked48-hour lockup active
AlreadyWithdrawnAlready exited
NoContributionNo contribution found
CannotCancelNot authorized to cancel
ContributorsStillActivewithdrawTokenFees while contributors remain
NotMigratedwithdrawTokenFees before graduation
TransferFailedETH transfer failed
HookNotImplementedUnused hook function called