Skip to content

Latest commit

 

History

History
50 lines (30 loc) · 1.13 KB

051.md

File metadata and controls

50 lines (30 loc) · 1.13 KB

Interesting Cedar Hare

Medium

WRONG IMPLEMENT OF checkMinOrderSize

Summary

checkMinOrderSize will not work when sdValue is equal to minOrderSize.

Root Cause

https://github.com/sherlock-audit/2024-11-oku/blob/main/oku-custom-order-types/contracts/automatedTrigger/AutomationMaster.sol#L144 function checkMinOrderSize(IERC20 tokenIn, uint256 amountIn) external view override { uint256 currentPrice = oracles[tokenIn].currentValue(); uint256 usdValue = (currentPrice * amountIn) / (10 ** ERC20(address(tokenIn)).decimals());

@>    require(usdValue > minOrderSize, "order too small");
}

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

No response

PoC

No response

Mitigation

function checkMinOrderSize(IERC20 tokenIn, uint256 amountIn) external view override { uint256 currentPrice = oracles[tokenIn].currentValue(); uint256 usdValue = (currentPrice * amountIn) / (10 ** ERC20(address(tokenIn)).decimals());

    require(usdValue >= minOrderSize, "order too small");
}