ydlee - Token precision problem will cause mintUBIFromReserveBalance
to not work properly.
#7
Labels
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
ydlee
Medium
Token precision problem will cause
mintUBIFromReserveBalance
to not work properly.Summary
The
mintUBIFromReserveBalance
function may not work properly when the decimals of reserve asset token is less than 18, as different token precisions are used when calculatingadditionalReserveBalance
.Root Cause
In
mintUBIFromReserveBalance
, the precision ofcontractReserveBalance
is10 ** reserveDecimals
, whileexchange.reserveBalance
is10 ** 18
. If the decimals of reserve asset token is less than 18, the precisions will be different and the resultedadditionalReserveBalance
will be incorrect.https://github.com/sherlock-audit/2024-10-mento-update/blob/main/mento-core/contracts/goodDollar/GoodDollarExpansionController.sol#L157-L160
The precision of
exchange.reserveBalance
is10 ** 18
, which can be seen inGoodDollarExchangeProvider.sol:185
.https://github.com/sherlock-audit/2024-10-mento-update/blob/main/mento-core/contracts/goodDollar/GoodDollarExchangeProvider.sol#L178-L185
Internal pre-conditions
External pre-conditions
No response
Attack Path
No response
Impact
The
mintUBIFromReserveBalance
function may not work as expected when the decimals of reserve asset token is less than 18.PoC
No response
Mitigation
The text was updated successfully, but these errors were encountered: