22 auto st = stat.find(coopname.value);
24 uint64_t new_count = 0;
26 if (st == stat.end()){
28 stat.emplace(coopname, [&](
auto &s){
29 s.coopname = coopname;
33 new_count = st -> count + 1;
34 stat.modify(st, coopname, [&](
auto &s){
44 auto st = stat.find(coopname.value);
45 uint64_t new_count = 0;
47 eosio::check(st != stat.end(),
"Нет кооперативных участков");
48 eosio::check( st -> count > 0,
"Системная ошибка");
50 new_count = st -> count - 1;
52 stat.modify(st, coopname, [&](
auto &s){
82 auto itr = std::remove(trusted.begin(), trusted.end(),
account);
83 check(itr != trusted.end(),
"Account not found in trusted list");
84 trusted.erase(itr, trusted.end());
88 return std::find(trusted.begin(), trusted.end(),
account) != trusted.end();
98 if (trustee == username) {
103 return is_account_in_trusted(username);
107typedef eosio::multi_index<
"branches"_n,
coobranch,
108 eosio::indexed_by<
"bytrustee"_n, eosio::const_mem_fun<coobranch, uint64_t, &coobranch::by_trustee>>
114 auto branch = branches.find(braname.value);
116 eosio::check(
branch != branches.end(),
"Кооперативный Участок не найден");
Константы контракта кооперативных участков
Definition: branch.hpp:51
static constexpr eosio::name _branch
Definition: consts.hpp:160
contract
Definition: eosio.msig_tests.cpp:977
eosio::multi_index<"branchstat"_n, branchstat > branchstat_index
Definition: branch.hpp:18
uint64_t add_branch_count(eosio::name coopname)
Definition: branch.hpp:20
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
coobranch get_branch_or_fail(eosio::name coopname, eosio::name braname)
Definition: branch.hpp:112
uint64_t sub_branch_count(eosio::name coopname)
Definition: branch.hpp:42
Definition: eosio.msig.hpp:34
Структура, представляющая учетные записи аккаунтов.
Definition: accounts.hpp:60
Таблица статистики кооперативных участков хранит количество участков для каждого кооператива.
Definition: branch.hpp:11
uint64_t count
Количество кооперативных участков
Definition: branch.hpp:13
uint64_t primary_key() const
Definition: branch.hpp:15
eosio::name coopname
Имя кооператива
Definition: branch.hpp:12
Таблица кооперативных участков хранит информацию о кооперативных участках и их доверенных лицах.
Definition: branch.hpp:68
uint64_t by_trustee() const
Индекс по доверенному лицу (2)
Definition: branch.hpp:75
void add_account_to_trusted(const eosio::name &account)
Definition: branch.hpp:77
uint64_t primary_key() const
Первичный ключ (1)
Definition: branch.hpp:74
void remove_account_from_trusted(const eosio::name &account)
Definition: branch.hpp:81
bool is_user_authorized(const eosio::name &username) const
Проверяет права доступа пользователя к данному кооперативному участку
Definition: branch.hpp:96
bool is_account_in_trusted(const eosio::name &account) const
Definition: branch.hpp:87
eosio::name trustee
Председатель кооперативного участка
Definition: branch.hpp:70
std::vector< eosio::name > trusted
Список доверенных лиц кооперативного участка
Definition: branch.hpp:71
eosio::name braname
Имя кооперативного участка
Definition: branch.hpp:69