# RiskFund

## RiskFundV2

Contract with basic features to track/hold different assets for different Comptrollers.

## Solidity API

#### sweepToken

Function to sweep baseAsset for pool; Tokens are sent to address(to)

```solidity
function sweepToken(address tokenAddress, address to, uint256 amount) external
```

**Parameters**

| Name         | Type    | Description                                 |
| ------------ | ------- | ------------------------------------------- |
| tokenAddress | address | Address of the asset(token)                 |
| to           | address | Address to which assets will be transferred |
| amount       | uint256 | Amount need to sweep for the pool           |

**📅 Events**

* Emits SweepToken event on success

**⛔️ Access Requirements**

* Only Governance

**❌ Errors**

* ZeroAddressNotAllowed is thrown when tokenAddress/to address is zero
* ZeroValueNotAllowed is thrown when amount is zero

***

#### sweepTokenFromPool

Function to sweep token from pool

```solidity
function sweepTokenFromPool(address tokenAddress, address comptroller, uint256 amount) external
```

**Parameters**

| Name         | Type    | Description                                      |
| ------------ | ------- | ------------------------------------------------ |
| tokenAddress | address | Address of the asset(token)                      |
| comptroller  | address | Pool address to which assets will be transferred |
| amount       | uint256 | Amount need to sweep from the pool               |

**📅 Events**

* Emits sweepTokenFromPool event on success

**⛔️ Access Requirements**

* Only Governance

**❌ Errors**

* ZeroAddressNotAllowed is thrown when tokenAddress/comptroller address is zero
* ZeroValueNotAllowed is thrown when amount is zero

***

#### getPoolsBaseAssetReserves

Get the Amount of the Base asset in the risk fund for the specific pool.

```solidity
function getPoolsBaseAssetReserves(address comptroller) external view returns (uint256)
```

**Parameters**

| Name        | Type    | Description                |
| ----------- | ------- | -------------------------- |
| comptroller | address | Comptroller address(pool). |

**Return Values**

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| \[0] | uint256 | Base Asset's reserve in risk fund. |

***


---

# 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-v4.venus.io/technical-reference/reference-isolated-pools/risk-fund-and-shortfall/risk-fund-v2.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.
