COOPENOMICS  v1
Кооперативная Экономика
table_registrator_exits.hpp
См. документацию.
1#pragma once
2
3
4#include "../core/ram_payer.hpp"
5#include <optional>
6
7#include <eosio/asset.hpp>
8#include <eosio/crypto.hpp>
9#include <eosio/eosio.hpp>
10
11#include "../consts.hpp"
12#include "document_core.hpp"
13
14namespace Registrator {
15
16using namespace eosio;
17
42struct [[eosio::table, eosio::contract(REGISTRATOR)]] exit {
45 name status;
46 time_point_sec created_at;
49 checksum256 exit_hash;
50 asset quantity;
51
52 uint64_t primary_key() const { return username.value; }
53 checksum256 by_hash() const { return exit_hash; }
54};
55
56typedef multi_index<
57 "exits"_n, exit,
58 indexed_by<"byhash"_n, const_mem_fun<exit, checksum256, &exit::by_hash>>>
60
61inline std::optional<exit> get_exit_by_hash(name coopname, const checksum256 &hash) {
62 exits_index primary_index(_registrator, coopname.value);
63 auto secondary_index = primary_index.get_index<"byhash"_n>();
64
65 auto itr = secondary_index.find(hash);
66 if (itr == secondary_index.end()) {
67 return std::nullopt;
68 }
69
70 return *itr;
71}
72
73} // namespace Registrator
74
75// Плательщик за оперативную память строк таблицы — правило в lib/core/ram_payer.hpp.
static constexpr eosio::name _registrator
Definition: consts.hpp:178
contract
Definition: eosio.msig_tests.cpp:977
Вспомогательные функции процедуры выхода пайщика из кооператива.
Definition: table_registrator_candidates.hpp:15
multi_index< "exits"_n, exit, indexed_by<"byhash"_n, const_mem_fun< exit, checksum256, &exit::by_hash > > > exits_index
Definition: table_registrator_exits.hpp:59
std::optional< exit > get_exit_by_hash(name coopname, const checksum256 &hash)
Definition: table_registrator_exits.hpp:61
Definition: eosio.msig.hpp:34
Заявление пайщика на выход из кооператива и сопровождающий его процесс возврата паевого взноса.
Definition: table_registrator_exits.hpp:42
uint64_t primary_key() const
Definition: table_registrator_exits.hpp:52
checksum256 by_hash() const
Definition: table_registrator_exits.hpp:53
name coopname
Definition: table_registrator_exits.hpp:44
time_point_sec created_at
Definition: table_registrator_exits.hpp:46
name status
pending | authorized
Definition: table_registrator_exits.hpp:45
document2 approved_statement
решение совета о выходе (авторизация)
Definition: table_registrator_exits.hpp:48
name username
Definition: table_registrator_exits.hpp:43
asset quantity
итоговая сумма возврата (заполняется на confirmexit)
Definition: table_registrator_exits.hpp:50
document2 statement
заявление о выходе (registry 200)
Definition: table_registrator_exits.hpp:47
checksum256 exit_hash
Definition: table_registrator_exits.hpp:49
Definition: table_registrator_orgs.hpp:17
Definition: document_core.hpp:27
RAM_PAYER_CLASS(Registrator::exit, cooperative)