Tadle

Tadle
DeFi
30,000 USDC
View results
Submission Details
Severity: low
Valid

Incorrect Check for `eachTradeTax` in `createOffer` Function

Summary

In the createOffer function of the PreMarkets contract, the check for the eachTradeTax parameter should revert if eachTradeTax is greater than or equal to Constants.EACH_TRADE_TAX_DECIMAL_SCALER. The current implementation only checks if it is greater, potentially allowing invalid tax rates.

Vulnerability Details

The check for eachTradeTax ensures it is less than Constants.EACH_TRADE_TAX_DECIMAL_SCALER, but does not account for values equal to the scaler.

Impact

Allowing eachTradeTax to be equal to Constants.EACH_TRADE_TAX_DECIMAL_SCALER can lead to invalid tax rates, potentially causing financial losses or unfair trades.

Tools Used

Manual Review

Recommendations

Update the check for eachTradeTax to ensure it is strictly less than Constants.EACH_TRADE_TAX_DECIMAL_SCALER.

function createOffer(CreateOfferParams calldata params) external payable {
/**
* @dev points and amount must be greater than 0
* @dev eachTradeTax must be less than 100%, decimal scaler is 10000
* @dev collateralRate must be more than 100%, decimal scaler is 10000
*/
if (params.points == 0x0 || params.amount == 0x0) {
revert Errors.AmountIsZero();
}
- if (params.eachTradeTax > Constants.EACH_TRADE_TAX_DECIMAL_SCALER) {
- revert InvalidEachTradeTaxRate();
+ if (params.eachTradeTax >= Constants.EACH_TRADE_TAX_DECIMAL_SCALER) {
+ revert InvalidEachTradeTaxRate();
}
if (params.collateralRate < Constants.COLLATERAL_RATE_DECIMAL_SCALER) {
revert InvalidCollateralRate();
}
Updates

Lead Judging Commences

0xnevi Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-PreMarkets-off-by-one-Trade-TAX-100%

Similar to issue #1323, Despite this off-by-one error of the intended check, the difference between 99% and 100% is minimal, so I believe whether or not 100% is allowed has minimal impact. Ultimately, takers should not be realistically creating offer with such tradeTax

Support

FAQs

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