> For the complete documentation index, see [llms.txt](https://waxdao.gitbook.io/waxdao/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://waxdao.gitbook.io/waxdao/products/token-farms/creating-a-farm.md).

# Creating A Farm

If you are a creator and want to set up a token farm, this page is for you! Let's discuss each step of the process, and how it all works.

First, a quick note about tokens.

{% hint style="info" %}
Please be aware that third-party token contracts are out of our control. A contract owner can adjust balances at their will, or add additional logic that breaks the rules of standard token contracts. Due to these potential issues, we can not guarantee that a farm will always behave as expected. For example, if your token is a tax token that takes a fee on every transfer, our contract may end up with a lower balance than anticipated, resulting in users not getting the proper rewards. We accept no responsibility for issues like this, and please make sure to add `tf.waxdao` to your `feeignores` list if you have a taxable token.
{% endhint %}

### Payments

Before you can create a farm, you first need to pay the farm creation fee. There is a base price of 250 WAX, however you can receive discounts by paying with certain tokens.

To get a full list of which tokens are accepted, and the amount required to pay for a farm, you can look on the farm creation page of our website.

Alternatively, you can check via API or block explorer by looking at the `paymethods` table on the `tf.waxdao` contract.

A third option is to call the `getfarmprice` action on our contract, as demonstrated here:

{% embed url="<https://waxdao.gitbook.io/waxdao/products/token-farms/developers/become-a-partner#getting-the-current-farm-price>" %}

If you want to manually interact with the contract instead of using our front end, you can pay for a farm by sending the required tokens with the following memo: `farm payment`

### createfarm Action

After a farm is paid for, a user can now call the `createfarm` action, which is where they will submit the following details:

| Param          | Type             | Description                                                                                                                        |
| -------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| creator        | name             | The WAX address of the farm creator                                                                                                |
| farm\_name     | name             | The name of the farm you are creating. Must be <= 12 characters, `a-z`, `1-5` and `.`                                              |
| staking\_token | extended\_symbol | The symbol and contract of the token that users need to stake                                                                      |
| vesting\_time  | uint64\_t        | The amount of seconds that a user must lock their tokens for in order to stake in the farm. Can be set between `0` and `86400*365` |

### addreward Action

The `createfarm` action does not create a reward pool. After calling that action, the `addreward` action must also be called to set up a reward pool for the farm. Up to 10 different reward pools can be added, and they can run concurrently, or separately. Each reward pool exists individually and does not interfere with the others.

{% hint style="info" %}
Note: You can not alter the reward pool once it has been created. You must wait for the current reward period to end before you can extend it or add more funds to it. However, you **can** create multiple reward pools with the same reward token. So if you want to add more tokens to a farm, you can always just set up an additional reward for the same token.
{% endhint %}

The `addreward` action takes in the following details:

<table><thead><tr><th>Param</th><th width="220">Type</th><th>Description</th></tr></thead><tbody><tr><td>farm_name</td><td>name</td><td>The name of the farm to add a reward to</td></tr><tr><td>start_now</td><td>bool</td><td>Whether or not to start the reward period immediately</td></tr><tr><td>start_time</td><td>uint64_t</td><td>The epoch timestamp to start the reward period. If <code>start_now</code> is true, then the <code>start_time</code> will be ignored by the contract</td></tr><tr><td>duration</td><td>uint64_t</td><td>How many seconds the reward period should last for. Can be set between 1 day (<code>86400</code>) and 365 days (<code>86400*365</code>)</td></tr><tr><td>reward_token</td><td>extended_symbol</td><td>The symbol and contract of the reward token</td></tr></tbody></table>

### Depositing Rewards

{% hint style="info" %}
An important note about reward pools: it is crucial to ensure that the reward pool quantity is sufficient enough to be divisible into small amounts. Since farms pay out every second, there could be cases where small reward pools result in users not being able to claim anything. It is **highly recommended** to use a reward token that has a precision of at least 4 decimals, and to make sure that you deposit enough rewards to generate multiple units per second.
{% endhint %}

Once you've called the `addreward` action, you can now deposit the reward tokens. Keep in mind that you can not make more than 1 deposit until the current reward period ends. You must make 1 reward deposit only, and then wait for the reward period to finish before you can change anything.

If you want to deposit rewards without using our front end, you can do so by sending the tokens to `tf.waxdao` with the following memo:

`|rewards|<farm_name>|<reward_id>|`

For example...

`|rewards|myfarm|5|`

Only the farm creator can deposit rewards into a farm.

### extendreward Action

After an existing reward period has come to an end, you can restart that reward pool again by calling the `extendreward` action.&#x20;

<table><thead><tr><th>Param</th><th width="220">Type</th><th>Description</th></tr></thead><tbody><tr><td>farm_name</td><td>name</td><td>The name of the farm to extend the reward for</td></tr><tr><td>reward_id</td><td>uint64_t</td><td>The ID of the reward pool to extend</td></tr><tr><td>start_now</td><td>bool</td><td>Whether or not to restart the reward period immediately</td></tr><tr><td>start_time</td><td>uint64_t</td><td>The epoch timestamp to restart the reward period. If <code>start_now</code> is true, then the <code>start_time</code> will be ignored by the contract</td></tr><tr><td>duration</td><td>uint64_t</td><td>How many seconds the reward period should last for. Can be set between 1 day (<code>86400</code>) and 365 days (<code>86400*365</code>)</td></tr></tbody></table>

After calling this action, you can deposit the new rewards by following the instructions mentioned in the `Deposit Rewards` section above.

### setvesttime Action

This is optional, but if you want to adjust the time period that users must lock tokens for when they stake, you can call the `setvesttime` action.

| Param         | Type      | Description                                                                                                |
| ------------- | --------- | ---------------------------------------------------------------------------------------------------------- |
| farm\_name    | name      | The name of the farm to adjust the lock period for                                                         |
| vesting\_time | uint64\_t | How many seconds users need to lock their tokens for when staking. Can be anywhere from `0` to `86400*365` |
