Description: Based on KittyVault::ExecuteDeposit
function:
At first it seems that every user that deposits collateral they are going to get the equivalent (1:1) of cattyNips
. But the situation changes when some interest is earned on the aavePool
then is not going to be 1:1 relation. The new entrants they are going to get less cattyNips
than the collateral they deposited. Is totally fair because it still represents your collateral deposited but the user don't know anything about the cattyNips
, so if he wants to withdraw their total collateral they deposited, is going to revert as the function KittyPool::whiskdrawMeowllateral
is going to take as a parameter the cattyNips
not the amount of collateral deposited at the begining.
WHISKDRAWMEOWLATERAL
FUNCTION
Impact: Unable to withdraw the total collateral for some users.
Proof of Concept: Proof of Code
User1
and User2
deposits 100 ether
to the vault.
They get 100 cattyNips
each.
Total collateral balance of the vault: 200 ether
.
Meowntainer
puts the total collateral to the aavePool
After some time the aavePool
generate 50 ether
out of the 200 ether
Total collateral: 250 ether
Collateral of each user: 125 ether
User3
deposits 100 ether
.
Gets 80 cattyNips
based on this line of code inside KittyVault::executeDepawsit
function:
Total collateral: 350 ether
Total cattyNips
: 280
User3
wants to withdraw the total collateral:
Reverts with KittyPool__NotEnoughMeowllateralPurrrr()
custom error.
Recommended Mitigation: Options:
Create a getter function for the mapping mapping(address user => uint256 cattyNip) public userToCattyNip;
so then every user can know his own cattyNips
.
Take the collateral they want to withdraw and then calculate the cattyNips
inside the function to then substract the right amount of cattyNips
based on the collateral they want to withdraw.
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.