# MockFeeManager v0.3.1 API Reference
Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/mock-fee-manager

> For the complete documentation index, see [llms.txt](/llms.txt).

> **NOTE: Integrate Chainlink Local into your project**
>
> ### npm
>
> If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM
> package](https://www.npmjs.com/package/@chainlink/local):
>
> ```shell
> npm install @chainlink/local@0.3.1
> ```
>
> ### yarn
>
> If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM
> package](https://www.npmjs.com/package/@chainlink/local):
>
> ```shell
> yarn add @chainlink/local@0.3.1
> ```
>
> ### foundry
>
> If you use [Foundry](https://book.getfoundry.sh/):
>
> ```shell
> forge install smartcontractkit/chainlink-local@v0.3.1
> ```
>
> and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file
>
> ### RemixIDE
>
> Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package:
>
> ```solidity
> import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol";
> ```

## MockFeeManager

A mock implementation of the Data Streams verifier fee manager for local testing.

[`MockFeeManager`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/MockFeeManager.sol)

> **NOTE**
>
> This contract processes report verification fees in LINK or native token, applies per-subscriber discounts and a
> native surcharge, and forwards LINK rewards to the
> [`MockRewardManager`](/chainlink-local/api-reference/v0.3.1/mock-reward-manager). Only the verifier proxy may call its
> functions.

## Errors

### Unauthorized

```solidity
error Unauthorized()
```

> **NOTE**
>
> Reverts when called by anyone other than the verifier proxy.

### InvalidAddress

```solidity
error InvalidAddress()
```

### InvalidQuote

```solidity
error InvalidQuote()
```

> **NOTE**
>
> Reverts when the quote token is neither the LINK nor the wrapped native token.

### ExpiredReport

```solidity
error ExpiredReport()
```

### InvalidDiscount

```solidity
error InvalidDiscount()
```

### InvalidSurcharge

```solidity
error InvalidSurcharge()
```

### InvalidDeposit

```solidity
error InvalidDeposit()
```

## Functions

### constructor

Initializes the contract.

```solidity
constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager)
```

> **NOTE**
>
> Approves the reward manager to pull the LINK it receives.

#### Parameters

| Parameter     | Type      | Description                              |
| ------------- | --------- | ---------------------------------------- |
| linkAddress   | `address` | The LINK token address                   |
| nativeAddress | `address` | The wrapped native token address         |
| proxyAddress  | `address` | The verifier proxy address (only caller) |
| rewardManager | `address` | The reward manager address               |

### processFee

Processes the fee for a single report verification.

```solidity
function processFee(bytes calldata payload, bytes calldata parameterPayload, address subscriber) external payable override onlyProxy
```

> **NOTE**
>
> Decodes the fee from the report, applies the subscriber discount and (for native quotes) the surcharge, then pulls the
> fee from the subscriber and forwards the LINK reward to the reward manager.

### processFeeBulk

Processes fees for multiple report verifications.

```solidity
function processFeeBulk(bytes[] calldata payloads, bytes calldata parameterPayload, address subscriber) external payable override onlyProxy
```

### getFeeAndReward

Returns the fee and reward for a report and quote token.

```solidity
function getFeeAndReward(address subscriber, bytes memory report, address quoteAddress) public view returns (Common.Asset memory, Common.Asset memory, uint256)
```

> **NOTE**
>
> Reverts with `ExpiredReport` when the report's `expiresAt` is in the past.

#### Parameters

| Parameter    | Type      | Description                                      |
| ------------ | --------- | ------------------------------------------------ |
| subscriber   | `address` | The subscriber address (for the discount lookup) |
| report       | `bytes`   | The report data                                  |
| quoteAddress | `address` | The fee token to quote (LINK or wrapped native)  |

#### Returns

| Parameter | Type           | Description                               |
| --------- | -------------- | ----------------------------------------- |
| (unnamed) | `Common.Asset` | The fee asset and amount                  |
| (unnamed) | `Common.Asset` | The reward asset and amount (always LINK) |
| (unnamed) | `uint256`      | The discount applied                      |

### setNativeSurcharge

Sets the surcharge applied to native token fees.

```solidity
function setNativeSurcharge(uint256 surcharge) external onlyOwner
```

### setMockDiscount

Sets a per-subscriber discount.

```solidity
function setMockDiscount(address subscriber, uint256 discount) external onlyOwner
```

> **NOTE**
>
> `1e18` is a 100% discount.

### withdrawMockFee

Withdraws accumulated fees.

```solidity
function withdrawMockFee(address to, address coin) external onlyOwner
```

### withdrawLink

Withdraws accumulated LINK.

```solidity
function withdrawLink(address to) external onlyOwner
```