<!-- canonical: https://0xsimao.com/findings/ostium-pausability-automation-opening-orders -->

# Missing Pausability Check in OstiumTrading::executeAutomationOrder() for Opening Orders

Medium · Three Sigma · RWA perpetuals DEX · 19th February, 2024

Finding 3S-OS-M02 of the Ostium security review.

- Protocol: https://www.ostium.com/
- Report: /reports/ostium
- Source: https://cdn.sanity.io/files/qoqld077/production/a95b9c69e0f65d1d6b0e649f0d62a362358ca8ce.pdf

---

### Description

The [execution](https://github.com/0xOstium/smart-contracts-threeSigma/blob/1b70cffbac621d39e321c159e45c048b703add92/src/OstiumTrading.sol#L437) of a limit order within the OstiumTrading::executeAutomationOrder()
function lacks a check to determine if the contract is paused.

### Recommendation

```solidity
if (orderType == IOstiumTradingStorage.LimitOrder.OPEN) {
    if (!storageT.hasOpenLimitOrder(trader, pairIndex, index)) {
        return IOstiumTrading.AutomationOrderStatus.NO_LIMIT;
    }
+
isNotPaused();
IOstiumTradingStorage.OpenLimitOrder memory l = storageT.getOpenLimitOrder(trader, pairIndex, index);
leveragedPos = l.collateral * l.leverage / 100;
}
```

### Status

Addressed in [#fa95bb0](https://github.com/0xOstium/smart-contracts-threeSigma/pull/58/commits/fa95bb0e0fef8a23dc879b93c88e25a1984653f9#diff-568ff0fba662548dd09f3d552557c05c2135c95d7e0ffcd1e0617e18e69fa3ecL442).

---

Related findings:

- [Unnecessary conditional check in ThresholdGovernance.execute](https://0xsimao.com/findings/m-0-unnecessary-conditional-threshold-governance): M^0 Minter Gateway
- [Anyone can get the NFT collateral token after an Auction without bidding due to missing check on msg.sender](https://0xsimao.com/findings/benddao-nft-collateral-auction-bidding): BendDAO
- [`ManagedLeveragedVault::donateCollateral()` is missing a slippage check](https://0xsimao.com/findings/beraborrow-i-managed-donate-collateral-slippage): Beraborrow Managed Dens
- [Missing key zero value check](https://0xsimao.com/findings/codeup-missing-key-zero-value): CODEUP
