# FM\_DepositVault\_v1

[Git Source](https://github.com/InverterNetwork/inverter-contracts/blob/649b450f02fc8b735c128ff0821467e71966c666/src/modules/fundingManager/depositVault/FM_DepositVault_v1.sol)

**Inherits:** IFundingManager\_v1, IFM\_DepositVault\_v1, Module\_v1

**Author:** Inverter Network

This contract allows users to deposit tokens to fund the workflow.

*Implements {IFundingManager\_v1} interface.*

### State Variables

#### BPS

*Base Points used for percentage calculation. This value represents 100%.*

```solidity
uint internal constant BPS = 10_000;
```

#### \_token

*The token that is deposited.*

```solidity
IERC20 private _token;
```

#### \_\_gap

*Storage gap for future upgrades.*

```solidity
uint[50] private __gap;
```

### Public Functions

#### supportsInterface

*See {IERC165-supportsInterface}.*

```solidity
function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(Module_v1)
    returns (bool);
```

#### init

```solidity
function init(
    IOrchestrator_v1 orchestrator_,
    Metadata memory metadata,
    bytes memory configData
) external override initializer;
```

#### token

Returns the token.

```solidity
function token() public view returns (IERC20);
```

**Returns**

| Name     | Type     | Description |
| -------- | -------- | ----------- |
| `<none>` | `IERC20` | The token.  |

#### deposit

Deposits a specified amount of tokens into the contract from the sender's account.

*When using the {TransactionForwarder\_v1}, validate transaction success to prevent nonce exploitation and ensure transaction integrity.*

```solidity
function deposit(uint amount) external;
```

**Parameters**

| Name     | Type      | Description                      |
| -------- | --------- | -------------------------------- |
| `amount` | `uint256` | The number of tokens to deposit. |

#### transferOrchestratorToken

Transfer a specified amount of Tokens to a designated receiver address.

*This function MUST be restricted to be called only by the {Orchestrator\_v1}.*

```solidity
function transferOrchestratorToken(address to, uint amount)
    external
    onlyPaymentClient
    validAddress(to);
```

**Parameters**

| Name     | Type      | Description                               |
| -------- | --------- | ----------------------------------------- |
| `to`     | `address` | The address that will receive the tokens. |
| `amount` | `uint256` | The amount of tokens to be transfered.    |

### Internal Functions

#### \_processProtocolFeeViaTransfer

*Transfer protocol fees to the treasury.*

```solidity
function _processProtocolFeeViaTransfer(
    address treasury_,
    IERC20 token_,
    uint feeAmount_
) internal;
```

**Parameters**

| Name         | Type      | Description                           |
| ------------ | --------- | ------------------------------------- |
| `treasury_`  | `address` | The address of the protocol treasury. |
| `token_`     | `IERC20`  | The token to transfer the fees from.  |
| `feeAmount_` | `uint256` | The amount of fees to transfer.       |

#### \_validateRecipient

*Validates the recipient address.*

```solidity
function _validateRecipient(address _receiver) internal view;
```
