DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Incorrect Fee Calculation in PerpetualVault.sol

Summary

The fee calculation logic in PerpetualVault.sol is flawed, potentially leading to incorrect fee distribution

Vulnerability Details

The calculateFees function does not account for edge cases, such as zero deposits or negative funding fees

function calculateFees(uint256 amount) internal view returns (uint256) {
return amount * governanceFee / 10000;
}

Impact

Users could receive incorrect fee distributions, leading to financial losses or unfair advantages

Tools Used

Manual code review

Recommendations

Add checks for edge cases and ensure proper fee calculation

function calculateFees(uint256 amount) internal view returns (uint256) {
require(amount > 0, "Invalid amount");
require(governanceFee <= 2000, "Fee too high");
return amount * governanceFee / 10000;
}
Updates

Lead Judging Commences

n0kto Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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