# deposit

An entrypoint that deposits (stakes) tokens. In time of every deposit it claims user's rewards if timelock is finished (only for farms with timelock) or in farms without timelock it just claims user's rewards. In the case of claiming, rewards are minted to the user and to the referrer (***harvest\_fee***). Also setups a referrer for a user, votes for a user's baker if the QuipuSwap V1 TOK/TEZ LP token is deposited (staked).

### Call parameters

```pascaligo
type deposit_type       is [@layout:comb] record [
  fid                     : fid_type;
  amt                     : nat;
  referrer                : option(address);
  rewards_receiver        : address;
  candidate               : option(key_hash);
]
```

| Field             | Type              | Description                                                           |
| ----------------- | ----------------- | --------------------------------------------------------------------- |
| fid               | fid\_type (nat)   | Farm's ID                                                             |
| amt               | nat               | Amount of tokens to deposit                                           |
| referrer          | option(address)   | User's referrer                                                       |
| rewards\_receiver | address           | Receiver of earned tokens                                             |
| candidate         | option(key\_hash) | The baker for voting (only for QuipuSwap V1 TOK/TEZ LP staked tokens) |

### Usage

{% tabs %}
{% tab title="🌮 Taquito" %}

```javascript
const qFarmAddress = "KT1...";
const params = {
    fid: 1,
    amt: 100,
    referrer: "tz1.../KT1...", // or null
    rewards_receiver: "tz1.../KT1...",
    candidate: "tz1...", // or null
};
const qFarm = await tezos.contract.at(qFarmAddress);
const operation = await qFarm.methodsObject.deposit(params).send();

await operation.confirmation();
```

{% endtab %}
{% endtabs %}

### Errors

* `QSystem/farm-not-set` - farming with `fid` parameter doesn't exist.
* `QFarm/farm-is-paused` - farm is paused by an administrator.
* `QFarm/can-not-refer-yourself` - user is trying to refer himself.
* `QFarm/baker-is-required` - `baker` parameter is required (not optional) for QuipuSwap V1 TOK/TEZ LP staked tokens.
* `QFarm/baker-is-banned` - `baker` from the parameters is banned by an administrator.


---

# 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://docs.quipuswap.com/smart-contracts/farming/qfarm-contract/entrypoints-overview/farming-entrypoints/deposit.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.
