Root + Impact
Description
The `setAllowedSellToken` function creates inconsistent behavior across contract functions by only affecting `createSellOrder` while leaving all other functions `(amendSellOrder, cancelSellOrder, buyOrder)` unchecked. This asymmetric implementation allows the owner to disable new order creation for a token while existing orders remain fully functional, creating an artificial market constraint that favors buyers over sellers.
Risk
Likelihood:
Impact:
- Market Manipulation: Owner can artificially restrict supply of new sell orders while allowing existing orders to be executed, potentially manipulating token prices
- Centralization Risk: Introduces unnecessary admin control over market operations in the system, even though its TradFi but kind of control is unjustifiable.
- User Experience: Creates confusing behavior where some functions work while others fail with unclear error messages
- System Integrity: Breaks the principle of consistent behavior across related functions
Proof of Concept
setAllowedSellToken(address(wETH), false);
createSellOrder(address(wETH), 1e18, 3000e6, 1 days);
amendSellOrder(existingOrderId, 2e18, 6000e6, 2 days);
cancelSellOrder(existingOrderId);
buyOrder(existingOrderId);
Recommended Mitigation
Remove the function entirely
- function setAllowedSellToken( address _token,bool _isAllowed) external onlyOwner {
- if (_token == address(0) || _token == address(iUSDC)) revert InvalidToken();
- allowedSellToken[_token] = _isAllowed;
- emit TokenAllowed(_token, _isAllowed); }