Crypto Fund Profit Distribution: HWM, Performance Fee, LP

Note: when a crypto fund locks in profits and needs to distribute them among dozens of LPs with different entry dates, partial exits, and accrued performance fees, simple proportional calculations lead to unfairness and mathematical holes. For example, a fund with three LPs entering on different day

Blockchain Development Services

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1452
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1310
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    1005
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1270
  • image_logo-advance_0.webp
    B2B Advance company logo design
    719
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    1012

Note: when a crypto fund locks in profits and needs to distribute them among dozens of LPs with different entry dates, partial exits, and accrued performance fees, simple proportional calculations lead to unfairness and mathematical holes. For example, a fund with three LPs entering on different days, when paying quarterly without time-weighting contributions, would give some LPs undeserved income and others losses. We design and implement a profit distribution system for crypto funds that is mathematically accurate, auditable, and manipulation-proof. Turnkey—from model selection to deployment with documentation and support. Average savings on network fees for a fund with 500 LPs are estimated at $3,000–$5,000 per month. We assess your project in 1–2 days—get in touch.

Tasks of the Profit Distribution System

The system must fairly account for each LP's time of contribution, correctly charge performance fees only on new profits, and scale to thousands of participants. Without a well-thought-out architecture, problems arise: reentrancy during payouts, loss of precision, and vulnerabilities to flash loan attacks via oracle manipulation. Our solution uses proven DeFi patterns—EIP-4626 vaults and Synthetix staking rewards—and augments them with invariant testing on Foundry.

How to Choose a Share Accounting Model?

Before writing contracts, we select the fundamental share accounting model. Two main approaches.

Share-based (Tokenized Shares)

LPs receive ERC-20 shares upon entry. Profit is reflected through NAV per share growth—one share is worth more, but the number of shares does not change. Profit distribution means either capital appreciation (share value increase) or dividend payout with NAV per share decrease. "EIP-4626 defines a standard for tokenized vaults that simplifies integration with DeFi protocols"—the standard simplifies DeFi integration but creates complexities with partial exits and interim distributions.

Point-based (Accumulated Points)

Each LP accumulates "points" proportional to time and deposit amount. Profit is divided proportionally to points. This approach suits yield funds with regular payouts. The "Rewards per token" pattern is a proven way to efficiently calculate accrued rewards without iterating over all LPs.

contract ProfitDistributor { uint256 public rewardPerShareStored; uint256 public lastUpdateTime; uint256 public totalShares; mapping(address => uint256) public rewardPerSharePaid; mapping(address => uint256) public pendingRewards; mapping(address => uint256) public shares; modifier updateReward(address account) { rewardPerShareStored = rewardPerShare(); lastUpdateTime = block.timestamp; if (account != address(0)) { pendingRewards[account] = earned(account); rewardPerSharePaid[account] = rewardPerShareStored; } _; } function earned(address account) public view returns (uint256) { return shares[account] * (rewardPerShare() - rewardPerSharePaid[account]) / 1e18 + pendingRewards[account]; } } 
Characteristic Share-based Point-based
Transparency High (share value visible) Medium (points computed off-chain)
Gas per entry/exit ~80k (ERC-20 transfer) ~50k (mapping update)
Partial exit support Difficult (must burn shares) Easy (reduce points)
Smart contract audit Easier (EIP-4626 standard) More complex (point calculations)

Why Simple Systems Break on Complex Cases?

Mid-Period Entries and Exits

If an LP enters mid-quarter, they should not receive profit for the period before their entry. Conversely, on mid-period exit, they should get their share of accrued but undistributed profit. Solution: snapshot-based distribution. On each state change, we record a checkpoint with the current rewardPerShare. When calculating, we use the difference between current and checkpoint values.

function _updateCheckpoint(address lp) internal { uint256 currentRPS = rewardPerShareStored; uint256 lpShares = shares[lp]; uint256 lastRPS = checkpoints[lp].rewardPerShare; if (lpShares > 0 && currentRPS > lastRPS) { uint256 accrued = lpShares * (currentRPS - lastRPS) / PRECISION; checkpoints[lp].pendingReward += accrued; } checkpoints[lp].rewardPerShare = currentRPS; } 

Performance Fee with High Water Mark

