# add\_new\_farm

An entrypoint that adds a new farm with the specified parameters. Also setups share token default metadata.

### Call parameters

```pascaligo
type fa12_type          is address

type fa2_type           is [@layout:comb] record [
  token                   : address;
  id                      : token_id_type;
]

type token_type         is
  FA12                    of fa12_type
| FA2                     of fa2_type

type fees_type          is [@layout:comb] record [
  harvest_fee             : nat;
  withdrawal_fee          : nat;
  burn_reward             : nat;
]

type stake_params_type  is [@layout:comb] record [
  staked_token            : token_type;
  is_v1_lp                : bool;
]

type add_new_farm_type  is [@layout:comb] record [
  fees                    : fees_type;
  stake_params            : stake_params_type;
  token_info              : map(string, bytes);
  paused                  : bool;
  reward_per_second       : nat;
  timelock                : nat;
  start_time              : timestamp;
]
```

#### fees\_type

<table><thead><tr><th width="185.84381285171565">Field</th><th width="150">Type</th><th width="199.77716643741405">Hint</th><th>Description</th></tr></thead><tbody><tr><td>harvest_fee</td><td>nat</td><td>Float value multiplied by 1e+16</td><td>Fee that applies in time of rewards claiming</td></tr><tr><td>withdrawal_fee</td><td>nat</td><td>Float value multiplied by 1e+16</td><td>Fee that applies in time of withdrawing (unstaking) tokens only in farms with timelock</td></tr><tr><td>burn_reward</td><td>nat</td><td>Float value multiplied by 1e+16</td><td>The % of the rewards that will be minted to the transaction sender when he calls <a href="/pages/VhbiN7MZAaFsOoDPh7YV"><em><strong>burn_farm_rewards</strong></em></a> entrypoint</td></tr></tbody></table>

#### stake\_params\_type

<table><thead><tr><th width="190.33333333333331">Field</th><th width="182.41614906832302">Type</th><th>Description</th></tr></thead><tbody><tr><td>staked_token</td><td>token_type</td><td>FA1.2/FA2 staked token</td></tr><tr><td>is_v1_lp</td><td>bool</td><td>Flag that indicates: QuipuSwap V1 LP token staked or not</td></tr></tbody></table>

#### add\_new\_farm\_type

| Field               | Type                                      | Description                                        |
| ------------------- | ----------------------------------------- | -------------------------------------------------- |
| fees                | [fees\_type](#fees_type)                  | Fees that applies to the farming                   |
| stake\_params       | [stake\_params\_type](#stake_params_type) | Staking parameters                                 |
| token\_info         | map(string, bytes)                        | Mapping of token's keys to token's info            |
| paused              | bool                                      | Flag that indicates: farm is paused or not         |
| reward\_per\_second | nat                                       | Reward per second                                  |
| timelock            | nat                                       | Timelock in seconds (0 for farms without timelock) |
| start\_time         | timestamp                                 | Farm's start time                                  |

### Usage

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

```javascript
import { MichelsonMap } from "@taquito/michelson-encoder";

const qFarmAddress = "KT1...";
const params = {
    fees: {
        harvest_fee: 0.05 * 10 ** 16, // 0.05%
        withdrawal_fee: 0.25 * 10 ** 16, // 0.25%
        burn_reward: 3 * 10 ** 16, // 3%
    },
    stake_params: {
        staked_token: {
            fA2: {
                token: "KT1...",
                id: 0,
            },
        },
        is_v1_lp: true, // or false
    },
    token_info: MichelsonMap.fromLiteral({
        name: Buffer.from("wWBTC/TEZ FA2 Staking Share").toString("hex"),
        symbol: Buffer.from("QSHR").toString("hex"),
        decimals: Buffer.from("6").toString("hex"),
    }),
    paused: false, // or true
    reward_per_second: 1169098400000000,
    timelock: 0, // or positive number
    start_time: String(Math.ceil(Date.now() / 1000)),
};
const qFarm = await tezos.contract.at(qFarmAddress);
const operation = await qFarm.methodsObject.add_new_farm(params).send();

await operation.confirmation();
```

{% endtab %}
{% endtabs %}

### Errors

* `Not-admin` - `sender` of the transaction is not current 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/admin-entrypoints/add_new_farm.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.
