Staking::claimRewards() Contract Violating the Staking Rule and Rapidly Decreasing LoveTokens in StakingVault.Description: Staking contract stands for staking LoveToken and in return it will give more LoveToken. As per doc if user has to deposit LoveToken to the staking and have to wait for 1 week to receive reward as LoveToken.
For staking 1 love token for 1 week user will recevie 1 LoveToken as reward. But this design pattern actually don't work in the Staking::claimReward() function. User can claim more token than protocol rule.
Impact: Rapid decrease of LoveToken from StakingVault.
Proof of Concept: We can form below scerenio to proof that,
lets assume that a user mints a soulmate nft and after 7 days he claim his lovetoken from Airdrop::claim(). He gets 7 LoveTokens from the airdroping. Now he has 7 LoveToken. And then he dposits 2 LoveToken to Staking contract
and using Staking:deposit(). After Depositing he has 5 LoveToken. He waits for 2 weeks to receive reward. 2 tokens staking for 2 weeks he sholud get back 4 tokens as reward. But the problem arises that he actually received 6 tokens as reward. this happend because lastClaim[msg.sender] calculates the claiming time based on the creation of the Soulmate NFT using soulmateContract.idToCreationTimestamp(soulmateId). This timestamp represents the time of NFT creation, not the time of depositing the token into the staking contract.
This the line from the Staking::claimRewards() whhic cause the issue
So As he created Soulmate NFT 7 days back ago before staking the actual staking time is timebeforedeposit+timeafterdeposit = 7+14 = 21 /3 = 3 weeks so 3 weeks with 2 tokens is equal to 6 token as reward. but as per doc the countdown should satrted from the time of depositing. this lastClaim[msg.sender] is placed wrongly in the Staking::claimRewards().
Recommended Mitigation: This can be mitigated by updating the both Staking::deposit(amount) and Staking::claimRewards() function
Update The Staking::deposit(amount)
Also Update Staking::claimRewards()
High severity, this allows users to claim additional rewards without committing to intended weekly staking period via multi-deposit/deposit right before claiming rewards.
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.