> For the complete documentation index, see [llms.txt](https://docs.zestprotocol.com/start/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zestprotocol.com/start/stacks-vaults-smart-contracts/zvstbtc-contracts.md).

# zvstBTC Contracts

The zvstBTC Vault is live on Stacks mainnet. This page lists the deployed contracts and the main functions each one exposes. For a full, auto-generated function reference, see the contract reference docs; for failure codes, see [zvstBTC Error Codes](/start/stacks-vaults-smart-contracts/zvstbtc-error-codes.md).

All contracts are deployed by `SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7`.

## Deployed Contracts

| Contract                                                                                                                       | Role                                                              |
| ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------- |
| [`zvstBTC`](https://explorer.hiro.so/txid/SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.zvstBTC?chain=mainnet)                     | The SIP-010 share token                                           |
| [`zv-state-stbtc-0`](https://explorer.hiro.so/txid/SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.zv-state-stbtc-0?chain=mainnet)   | Permanent custody, configuration, roles, and the withdrawal queue |
| [`zv-engine-stbtc-0`](https://explorer.hiro.so/txid/SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.zv-engine-stbtc-0?chain=mainnet) | Vault logic: deposits, withdrawals, live NAV, and fees            |
| [`zv-ops-stbtc-0`](https://explorer.hiro.so/txid/SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.zv-ops-stbtc-0?chain=mainnet)       | Operator: runs the leverage strategy                              |
| [`zv-traits`](https://explorer.hiro.so/txid/SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.zv-traits?chain=mainnet)                 | Shared interface definitions                                      |

## zvstBTC (Share Token)

A standard SIP-010 fungible token with 8 decimals. Your balance is your claim on the vault.

**Reads:**

* `get-name`, `get-symbol`, `get-decimals`, `get-token-uri`
* `get-balance (who)`, `get-total-supply`

**Writes:**

* `transfer (amount sender recipient memo)`: standard SIP-010 transfer
* Minting and burning are internal and restricted to the engine; the token cannot be minted any other way.

## zv-engine-stbtc-0 (Vault Logic)

Everything a depositor does goes through the engine. Users call it directly from their own wallet.

**Deposit and withdraw:**

* `deposit (token amount min-shares-out)`: deposit stBTC, receive shares
* `deposit-sbtc (amount min-shares-out)`: deposit sBTC, which the vault stakes into stBTC first
* `request-redeem (assets is-express)`: start a withdrawal and escrow your shares
* `fund-claim (claim-id)`: set aside the payout once the cooldown has passed
* `redeem (token claim-id)`: pay out a funded claim in stBTC
* `cancel-redeem (claim-id)`: cancel an unfunded standard-lane request and get your shares back

**Reads (pricing and previews):**

* `get-net-assets`: the live Net Asset Value
* `get-share-price`: the current price per share (1e8-scaled)
* `preview-deposit (amount)` / `preview-redeem (shares)`: quote a deposit or withdrawal
* `convert-to-shares` / `convert-to-assets`: convert between the two

## zv-state-stbtc-0 (Custody and Configuration)

Holds the funds, the settings, the roles, and the withdrawal claims. Most of its write functions are restricted to the engine, the operator, or a specific role.

**Reads:**

* `get-deposit-config`: deposit cap, net deposited, minimum deposit, and the deposit/vault enabled flags
* `get-redeem-config`: cooldown, express settings, fees, and the redeem/vault enabled flags
* `get-fee-config`: fee rates, recipient, high-water mark, and last-fee timestamp
* `get-claim (id)`: the details of a queued withdrawal
* `get-vault-enabled`, `get-trading-enabled`, and the role checks (`is-owner`, `is-guardian`, and so on)

**Governed writes (role-gated):**

* `set-deposit-cap (value)`: adjust the deposit cap (owner or manager)
* `set-hot-role (role principal)`: assign an operational role (owner)
* `pause-vault (...)`: guardian emergency stop
* `request-*-update` / `confirm-*-update`: timelocked changes to core addresses and settings

## zv-ops-stbtc-0 (Operator)

Runs the leverage strategy. These functions are for authorized keeper accounts (the trader role), not for end users, and they can only move funds along the predefined strategy path. Typical entry points include opening, adjusting, and closing the looped position, and stacking or unstacking Bitcoin through Stacking DAO to service the strategy and fund withdrawals.

## zv-traits

Defines the shared interfaces the vault contracts implement, such as the operator interface the engine calls. Traits are what make the upgrade model safe: any replacement contract must conform to the same interface.

## See Also

* [zvstBTC Error Codes](/start/stacks-vaults-smart-contracts/zvstbtc-error-codes.md): what each failure code means
* [zvstBTC Audits](/start/stacks-vaults-smart-contracts/zvstbtc-audits.md): security review and audit reports
* [Architecture](/start/stacks-vaults/zvstbtc-vault/architecture.md): how the contracts fit together
