# IOperationFees

> Per-instruction fees for TEE operations.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

Source: https://dev.flare.network/fcc/reference/IOperationFees

Public interface for `OperationFeesFacet` on the [`FlareTeeManager`](/fcc/reference/IFlareTeeManager) diamond.

Each instruction sent through `IInstructions.sendInstructions` charges a **per-operation, per-machine** fee:

```
fee = perOperationFee(opType, opCommand) × number of TEE ids
```

The `getOperationFee` function returns a governance override for that `(opType, opCommand)` pair, or the global `defaultFee` if no override is set. The instructions sender attaches `msg.value` on `sendInstructions`; underpayment reverts with `FeeTooLow` error. Call `calculateFeeByTeeIds` function first and pay that amount.

This ABI is read-only. Governance sets the schedule through internal setters on `OperationFeesFacet` (`setDefaultFee`, `setOperationFees`).

Inherits shared [`ITeeCommonErrors`](/fcc/reference/ITeeCommonErrors).

## Functions[​](#functions "Direct link to Functions")

### `getDefaultFee`[​](#getdefaultfee "Direct link to getdefaultfee")

Returns the default fee.

```
function getDefaultFee()        external view        returns (uint256)
```

**Returns**

-   `uint256`: The default fee.

### `getOperationFee`[​](#getoperationfee "Direct link to getoperationfee")

Returns the operation's fee.

```
function getOperationFee(        bytes32 _opType,        bytes32 _opCommand    )        external view        returns (uint256 _operationFee)
```

**Parameters**

-   `_opType`: The operation type.
-   `_opCommand`: The operation command.

**Returns**

-   `_operationFee`: The fee. If no override is stored for the pair, this is the default fee.

### `calculateFeeByTeeIds`[​](#calculatefeebyteeids "Direct link to calculatefeebyteeids")

Calculates the fee for the operation and list of tee ids that will receive instructions.

```
function calculateFeeByTeeIds(        bytes32 _opType,        bytes32 _opCommand,        address[] memory _teeIds    )        external view        returns (uint256 _fee)
```

**Parameters**

-   `_opType`: The operation type.
-   `_opCommand`: The operation command.
-   `_teeIds`: The list of tee ids that will receive instructions.

**Returns**

-   `_fee`: The calculated fee.

### `calculateFeeByWalletId`[​](#calculatefeebywalletid "Direct link to calculatefeebywalletid")

Calculates the fee for an operation on the given wallet, resolving the receiving tee ids the same way `pay`/`reissue` do (deduplicated PRODUCTION tee ids). Reverts with `ThresholdNotMet` if the wallet does not have enough available keys.

```
function calculateFeeByWalletId(        bytes32 _walletId,        bytes32 _opType,        bytes32 _opCommand    )        external view        returns (uint256 _fee)
```

**Parameters**

-   `_walletId`: The wallet id.
-   `_opType`: The operation type.
-   `_opCommand`: The operation command.

**Returns**

-   `_fee`: The calculated fee.

## Events[​](#events "Direct link to Events")

### `DefaultFeeSet`[​](#defaultfeeset "Direct link to defaultfeeset")

Event emitted when default fee is set.

```
event DefaultFeeSet(        uint256 defaultFee    )
```

**Parameters**

-   `defaultFee` (`uint256 defaultFee`)

### `OperationFeesSet`[​](#operationfeesset "Direct link to operationfeesset")

Event emitted when operation fees are set.

```
event OperationFeesSet(        bytes32[] opTypes,        bytes32[] opCommands,        uint256[] fees    )
```

**Parameters**

-   `opTypes` (`bytes32[] opTypes`)
-   `opCommands` (`bytes32[] opCommands`)
-   `fees` (`uint256[] fees`)

## Errors[​](#errors "Direct link to Errors")

Facet-specific errors are listed here. The interface also inherits shared [`ITeeCommonErrors`](/fcc/reference/ITeeCommonErrors).

### `DefaultFeeZero`[​](#defaultfeezero "Direct link to defaultfeezero")

The global default fee cannot be `0`. Governance `setDefaultFee` and diamond init both reject a zero value. A per-operation override of `0` means "use the default", so the default itself must stay positive.

```
error DefaultFeeZero()
```
