Normal behavior:
Users send ETH to fund_investor() (via fund_cyfrin(1)) and should receive shares proportional to their contribution. If the requested number of shares would exceed the public cap, the investor should either receive only the allowable shares and any ETH excess refunded, or the transaction should revert.
Specific issue:
When issued_shares == public_shares_cap, the function accepts the investor’s ETH, computes new_shares, clamps new_shares to available = public_shares_cap - issued_shares (which becomes 0), credits company_balance with the investor’s ETH and emits SharesIssued with amount 0. The investor ends up paying ETH and receiving zero shares with no refund or revert — effectively losing funds (or unintentionally funding the company without stake).
Likelihood:
This will occur whenever the public share cap is fully allocated (i.e., issued_shares == public_shares_cap), which is a normal state after public fundraising completes.
This will also occur during race/ordering scenarios where the cap is reached by other transactions in the same block or shortly before the investor’s transaction is processed.
Impact:
Investors may lose funds (their ETH is accepted but they receive zero shares).
Trust and reputation damage — investors who see money accepted but no shares will consider the system broken or malicious.
Economic & accounting inconsistency: company balance increases without corresponding ownership changes, which can be abused or create legal/auditing issues.
Explanation:
The contract accepted investor ETH and increased companyBalance even though newShares was trimmed to 0 because the cap was reached. The investor paid but received no shares.
Explanation: (issue available shares + refund excess) gives best UX: partial issuance with refund of leftover ETH, but requires careful math and a safe refund mechanism. Always perform state updates before external calls and use non-reentrant patterns.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.