Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: low
Valid

Incorrect check for eachTradeTax

Summary

Incorrect check for eachTradeTax

Vulnerability Details

as wecan see inside createOffer function the check for params.eachTradeTax is Incorrect .

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();
}
//@audit Incorrect >= must be less than 100%
if (params.eachTradeTax > Constants.EACH_TRADE_TAX_DECIMAL_SCALER) {
revert InvalidEachTradeTaxRate();
}

Poc

chisel

➜ uint256 EACH_TRADE_TAX_DECIMAL_SCALER = 10000;
➜ uint256 Tax = 1000;
➜ Tax > EACH_TRADE_TAX_DECIMAL_SCALER
Type: bool
└ Value: false

Impact

unexpected behavior if Tax is 100%

Tools Used

Manual Review

Recommendations

change to

if (params.eachTradeTax >= Constants.EACH_TRADE_TAX_DECIMAL_SCALER) {
revert InvalidEachTradeTaxRate();
}
Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year 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.