_current_share_price divides net worth by issued_shares without enforcing a floor, so when debt approaches the treasury balance the share price becomes zero and fund_investor reverts on every deposit, blocking capital inflow.
Likelihood: High
Realistic inventory (1,000 items) accumulates 24 ETH/day in holding costs. Normal operational lags (slow sales for 40-50 days) trigger insolvency without attacker intervention.
Impact: Medium
Investors cannot enter positions until capital is restored, halting fundraising and starving the treasury.
Overview: tests/unit/test_poc_003_division_by_zero.py recreates the insolvency edge, proves share_price == 0, and demonstrates fund_cyfrin() reverts (division by zero in share price calculation). Note: PoC uses minimal inventory (1 item) for test determinism. With realistic inventory levels (100-1,000 items), this scenario occurs in days to weeks, not years. Holding costs are 0.001 ETH per item per hour, so 1,000 items accumulate 24 ETH/day in costs.
Step-by-step:
Setup: Deploy fresh contracts, seed 1 ETH, and mint 1,000,000 shares to a primary investor.
Attack Vector: Produce 1 item (minimal inventory for test), fast-forward time to accumulate holding costs until company_balance reaches zero and debt accrues.
Execution Flow: Owner tops up with holding_debt + 1, leaving net worth at exactly 1 wei.
Result: Next investor call to fund_cyfrin(1) reverts (division by zero when calculating share price).
Clamp share price to at least 1 wei or revert early with a descriptive error when net_worth < issued_shares.
Consider writing idle holding debt off to treasury equity or diluting shares when debt spikes, preventing zero division.
Emit monitoring events when share price is within 1 wei of zero so ops can react.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
View preliminary resultsAppeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.