# Stacking DAO 核心 V4

Stacking DAO Core V4 是用户进行所有操作的主要入口，包括存入和提取 STX、查询 stSTX 与 STX 的兑换比率或查看用户的提取 NFT 头寸。

合约地址如下：

<https://explorer.hiro.so/txid/SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.stacking-dao-core-v4?chain=mainnet>

**集成说明**

对于钱包、中心化交易所（CEX）以及其他想要集成 Stacking DAO 存取逻辑的协议，有三个关键方法需要了解：<br>

1. **存入 STX（Deposit）**

The deposit method can be initiated using the `deposit` method on the `SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.stacking-dao-core-v4` contract.&#x20;

This contract expects the following parameters

* `reserve-contract` - this is the Stacking DAO reserve contract, and should always be set to \``` SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.reserve-v1` ``
* `commission-contract` - this is the Stacking DAO commission contract, and should always be set to \``` SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.commission-v2` ``
* `staking-contract` - this is the Stacking DAO staking contract, and should always be set to \``` SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.staking-v0` ``
* `direct-helpers` - this is the Stacking DAO direct helpers contract, and should always be set to \``` SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.direct-helpers-v2` ``
* `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.
* `referrer` - an optional Stacks address, this accumulates referral points on the leaderboard
* `pool` - should be set to `none` for now<br>

2. **发起提取（Init-Withdraw）**

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:

* `reserve-contract` - this is the Stacking DAO reserve contract, and should always be set to \``` SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.reserve-v1` ``
* `direct-helpers` - this is the Stacking DAO direct helpers contract, and should always be set to \``` SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.direct-helpers-v2` ``
* `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).<br>

3. **完成提取（Withdraw）**

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:

* `reserve-contract` - this is the Stacking DAO reserve contract, and should always be set to \``` SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.reserve-v1` ``
* `commission-contract` - this is the Stacking DAO commission contract, and should always be set to \``` SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.commission-v2` ``
* `staking-contract` - this is the Stacking DAO staking contract, and should always be set to \``` SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.staking-v0` ``
* `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.
