1#include <eosio/binary_extension.hpp>
4 for (
const auto& payer : payers) {
13 for (
const auto& payer : payers) {
14 if (has_auth(payer)) {
18 eosio::check(
false,
"Недостаточно прав доступа");
78 return username.value;
91 uint64_t
by_type()
const {
return type.value; }
106 return status ==
"active"_n;
110 return registered_at.sec_since_epoch();
118 for (
const auto& v : verifications) {
132 for (
const auto& v : verifications) {
141typedef eosio::multi_index<
143 eosio::indexed_by<
"byreferer"_n, eosio::const_mem_fun<account, uint64_t, &account::by_referer>>,
144 eosio::indexed_by<
"bytype"_n, eosio::const_mem_fun<account, uint64_t, &account::by_type>>,
145 eosio::indexed_by<
"bystatus"_n, eosio::const_mem_fun<account, uint64_t, &account::by_status>>,
146 eosio::indexed_by<
"byregistr"_n, eosio::const_mem_fun<account, uint64_t, &account::by_registr>>,
147 eosio::indexed_by<
"byregistred"_n, eosio::const_mem_fun<account, uint64_t, &account::by_registered_at>>,
148 eosio::indexed_by<
"byverif"_n, eosio::const_mem_fun<account, uint64_t,&account::is_verified_index>>
186 bool is_cooperative =
false;
188 bool is_branched =
false;
189 bool is_enrolled =
false;
201 eosio::binary_extension<eosio::name>
status;
212 return username.value;
219 eosio::check(initial.symbol == contribution.symbol && minimum.symbol == contribution.symbol,
"Неверный контракт токена");
223 return status.has_value() ? status.value().value : 0;
227 return created_at.has_value() ? created_at.value().sec_since_epoch() : 0;
234 return parent_username.value;
242 return combine_ids(username.value, parent_username.value);
250 return is_cooperative ==
true ? 1 : 0;
258 return coop_type.value;
267 return is_cooperative;
273eosio::indexed_by<
"iscoop"_n, eosio::const_mem_fun<
cooperative, uint64_t,
275eosio::indexed_by<
"byparent"_n, eosio::const_mem_fun<
cooperative, uint64_t,
277eosio::indexed_by<
"bycoopchilds"_n, eosio::const_mem_fun<cooperative, uint128_t, &cooperative::by_coop_childs>>,
278eosio::indexed_by<
"bycooptype"_n, eosio::const_mem_fun<cooperative, uint64_t, &cooperative::bycooptype>>
297 bool is_cooperative =
false;
299 bool is_branched =
false;
300 bool is_enrolled =
false;
312 eosio::binary_extension<eosio::name>
status;
324 return username.value;
331 eosio::check(initial.symbol == contribution.symbol && minimum.symbol == contribution.symbol,
"Неверный контракт токена");
335 return status.has_value() ? status.value().value : 0;
339 return created_at.has_value() ? created_at.value().sec_since_epoch() : 0;
346 return parent_username.value;
354 return combine_ids(username.value, parent_username.value);
362 return is_cooperative ==
true ? 1 : 0;
370 return coop_type.value;
379 return is_cooperative;
385eosio::indexed_by<
"iscoop"_n, eosio::const_mem_fun<
cooperative2, uint64_t,
387eosio::indexed_by<
"byparent"_n, eosio::const_mem_fun<
cooperative2, uint64_t,
389eosio::indexed_by<
"bycoopchilds"_n, eosio::const_mem_fun<cooperative2, uint128_t, &cooperative2::by_coop_childs>>,
390eosio::indexed_by<
"bycooptype"_n, eosio::const_mem_fun<cooperative2, uint64_t, &cooperative2::bycooptype>>
396 auto org = coops.find(coopname.value);
397 eosio::check(org != coops.end(),
"Организация не найдена");
398 eosio::check(org -> is_coop(),
"Организация - не кооператив");
399 eosio::check(org -> status.value() ==
"active"_n,
"Кооператив не активен");
407 auto account = accounts.find(username.value);
408 eosio::check(
account != accounts.end(),
"Аккаунт не найден");
account get_account_or_fail(eosio::name username)
Definition: accounts.hpp:405
bool check_auth_and_get_payer(const std::vector< eosio::name > &payers)
Definition: accounts.hpp:3
eosio::multi_index<"orgs"_n, cooperative, eosio::indexed_by<"iscoop"_n, eosio::const_mem_fun< cooperative, uint64_t, &cooperative::is_coop_index > >, eosio::indexed_by<"byparent"_n, eosio::const_mem_fun< cooperative, uint64_t, &cooperative::by_parent > >, eosio::indexed_by<"bycoopchilds"_n, eosio::const_mem_fun< cooperative, uint128_t, &cooperative::by_coop_childs > >, eosio::indexed_by<"bycooptype"_n, eosio::const_mem_fun< cooperative, uint64_t, &cooperative::bycooptype > > > cooperatives_index
Definition: accounts.hpp:283
eosio::name check_auth_and_get_payer_or_fail(const std::vector< eosio::name > &payers)
Definition: accounts.hpp:12
cooperative2 get_cooperative_or_fail(eosio::name coopname)
Definition: accounts.hpp:394
eosio::multi_index< "accounts"_n, account, eosio::indexed_by< "byreferer"_n, eosio::const_mem_fun< account, uint64_t, &account::by_referer > >, eosio::indexed_by<"bytype"_n, eosio::const_mem_fun< account, uint64_t, &account::by_type > >, eosio::indexed_by<"bystatus"_n, eosio::const_mem_fun< account, uint64_t, &account::by_status > >, eosio::indexed_by<"byregistr"_n, eosio::const_mem_fun< account, uint64_t, &account::by_registr > >, eosio::indexed_by<"byregistred"_n, eosio::const_mem_fun< account, uint64_t, &account::by_registered_at > >, eosio::indexed_by<"byverif"_n, eosio::const_mem_fun< account, uint64_t,&account::is_verified_index > > > accounts_index
Definition: accounts.hpp:150
eosio::multi_index<"coops"_n, cooperative2, eosio::indexed_by<"iscoop"_n, eosio::const_mem_fun< cooperative2, uint64_t, &cooperative2::is_coop_index > >, eosio::indexed_by<"byparent"_n, eosio::const_mem_fun< cooperative2, uint64_t, &cooperative2::by_parent > >, eosio::indexed_by<"bycoopchilds"_n, eosio::const_mem_fun< cooperative2, uint128_t, &cooperative2::by_coop_childs > >, eosio::indexed_by<"bycooptype"_n, eosio::const_mem_fun< cooperative2, uint64_t, &cooperative2::bycooptype > > > cooperatives2_index
Definition: accounts.hpp:391
Класс registrator служит воротами в блокчейн-систему для новых участников, позволяя регистрировать ак...
Definition: registrator.hpp:54
static constexpr eosio::name _registrator
Definition: consts.hpp:157
contract
Definition: eosio.msig_tests.cpp:977
Definition: eosio.msig.hpp:34
Структура, представляющая учетные записи аккаунтов.
Definition: accounts.hpp:60
bool is_verified() const
Проверяет, верифицирована ли организация.
Definition: accounts.hpp:117
eosio::name type
Тип аккаунта: individual | entrepreneur | org.
Definition: accounts.hpp:64
eosio::time_point_sec registered_at
Время регистрации аккаунта.
Definition: accounts.hpp:71
bool is_active() const
Definition: accounts.hpp:105
uint64_t by_registered_at() const
Definition: accounts.hpp:109
uint64_t primary_key() const
Возвращает первичный ключ учетной записи аккаунта.
Definition: accounts.hpp:77
eosio::name username
Имя аккаунта гостя. Имя пользователя в системе.
Definition: accounts.hpp:61
eosio::name registrator
Имя аккаунта регистратора, который создал этот аккаунт.
Definition: accounts.hpp:63
uint64_t by_status() const
Возвращает ключ по статусу аккаунта.
Definition: accounts.hpp:97
uint64_t is_verified_index() const
Возвращает индекс для определения, является ли организация верифицированной.
Definition: accounts.hpp:131
eosio::name status
Статус аккаунта
Definition: accounts.hpp:65
std::vector< eosio::name > storages
Хранилища персональных данных и идентификаторы данных в них.
Definition: accounts.hpp:68
uint64_t by_type() const
Возвращает ключ по типу аккаунта.
Definition: accounts.hpp:91
std::string meta
Дополнительная мета-информация о аккаунте.
Definition: accounts.hpp:66
uint64_t by_registr() const
Возвращает ключ по регистратору.
Definition: accounts.hpp:103
eosio::name referer
Имя аккаунта, который был реферером при регистрации.
Definition: accounts.hpp:62
std::vector< verification > verifications
Информация о верификации пользователя.
Definition: accounts.hpp:69
uint64_t by_referer() const
Возвращает ключ по рефереру.
Definition: accounts.hpp:85
Структура, представляющая организации с новым документом document2.
Definition: accounts.hpp:291
eosio::binary_extension< document2 > document
Подписанный документ соглашения на подключение
Definition: accounts.hpp:314
eosio::binary_extension< eosio::asset > org_minimum
Минимальный паевой взнос юридического лица
Definition: accounts.hpp:310
eosio::binary_extension< eosio::time_point_sec > created_at
Дата поступления заявки на подключение (pending | ... | active | blocked)
Definition: accounts.hpp:313
eosio::name parent_username
Имя родительской организации, если есть.
Definition: accounts.hpp:293
std::string description
Описание организации.
Definition: accounts.hpp:296
eosio::binary_extension< eosio::name > status
Статус процесса подключения
Definition: accounts.hpp:312
eosio::asset minimum
Минимальный паевой взнос физического лица / ип
Definition: accounts.hpp:306
void check_symbol_or_fail(eosio::asset contribution)
Сравнивает символ токена кооператива и представленный
Definition: accounts.hpp:330
uint64_t by_created() const
Definition: accounts.hpp:338
uint64_t by_parent() const
Возвращает ключ по родительской организации.
Definition: accounts.hpp:345
eosio::binary_extension< eosio::asset > org_initial
Вступительный членский взнос юридического лица
Definition: accounts.hpp:309
uint64_t bycooptype() const
Возвращает ключ для индекса по типу некоммерческой организации (если это кооператив).
Definition: accounts.hpp:369
bool is_coop() const
Проверяет, является ли организация кооперативом.
Definition: accounts.hpp:378
uint64_t primary_key() const
Возвращает первичный ключ учетной записи организации.
Definition: accounts.hpp:323
std::string announce
Анонс организации.
Definition: accounts.hpp:295
eosio::name username
Имя аккаунта организации.
Definition: accounts.hpp:292
uint128_t by_coop_childs() const
Возвращает ключ для индекса кооперативных подразделений организации.
Definition: accounts.hpp:353
uint64_t is_coop_index() const
Возвращает индекс для определения, является ли организация кооперативом.
Definition: accounts.hpp:361
uint64_t by_status() const
Definition: accounts.hpp:334
eosio::binary_extension< uint64_t > active_participants_count
Счетчик активных пайщиков в кооперативе
Definition: accounts.hpp:315
eosio::asset registration
Регистрационный взнос физического лица / ип
Definition: accounts.hpp:304
eosio::binary_extension< eosio::asset > org_registration
Регистрационный взнос юридического лица
Definition: accounts.hpp:308
eosio::name coop_type
Тип некоммерческой организации (если это кооператив).
Definition: accounts.hpp:302
eosio::asset initial
Вступительный членский взнос физического лица / ип
Definition: accounts.hpp:305
Структура, представляющая организации.
Definition: accounts.hpp:180
eosio::asset minimum
Минимальный паевой взнос физического лица / ип
Definition: accounts.hpp:195
uint64_t is_coop_index() const
Возвращает индекс для определения, является ли организация кооперативом.
Definition: accounts.hpp:249
uint64_t by_parent() const
Возвращает ключ по родительской организации.
Definition: accounts.hpp:233
eosio::binary_extension< eosio::asset > org_initial
Вступительный членский взнос юридического лица
Definition: accounts.hpp:198
std::string description
Описание организации.
Definition: accounts.hpp:185
eosio::binary_extension< document > document
Подписанный документ соглашения на подключение
Definition: accounts.hpp:203
std::string announce
Анонс организации.
Definition: accounts.hpp:184
eosio::binary_extension< eosio::asset > org_minimum
Минимальный паевой взнос юридического лица
Definition: accounts.hpp:199
eosio::binary_extension< eosio::time_point_sec > created_at
Дата поступления заявки на подключение (pending | ... | active | blocked)
Definition: accounts.hpp:202
eosio::name parent_username
Имя родительской организации, если есть.
Definition: accounts.hpp:182
eosio::binary_extension< eosio::asset > org_registration
Регистрационный взнос юридического лица
Definition: accounts.hpp:197
uint64_t by_status() const
Definition: accounts.hpp:222
eosio::name coop_type
Тип некоммерческой организации (если это кооператив).
Definition: accounts.hpp:191
bool is_coop() const
Проверяет, является ли организация кооперативом.
Definition: accounts.hpp:266
uint64_t bycooptype() const
Возвращает ключ для индекса по типу некоммерческой организации (если это кооператив).
Definition: accounts.hpp:257
uint128_t by_coop_childs() const
Возвращает ключ для индекса кооперативных подразделений организации.
Definition: accounts.hpp:241
eosio::asset registration
Регистрационный взнос физического лица / ип
Definition: accounts.hpp:193
eosio::asset initial
Вступительный членский взнос физического лица / ип
Definition: accounts.hpp:194
eosio::binary_extension< eosio::name > status
Статус процесса подключения
Definition: accounts.hpp:201
uint64_t by_created() const
Definition: accounts.hpp:226
void check_symbol_or_fail(eosio::asset contribution)
Сравнивает символ токена кооператива и представленный
Definition: accounts.hpp:218
uint64_t primary_key() const
Возвращает первичный ключ учетной записи организации.
Definition: accounts.hpp:211
eosio::name username
Имя аккаунта организации.
Definition: accounts.hpp:181
Структура данных нового юридического лица
Definition: accounts.hpp:161
eosio::asset minimum
Минимальный паевой взнос физического лица / ип
Definition: accounts.hpp:167
eosio::asset org_initial
Вступительный взнос юридического лица
Definition: accounts.hpp:169
eosio::asset initial
Вступительный взнос физического лица / ип
Definition: accounts.hpp:166
std::string description
Описание
Definition: accounts.hpp:165
bool is_cooperative
Является ли кооперативом
Definition: accounts.hpp:162
eosio::name coop_type
Тип кооператива (union, conscoop, prodcoop, agricoop, builderscoop, nonprofitorg)
Definition: accounts.hpp:163
std::string announce
Анонс
Definition: accounts.hpp:164
eosio::asset org_minimum
Минимальный паевой взнос юридического лица
Definition: accounts.hpp:170
Структура, представляющая верификацию.
Definition: accounts.hpp:35
eosio::name procedure
Тип процедуры верификации
Definition: accounts.hpp:38
std::string notice
Дополнительная информация
Definition: accounts.hpp:51
eosio::time_point_sec last_update
Время последнего обновления записи
Definition: accounts.hpp:50
eosio::name verificator
Организация, которая произвела верификацию
Definition: accounts.hpp:36
eosio::time_point_sec created_at
Время создания записи
Definition: accounts.hpp:49
bool is_verified
Флаг, указывающий, прошла ли верификация
Definition: accounts.hpp:37
static uint128_t combine_ids(const uint64_t &x, const uint64_t &y)
Definition: utils.hpp:5