sherlock-audit / 2024-08-cork-protocol-judging

0 stars 0 forks source link

dreamcoder - Wrong variable name #21

Closed sherlock-admin3 closed 2 weeks ago

sherlock-admin3 commented 2 weeks ago

dreamcoder

High

Wrong variable name

Summary

https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/core/ModuleState.sol#L57

In constructor of ModuleState.sol

constructor( address _swapAssetFactory, address _ammFactory, address _dsFlashSwapRouter, address _ammRouter, address _config, uint256 _psmBaseRedemptionFeePrecentage ) { if (psmBaseRedemptionFeePrecentage > 5 ether) { //wrong variable revert InvalidFees(); } SWAP_ASSET_FACTORY = _swapAssetFactory; AMM_FACTORY = _ammFactory; DS_FLASHSWAP_ROUTER = _dsFlashSwapRouter; AMM_ROUTER = _ammRouter; CONFIG = _config; psmBaseRedemptionFeePrecentage = _psmBaseRedemptionFeePrecentage; }

Need to replace psmBaseRedemptionFeePrecentage as _psmBaseRedemptionFeePrecentage

Recommendation

Code improved

constructor( address _swapAssetFactory, address _ammFactory, address _dsFlashSwapRouter, address _ammRouter, address _config, uint256 _psmBaseRedemptionFeePrecentage ) { if (_psmBaseRedemptionFeePrecentage> 5 ether) { revert InvalidFees(); } ... }

sherlock-admin3 commented 2 weeks ago

1 comment(s) were left on this issue during the judging contest.

tsvetanovv commented:

Poor writing report. No impact and attack vector description.