COOPENOMICS  v1
Кооперативная Экономика
sync_branched.hpp
См. документацию.
1#pragma once
2
17template <typename Index, typename Iterator>
18inline void sync_branched(Index &cooperatives, Iterator coop_itr) {
19 if (coop_itr == cooperatives.end() || !coop_itr->is_cooperative) return;
20
21 const uint64_t participants =
22 coop_itr->active_participants_count.has_value() ? coop_itr->active_participants_count.value() : 0;
23 const bool branched =
24 get_branch_count(coop_itr->username) >= MIN_BRANCHES_COUNT && participants >= MIN_BRANCHED_PARTICIPANTS_COUNT;
25
26 if (coop_itr->is_branched == branched) return;
27
28 cooperatives.modify(coop_itr, RamPayer::of(cooperatives, coop_itr->username), [&](auto &c) {
29 c.is_branched = branched;
30 });
31}
static constexpr uint64_t MIN_BRANCHED_PARTICIPANTS_COUNT
Definition: consts.hpp:295
static constexpr uint64_t MIN_BRANCHES_COUNT
Definition: consts.hpp:288
eosio::name of(const Table &table, eosio::name coopname)
Definition: ram_payer.hpp:78
void sync_branched(Index &cooperatives, Iterator coop_itr)
Пересчёт мажоритарной системы управления кооператива (флаг is_branched).
Definition: sync_branched.hpp:18
uint64_t get_branch_count(eosio::name coopname)
Definition: table_branch_branchstat.hpp:24