Performance fee (typically 20%) should only apply to new profit—above the previous HWM. This protects LPs from double fees after a drawdown and recovery. Choice between Global HWM and Per-LP HWM: the first is simpler, the second fairer but gas-heavier. If the fund has more than 50 LPs, the gas difference can exceed 30%. For funds with capital from $5 million, savings from Per-LP HWM can reach $2,000 per month due to fair accounting.

mapping(address => uint256) public lpHighWaterMark; function calculatePerformanceFee(address lp, uint256 currentNAVPerShare) public view returns (uint256 feeAmount) { uint256 hwm = lpHighWaterMark[lp]; if (currentNAVPerShare <= hwm) return 0; uint256 profitPerShare = currentNAVPerShare - hwm; uint256 lpShareBalance = shares[lp]; feeAmount = profitPerShare * lpShareBalance * performanceFeeRate / (PRECISION * 10000); } 

Hurdle Rate

Some funds charge performance fee only if returns exceed a benchmark (e.g., 8% annual). Implemented as an additional threshold on top of HWM.

Protection Against Oracle Manipulation in Performance Fee Calculation

We use TWAP instead of spot prices and introduce a cooldown between NAV update and fee settlement. This prevents flash loan attacks where an attacker temporarily distorts prices to trigger fees. Additionally, multi-sig for manager operations.

Methods of Organizing Payouts

Method Gas per payout Suitable for Risks
Reinvestment Low Any scale None
Pull pattern (claim) ~50k gas Up to 1000 LPs LP must claim themselves
Merkle drop O(log N) ~60k Thousands of LPs (10x cheaper than push pattern) Requires off-chain calculation
Push pattern O(N) ~100k+ Up to ~50 LPs Can revert on recipient contract

Merkle distribution is optimal for thousands of LPs: the manager computes payouts off-chain, builds a Merkle tree, and publishes the root on-chain. Each LP claims their payout with a proof, gas independent of the number of recipients. Uniswap uses this pattern for UNI distribution.

bytes32 public merkleRoot; function claimMerkle( uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof ) external { require(!isClaimed(index), "Already claimed"); bytes32 node = keccak256(abi.encodePacked(index, account, amount)); require(MerkleProof.verify(merkleProof, merkleRoot, node), "Invalid proof"); _setClaimed(index); IERC20(rewardToken).safeTransfer(account, amount); emit Claimed(index, account, amount); } 

Security and Audit: Protection Against Manipulation

Key vulnerabilities:

  • Reentrancy during payouts—zero out pendingRewards before transfer.
  • Precision loss—use fixed-point arithmetic with scale 1e18, round down.
  • Oracle manipulation—TWAP and cooldown between NAV update and fee settlement.
  • Manager centralization—timelock 24–48h and multi-sig for settleFee operations.

Gas optimization details: Use storage packing, reduce SSTORE count, apply unchecked for overflow-safe operations. This cuts gas by 30–40% compared to naive implementation. In one project with 500 LPs, savings were substantial on fees. We guarantee contract auditability: our team has experience with smart contracts in Solidity, Rust (Solana), Vyper. Each smart contract goes through formal verification and invariant testing on Foundry. Over 30 successful projects: funds, DEXes, NFT marketplaces. Gas savings through optimization reach 40% compared to naive implementations.

What You Get: Stages and Deliverables

  1. Design (3–5 days): model selection, fee structure, HWM per-LP vs global, payout mechanism. Formalize invariants. Scheme documentation.
  2. Contract Development (7–10 days): vault, distributor, fee module. Unit tests, fuzz tests, invariant tests. Source code + comprehensive documentation.
  3. Off-chain Components (3–5 days): NAV calculator, Merkle tree builder, claim scripts. Integration tests.
  4. Audit (1–2 weeks): external audit mandatory for systems managing third-party funds. Report with recommendations. External audit cost ranges from $10,000 to $25,000 depending on complexity—we help select a contractor.
  5. Deployment and Monitoring (2–3 days): graduated rollout, real-time invariant monitoring. Dashboard access.

After deployment, we deliver full technical documentation, configurations, and team training. 30-day support. Vulnerability warranty—6 months. Get a consultation—contact us, we assess the project free of charge and on schedule. Order development of a profit distribution system for your crypto fund today.

Additionally: for a fund with $10 million capital and 1000 LPs, gas optimization savings amount to about $4,000 per month.