COOPENOMICS  v1
Кооперативная Экономика
shared_branch.hpp
См. документацию.
1#pragma once
2
3namespace Branch {
9 uint64_t get_branch_count(eosio::name coopname) {
10 branchstat_index stat(_branch, _branch.value);
11 auto st = stat.find(coopname.value);
12
13 if (st == stat.end()) {
14 return 0;
15 }
16
17 return st->count;
18 }
19
26 bool is_trustee(eosio::name coopname, eosio::name username) {
27 branch_index branches(_branch, coopname.value);
28
29 auto by_trustee_index = branches.get_index<"bytrustee"_n>();
30 auto trustee_itr = by_trustee_index.find(username.value);
31
32 return trustee_itr != by_trustee_index.end();
33 }
34
42 bool is_trusted(eosio::name coopname, eosio::name braname, eosio::name username) {
43 branch_index branches(_branch, coopname.value);
44 auto branch_itr = branches.find(braname.value);
45
46 if (branch_itr == branches.end()) {
47 return false;
48 }
49
50 return branch_itr->is_account_in_trusted(username);
51 }
52
53}
static constexpr eosio::name _branch
Definition: consts.hpp:160
eosio::multi_index<"branchstat"_n, branchstat > branchstat_index
Definition: branch.hpp:18
eosio::multi_index<"branches"_n, coobranch, eosio::indexed_by<"bytrustee"_n, eosio::const_mem_fun< coobranch, uint64_t, &coobranch::by_trustee > > > branch_index
Definition: branch.hpp:109
Definition: shared_branch.hpp:3
bool is_trusted(eosio::name coopname, eosio::name braname, eosio::name username)
Проверяет, является ли пользователь доверенным лицом (trusted) в указанном участке кооператива
Definition: shared_branch.hpp:42
bool is_trustee(eosio::name coopname, eosio::name username)
Проверяет, является ли пользователь уполномоченным лицом (trustee) кооперативного участка
Definition: shared_branch.hpp:26
uint64_t get_branch_count(eosio::name coopname)
Получает количество кооперативных участков для данного кооператива
Definition: shared_branch.hpp:9