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

Define and use `constant` variables instead of using literals

Summary

If the same constant literal value is used multiple times, create a constant state variable and reference it throughout the contract.

Vulnerability Details

6 Found Instances
  • Found in src/perpetuals/branches/PerpMarketBranch.sol Line: 66

    SD59x18 halfSkew = sd59x18(perpMarket.skew).div(sd59x18(2e18));
  • Found in src/perpetuals/branches/PerpMarketBranch.sol Line: 72

    SD59x18 halfOpenInterest = currentOpenInterest.div(sd59x18(2e18));
  • Found in src/perpetuals/branches/TradingAccountBranch.sol Line: 299

    bytes memory dataWithAccountId = bytes.concat(data[i][0:4], abi.encode(tradingAccountId), data[i][4:]);
  • Found in src/perpetuals/leaves/MarginCollateralConfiguration.sol Line: 54

    return ud60x18(amount * 10 ** (Constants.SYSTEM_DECIMALS - self.decimals));
  • Found in src/perpetuals/leaves/MarginCollateralConfiguration.sol Line: 62

    return ud60x18Amount.intoUint256() / (10 ** (Constants.SYSTEM_DECIMALS - self.decimals));

Tools Used

Aderyn

Recommendations

Use constants instead of literals.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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