Build An API
We have a public API that you can use, details are in the API Documentation section.
API DocumentationIf you prefer to build your own API instead, you'll need to keep track of data related to the tf.waxdao
contract. We've made that quite simple for you.
If you're using a SHIP reader, you can watch for the following actions.
createfarm
This will notify you of the creation of any new farms so you can add them into a table.
creator
name
The WAX address of the user who created the farm
farm_name
name
The name of the farm they created
staking_token
extended_symbol
The symbol and contract of the token that will be staked in the farm
vesting_time
uint64_t
The amount of seconds that users will need to lock their tokens for if they stake in the farm
original_creator
name
Since our partners act as intermediaries, the partners are the creator
of all their farms. original_creator
allows them to specify the user who actually created the farm, so we can track it off chain and use it for indexing
logclaim
When a user claims rewards, this action will be called so you can track the amounts claimed.
user
name
The wallet address of the user who made the claim
farm_name
name
The name of the farm they claimed from
claimed_rewards
vector<extended_asset>
A list of the token amounts that were claimed. Including the amount, symbol and contract
logrewards
Whenever the state of a reward pool for a farm changes, this action will log a list of all reward pools for that farm, and their current state.
f
farm_struct
A custom struct which has the same structure as the farms table
rs
vector<reward_struct>
A vector of custom structs which match the rows of the rewards table
The struct definitions are outlined below.
struct farm_struct {
eosio::name farm_name;
eosio::name creator;
uint64_t time_created;
eosio::extended_symbol staking_token;
uint8_t incentive_count;
uint64_t total_staked;
uint64_t vesting_time;
uint64_t last_update_time;
farm_struct(const farms& f)
: farm_name(f.farm_name),
creator(f.creator),
time_created(f.time_created),
staking_token(f.staking_token),
incentive_count(f.incentive_count),
total_staked(f.total_staked),
vesting_time(f.vesting_time),
last_update_time(f.last_update_time) {}
farm_struct() = default;
// Custom serialization is necessary to pack/unpack the farm_struct when passing
// to certain actions, such as `logrewards`
template<typename DataStream>
friend DataStream& operator << (DataStream& ds, const farm_struct& obj) {
ds << obj.farm_name
<< obj.creator
<< obj.time_created
<< obj.staking_token
<< obj.incentive_count
<< obj.total_staked
<< obj.vesting_time
<< obj.last_update_time;
return ds;
}
template<typename DataStream>
friend DataStream& operator >> (DataStream& ds, farm_struct& obj) {
ds >> obj.farm_name
>> obj.creator
>> obj.time_created
>> obj.staking_token
>> obj.incentive_count
>> obj.total_staked
>> obj.vesting_time
>> obj.last_update_time;
return ds;
}
};
struct reward_struct {
uint64_t id;
uint64_t period_start;
uint64_t period_finish;
uint128_t reward_rate;
uint64_t rewards_duration;
uint128_t reward_per_token_stored;
eosio::extended_asset reward_pool;
eosio::asset total_rewards_paid_out;
reward_struct(const rewards& r)
: id(r.id),
period_start(r.period_start),
period_finish(r.period_finish),
reward_rate(r.reward_rate),
rewards_duration(r.rewards_duration),
reward_per_token_stored(r.reward_per_token_stored),
reward_pool(r.reward_pool),
total_rewards_paid_out(r.total_rewards_paid_out) {}
reward_struct() = default;
// Custom serialization is necessary to pack/unpack the reward_struct when passing
// to certain actions, such as `logrewards`
template<typename DataStream>
friend DataStream& operator << (DataStream& ds, const reward_struct& obj) {
ds << obj.id
<< obj.period_start
<< obj.period_finish
<< obj.reward_rate
<< obj.rewards_duration
<< obj.reward_per_token_stored
<< obj.reward_pool
<< obj.total_rewards_paid_out;
return ds;
}
template<typename DataStream>
friend DataStream& operator >> (DataStream& ds, reward_struct& obj) {
ds >> obj.id
>> obj.period_start
>> obj.period_finish
>> obj.reward_rate
>> obj.rewards_duration
>> obj.reward_per_token_stored
>> obj.reward_pool
>> obj.total_rewards_paid_out;
return ds;
}
};
logstake
Any time a user stakes new tokens into a farm, this action logs the relevant information.
user
name
The name of the user who staked
farm_name
name
The name of the farm they staked into
amount
extended_asset
The amount that they staked in this transaction
updated_balance
extended_asset
Their current staked balance after adding the new stake to the farm
logunstake
Works the same as the logstake action, except this is for unstaking instead.
user
name
The name of the user who unstaked
farm_name
name
The farm that they unstaked from
amount
extended_asset
The amount that they unstaked
updated_balance
extended_asset
Their current staked balance after unstaking
Last updated