3#include <eosio/eosio.hpp>
4#include <eosio/asset.hpp>
17 constexpr eosio::name
CREATED =
"created"_n;
20 constexpr eosio::name
ACT1 =
"act1"_n;
21 constexpr eosio::name
ACT2 =
"act2"_n;
53typedef eosio::multi_index<
54 "pgproperties"_n, program_property,
55 indexed_by<
"byusername"_n, const_mem_fun<program_property, uint64_t, &program_property::by_username>>,
56 indexed_by<
"byhash"_n, const_mem_fun<program_property, checksum256, &program_property::by_property_hash>>
65 inline std::optional<program_property>
get_program_property(eosio::name coopname,
const checksum256 &hash) {
67 auto property_hash_index = properties.get_index<
"byhash"_n>();
69 auto itr = property_hash_index.find(hash);
70 if (itr == property_hash_index.end()) {
85 eosio::check(property.has_value(),
"Предложение по программному имущественному взносу не найдено");
87 return property.value();
97 auto property_hash_index = properties.get_index<
"byhash"_n>();
99 auto itr = property_hash_index.find(hash);
100 eosio::check(itr != property_hash_index.end(),
"Предложение по программному имущественному взносу не найдено");
102 properties.erase(*itr);
115 eosio::name coopname,
116 eosio::name username,
117 checksum256 property_hash,
118 const eosio::asset &property_amount,
119 const std::string &property_description,
127 properties.emplace(coopname, [&](
auto &p) {
130 p.coopname = coopname;
131 p.username = username;
132 p.property_hash = property_hash;
133 p.property_amount = property_amount;
134 p.property_description = property_description;
135 p.statement = statement;
136 p.created_at = current_time_point();
162 auto property_hash_index = properties.get_index<
"byhash"_n>();
164 auto itr = property_hash_index.find(property_hash);
165 eosio::check(itr != property_hash_index.end(),
"Предложение по программному имущественному взносу не найдено");
167 property_hash_index.modify(itr,
_capital, [&](
auto &p) {
168 p.status = new_status;
177 auto property_hash_index = properties.get_index<
"byhash"_n>();
179 auto itr = property_hash_index.find(property_hash);
180 eosio::check(itr != property_hash_index.end(),
"Предложение по программному имущественному взносу не найдено");
182 property_hash_index.modify(itr,
_capital, [&](
auto &p) {
183 p.statement = approved_statement;
192 auto property_hash_index = properties.get_index<
"byhash"_n>();
194 auto itr = property_hash_index.find(property_hash);
195 eosio::check(itr != property_hash_index.end(),
"Предложение по программному имущественному взносу не найдено");
197 property_hash_index.modify(itr,
_capital, [&](
auto &p) {
198 p.authorization = authorization;
207 auto property_hash_index = properties.get_index<
"byhash"_n>();
209 auto itr = property_hash_index.find(property_hash);
210 eosio::check(itr != property_hash_index.end(),
"Предложение по программному имущественному взносу не найдено");
212 property_hash_index.modify(itr,
_capital, [&](
auto &p) {
222 auto property_hash_index = properties.get_index<
"byhash"_n>();
224 auto itr = property_hash_index.find(property_hash);
225 eosio::check(itr != property_hash_index.end(),
"Предложение по программному имущественному взносу не найдено");
227 property_hash_index.modify(itr,
_capital, [&](
auto &p) {
static constexpr eosio::name _capital
Definition: consts.hpp:150
contract
Definition: eosio.msig_tests.cpp:977
uint64_t get_global_id_in_scope(eosio::name _me, eosio::name scope, eosio::name key)
Definition: counts.hpp:61
constexpr eosio::name AUTHORIZED
Программный имущественный взнос авторизован
Definition: program_properties.hpp:19
constexpr eosio::name ACT2
Второй акт подписан
Definition: program_properties.hpp:21
constexpr eosio::name CREATED
Программный имущественный взнос создан
Definition: program_properties.hpp:17
constexpr eosio::name APPROVED
Программный имущественный взнос одобрен
Definition: program_properties.hpp:18
constexpr eosio::name ACT1
Первый акт подписан
Definition: program_properties.hpp:20
Definition: program_properties.hpp:9
void set_program_property_act1(eosio::name coopname, const checksum256 &property_hash, const document2 &act1)
Устанавливает первый акт
Definition: program_properties.hpp:205
void set_program_property_act2(eosio::name coopname, const checksum256 &property_hash, const document2 &act2)
Устанавливает второй акт
Definition: program_properties.hpp:220
std::optional< program_property > get_program_property(eosio::name coopname, const checksum256 &hash)
Получает программное предложение по хэшу.
Definition: program_properties.hpp:65
void update_program_property_status(eosio::name coopname, const checksum256 &property_hash, eosio::name new_status)
Обновляет статус программного предложения
Definition: program_properties.hpp:160
void create_program_property_with_approve(eosio::name coopname, eosio::name username, checksum256 property_hash, const eosio::asset &property_amount, const std::string &property_description, const document2 &statement)
Создает предложение по программному имущественному взносу и отправляет его на утверждение.
Definition: program_properties.hpp:114
program_property get_program_property_or_fail(eosio::name coopname, const checksum256 &hash)
Получает программное предложение по хэшу или падает с ошибкой.
Definition: program_properties.hpp:83
void set_program_property_authorization(eosio::name coopname, const checksum256 &property_hash, const document2 &authorization)
Устанавливает решение совета
Definition: program_properties.hpp:190
eosio::multi_index< "pgproperties"_n, program_property, indexed_by<"byusername"_n, const_mem_fun< program_property, uint64_t, &program_property::by_username > >, indexed_by<"byhash"_n, const_mem_fun< program_property, checksum256, &program_property::by_property_hash > > > program_property_index
Definition: program_properties.hpp:57
void set_program_property_approved_statement(eosio::name coopname, const checksum256 &property_hash, const document2 &approved_statement)
Устанавливает одобренное заявление
Definition: program_properties.hpp:175
void delete_program_property(eosio::name coopname, const checksum256 &hash)
Удаляет программное предложение по хэшу.
Definition: program_properties.hpp:95
constexpr eosio::name CREATE_PROGRAM_PROPERTY
Definition: shared_names.hpp:106
constexpr eosio::name DECLINE_PROGRAM_PROPERTY
Definition: shared_names.hpp:25
constexpr eosio::name APPROVE_PROGRAM_PROPERTY
Definition: shared_names.hpp:24
void create_approval(name calling_contract, CREATEAPPRV_SIGNATURE)
Создаёт аппрув в совете
Definition: shared_soviet.hpp:73
Definition: eosio.msig.hpp:34
Таблица программных имущественных взносов хранит данные о предложениях по имущественным взносам в про...
Definition: program_properties.hpp:35
document2 statement
Заявление о внесении имущества
Definition: program_properties.hpp:43
uint64_t primary_key() const
Первичный ключ (1)
Definition: program_properties.hpp:48
document2 act
Акт
Definition: program_properties.hpp:45
time_point_sec created_at
Время создания предложения
Definition: program_properties.hpp:46
checksum256 by_property_hash() const
Индекс по хэшу предложения (3)
Definition: program_properties.hpp:50
checksum256 property_hash
Хэш предложения
Definition: program_properties.hpp:40
uint64_t id
ID программного имущественного взноса (внутренний ключ)
Definition: program_properties.hpp:36
document2 authorization
Решение совета
Definition: program_properties.hpp:44
eosio::asset property_amount
Оценочная стоимость имущества
Definition: program_properties.hpp:41
name status
Статус предложения (created | approved | authorized | act1 | act2)
Definition: program_properties.hpp:39
name username
Имя пользователя, подающего предложение
Definition: program_properties.hpp:38
uint64_t by_username() const
Индекс по имени пользователя (2)
Definition: program_properties.hpp:49
std::string property_description
Описание имущества
Definition: program_properties.hpp:42
name coopname
Имя кооператива
Definition: program_properties.hpp:37
Definition: drafts.hpp:28