> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gains.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# PairsStorageUtils

*GNSPairsStorage facet internal library*

## initializeGroupLiquidationParams

```solidity theme={null}
function initializeGroupLiquidationParams(struct IPairsStorage.GroupLiquidationParams[] _groupLiquidationParams) internal
```

*Check IPairsStorageUtils interface for documentation*

## initializeNewFees

```solidity theme={null}
function initializeNewFees(struct IPairsStorage.GlobalTradeFeeParams _tradeFeeParams) internal
```

*Check IPairsStorageUtils interface for documentation*

## addPairs

```solidity theme={null}
function addPairs(struct IPairsStorage.Pair[] _pairs) internal
```

*Check IPairsStorageUtils interface for documentation*

## updatePairs

```solidity theme={null}
function updatePairs(uint256[] _pairIndices, struct IPairsStorage.Pair[] _pairs) internal
```

*Check IPairsStorageUtils interface for documentation*

## addGroups

```solidity theme={null}
function addGroups(struct IPairsStorage.Group[] _groups) internal
```

*Check IPairsStorageUtils interface for documentation*

## updateGroups

```solidity theme={null}
function updateGroups(uint256[] _ids, struct IPairsStorage.Group[] _groups) internal
```

*Check IPairsStorageUtils interface for documentation*

## addFees

```solidity theme={null}
function addFees(struct IPairsStorage.FeeGroup[] _fees) internal
```

*Check IPairsStorageUtils interface for documentation*

## updateFees

```solidity theme={null}
function updateFees(uint256[] _ids, struct IPairsStorage.FeeGroup[] _fees) internal
```

*Check IPairsStorageUtils interface for documentation*

## setPairCustomMaxLeverages

```solidity theme={null}
function setPairCustomMaxLeverages(uint256[] _indices, uint256[] _values) internal
```

*Check IPairsStorageUtils interface for documentation*

## setGroupLiquidationParams

```solidity theme={null}
function setGroupLiquidationParams(uint256 _groupIndex, struct IPairsStorage.GroupLiquidationParams _params) internal
```

*Check IPairsStorageUtils interface for documentation*

## setGlobalTradeFeeParams

```solidity theme={null}
function setGlobalTradeFeeParams(struct IPairsStorage.GlobalTradeFeeParams _feeParams) internal
```

*Check IPairsStorageUtils interface for documentation*

## pairJob

```solidity theme={null}
function pairJob(uint256 _pairIndex) internal view returns (string, string)
```

*Check IPairsStorageUtils interface for documentation*

## isPairListed

```solidity theme={null}
function isPairListed(string _from, string _to) internal view returns (bool)
```

*Check IPairsStorageUtils interface for documentation*

## isPairIndexListed

```solidity theme={null}
function isPairIndexListed(uint256 _pairIndex) internal view returns (bool)
```

*Check IPairsStorageUtils interface for documentation*

## pairs

```solidity theme={null}
function pairs(uint256 _index) internal view returns (struct IPairsStorage.Pair)
```

*Check IPairsStorageUtils interface for documentation*

## pairsCount

```solidity theme={null}
function pairsCount() internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## pairSpreadP

```solidity theme={null}
function pairSpreadP(uint256 _pairIndex) internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## pairMinLeverage

```solidity theme={null}
function pairMinLeverage(uint256 _pairIndex) internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## pairTotalPositionSizeFeeP

```solidity theme={null}
function pairTotalPositionSizeFeeP(uint256 _pairIndex) internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## pairTotalLiqCollateralFeeP

```solidity theme={null}
function pairTotalLiqCollateralFeeP(uint256 _pairIndex) internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## pairOraclePositionSizeFeeP

```solidity theme={null}
function pairOraclePositionSizeFeeP(uint256 _pairIndex) internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## pairMinPositionSizeUsd

```solidity theme={null}
function pairMinPositionSizeUsd(uint256 _pairIndex) internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## getGlobalTradeFeeParams

```solidity theme={null}
function getGlobalTradeFeeParams() internal view returns (struct IPairsStorage.GlobalTradeFeeParams)
```

*Check IPairsStorageUtils interface for documentation*

## pairMinFeeUsd

```solidity theme={null}
function pairMinFeeUsd(uint256 _pairIndex) internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## pairFeeIndex

```solidity theme={null}
function pairFeeIndex(uint256 _pairIndex) internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## groups

```solidity theme={null}
function groups(uint256 _index) internal view returns (struct IPairsStorage.Group)
```

*Check IPairsStorageUtils interface for documentation*

## groupsCount

```solidity theme={null}
function groupsCount() internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## fees

```solidity theme={null}
function fees(uint256 _index) internal view returns (struct IPairsStorage.FeeGroup)
```

*Check IPairsStorageUtils interface for documentation*

## feesCount

```solidity theme={null}
function feesCount() internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## pairMaxLeverage

```solidity theme={null}
function pairMaxLeverage(uint256 _pairIndex) internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## pairCustomMaxLeverage

```solidity theme={null}
function pairCustomMaxLeverage(uint256 _pairIndex) internal view returns (uint256)
```

*Check IPairsStorageUtils interface for documentation*

