> For the complete documentation index, see [llms.txt](https://docs.zivoe.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zivoe.com/developer-docs/core-contracts/zivoevault.sol.md).

# ZivoeVault.sol

## Introduction

Implements an ERC-4626 vault using zSTT as the underlying asset and auto-stakes into stSTT

This contract has the following features:

* Allows user to mint by depositing zSTT (alternatively,  burn for zSTT)
* Interfaces with a router that automates stablecoin deposits, so users can simply interact with the router and deposit USDT, USDC, etc. to mint **zVLT** tokens
* Auto-compunds yield with `compound()` function to claim any outstanding yield (generally in the form of a stablecoin, USDC) which occurs by minting more zSTT and staking into stSTT

{% embed url="<https://www.figma.com/board/qjuQ0uGQl9QD7KeBwyf73d/Zivoe-Visualization?node-id=4440-557&t=NrqSUJrfnafVBXIu-4>" %}

#### State Variables

<table><thead><tr><th width="194.33333333333331">Type</th><th width="179">Name</th><th>Description</th></tr></thead><tbody><tr><td>IERC20</td><td>zSTT</td><td>The address of the zSTT token (underlying asset)</td></tr><tr><td>IZivoeRewards</td><td>stSTT</td><td>The address of the ZivoeRewards staking contract</td></tr><tr><td>IZivoeTranches</td><td>ZVT</td><td>The address of the ZivoeTranches contract</td></tr><tr><td>IZivoeGlobals</td><td>GBL</td><td>The address of the ZivoeGlobals contract</td></tr></tbody></table>

## Read Functions

#### `totalAssets()`

Overrides totalAssets(), returns staked amount of zSTT (represented by stSTT)

```solidity
function totalAssets() public view override returns (uint256);
```

*Returns*

<table><thead><tr><th width="160.33333333333331">Type</th><th width="181">Name</th><th>Description</th></tr></thead><tbody><tr><td>uint256</td><td>-</td><td>stSTT balance held in the vault.</td></tr></tbody></table>

## Write Functions

#### `_deposit()`

Overrides \_deposit(), handles staking deposited zSTT (to receive stSTT)

```solidity
function _deposit(
    address caller, 
    address receiver, 
    uint256 assets, 
    uint256 shares
) internal override;
```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="176">Name</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>caller</td><td>The caller of the function.</td></tr><tr><td>address</td><td>receiver</td><td>The receiver of shares.</td></tr><tr><td>uint256</td><td>assets</td><td>The amount of assets to deposit.</td></tr><tr><td>uint256</td><td>shares</td><td>The amount of shares to receive.</td></tr></tbody></table>

#### `_withdraw()`

Overrides \_withdraw(), handles unstaking stSTT (to receive zSTT)

```solidity
function _withdraw(
    address caller, 
    address receiver, 
    address owner, 
    uint256 assets, 
    uint256 shares
) internal override;
```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="176">Name</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>caller</td><td>The caller of the function.</td></tr><tr><td>address</td><td>receiver</td><td>The receiver of shares.</td></tr><tr><td>address</td><td>owner</td><td>The owner of shares.</td></tr><tr><td>uint256</td><td>assets</td><td>The amount of assets to deposit.</td></tr><tr><td>uint256</td><td>shares</td><td>The amount of shares to receive.</td></tr></tbody></table>

#### `compound()`

Claims rewards from stSTT, mints zSTT with USDC, and stakes the zSTT

```solidity
function compound(address stablecoin) external;
```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="176">Name</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>stablecoin</td><td>The stablecoin to be compounded.</td></tr></tbody></table>

#### `passThrough()`

Returns any external tokens to the DAO.

```solidity
function passThrough(IERC20 asset) external
```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="176">Name</th><th>Description</th></tr></thead><tbody><tr><td>IERC20</td><td>asset</td><td>The asset to pass through.</td></tr></tbody></table>


---

# 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.zivoe.com/developer-docs/core-contracts/zivoevault.sol.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.
