Assessment reports>GTE -- Perp>Threat Model>cancel

Function: cancel(byte[32] asset, address account, uint256[] orderIds)

This function cancels previously placed limit orders. The account should be an owner of all orders from orderIds. Provided orders are removed from the order book (if they exist), and the totalCollateralRefunded is returned from this function.

This function ensures the order belongs to the account and the order exists.

Branches and code coverage

Intended branches

  • One reduceOnly order — totalCollateralRefunded is zero.

  • Successfully cancels all provided active limit orders.

  • Emits OrderCanceled events with correct data.

  • Orders are removed from the order book.

  • orderbookCollateral in the GTL contract is updated correctly.

  • quoteTokenOpenInterest is updated properly when side == Side.BUY.

  • baseTokenOpenInterest is updated properly when side == Side.SELL.

Negative behavior

  • order.owner != account.

  • if order is null, this order will be skipped, and execution is not revert.

  • orderIds contains duplicate IDs. All duplicate IDs are skipped, and execution is not revert.

Zellic © 2025Back to top ↑