Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: medium
Invalid

Precision Loss.

Summary

The GMXProcessWithdraw.sol contract performs division before division before multiplication in some instances.

Vulnerability Details

In the following instances the contract contains scenarios where there is divisions before multiplications instances that might lead to issues in the contract"
GMXManager.calcBorrow(GMXTypes.Store,uint256) (contracts/strategy/gmx/GMXManager.sol#70-112)
GMXManager.calcMinTokensSlippageAmt(GMXTypes.Store,uint256,address,address,uint256) (contracts/strategy/gmx/GMXManager.sol#170-214)
GMXManager.calcMinMarketSlippageAmt(GMXTypes.Store,uint256,uint256) (contracts/strategy/gmx/GMXManager.sol#138-156)
GMXManager.calcMinTokensSlippageAmt(GMXTypes.Store,uint256,address,address,uint256) (contracts/strategy/gmx/GMXManager.sol#170-214)
GMXManager.calcBorrow(GMXTypes.Store,uint256) (contracts/strategy/gmx/GMXManager.sol#70-112)
GMXManager.calcMinTokensSlippageAmt(GMXTypes.Store,uint256,address,address,uint256) (contracts/strategy/gmx/GMXManager.sol#170-214)

Impact

In the above highlighted codes, there is performance of multiplication on the result of a division. Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.

Tools Used

Manual Review

Recommendations

Consider ordering multiplication before division.

Updates

Lead Judging Commences

hans Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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