# V1 Dynamic Staking Guide

This guide covers the V1 **DCBMultiFarm** contract — stake one token, earn another with rate-based rewards. If you are unsure which version you have, see the Staking Version Identification Guide.

***

### Prerequisites

* Your DCBMultiFarm contract address.
* A block explorer for your chain (e.g., Etherscan, BscScan).
* A wallet (e.g., MetaMask) connected to the correct network.

***

## Part 1: Investor Guide

### View Available Pools

1. Navigate to **"Read as Proxy"**.
2. Call **`getPools`** to see all pools, or **`poolInfo`** with a pool index.
3. Key fields:
   * `rewardRate`: Reward per token staked per second (in wei).
   * `lockPeriodInDays`: Lock period.
   * `totalInvested`: Current total staked.
   * `totalInvestors`: Active stakers.
   * `startDate` / `endDate`: Pool active period.
   * `hardCap`: Max total stake.
   * `input`: Token you stake.
   * `reward`: Token you earn.

### Check Your Position

1. Call **`users`** with pool ID and your address.
   * `totalInvested`, `totalWithdrawn`, `totalClaimed`, `lastPayout`, `depositTime`.

### Check Pending Rewards

1. Call **`payout`** with pool ID and your address.

> Rewards = `time × rewardRate × staked amount`. Multiplier may apply.

### Check If You Can Claim / Unstake

1. Call **`canClaim`** with pool ID and your address.

### Check Multiplier

1. Call **`multipliers`** with pool ID. If `active` is `true`, boost exists.
2. Call **`calcMultiplier`** — `1000` = 1x, `1500` = 1.5x.

### Approve Tokens (Before First Stake)

1. Go to the **input token contract**.
2. Call **`approve`** with the MultiFarm address and amount in wei.

### Stake

1. Navigate to **"Write as Proxy"**.
2. Call **`stake`** with `_pid` and `_amount` (in wei).

> Cannot stake if pool is full or staking window closed.

### Claim Rewards

1. Call **`claim`** with `_pid`. Or **`claimAll`** for all pools.

### Claim and Restake

1. Call **`claimAndRestake`** with `_pid`. Resets lock timer.

### Unstake

1. Call **`unStake`** with `_pid` and `_amount` (in wei).
2. Rewards are auto-claimed.

> Lock period must have passed.

***

## Part 2: Admin / Founder Guide

> **All write functions require contract owner.**

### Add a Pool

1. Call **`add`** with:
   * First `bool`: Unused — pass `true`.
   * `_rewardRateInSeconds`: Reward per token per second in wei.
   * `_lockPeriodInDays`: Lock period.
   * `_endDate`: Unix timestamp (must be >= now + lock period).
   * `_hardCap`: Max total stake in wei.
   * `_inputToken`: Token users stake.
   * `_rewardToken`: Token users earn.

### Update a Pool

1. Call **`set`** with pool ID and updated params.

> Input/reward tokens **cannot** be changed after creation.

### Set Multiplier

1. Call **`setMultiplier`** with:
   * `_pid`, `_name`, `_contractAdd`, `_isUsed`, `_multiplier` (base `1000`), `_start`, `_end`.

### Expire a Pool

1. Call **`set`** and lower `_endDate`.

> `_endDate` must still be >= now + lock period. Reduce `_lockPeriodInDays` first if needed.

### Withdraw Stuck NFTs

1. Call **`transferStuckNFT`** with NFT address and token ID.

> **Note:** `transferStuckToken` on MultiFarm does **not** transfer tokens — it toggles an internal flag. Do not rely on it for token recovery.

### Fund Rewards

Transfer reward tokens directly to the contract. Verify with `balanceOf` on the reward token.


---

# Agent Instructions: 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:

```
GET https://tms-finance.gitbook.io/tms.finance/staking-contracts/v1-dynamic-staking-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
