> For the complete documentation index, see [llms.txt](https://docs.fathom.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fathom.fi/dao/interfaces/staking/vault.md).

# Vault

[`VaultProxy`](https://github.com/Into-the-Fathom/fathom-dao-smart-contracts/blob/master/contracts/common/proxy/VaultProxy.sol) is proxy, and its implementation is [`VaultPackage`](https://github.com/Into-the-Fathom/fathom-dao-smart-contracts/blob/master/contracts/dao/staking/vault/packages/VaultPackage.sol).

The `VaultPackage` contract manages the operations and state related to supported tokens and their deposits within the vault. It handles the addition and removal of tokens, depositing of tokens for rewards, and managing migration of tokens to a new vault package.

### **State Variables:**

#### **deposited (mapping(address => uint256))**

* Description: Tracks the total amount of each token that has been deposited into the vault.
* Key: Token address.
* Value: Amount deposited.

#### **isSupportedToken (mapping(address => bool))**

* Description: Indicates whether a token is supported by the vault.
* Key: Token address.
* Value: Boolean indicating support.

#### **listOfSupportedTokens (address\[])**

* Description: An array of token addresses that are currently supported by the vault.

#### **migrated (bool)**

* Description: A boolean flag indicating if the vault has been migrated to a new package.

### **Set Functions:**

#### **deposit(address \_token, uint256 \_amount)**

* Deposits a specified amount of a supported token into the vault.
* Parameters:
  * `_token` (address): The token's address.
  * `_amount` (uint256): Amount of the token to deposit.
* Returns: None.

#### **payRewards(address \_user, address \_token, uint256 \_amount)**

* Pays out rewards to a user from the deposited tokens.
* Parameters:
  * `_user` (address): The user's address.
  * `_token` (address): The token's address.
  * `_amount` (uint256): Amount of the token to pay out.
* Returns: None.

#### **addSupportedToken(address \_token)**

* Adds a token to the list of supported tokens.
* Parameters:
  * `_token` (address): The token's address.
* Returns: None.

#### **removeSupportedToken(address \_token)**

* Removes a token from the list of supported tokens.
* Parameters:
  * `_token` (address): The token's address.
* Returns: None.

#### **migrate(address newVaultPackage)**

* Migrates the vault to a new package.
* Parameters:
  * `newVaultPackage` (address): The new vault package's address.
* Returns: None.

#### **withdrawExtraSupportedTokens(address \_withdrawTo)**

* Withdraws excess balances of supported tokens.
* Parameters:
  * `_withdrawTo` (address): Address to which the tokens will be withdrawn.
* Returns: None.

#### **withdrawExtraUnsupportedToken(address \_token, address \_withdrawTo)**

* Withdraws all balances of an unsupported token.
* Parameters:
  * `_token` (address): The token's address.
  * `_withdrawTo` (address): Address to which the tokens will be withdrawn.
* Returns: None.

### **Events:**

#### **TokenAdded**

* Emitted when a token is added to the list of supported tokens.
* Parameters:
  * `tokenAddress` (address indexed): Address of the token added.
  * `addedBy` (address indexed): Address of the user who added the token.
  * `timestamp` (uint256): Time at which the token was added.

#### **TokenRemoved**

* Emitted when a token is removed from the list of supported tokens.
* Parameters:
  * `tokenAddress` (address indexed): Address of the token removed.
  * `removedBy` (address indexed): Address of the user who removed the token.
  * `timestamp` (uint256): Time at which the token was removed.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.fathom.fi/dao/interfaces/staking/vault.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
