40 checksum256
by_hash()
const {
return invest_hash; }
43typedef eosio::multi_index<
44 "progrinvests"_n, program_invest,
45 indexed_by<
"byusername"_n, const_mem_fun<program_invest, uint64_t, &program_invest::by_username>>,
46 indexed_by<
"byhash"_n, const_mem_fun<program_invest, checksum256, &program_invest::by_hash>>
49namespace ProgramInvests {
57 inline std::optional<program_invest>
get_program_invest(eosio::name coopname,
const checksum256& invest_hash) {
59 auto invest_hash_index = program_invests.get_index<
"byhash"_n>();
60 auto itr = invest_hash_index.find(invest_hash);
62 if (itr != invest_hash_index.end()) {
77 eosio::check(
invest.has_value(),
"Программная инвестиция с указанным хэшем не найдена");
92 checksum256 invest_hash,
100 program_invests.emplace(coopname, [&](
auto &i){
102 i.coopname = coopname;
103 i.username = username;
104 i.invest_hash = invest_hash;
106 i.invested_at = current_time_point();
107 i.statement = statement;
133 auto invest_hash_index = program_invests.get_index<
"byhash"_n>();
134 auto itr = invest_hash_index.find(invest_hash);
136 eosio::check(itr != invest_hash_index.end(),
"Программная инвестиция для удаления не найдена");
137 invest_hash_index.erase(itr);
static constexpr eosio::name _capital
Definition: consts.hpp:150
contract
Definition: eosio.msig_tests.cpp:977
share_type amount
Definition: eosio.token_tests.cpp:174
uint64_t get_global_id_in_scope(eosio::name _me, eosio::name scope, eosio::name key)
Definition: counts.hpp:61
const eosio::name CREATED
Программная инвестиция создана
Definition: program_invests.hpp:14
Definition: program_invests.hpp:6
void remove_program_invest(eosio::name coopname, const checksum256 &invest_hash)
Удаляет программную инвестицию после обработки.
Definition: program_invests.hpp:131
program_invest get_program_invest_or_fail(eosio::name coopname, const checksum256 &invest_hash)
Получает программную инвестицию по хэшу или завершает выполнение с ошибкой.
Definition: program_invests.hpp:75
void create_program_invest_with_approve(eosio::name coopname, eosio::name username, checksum256 invest_hash, eosio::asset amount, document2 statement)
Создает программную инвестицию и отправляет её на утверждение.
Definition: program_invests.hpp:89
std::optional< program_invest > get_program_invest(eosio::name coopname, const checksum256 &invest_hash)
Получает программную инвестицию по хэшу.
Definition: program_invests.hpp:57
Definition: balances.cpp:6
eosio::multi_index< "progrinvests"_n, program_invest, indexed_by<"byusername"_n, const_mem_fun< program_invest, uint64_t, &program_invest::by_username > >, indexed_by<"byhash"_n, const_mem_fun< program_invest, checksum256, &program_invest::by_hash > > > program_invest_index
Definition: program_invests.hpp:47
constexpr eosio::name CREATE_PROGRAM_INVESTMENT
Definition: shared_names.hpp:109
constexpr eosio::name DECLINE_PROGRAM_INVESTMENT
Definition: shared_names.hpp:44
constexpr eosio::name APPROVE_PROGRAM_INVESTMENT
Definition: shared_names.hpp:43
void create_approval(name calling_contract, CREATEAPPRV_SIGNATURE)
Создаёт аппрув в совете
Definition: shared_soviet.hpp:73
Definition: eosio.msig.hpp:34
Таблица инвестиций хранит данные о вложениях в проекты.
Definition: invests.hpp:27
Таблица программных инвестиций хранит данные об инвестициях в программу капитализации.
Definition: program_invests.hpp:28
checksum256 by_hash() const
Индекс по хэшу инвестиции (3)
Definition: program_invests.hpp:40
document2 statement
Заявление на инвестицию
Definition: program_invests.hpp:35
checksum256 invest_hash
Хэш инвестиции
Definition: program_invests.hpp:32
eosio::name status
Статус инвестиции
Definition: program_invests.hpp:33
eosio::name username
Имя инвестора
Definition: program_invests.hpp:31
time_point_sec invested_at
Время создания инвестиции
Definition: program_invests.hpp:34
eosio::name coopname
Имя кооператива
Definition: program_invests.hpp:30
uint64_t by_username() const
Индекс по имени пользователя (2)
Definition: program_invests.hpp:39
uint64_t primary_key() const
Первичный ключ (1)
Definition: program_invests.hpp:38
uint64_t id
ID программной инвестиции (внутренний ключ)
Definition: program_invests.hpp:29
eosio::asset amount
Сумма инвестиции
Definition: program_invests.hpp:36
Definition: drafts.hpp:28