In case of tokens with different number of decimals than 18 (the decimals for KittyCoin), both meowintKittyCoin
and purrgeBadPawsition
will fail as they are dependent of _hasEnoughMeowllateral
.
The issue is htat _hasEnoughMeowllateral
checks fetches getUserMeowllateralInEuros(user)
which will return the value in terms of the number of decimals of the token.
Based on this value, the contract checks the collateralRequiredInEuros
by upscaliing it with required collateral percent.
Lastly it compares totalCollateralInEuros >= collateralRequiredInEuros;
which will fail in case of tokens with different number of decimals.
In case of tokens like USDC, WETH which have 6 and 8 decimals respectively, this will always fail thus causing users fund to be stuck in the contract.
Since users deposit collateral first using depawsitMeowllateral
and then only they are allowed to mint tokens using meowintKittyCoin()
which is defined as:
This will always revert and the users deposited funds will be stuck!
Morever, this can lead to weird scenarios where despite having enough collateral, users can end up in having their positions purged.
Add the following code in KittyFiTest.t.sol
Console Log:
Ensure that inside _hasEnoughMeowllateral
the call to getUserMeowllateralInEuros(user)
always returns fixed decimals and then handle the number accordingly
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.