# The quantity is calculated incorrectly when depositing ETH to weETH.

SophonFarming treats EtherFi LiquidityPool.deposit's returned eETH share count as eETH amount, so weETH.wrap gets wrong value causing fund loss or deposit DoS.

- Payout: Contest reward
- Severity: high
- Program: Sophon
- Credited: EgisSecurity
- Disclosed: 2024-05-13
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-05-sophon-judging/issues/4
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-05-sophon%3AH-1
- Tags: domain:web3 impact:dos impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic vuln:precision-loss

**Target:** SophonFarming.depositEth / _ethTOeEth weETH deposit path
**Root cause:** EtherFi LiquidityPool.deposit returns minted shares, not eETH amount; Sophon passes that share count directly into weETH.wrap which expects an eETH amount, and shares != amount due to the conversion rate.
**Steps:**
1. Call `depositEth(boost, PredefinedPool.weETH)` with msg.value=100 ETH.
2. `_ethTOeEth` calls `IeETHLiquidityPool.deposit{value:100e18}(address(this))`, which mints shares via `eETH.mintShares` and returns the share count (e.g. 90 or 110 shares).
3. Returned share count is used as `_finalAmount` and passed to `_eethTOweEth` -> `IweETH(weETH).wrap(shareCount)`.
4. If shareCount < actual eETH amount, leftover eETH is stranded; if shareCount > eETH balance, `eETH.transferFrom` reverts, DoS-ing the deposit.
5. Fix: measure eETH balance delta around the deposit like `_ethTOstEth` does.
**How found:** Code-reading: noticed `_ethTOeEth` comment claims deposit returns exact eETH amount, compared against EtherFi's `_deposit` which returns `share` from `mintShares`, and observed the stETH path already handles this via balance delta while the eETH path does not. Also noted the mock uses `eEth.mint` (amount) instead of `mintShares`, masking the bug in tests.
**Exploitation:** Not an attacker-driven exploit; a user depositing ETH via the weETH pool either loses the eETH/share delta or has the deposit revert, depending on the current share price.
**Insight:** When integrating a yield-bearing token, verify whether the deposit/mint function returns shares or underlying amount; mocks that mint amounts instead of shares hide share/amount confusion. Compare against a sibling code path (here stETH) that already uses balance-delta measurement.
