Creating A Farm
Last updated
Last updated
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.
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:
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
After a farm is paid for, a user can now call the createfarm
action, which is where they will submit the following details:
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
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.
The addreward
action takes in the following details:
farm_name
name
The name of the farm to add a reward to
start_now
bool
Whether or not to start the reward period immediately
start_time
uint64_t
The epoch timestamp to start the reward period. If start_now
is true, then the start_time
will be ignored by the contract
duration
uint64_t
How many seconds the reward period should last for. Can be set between 1 day (86400
) and 365 days (86400*365
)
reward_token
extended_symbol
The symbol and contract of the reward token
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.
After an existing reward period has come to an end, you can restart that reward pool again by calling the extendreward
action.
farm_name
name
The name of the farm to extend the reward for
reward_id
uint64_t
The ID of the reward pool to extend
start_now
bool
Whether or not to restart the reward period immediately
start_time
uint64_t
The epoch timestamp to restart the reward period. If start_now
is true, then the start_time
will be ignored by the contract
duration
uint64_t
How many seconds the reward period should last for. Can be set between 1 day (86400
) and 365 days (86400*365
)
After calling this action, you can deposit the new rewards by following the instructions mentioned in the Deposit Rewards
section above.
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.
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