Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: low
Invalid

L1: The staked amount should be incremented after love tokens are deposited

Summary

The deposited amount should be increased just after the transfer has finished, making it a better, safer and bit more gas-efficient solution.

Vulnerability Details

Impact

Tools Used

Static analysis

Recommendations

Change the order of the transferFrom function and userStakes increment in the Staking::deposit function

function deposit(uint256 amount) public {
if (loveToken.balanceOf(address(stakingVault)) == 0)
revert Staking__NoMoreRewards();
// Changed order - better practice
loveToken.transferFrom(msg.sender, address(this), amount);
userStakes[msg.sender] += amount;
emit Deposited(msg.sender, amount);
}
Updates

Lead Judging Commences

0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Other
awacs Submitter
over 1 year ago
0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.