4#include <eosio/binary_extension.hpp>
5#include <eosio/crypto.hpp>
6#include <eosio/eosio.hpp>
10#include "../consts.hpp"
32 bool validated =
false;
33 bool approved =
false;
34 bool authorized =
false;
40 eosio::binary_extension<eosio::time_point_sec>
expired_at;
41 eosio::binary_extension<std::string>
meta;
46 eosio::binary_extension<checksum256>
hash;
52 uint64_t
bytype()
const {
return type.value; }
60 checksum256
byhash()
const {
return hash.value(); }
63 eosio::check(std::find(votes_for.begin(), votes_for.end(), member) == votes_for.end(),
64 "Участник уже голосовал за данное решение.");
66 eosio::check(std::find(votes_against.begin(), votes_against.end(), member) == votes_against.end(),
67 "Участник уже голосовал против данного решения.");
71 return std::make_pair(votes_for.size(), votes_against.size());
75typedef eosio::multi_index<
77 eosio::indexed_by<
"bysecondary"_n, eosio::const_mem_fun<decision, uint64_t, &decision::by_secondary>>,
78 eosio::indexed_by<
"bytype"_n, eosio::const_mem_fun<decision, uint64_t, &decision::bytype>>,
79 eosio::indexed_by<
"byapproved"_n, eosio::const_mem_fun<decision, uint64_t, &decision::byapproved>>,
80 eosio::indexed_by<
"byvalidated"_n, eosio::const_mem_fun<decision, uint64_t, &decision::byvalidated>>,
81 eosio::indexed_by<
"byauthorized"_n, eosio::const_mem_fun<decision, uint64_t, &decision::byauthorized>>,
82 eosio::indexed_by<
"byhash"_n, eosio::const_mem_fun<decision, checksum256, &decision::byhash>>>
contract
Definition: eosio.msig_tests.cpp:977
Definition: eosio.msig.hpp:34
Definition: table_soviet_decisions.hpp:20
bool validated
Definition: table_soviet_decisions.hpp:32
document2 authorization
Definition: table_soviet_decisions.hpp:36
eosio::binary_extension< name > confirm_callback
Definition: table_soviet_decisions.hpp:44
uint64_t by_secondary() const
Definition: table_soviet_decisions.hpp:50
eosio::name coopname
Definition: table_soviet_decisions.hpp:22
bool approved
Definition: table_soviet_decisions.hpp:33
eosio::binary_extension< checksum256 > hash
Definition: table_soviet_decisions.hpp:46
eosio::name type
Definition: table_soviet_decisions.hpp:25
uint64_t byauthorized() const
Definition: table_soviet_decisions.hpp:58
eosio::binary_extension< eosio::time_point_sec > expired_at
Definition: table_soviet_decisions.hpp:40
uint64_t batch_id
Definition: table_soviet_decisions.hpp:26
std::vector< eosio::name > votes_against
Definition: table_soviet_decisions.hpp:30
uint64_t bytype() const
Definition: table_soviet_decisions.hpp:52
uint64_t id
Definition: table_soviet_decisions.hpp:21
eosio::binary_extension< std::string > meta
Definition: table_soviet_decisions.hpp:41
std::pair< uint64_t, uint64_t > get_votes_count() const
Definition: table_soviet_decisions.hpp:70
bool authorized
Definition: table_soviet_decisions.hpp:34
document2 statement
Definition: table_soviet_decisions.hpp:27
checksum256 byhash() const
Definition: table_soviet_decisions.hpp:60
eosio::name username
Definition: table_soviet_decisions.hpp:23
std::vector< eosio::name > votes_for
Definition: table_soviet_decisions.hpp:29
uint64_t byvalidated() const
Definition: table_soviet_decisions.hpp:56
uint64_t byapproved() const
Definition: table_soviet_decisions.hpp:54
eosio::binary_extension< name > callback_contract
Definition: table_soviet_decisions.hpp:43
uint64_t primary_key() const
Definition: table_soviet_decisions.hpp:48
eosio::binary_extension< name > decline_callback
Definition: table_soviet_decisions.hpp:45
eosio::name authorized_by
Definition: table_soviet_decisions.hpp:35
eosio::time_point_sec created_at
Definition: table_soviet_decisions.hpp:38
void check_for_any_vote_exist(eosio::name member) const
Definition: table_soviet_decisions.hpp:62
Definition: document_core.hpp:27
eosio::multi_index< "decisions"_n, decision, eosio::indexed_by<"bysecondary"_n, eosio::const_mem_fun< decision, uint64_t, &decision::by_secondary > >, eosio::indexed_by<"bytype"_n, eosio::const_mem_fun< decision, uint64_t, &decision::bytype > >, eosio::indexed_by<"byapproved"_n, eosio::const_mem_fun< decision, uint64_t, &decision::byapproved > >, eosio::indexed_by<"byvalidated"_n, eosio::const_mem_fun< decision, uint64_t, &decision::byvalidated > >, eosio::indexed_by<"byauthorized"_n, eosio::const_mem_fun< decision, uint64_t, &decision::byauthorized > >, eosio::indexed_by<"byhash"_n, eosio::const_mem_fun< decision, checksum256, &decision::byhash > > > decisions_index
Definition: table_soviet_decisions.hpp:83