The dsc_engine.vy contract hardcodes precision scaling constants (PRECISION = 10**18 and ADDITIONAL_FEED_PRECISION = 10**10) across all collateral conversion functions. On ZKsync Era and Ethereum, Wrapped Bitcoin (WBTC) uses 8 decimals. This hardcoded assumption undervalues deposited WBTC by a factor of $10^{10}$ ($10 \text{ billion times}$), blocking users from borrowing against WBTC, and causes liquidation transfers to fail due to attempting to seize $10^{18}$ WBTC tokens.
In src/dsc_engine.vy, token valuation functions assume all tokens have 18 decimals and all price feeds have 8 decimals ($18 - 8 = 10$):
In _get_usd_value():
When a user deposits $1 \text{ WBTC}$ ($10^8$ satoshis) with WBTC price at $60,000 ($60,000 \times 10^8$):
$$
The actual collateral value is $60,000 ($60000 \times 10^{18}$ wei). The protocol records the value as , preventing the user from minting even 1 DSC token.
In _get_token_amount_from_usd():
When calculating collateral to seize for $60,000 of debt ($60,000 \times 10^{18}$ wei):
$$
The contract calculates $10^{18}$ WBTC tokens ($10 \text{ billion WBTC}$), far exceeding WBTC total supply (21 million). Any attempt by a liquidator to liquidate a WBTC position reverts in the ERC20 transfer.
Severe Loss of Functionality: WBTC collateral is practically unusable; depositors cannot mint DSC.
Protocol Insolvency: Any existing WBTC positions can never be liquidated, leaving bad debt unrecoverable.
An automated test is included in tests/unit/test_poc_audit.py:
The test deposits $1 \text{ WBTC}$, checks that get_account_collateral_value returns only , confirms that minting 1 DSC reverts with DSCEngine__BreaksHealthFactor, and verifies that get_token_amount_from_usd calculates $10^{18}$ tokens instead of $10^8$.
Moccasin v0.4.4
Titanoboa v0.2.8
Pytest
Dynamically query decimals from the collateral token or pass scaling factors in constructor:
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.