COOPENOMICS  v1
Кооперативная Экономика
table_soviet_participants.hpp
См. документацию.
1#pragma once
2
3#include <eosio/asset.hpp>
4#include <eosio/binary_extension.hpp>
5#include <eosio/eosio.hpp>
6
7#include "../consts.hpp"
8
14struct [[eosio::table, eosio::contract(SOVIET)]] participant {
15 eosio::name username;
16 eosio::time_point_sec created_at;
17 eosio::time_point_sec last_update;
18 eosio::time_point_sec last_min_pay;
19
20 eosio::name status;
21
22 bool is_initial = true;
23 bool is_minimum = true;
24 bool has_vote = true;
25
26 eosio::binary_extension<eosio::name> type;
27 eosio::binary_extension<eosio::name> braname;
28
29 eosio::binary_extension<eosio::asset> initial_amount;
30 eosio::binary_extension<eosio::asset> minimum_amount;
31
32 uint64_t primary_key() const { return username.value; }
33
34 uint64_t bylastpay() const { return last_min_pay.sec_since_epoch(); }
35
36 uint64_t by_created_at() const { return created_at.sec_since_epoch(); }
37
38 bool is_active() const { return status == "accepted"_n; }
39
40 uint64_t by_braname() const { return braname.has_value() ? braname->value : 0; }
41};
42
43typedef eosio::multi_index<
44 "participants"_n, participant,
45 eosio::indexed_by<"bylastpay"_n, eosio::const_mem_fun<participant, uint64_t, &participant::bylastpay>>,
46 eosio::indexed_by<"createdat"_n, eosio::const_mem_fun<participant, uint64_t, &participant::by_created_at>>,
47 eosio::indexed_by<"bybranch"_n, eosio::const_mem_fun<participant, uint64_t, &participant::by_braname>>>
contract
Definition: eosio.msig_tests.cpp:977
Definition: eosio.msig.hpp:34
Definition: table_soviet_participants.hpp:14
eosio::binary_extension< eosio::name > braname
Definition: table_soviet_participants.hpp:27
uint64_t bylastpay() const
Definition: table_soviet_participants.hpp:34
uint64_t by_braname() const
Definition: table_soviet_participants.hpp:40
eosio::name username
Definition: table_soviet_participants.hpp:15
eosio::binary_extension< eosio::name > type
Definition: table_soviet_participants.hpp:26
eosio::binary_extension< eosio::asset > minimum_amount
Definition: table_soviet_participants.hpp:30
eosio::time_point_sec created_at
Definition: table_soviet_participants.hpp:16
eosio::name status
Definition: table_soviet_participants.hpp:20
uint64_t primary_key() const
Definition: table_soviet_participants.hpp:32
eosio::time_point_sec last_update
Definition: table_soviet_participants.hpp:17
eosio::binary_extension< eosio::asset > initial_amount
Definition: table_soviet_participants.hpp:29
eosio::time_point_sec last_min_pay
Definition: table_soviet_participants.hpp:18
uint64_t by_created_at() const
Definition: table_soviet_participants.hpp:36
bool is_active() const
Definition: table_soviet_participants.hpp:38
eosio::multi_index< "participants"_n, participant, eosio::indexed_by<"bylastpay"_n, eosio::const_mem_fun< participant, uint64_t, &participant::bylastpay > >, eosio::indexed_by<"createdat"_n, eosio::const_mem_fun< participant, uint64_t, &participant::by_created_at > >, eosio::indexed_by<"bybranch"_n, eosio::const_mem_fun< participant, uint64_t, &participant::by_braname > > > participants_index
Definition: table_soviet_participants.hpp:48