# GNSFeeTiers

*Facet #3: Fee tiers*

## constructor

```solidity
constructor() public
```

## initializeFeeTiers

```solidity
function initializeFeeTiers(uint256[] _groupIndices, uint256[] _groupVolumeMultipliers, uint256[] _feeTiersIndices, struct IFeeTiers.FeeTier[] _feeTiers) external
```

### Parameters

| Name                     | Type                                                                                                    | Description                                                     |
| ------------------------ | ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| \_groupIndices           | uint256\[]                                                                                              | group indices (pairs storage fee index) to initialize           |
| \_groupVolumeMultipliers | uint256\[]                                                                                              | corresponding group volume multipliers (1e3)                    |
| \_feeTiersIndices        | uint256\[]                                                                                              | fee tiers indices to initialize                                 |
| \_feeTiers               | [IFeeTiers.FeeTier\[\]](/developer/technical-reference/contracts/interfaces/types/ifeetiers.md#feetier) | fee tiers values to initialize (feeMultiplier, pointsThreshold) |

## setGroupVolumeMultipliers

```solidity
function setGroupVolumeMultipliers(uint256[] _groupIndices, uint256[] _groupVolumeMultipliers) external
```

*Updates groups volume multipliers*

### Parameters

| Name                     | Type       | Description                                |
| ------------------------ | ---------- | ------------------------------------------ |
| \_groupIndices           | uint256\[] | indices of groups to update                |
| \_groupVolumeMultipliers | uint256\[] | corresponding new volume multipliers (1e3) |

## setFeeTiers

```solidity
function setFeeTiers(uint256[] _feeTiersIndices, struct IFeeTiers.FeeTier[] _feeTiers) external
```

*Updates fee tiers*

### Parameters

| Name              | Type                                                                                                    | Description                                           |
| ----------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| \_feeTiersIndices | uint256\[]                                                                                              | indices of fee tiers to update                        |
| \_feeTiers        | [IFeeTiers.FeeTier\[\]](/developer/technical-reference/contracts/interfaces/types/ifeetiers.md#feetier) | new fee tiers values (feeMultiplier, pointsThreshold) |

## setTradersFeeTiersEnrollment

```solidity
function setTradersFeeTiersEnrollment(address[] _traders, struct IFeeTiers.TraderEnrollment[] _values) external
```

*Updates traders enrollment status in fee tiers*

### Parameters

| Name      | Type                                                                                                                      | Description                     |
| --------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
| \_traders | address\[]                                                                                                                | group of traders                |
| \_values  | [IFeeTiers.TraderEnrollment\[\]](/developer/technical-reference/contracts/interfaces/types/ifeetiers.md#traderenrollment) | corresponding enrollment values |

## addTradersUnclaimedPoints

```solidity
function addTradersUnclaimedPoints(address[] _traders, enum IFeeTiers.CreditType[] _creditTypes, uint224[] _points) external
```

*Credits points to traders*

### Parameters

| Name          | Type                         | Description                            |
| ------------- | ---------------------------- | -------------------------------------- |
| \_traders     | address\[]                   | traders addresses                      |
| \_creditTypes | enum IFeeTiers.CreditType\[] | types of credit (IMMEDIATE, CLAIMABLE) |
| \_points      | uint224\[]                   | points to credit (1e18)                |

## updateTraderPoints

```solidity
function updateTraderPoints(address _trader, uint256 _volumeUsd, uint256 _pairIndex) external virtual
```

*Increases daily points from a new trade, re-calculate trailing points, and cache daily fee tier for a trader.*

### Parameters

| Name        | Type    | Description                  |
| ----------- | ------- | ---------------------------- |
| \_trader    | address | trader address               |
| \_volumeUsd | uint256 | trading volume in USD (1e18) |
| \_pairIndex | uint256 | pair index                   |

## calculateFeeAmount

```solidity
function calculateFeeAmount(address _trader, uint256 _normalFeeAmountCollateral) external view returns (uint256)
```

*Returns fee amount after applying the trader's active fee tier multiplier*

### Parameters

| Name                        | Type    | Description                            |
| --------------------------- | ------- | -------------------------------------- |
| \_trader                    | address | address of trader                      |
| \_normalFeeAmountCollateral | uint256 | base fee amount (collateral precision) |

## getFeeTiersCount

```solidity
function getFeeTiersCount() external view returns (uint256)
```

Returns the current number of active fee tiers

## getFeeTier

```solidity
function getFeeTier(uint256 _feeTierIndex) external view returns (struct IFeeTiers.FeeTier)
```

*Returns a fee tier's details (feeMultiplier, pointsThreshold)*

### Parameters

| Name           | Type    | Description    |
| -------------- | ------- | -------------- |
| \_feeTierIndex | uint256 | fee tier index |

## getGroupVolumeMultiplier

```solidity
function getGroupVolumeMultiplier(uint256 _groupIndex) external view returns (uint256)
```

*Returns a group's volume multiplier*

### Parameters

| Name         | Type    | Description                           |
| ------------ | ------- | ------------------------------------- |
| \_groupIndex | uint256 | group index (pairs storage fee index) |

## getFeeTiersTraderInfo

```solidity
function getFeeTiersTraderInfo(address _trader) external view returns (struct IFeeTiers.TraderInfo)
```

*Returns a trader's info (lastDayUpdated, trailingPoints)*

### Parameters

| Name     | Type    | Description    |
| -------- | ------- | -------------- |
| \_trader | address | trader address |

## getFeeTiersTraderDailyInfo

```solidity
function getFeeTiersTraderDailyInfo(address _trader, uint32 _day) external view returns (struct IFeeTiers.TraderDailyInfo)
```

*Returns a trader's daily fee tier info (feeMultiplierCache, points)*

### Parameters

| Name     | Type    | Description    |
| -------- | ------- | -------------- |
| \_trader | address | trader address |
| \_day    | uint32  | day            |

## getTraderFeeTiersEnrollment

```solidity
function getTraderFeeTiersEnrollment(address _trader) external view returns (struct IFeeTiers.TraderEnrollment)
```

*Returns a trader's fee tiers enrollment status*

### Parameters

| Name     | Type    | Description    |
| -------- | ------- | -------------- |
| \_trader | address | trader address |

## getTraderUnclaimedPoints

```solidity
function getTraderUnclaimedPoints(address _trader) external view returns (uint224)
```

*Returns a trader's unclaimed points, credited by Governance*

### Parameters

| Name     | Type    | Description    |
| -------- | ------- | -------------- |
| \_trader | address | trader address |


---

# 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/core/facets/gnsfeetiers.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.
