-
Notifications
You must be signed in to change notification settings - Fork 1
/
tables.hpp
147 lines (124 loc) · 4.63 KB
/
tables.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#pragma once
#include "structs.hpp"
//Tables on other contracts
struct balances_s {
name owner;
vector <asset> quantities;
uint64_t primary_key() const { return owner.value; };
};
typedef multi_index <name("balances"), balances_s> balances_t;
struct [[eosio::table]] daos {
eosio::name daoname;
eosio::name creator;
uint64_t time_created;
uint8_t status;
double threshold;
uint8_t dao_type;
uint8_t proposer_type;
std::vector<eosio::name> authors;
eosio::symbol gov_token_symbol;
eosio::name gov_token_contract;
uint64_t hours_per_proposal;
uint64_t minimum_weight;
uint64_t minimum_votes;
eosio::name gov_farm_name;
eosio::asset proposal_cost;
std::vector<COLLECTION_AND_SCHEMA> gov_schemas;
uint64_t primary_key() const { return daoname.value; }
};
using daotable = eosio::multi_index<"daos"_n, daos
>;
struct [[eosio::table]] farms {
uint64_t ID;
eosio::name farmname;
eosio::name creator;
std::string rewardtoken;
eosio::name contract;
eosio::name collection;
eosio::name schema;
eosio::asset poolsize;
uint64_t mintime;
uint64_t enddate;
std::string logo;
eosio::asset hourlyreward;
uint64_t totalstaked;
eosio::name farmtype;
std::vector<uint64_t> templates;
uint32_t template_limit;
uint64_t lastupdate;
eosio::name reward_type;
uint64_t hourly_cap;
std::vector<STAKEABLE_COLLECTION> collections;
uint8_t max_bonus_pools;
uint8_t allow_new_members;
eosio::name cpu_payer;
uint64_t time_created;
uint8_t tier;
uint64_t primary_key() const { return ID; }
uint64_t secondarykey() const { return farmname.value; }
uint64_t thirdkey() const { return creator.value; }
uint64_t fourthkey() const { return collection.value; }
uint64_t fifthkey() const { return schema.value; }
};
using farms_table = eosio::multi_index<"farms"_n, farms,
eosio::indexed_by<"farmname"_n, eosio::const_mem_fun<farms, uint64_t, &farms::secondarykey>>,
eosio::indexed_by<"creator"_n, eosio::const_mem_fun<farms, uint64_t, &farms::thirdkey>>,
eosio::indexed_by<"collection"_n, eosio::const_mem_fun<farms, uint64_t, &farms::fourthkey>>,
eosio::indexed_by<"schema"_n, eosio::const_mem_fun<farms, uint64_t, &farms::fifthkey>>
>;
struct [[eosio::table, eosio::contract("farms.waxdao")]] farms_v2 {
eosio::name farmname;
eosio::name creator;
uint64_t time_created;
uint64_t last_state_change;
uint64_t expiration;
uint8_t status;
std::vector<REWARD_POOL> reward_pools;
uint8_t farm_type;
std::vector<STAKEABLE_COLLECTION> collections;
uint64_t total_staked;
uint64_t id;
FARM_PROFILE profile;
SOCIAL_LINKS socials;
uint64_t hours_between_payouts;
uint64_t primary_key() const { return farmname.value; }
uint64_t secondarykey() const { return creator.value; }
uint64_t thirdkey() const { return id; }
};
using v2_farms_t = eosio::multi_index<"farmsv2"_n, farms_v2,
eosio::indexed_by<"creator"_n, eosio::const_mem_fun<farms_v2, uint64_t, &farms_v2::secondarykey>>,
eosio::indexed_by<"id"_n, eosio::const_mem_fun<farms_v2, uint64_t, &farms_v2::thirdkey>>
>;
struct [[eosio::table]] stat {
asset supply;
asset max_supply;
name issuer;
uint64_t primary_key()const { return supply.symbol.code().raw(); }
};
typedef eosio::multi_index< "stat"_n, stat > stat_table;
//Tables on this contract
struct [[eosio::table, eosio::contract(CONTRACT_NAME)]] config2 {
uint64_t ID;
std::vector<RECEIVING_FARM> linked_farms;
std::vector<RECEIVING_DAO> linked_daos;
std::vector<RECEIVING_WALLET> linked_wallets;
uint64_t hours_between_claims;
uint64_t last_claim;
std::vector<eosio::name> authorized_accounts;
uint8_t allow_all_tokens;
uint64_t primary_key() const { return ID; }
};
using configtable = eosio::multi_index<"config2"_n, config2>;
struct [[eosio::table, eosio::contract(CONTRACT_NAME)]] rules {
uint64_t ID;
eosio::symbol token_symbol;
eosio::name contract;
std::vector<RECEIVING_FARM> linked_farms;
std::vector<RECEIVING_DAO> linked_daos;
std::vector<RECEIVING_WALLET> linked_wallets;
uint64_t primary_key() const { return ID; }
uint128_t second_key() const { return mix64to128(token_symbol.code().raw(), contract.value); }
};
using rules_table = eosio::multi_index<"rules"_n, rules,
eosio::indexed_by<"symcontract"_n, eosio::const_mem_fun<rules, uint128_t, &rules::second_key>>
>;