Closed sherlock-admin3 closed 2 months ago
Parvez.eth
Invalid
constant
L-5: Define and use constant variables instead of using literals
If the same constant literal value is used multiple times, create a constant state variable and reference it throughout the contract.
Parvez.eth
Invalid
Define and use
constant
variables instead of using literalsSummary
L-5: Define and use
constant
variables instead of using literalsVulnerability details
If the same constant literal value is used multiple times, create a constant state variable and reference it throughout the contract.
49 Found Instances
- Found in src/contracts/core/ModuleCore.sol [Line: 63](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/core/ModuleCore.sol#L63) ```solidity if (repurchaseFeePrecentage > 5 ether) { ``` - Found in src/contracts/core/ModuleCore.sol [Line: 154](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/core/ModuleCore.sol#L154) ```solidity if (newPsmBaseRedemptionFeePrecentage > 5 ether) { ``` - Found in src/contracts/libraries/DsSwapperMathLib.sol [Line: 47](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/DsSwapperMathLib.sol#L47) ```solidity raPriceRatio = (uint256(raPriceRatioUQ) * 1e18) / UQ112x112.Q112; ``` - Found in src/contracts/libraries/DsSwapperMathLib.sol [Line: 48](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/DsSwapperMathLib.sol#L48) ```solidity ctPriceRatio = (uint256(ctPriceRatioUQ) * 1e18) / UQ112x112.Q112; ``` - Found in src/contracts/libraries/DsSwapperMathLib.sol [Line: 77](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/DsSwapperMathLib.sol#L77) ```solidity amountIn = (amountOut * dsPrice) / 1e18; ``` - Found in src/contracts/libraries/DsSwapperMathLib.sol [Line: 135](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/DsSwapperMathLib.sol#L135) ```solidity s = (r3 * 1e18) / 2e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 31](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L31) ```solidity ct = (amountra * 1e18) / (priceRatio + 1e18); ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 61](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L61) ```solidity ra = (amount * (accruedRa * 1e18) / totalLv) / 1e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 62](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L62) ```solidity pa = (amount * (accruedPa * 1e18) / totalLv) / 1e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 76](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L76) ```solidity received = (amount * (lvRaBalance * 1e18) / totalLv) / 1e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 85](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L85) ```solidity precentage = (((amount * 1e18) * fee1e18) / (100 * 1e18)) / 1e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 98](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L98) ```solidity _amount = (amount * 1e18) / exchangeRate; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 111](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L111) ```solidity _amount = (amount * exchangeRate) / 1e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 125](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L125) ```solidity accrued = (amount * (available * 1e18) / totalCtIssued) / 1e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 134](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L134) ```solidity ratePerLv = ((totalAmount * 1e18) / totalLvIssued); ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 141](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L141) ```solidity attributedWithdrawal = (ratePerLv * totalLvWithdrawn) / 1e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 152](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L152) ```solidity raTolerance = ra - ((ra * 1e18 * tolerance) / (100 * 1e18) / 1e18); ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 153](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L153) ```solidity ctTolerance = ct - ((ct * 1e18 * tolerance) / (100 * 1e18) / 1e18); ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 161](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L161) ```solidity valueRaPerLp = (uint256(totalRaReserve) * 1e18) / totalLpSupply; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 162](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L162) ```solidity valueCtPerLp = (uint256(totalCtReserve) * 1e18) / totalLpSupply; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 185](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L185) ```solidity uint256 cumulatedLptotalLvOwnedRa = (totalLpOwned * valueRaPerLp) / 1e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 186](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L186) ```solidity uint256 cumulatedLptotalLvOwnedCt = (totalLpOwned * valueCtPerLp) / 1e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 188](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L188) ```solidity raValuePerLv = (cumulatedLptotalLvOwnedRa * 1e18) / totalLvIssued; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 189](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L189) ```solidity ctValuePerLv = (cumulatedLptotalLvOwnedCt * 1e18) / totalLvIssued; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 191](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L191) ```solidity totalLvRaValue = (raValuePerLv * totalLvIssued) / 1e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 192](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L192) ```solidity totalLvCtValue = (ctValuePerLv * totalLvIssued) / 1e18; ``` - Found in src/contracts/libraries/MathHelper.sol [Line: 200](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/MathHelper.sol#L200) ```solidity lpLiquidated = ((redeemedLv * rateRaPerLv) * 1e18) / rateRaPerLp / 1e18; ``` - Found in src/contracts/libraries/VaultConfig.sol [Line: 13](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/VaultConfig.sol#L13) ```solidity if (fee > 5 ether) { ``` - Found in src/contracts/libraries/VaultConfig.sol [Line: 20](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/VaultConfig.sol#L20) ```solidity if (fee > 5 ether) { ``` - Found in src/contracts/libraries/VaultLib.sol [Line: 481](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/VaultLib.sol#L481) ```solidity totalRa = (raPerLv * lvRedeemed) / 1e18; ``` - Found in src/contracts/libraries/VaultLib.sol [Line: 482](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/VaultLib.sol#L482) ```solidity uint256 ammCtBalance = (ctPerLv * lvRedeemed) / 1e18; ``` - Found in src/contracts/libraries/VaultLib.sol [Line: 510](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/VaultLib.sol#L510) ```solidity uint256 ct = (excessCt * ctPerLp) / 1e18; ``` - Found in src/contracts/libraries/uni-v2/UniswapV2Library.sol [Line: 71](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/uni-v2/UniswapV2Library.sol#L71) ```solidity uint256 denominator = reserveIn * 1000; ``` - Found in src/contracts/libraries/uni-v2/UniswapV2Library.sol [Line: 84](https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/uni-v2/UniswapV2Library.sol#L84) ```solidity uint256 numerator = reserveIn * amountOut * 1000; ```