Assessment reports>Avantis>Threat Model>updateOpenLimitOrder

Function: updateOpenLimitOrder(uint256 _pairIndex, uint256 _index, uint256 _price, uint256 _tp, uint256 _sl)

This updates an open limit order.

Inputs

  • _pairIndex

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: The index of the trading pair.

  • _index

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: The index of the order.

  • _price

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: The price level to set (_PRECISION).

  • _tp

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: The take-profit price.

  • _sl

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: The stop-loss price.

Branches and code coverage

Intended branches

  • If the new TP and SL are in the correct range, update the open limit order.

Negative behavior

  • Revert if the time since the order creation is less than the defined timelock period. (Enforces timelock for order updates.)

  • Revert if _tp is set and not valid according to order type.

  • Revert if _sl is set and not valid according to order type.

Function call analysis

  • this.storageT.getOpenLimitOrder(msg.sender, _pairIndex, _index)

    • What is controllable? msg.sender, _pairIndex, and _index.

    • If the return value is controllable, how is it used and how can it go wrong? Returns the open limit order; this limit order is updated and later stored in storage.

    • What happens if it reverts, reenters, or does other unusual control flow? N/A.

  • this.storageT.updateOpenLimitOrder(o)

    • What is controllable? o.

    • If the return value is controllable, how is it used and how can it go wrong? Updates the open limit order based on the provided information — no return value.

    • What happens if it reverts, reenters, or does other unusual control flow? If it reverts, the entire call will revert — no reentrancy scenarios.

Zellic © 2025Back to top ↑