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.
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.
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:
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:
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.
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.
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
Depositing Rewards
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.
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.
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.
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.
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
Last updated