This repository has been archived by the owner on Jul 14, 2024. It is now read-only.
KingNFT - The formula used in getDollarPriceUsd()
is incorrect
#61
Labels
Non-Reward
This issue will not receive a payout
KingNFT
high
The formula used in
getDollarPriceUsd()
is incorrectSummary
The
getDollarPriceUsd()
is intended to return USD price ofuAD
, but actually it returns the3CRV
price of peruAD
. The wrong price would cause potential fund loss to users while interacting with the protocol.Vulnerability Detail
The following PoC is built on fork of the real mainnet environment, we can see: while the average price design of
twapOracleDollar3PoolFacet
works, the reportuAD
USD price is about0.97
, but the intended result should be very close to1.0
.The test log:
Impact
The wrong report
uAD
price would cause users suffering fund loss while interact with the protocol, for example:if the current correct
uAD
price is$1.05
, but the report price is$1.0
, a user callsUbiquityPoolFacet.redeemDollar()
to redeem 10kuAD
which is worth 10.5k USD, but only get 10k USD value ofLUSD
back, a 500 USD loss occurs.Code Snippet
https://github.com/sherlock-audit/2023-12-ubiquity/blob/d9c39e8dfd5601e7e8db2e4b3390e7d8dff42a8e/ubiquity-dollar/packages/contracts/src/dollar/libraries/LibUbiquityPool.sol#L300
Tool used
Manual Review
Recommendation
see PoC for the correct formula
Duplicate of #59
The text was updated successfully, but these errors were encountered: