Constants should be used instead of magic numbers.
Use of constants is preferred over magic numbers. Even assembly can benefit from using readable constants instead of hex/numeric literals.
Instances:
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L85
if (_fee > 5000) revert FeeTooHigh();
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L93
if (_fee > 500) revert FeeTooHigh();
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L246
uint256 loanRatio = (debt * 10 ** 18) / collateral;
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L384
uint256 loanRatio = (totalDebt * 10 ** 18) / loan.collateral;
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L561
uint256 govFee = (borrowerFee * loan.collateral) / 10000;
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L618
uint256 loanRatio = (debt * 10 ** 18) / collateral;
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L650
uint256 fee = (borrowerFee * (debt - debtToPay)) / 10000;
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L724
interest = (l.interestRate * l.debt * timeElapsed) / 10000 / 365 days;
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L725
fees = (lenderFee * interest) / 10000;
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Staking.sol#L68
uint256 _ratio = _diff * 1e18 / totalSupply;
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Staking.sol#L88
uint256 _share = _supplied * _delta / 1e18;
Use of constants improves the overall readability of the code.
Manual Review and VS Code
Use constants instead of magic numbers.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.