The _mint
function incorrectly calculates shares for the first depositor due to a hardcoded multiplier (1e8). Since different tokens have different decimal places, this results in incorrect share allocation for tokens with decimals other than 8.
Affected Code in _mint Function
This hardcoded 1e8 assumes all deposit tokens have 8 decimals.
However, the contract allows deposits in WETH (18 decimals), WBTC (8 decimals), LINK (18 decimals), and USDC (6 decimals).
For 18-decimal tokens (WETH, LINK), this causes over-minting of shares.
For 6-decimal tokens (USDC), this causes under-minting.
Allowing it to break this saying:
First depositor using WETH or LINK will receive 10⁸
times more shares than intended, causing inflation.
First depositor using USDC will receive 10²
times fewer shares, leading to unfair loss.
Manual code review
Normalize Deposits Using Token Decimals
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.