# IUpdateLeverageUtils

*Interface for leverage updates*

## LeverageUpdateInitiated

```solidity
event LeverageUpdateInitiated(struct ITradingStorage.Id orderId, address trader, uint256 pairIndex, uint256 index, bool isIncrease, uint256 newLeverage)
```

### Parameters

| Name        | Type                      | Description                                  |
| ----------- | ------------------------- | -------------------------------------------- |
| orderId     | struct ITradingStorage.Id | request order id                             |
| trader      | address                   | address of trader                            |
| pairIndex   | uint256                   | index of pair                                |
| index       | uint256                   | index of trade                               |
| isIncrease  | bool                      | true if increase leverage, false if decrease |
| newLeverage | uint256                   | new leverage value (1e3)                     |

## LeverageUpdateExecuted

```solidity
event LeverageUpdateExecuted(struct ITradingStorage.Id orderId, bool isIncrease, enum ITradingCallbacks.CancelReason cancelReason, uint8 collateralIndex, address trader, uint256 pairIndex, uint256 index, uint256 oraclePrice, uint256 collateralDelta, struct IUpdateLeverage.UpdateLeverageValues values)
```

### Parameters

| Name            | Type                                        | Description                                                                 |
| --------------- | ------------------------------------------- | --------------------------------------------------------------------------- |
| orderId         | struct ITradingStorage.Id                   | request order id                                                            |
| isIncrease      | bool                                        | true if leverage increased, false if decreased                              |
| cancelReason    | enum ITradingCallbacks.CancelReason         | cancel reason (executed if none)                                            |
| collateralIndex | uint8                                       | collateral index                                                            |
| trader          | address                                     | address of trader                                                           |
| pairIndex       | uint256                                     | index of pair                                                               |
| index           | uint256                                     | index of trade                                                              |
| oraclePrice     | uint256                                     | current oracle price (1e10)                                                 |
| collateralDelta | uint256                                     | collateral delta (collateral precision)                                     |
| values          | struct IUpdateLeverage.UpdateLeverageValues | useful values (new collateral, new leverage, liq price, gov fee collateral) |


---

# 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://docs.gains.trade/developer/technical-reference/contracts/interfaces/libraries/iupdateleverageutils.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.
