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