COOPENOMICS  v1
Кооперативная Экономика
project_withdraw.hpp
См. документацию.
1#pragma once
2
3using namespace eosio;
4using std::string;
5
13 namespace Status {
14 const eosio::name CREATED = "created"_n;
15 const eosio::name APPROVED = "approved"_n;
16 }
17}
18
19namespace Capital {
20
29 struct [[eosio::table, eosio::contract(CAPITAL)]] project_withdraw {
30 uint64_t id;
31 name coopname;
32 checksum256 project_hash;
33 checksum256 withdraw_hash;
34 name username;
35 name status;
36 asset amount = asset(0, _root_govern_symbol);
38
39 time_point_sec created_at = current_time_point();
40
41 uint64_t primary_key() const { return id; }
42 uint64_t by_username() const { return username.value; }
43 checksum256 by_hash() const { return withdraw_hash; }
44 checksum256 by_project_hash() const { return project_hash; }
45 };
46
47typedef eosio::multi_index<"prjwithdraws"_n, project_withdraw,
48 indexed_by<"byhash"_n, const_mem_fun<project_withdraw, checksum256, &project_withdraw::by_hash>>,
49 indexed_by<"byusername"_n, const_mem_fun<project_withdraw, uint64_t, &project_withdraw::by_username>>
51
58inline std::optional<project_withdraw> get_project_withdraw(eosio::name coopname, const checksum256 &hash) {
59 Capital::project_withdraws_index project_withdraws(_capital, coopname.value);
60 auto index = project_withdraws.get_index<"byhash"_n>();
61
62 auto itr = index.find(hash);
63
64 if (itr == index.end()) {
65 return std::nullopt;
66 }
67
68 return *itr;
69}
70
71}// namespace Capital
static constexpr eosio::name _capital
Definition: consts.hpp:150
static constexpr eosio::symbol _root_govern_symbol
Definition: consts.hpp:210
contract
Definition: eosio.msig_tests.cpp:977
share_type amount
Definition: eosio.token_tests.cpp:174
const eosio::name CREATED
Запрос на возврат создан
Definition: project_withdraw.hpp:14
const eosio::name APPROVED
Запрос на возврат одобрен
Definition: project_withdraw.hpp:15
Definition: project_withdraw.hpp:6
Definition: balances.cpp:6
eosio::multi_index<"prjwithdraws"_n, project_withdraw, indexed_by<"byhash"_n, const_mem_fun< project_withdraw, checksum256, &project_withdraw::by_hash > >, indexed_by<"byusername"_n, const_mem_fun< project_withdraw, uint64_t, &project_withdraw::by_username > > > project_withdraws_index
Таблица для хранения запросов на возврат из проекта.
Definition: project_withdraw.hpp:50
std::optional< project_withdraw > get_project_withdraw(eosio::name coopname, const checksum256 &hash)
Получает запрос на возврат из проекта по хэшу.
Definition: project_withdraw.hpp:58
Definition: eosio.msig.hpp:34
Таблица возвратов из проекта хранит данные о запросах на возврат средств из проектов.
Definition: project_withdraw.hpp:29
uint64_t id
ID запроса на возврат (внутренний ключ)
Definition: project_withdraw.hpp:30
checksum256 by_hash() const
Индекс по хэшу запроса (3)
Definition: project_withdraw.hpp:43
document2 statement
Заявление на возврат паевого взноса деньгами
Definition: project_withdraw.hpp:37
checksum256 by_project_hash() const
Индекс по хэшу проекта (4)
Definition: project_withdraw.hpp:44
name username
Имя участника, запрашивающего возврат
Definition: project_withdraw.hpp:34
name coopname
Имя кооператива
Definition: project_withdraw.hpp:31
checksum256 withdraw_hash
Хэш запроса на возврат
Definition: project_withdraw.hpp:33
name status
Статус запроса (created | approved)
Definition: project_withdraw.hpp:35
uint64_t by_username() const
Индекс по имени пользователя (2)
Definition: project_withdraw.hpp:42
uint64_t primary_key() const
Первичный ключ (1)
Definition: project_withdraw.hpp:41
checksum256 project_hash
Хэш проекта
Definition: project_withdraw.hpp:32
Definition: drafts.hpp:28