Users are unable to withdraw the entirety of their deposited collateral in a single transaction using the KittyPool::whiskdrawMeowllateral
function. The transaction reverts with an error related to a division or modulo by zero.
When a user attempts to withdraw their entire deposited collateral using the whiskdrawMeowllateral
function, the transaction fails and reverts. The error message indicates a division or modulo by zero, which suggests a flaw in the logic handling the calculation or validation of the withdrawal amount. The issue is tied to the fact that the user withdraws his collateral then checks if they have enough collateral but after the withdrawal.
The relevant code snippet is shown below:
PoC:
Add the following to KittyFiTest.t.sol
test file:
User Inconvenience: Users are unable to withdraw their entire collateral, potentially leading to a loss of confidence in the platform.
Liquidity Issues: Users might face liquidity issues if they are unable to retrieve their funds when needed.
Financial Risk: Inability to withdraw collateral could expose users to financial risks if they cannot access their funds in a timely manner.
Manual review
Foundry
Fix the function as follows:
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.