stuart_the_minion - mintUBIFromInterest()
, mintUBIFromReserveBalance()
and mintRewardFromReserveRatio()
will be denied when the exchange reserve balance is 0
#57
Labels
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
stuart_the_minion
Medium
mintUBIFromInterest()
,mintUBIFromReserveBalance()
andmintRewardFromReserveRatio()
will be denied when the exchange reserve balance is 0Summary
When an exchange is created, the reserve balance can be 0 or any positive value.
By the way, the
GoodDollarExchangeProvider::mintFromInterest()
will be reverted due to division by zero when the reserve balance is 0, denyingmintUBIFromInterest()
,mintUBIFromReserveBalance()
andmintRewardFromReserveRatio()
inGoodDollarExpansionController
.Root Cause
The
GoodDollarExpansionProvider::mintFromInterest()
doesn't check ifexchange.reserveBalance
is zero.Therefore, when the reserve balance is 0, this function will be reverted with the division error.
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
Minting UBI from interest and reserve balance will be denied.
I think, creating an exchange with 0 reserve balance doesn't require a malicious owner, and there exists possibility that an owner can make a mistake because there's no restriction on input reserve balance.
PoC
POC Test:
Output:
As can be seen from the logs, three minting functions are denied due to zero reserve balance.
Mitigation
I'd suggest adding the minimum limit of reserve balance when creating an exchange.
The text was updated successfully, but these errors were encountered: