# GmxV2CauldronOrderAgent

### createOrder | only callable by cauldrons

This function creates a new order for a specific user with the given parameters. It is called by the `GmxV2CauldronV4` contract to set up a new order in response to user actions.

It creates a clone of the RouterOrder contract and initializes it accordingly.

```solidity
function createOrder(address user, GmRouterOrderParams memory params) external payable onlyOperators returns (address order)
```

**Parameters**

| Name     | Type                  | Note                                                     |
| -------- | --------------------- | -------------------------------------------------------- |
| `user`   | `address`             | Address of the user for whom the order is being created. |
| `params` | `GmRouterOrderParams` | Parameters defining the details of the order.            |

***

### setOracle | only owner

Sets the oracle for a specific GMX V2 market, essential for ensuring accurate market data for the orders.

This oracle is then used by all RouterOrder clones

```solidity
function setOracle(address market, IOracle oracle) external onlyOwner
```

**Parameters**

| Name     | Type      | Note                                                 |
| -------- | --------- | ---------------------------------------------------- |
| `market` | `address` | The market for which the oracle is being set.        |
| `oracle` | `IOracle` | The oracle contract to use for the specified market. |

***

### setCallbackGasLimit | only owner

Adjusts the gas limit for callback functions used in the GMX architecture. This function sets the maximum amount of gas allowed for operations following a callback. This is particularly relevant for the non-atomic nature of GMX transactions, where a user creates an order that is later filled by a keeper. The callback mechanism allows for composability by enabling the orderRouter proxy contract to continue the flow after receiving tokens from the deposit or withdrawal handler.

This callback gas limit is used by all RouterOrder clones.

```solidity
function setCallbackGasLimit(uint256 _callbackGasLimit) external onlyOwner
```

**Parameters**

| Name                | Type      | Note                             |
| ------------------- | --------- | -------------------------------- |
| `_callbackGasLimit` | `uint256` | The new gas limit for callbacks. |

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.abracadabra.money/periphery-contracts/gmx-v2-orderagent-and-routerorder/gmxv2cauldronorderagent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
