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

# stSTX: Stacking DAO Core

Stacking DAO Core is the main entry point for all user-related actions such as depositing and withdrawing STX, or looking up a withdrawal NFT position of a user. The stSTX/STX ratio is read from the data contract (see [Reading the ratio](#reading-the-ratio)).

The contract can be found here: <https://explorer.hiro.so/txid/SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.stacking-dao-core-stx-v2?chain=mainnet>

{% hint style="info" %}
This contract replaces the previous `stacking-dao-core-v6`. The interface is now simpler: the reserve, commission and staking contracts are resolved internally, so they no longer need to be passed as parameters. A `min-shares-out` slippage parameter has been added to `deposit`.
{% endhint %}

## Integrations

For wallets, CEXes and other protocols who want to integrate the Stacking DAO deposit/withdrawal logic, there are four important methods to take into account:

{% stepper %}
{% step %}

## Deposit

The deposit method can be initiated using the `deposit` method on the `SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.stacking-dao-core-stx-v2` contract.

This contract expects the following parameters:

* `stx-amount` - a positive integer value for the uSTX (micro-STX, 10^6) amount you want to stack and get `stSTX` in return for. For example, passing `1000000` will stack 1 STX.
* `min-shares-out` - a positive integer for the minimum amount of `stSTX` (in micro-stSTX) you are willing to receive. The transaction reverts if fewer shares would be minted, protecting you against an unexpected ratio change (slippage protection). Compute it from the current ratio (see [Reading the ratio](#reading-the-ratio) below); pass a value slightly below the expected output, or `0` to accept any amount.
  {% endstep %}

{% step %}

## Initiate Withdrawal

When withdrawing, users can follow a two-step process. See <https://docs.stackingdao.com/stackingdao/the-stacking-dao-app/withdrawing-stx> for more information.

The initialisation of a withdrawal can be called using `init-withdraw` and expects the following parameters:

* `ststx-amount` - a positive integer value for the ustSTX (micro-stSTX, 10^6) amount you want to unstack and get `STX` in return for. For example, passing `1000000` will unstack 1 stSTX.

When this call succeeds, the user will receive an NFT that represents their unstacking position and indicates the amount of STX they should receive after a given PoX cycle ends (this is always principal + yield).
{% endstep %}

{% step %}

## Withdrawal

Finally, once the PoX cycle ends after a given `init-withdrawal` call (but always before the last 288 blocks of a given cycle), the STX principal + yield can be withdrawn from Stacking DAO.

The withdrawal can be called using `withdraw` and expects the following parameters:

* `nft-id` - the ID of the NFT that was minted in the `init-withdraw` method previously.

After the withdrawal succeeds, the STX principal and yield amounts will be returned to the transaction sender's wallet.
{% endstep %}

{% step %}

## Instant Withdrawal

Instant withdrawal lets you withdraw your STX immediately using idle liquidity from the protocol, if idle liquidity is available. A 1% fee applies to Instant Unstack.

The instant withdrawal can be called using `withdraw-idle` and expects the following parameters:

* `ststx-amount` - a positive integer value for the ustSTX (micro-stSTX, 10^6) amount you want to unstack and get `STX` in return for. For example, passing `1000000` will unstack 1 stSTX.
  {% endstep %}
  {% endstepper %}

## Reading the ratio

The stSTX/STX exchange rate is read from the data contract at `SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.data-stx-v2`, using the `get-stx-per-ststx` read-only method. It returns the amount of micro-STX backing one stSTX (10^6 based), and is what you should use to size `min-shares-out`.

The data contract can be found here: <https://explorer.hiro.so/txid/SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.data-stx-v2?chain=mainnet>