## getAllPairsRestrictedMaxLeverage

```solidity theme={null}
function getAllPairsRestrictedMaxLeverage() internal view returns (uint256[])
```

*Check IPairsStorageUtils interface for documentation*

## getGroupLiquidationParams

```solidity theme={null}
function getGroupLiquidationParams(uint256 _groupIndex) internal view returns (struct IPairsStorage.GroupLiquidationParams)
```

*Check IPairsStorageUtils interface for documentation*

## getPairLiquidationParams

```solidity theme={null}
function getPairLiquidationParams(uint256 _pairIndex) internal view returns (struct IPairsStorage.GroupLiquidationParams)
```

*Check IPairsStorageUtils interface for documentation*

## \_getSlot

```solidity theme={null}
function _getSlot() internal pure returns (uint256)
```

*Returns storage slot to use when fetching storage relevant to library*

## \_getStorage

```solidity theme={null}
function _getStorage() internal pure returns (struct IPairsStorage.PairsStorage s)
```

*Returns storage pointer for storage struct in diamond contract, at defined slot*

## groupListed

```solidity theme={null}
modifier groupListed(uint256 _groupIndex)
```

Reverts if group is not listed

### Parameters

| Name         | Type    | Description          |
| ------------ | ------- | -------------------- |
| \_groupIndex | uint256 | group index to check |

## feeListed

```solidity theme={null}
modifier feeListed(uint256 _feeIndex)
```

Reverts if fee is not listed

### Parameters

| Name       | Type    | Description        |
| ---------- | ------- | ------------------ |
| \_feeIndex | uint256 | fee index to check |

## groupOk

```solidity theme={null}
modifier groupOk(struct IPairsStorage.Group _group)
```

Reverts if group is not valid

### Parameters

| Name    | Type                       | Description    |
| ------- | -------------------------- | -------------- |
| \_group | struct IPairsStorage.Group | group to check |

## feeOk

```solidity theme={null}
modifier feeOk(struct IPairsStorage.FeeGroup _fee)
```

*Reverts if fee is not valid*

### Parameters

| Name  | Type                          | Description  |
| ----- | ----------------------------- | ------------ |
| \_fee | struct IPairsStorage.FeeGroup | fee to check |

## \_addPair

```solidity theme={null}
function _addPair(struct IPairsStorage.Pair _pair) internal
```

*Adds a new trading pair*

### Parameters

| Name   | Type                                                                                               | Description |
| ------ | -------------------------------------------------------------------------------------------------- | ----------- |
| \_pair | [IPairsStorage.Pair](/developer/technical-reference/contracts/interfaces/types/ipairsstorage#pair) | pair to add |

## \_updatePair

```solidity theme={null}
function _updatePair(uint256 _pairIndex, struct IPairsStorage.Pair _pair) internal
```

*Updates an existing trading pair*

### Parameters

| Name        | Type                                                                                               | Description             |
| ----------- | -------------------------------------------------------------------------------------------------- | ----------------------- |
| \_pairIndex | uint256                                                                                            | index of pair to update |
| \_pair      | [IPairsStorage.Pair](/developer/technical-reference/contracts/interfaces/types/ipairsstorage#pair) | new pair value          |

## \_addGroup

```solidity theme={null}
function _addGroup(struct IPairsStorage.Group _group) internal
```

*Adds a new pair group*

### Parameters

| Name    | Type                                                                                                 | Description  |
| ------- | ---------------------------------------------------------------------------------------------------- | ------------ |
| \_group | [IPairsStorage.Group](/developer/technical-reference/contracts/interfaces/types/ipairsstorage#group) | group to add |

## \_updateGroup

```solidity theme={null}
function _updateGroup(uint256 _id, struct IPairsStorage.Group _group) internal
```

*Updates an existing pair group*

### Parameters

| Name    | Type                                                                                                 | Description              |
| ------- | ---------------------------------------------------------------------------------------------------- | ------------------------ |
| \_id    | uint256                                                                                              | index of group to update |
| \_group | [IPairsStorage.Group](/developer/technical-reference/contracts/interfaces/types/ipairsstorage#group) | new group value          |

## \_addFee

```solidity theme={null}
function _addFee(struct IPairsStorage.FeeGroup _fee) internal
```

*Adds a new pair fee group*

### Parameters

| Name  | Type                                                                                                       | Description |
| ----- | ---------------------------------------------------------------------------------------------------------- | ----------- |
| \_fee | [IPairsStorage.FeeGroup](/developer/technical-reference/contracts/interfaces/types/ipairsstorage#feegroup) | fee to add  |

## \_updateFee

```solidity theme={null}
function _updateFee(uint256 _id, struct IPairsStorage.FeeGroup _fee) internal
```

*Updates an existing pair fee group*

### Parameters

| Name  | Type                                                                                                       | Description            |
| ----- | ---------------------------------------------------------------------------------------------------------- | ---------------------- |
| \_id  | uint256                                                                                                    | index of fee to update |
| \_fee | [IPairsStorage.FeeGroup](/developer/technical-reference/contracts/interfaces/types/ipairsstorage#feegroup) | new fee value          |
