COOPENOMICS  v1
Кооперативная Экономика
table_marketplace_writeoff_proposals.hpp
См. документацию.
1#pragma once
2
3#include <eosio/asset.hpp>
4#include <eosio/crypto.hpp>
5#include <eosio/eosio.hpp>
6#include <string>
7#include <vector>
8
9#include "../consts.hpp"
10#include "../core/document.hpp"
11#include "../core/utils.hpp"
12
13namespace Marketplace {
14
15using namespace eosio;
16
34namespace WroffStatus {
35 // on-chain имена 1:1 совпадают с YAML (имя PROPOSED вместо DRAFT — чтобы
36 // не конфликтовать с макросом DRAFT из lib/consts.hpp).
37 inline constexpr eosio::name PROPOSED = "proposed"_n;
38 inline constexpr eosio::name AUTHORIZED = "authorized"_n;
39}
40
67struct wroff_item {
68 uint64_t source_order_id = 0;
69 eosio::name braname;
70 eosio::asset amount = asset(0, _root_govern_symbol);
71 std::string meta;
72 bool executed = false;
73};
74
90struct [[eosio::table, eosio::contract(MARKETPLACE)]] writeoff_proposal {
91 uint64_t id;
92 checksum256 hash;
93 eosio::name coopname;
94 eosio::name proposed_by;
95 eosio::name decided_by;
96
97 std::vector<wroff_item> items;
98 eosio::asset total_amount = asset(0, _root_govern_symbol);
99
100 eosio::name status = WroffStatus::PROPOSED;
102
103 // Связка с soviet.decisions — через decisions.hash == proposal.hash; backend стыкует обе таблицы по hash.
104 // Timestamp'ы propwroff / onmktwoauth / onmktwodecl / execwroff фиксируются
105 // backend'ом из блокчейн-дельт (поле blockchain_actions[at]).
106
107 uint64_t primary_key() const { return id; }
108 checksum256 by_hash() const { return hash; }
109 uint64_t by_status() const { return status.value; }
110};
111
112typedef eosio::multi_index<
113 "wroffprops"_n, writeoff_proposal,
114 eosio::indexed_by<"byhash"_n, eosio::const_mem_fun<writeoff_proposal, checksum256, &writeoff_proposal::by_hash>>,
115 eosio::indexed_by<"bystatus"_n, eosio::const_mem_fun<writeoff_proposal, uint64_t, &writeoff_proposal::by_status>>>
117
118} // namespace Marketplace
static constexpr eosio::symbol _root_govern_symbol
Definition: consts.hpp:231
contract
Definition: eosio.msig_tests.cpp:977
constexpr eosio::name PROPOSED
Definition: table_marketplace_writeoff_proposals.hpp:37
constexpr eosio::name AUTHORIZED
Definition: table_marketplace_writeoff_proposals.hpp:38
Canonical helpers контракта marketplace (Story 11.1).
Definition: marketplace.hpp:32
eosio::multi_index< "wroffprops"_n, writeoff_proposal, eosio::indexed_by<"byhash"_n, eosio::const_mem_fun< writeoff_proposal, checksum256, &writeoff_proposal::by_hash > >, eosio::indexed_by<"bystatus"_n, eosio::const_mem_fun< writeoff_proposal, uint64_t, &writeoff_proposal::by_status > > > writeoff_proposals_index
Definition: table_marketplace_writeoff_proposals.hpp:116
Definition: eosio.msig.hpp:34
On-chain Проект решения совета о списании скоропорта — анкер процесса p.mkt.wroff.
Definition: table_marketplace_writeoff_proposals.hpp:90
checksum256 by_hash() const
Definition: table_marketplace_writeoff_proposals.hpp:108
checksum256 hash
process_hash для p.mkt.wroff
Definition: table_marketplace_writeoff_proposals.hpp:92
eosio::name decided_by
actor execwroff/declwroff (председатель / совет)
Definition: table_marketplace_writeoff_proposals.hpp:95
uint64_t id
Definition: table_marketplace_writeoff_proposals.hpp:91
eosio::name proposed_by
backend / админ — инициатор propwroff
Definition: table_marketplace_writeoff_proposals.hpp:94
eosio::name coopname
Definition: table_marketplace_writeoff_proposals.hpp:93
uint64_t primary_key() const
Definition: table_marketplace_writeoff_proposals.hpp:107
std::vector< wroff_item > items
Definition: table_marketplace_writeoff_proposals.hpp:97
document2 protocol
Подписанный советом протокол решения; кладётся в callback onmktwoauth.
Definition: table_marketplace_writeoff_proposals.hpp:101
uint64_t by_status() const
Definition: table_marketplace_writeoff_proposals.hpp:109
Позиция к списанию в составе writeoff_proposal.
Definition: table_marketplace_writeoff_proposals.hpp:67
eosio::asset amount
Definition: table_marketplace_writeoff_proposals.hpp:70
bool executed
true после execwroff(proposal_hash, item_index)
Definition: table_marketplace_writeoff_proposals.hpp:72
eosio::name braname
КУ-склад источник списания
Definition: table_marketplace_writeoff_proposals.hpp:69
uint64_t source_order_id
0 если списание из складского остатка без привязки к order'у
Definition: table_marketplace_writeoff_proposals.hpp:68
std::string meta
Definition: table_marketplace_writeoff_proposals.hpp:71
Definition: document_core.hpp:27