# V1 Liquidity staking Guide

This guide covers the V1 **LiqLocker** (legacy) contract — provide liquidity to a Uniswap V2 pair and lock LP tokens to earn rewards. If you are unsure which version you have, see the Staking Version Identification Guide.

***

### Prerequisites

* Your LiqLocker contract address.
* A block explorer for your chain (e.g., Etherscan, BscScan).
* A wallet (e.g., MetaMask) connected to the correct network.
* Both tokens of the liquidity pair.

### How It Works

The Liquidity Locker combines two steps into one:

1. **Adds liquidity** to a Uniswap V2 pair using your two tokens.
2. **Locks the resulting LP tokens** in the contract to earn rewards.

When you unstake, the contract removes liquidity and returns both tokens to you.

***

## Part 1: Investor Guide

### View Available Pools

1. Navigate to **"Read as Proxy"**.
2. Call **`poolInfo`** with a pool index (starting from `0`).
3. Key fields:
   * `rewardRate`: Reward per LP token per second (in wei).
   * `lockPeriodInDays`: Lock period.
   * `endDate`: When rewards stop.
   * `input`: LP pair address.
   * `reward`: Reward token address.
   * `isWithdrawLocked`: If `true`, cannot unlock until lock period ends.

### Check Your Position

1. Call **`users`** with pool ID and your address.
   * `totalInvested`: LP tokens locked.
   * `totalClaimed`: Rewards claimed.
   * `depositTime`: When you locked.

### Check Your Staked LP Amount

1. Call **`stakedTokens`** with pool ID and your address.
2. Returns the LP token amount you have staked.

### Check Pending Rewards

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

### Check If You Can Claim / Unlock

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

### Check Multiplier

1. Call **`multis`** with pool ID. If `active` is `true`, boost exists.
2. Call **`calcMultiplier`** with pool ID and your address.

### Approve Tokens (Before First Lock)

You need to approve **both tokens** of the pair:

1. Go to **Token 0** contract → call **`approve`** with LiqLocker address and amount.
2. Go to **Token 1** contract → call **`approve`** with LiqLocker address and amount.

> If one of the tokens is the native token (e.g., ETH, BNB), you do not need to approve it — you send it as `msg.value` instead.

### Add Liquidity and Lock

1. Navigate to **"Write as Proxy"** on the LiqLocker.
2. Call **`addLiquidityAndLock`** with:
   * `_pid`: Pool ID.
   * `_token0Amt`: Amount of token 0 in wei.
   * `_token1Amt`: Amount of token 1 in wei.
   * `_token0Min`: Minimum token 0 accepted (slippage protection). Use \~95% of `_token0Amt`.
   * `_token1Min`: Minimum token 1 accepted (slippage protection). Use \~95% of `_token1Amt`.
3. If one token is native (ETH/BNB), also set the **value** field to the native token amount.

#### Slippage Protection

The `_token0Min` and `_token1Min` parameters protect against price movement. Set them to \~95% of your desired amounts:

```
_token0Amt: 1000000000000000000    (1 token)
_token0Min:  950000000000000000    (0.95 token — 5% slippage)
```

### Claim Rewards

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

> Lock period must have passed.

### Unlock and Remove Liquidity

1. Call **`unlockAndRemoveLP`** with:
   * `_pid`: Pool ID.
   * `_amount`: LP token amount to unlock (in wei). Use your full `stakedTokens` amount to unlock everything.
   * `_token0Min`: Minimum token 0 to receive (slippage protection).
   * `_token1Min`: Minimum token 1 to receive (slippage protection).
2. The contract removes liquidity from the pair and sends both tokens to your wallet.

> Lock period must have passed if `isWithdrawLocked` is `true`.

***

## Part 2: Admin / Founder Guide

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

### Add a Pool

1. Call **`add`** with:
   * `_isWithdrawLocked`: `true` to lock unstaking during lock period.
   * `_rewardRate`: Reward per LP token per second in wei.
   * `_lockPeriodInDays`: Lock period.
   * `_endDate`: Unix timestamp.
   * Hardcap param: Unused for liquidity — pass `0`.
   * `_inputToken`: LP pair address.
   * `_rewardToken`: Reward token address.

### Update a Pool

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

### Set Multiplier

1. Call **`setMultiplier`** with:
   * `_pid`, `_name`, `_contractAdd`, `_isUsed`, `_multi`, `_start`, `_end`.

### Expire a Pool

1. Call **`set`** and set `_endDate` to a past timestamp.

### Withdraw Stuck Tokens

1. Call **`transferStuckToken`** with token address.

### Withdraw Stuck NFTs

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

### Fund Rewards

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


---

# 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-liquidity-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.
