4#include "../../../lib/core/ram_payer.hpp"
5#include <eosio/eosio.hpp>
6#include <eosio/asset.hpp>
81typedef eosio::multi_index<
"votes"_n, vote,
82 indexed_by<
"byproject"_n, const_mem_fun<vote, checksum256, &vote::by_project>>,
83 indexed_by<
"byprojvoter"_n, const_mem_fun<vote, uint128_t, &vote::by_project_voter>>,
84 indexed_by<
"byprojrecip"_n, const_mem_fun<vote, uint128_t, &vote::by_project_recipient>>
94 auto idx = votes.get_index<
"byprojvoter"_n>();
97 return idx.find(key) != idx.end();
105 auto idx = votes.get_index<
"byprojrecip"_n>();
109 auto itr = idx.find(key);
110 while (itr != idx.end() && itr->by_project_recipient() == key) {
127 auto idx = votes.get_index<
"byproject"_n>();
128 for (
auto itr = idx.lower_bound(project_hash); itr != idx.end() && itr->project_hash == project_hash;) {
129 itr = idx.erase(itr);
136 inline void add_vote(name coopname, checksum256 project_hash,
141 votes.emplace(
RamPayer::of(votes, coopname), [&](
auto &v) {
143 v.coopname = coopname;
144 v.project_hash = project_hash;
146 v.recipient = recipient;
148 v.voted_at = current_time_point();
static constexpr eosio::name _capital
Definition: consts.hpp:171
static constexpr eosio::symbol _root_govern_symbol
Definition: consts.hpp:236
contract
Definition: eosio.msig_tests.cpp:977
share_type amount
Definition: eosio.token_tests.cpp:174
std::vector< vote > get_votes_for_recipient(name coopname, checksum256 project_hash, name recipient)
Получает все голоса получателя в проекте
Definition: votes.hpp:103
bool has_user_voted(name coopname, checksum256 project_hash, name voter)
Проверяет голосовал ли пользователь в данном проекте
Definition: votes.hpp:92
void add_vote(name coopname, checksum256 project_hash, name voter, name recipient, asset amount)
Добавляет голос в проект
Definition: votes.hpp:136
void erase_project_votes(name coopname, const checksum256 &project_hash)
Удаляет голоса проекта.
Definition: votes.hpp:125
Definition: balances.cpp:6
eosio::multi_index<"votes"_n, vote, indexed_by<"byproject"_n, const_mem_fun< vote, checksum256, &vote::by_project > >, indexed_by<"byprojvoter"_n, const_mem_fun< vote, uint128_t, &vote::by_project_voter > >, indexed_by<"byprojrecip"_n, const_mem_fun< vote, uint128_t, &vote::by_project_recipient > > > votes_index
Definition: votes.hpp:85
eosio::name of(const Table &table, eosio::name coopname)
Definition: ram_payer.hpp:78
fc::mutable_variant_object voter(account_name acct)
Definition: eosio.system_tester.hpp:1183
Definition: eosio.msig.hpp:34
Таблица результатов хранит данные о результатах участников проектов.
Definition: results.hpp:35
Таблица голосов хранит информацию о голосах участников по методу Водянова.
Definition: votes.hpp:57
name coopname
Кооператив
Definition: votes.hpp:59
uint128_t by_project_recipient() const
Definition: votes.hpp:76
name voter
Кто голосует
Definition: votes.hpp:61
time_point_sec voted_at
Время голосования
Definition: votes.hpp:64
uint128_t by_project_voter() const
Definition: votes.hpp:71
checksum256 project_hash
Хэш проекта
Definition: votes.hpp:60
checksum256 by_project() const
Индекс по хэшу проекта (2)
Definition: votes.hpp:68
uint64_t primary_key() const
Первичный ключ (1)
Definition: votes.hpp:66
uint64_t id
ID голоса (внутренний ключ)
Definition: votes.hpp:58
asset amount
Сумма голоса
Definition: votes.hpp:63
name recipient
За кого голосует
Definition: votes.hpp:62
Рассчитывает суммы для распределения по пулам
Definition: votes.hpp:23
eosio::asset authors_equal_spread
62.8% авторских премий поровну
Definition: votes.hpp:24
eosio::asset creators_bonuses_on_voting
38.2% исполнительских премий на голосование
Definition: votes.hpp:27
eosio::asset authors_equal_per_author
Равная сумма на каждого автора (62.8% / количество авторов)
Definition: votes.hpp:31
eosio::asset authors_bonuses_on_voting
38.2% авторских премий на голосование
Definition: votes.hpp:26
eosio::asset equal_voting_amount
Средняя сумма на каждого участника (total_voting_pool / voters)
Definition: votes.hpp:30
eosio::asset creators_direct_spread
62.8% исполнительских премий каждому
Definition: votes.hpp:25
eosio::asset total_voting_pool
Общая сумма для распределения по Водянову (авторы + создатели)
Definition: votes.hpp:28
eosio::asset active_voting_amount
Общая голосующая сумма = total_voting_pool * (voters-1)/voters.
Definition: votes.hpp:29
Структура данных для голосования по методу Водянова
Definition: votes.hpp:37
uint32_t total_voters
Общее количество участников
Definition: votes.hpp:38
voting_amounts amounts
Суммы на голосовании
Definition: votes.hpp:44
uint32_t votes_received
Количество полученных голосов
Definition: votes.hpp:39
double authors_voting_percent
Процент премий авторов для голосования (по умолчанию; уточняется из config при инициализации голосова...
Definition: votes.hpp:41
double creators_voting_percent
Процент премий создателей для голосования (по умолчанию; уточняется из config при инициализации голос...
Definition: votes.hpp:42
time_point_sec voting_deadline
Дедлайн голосования
Definition: votes.hpp:46
Definition: table_registrator_orgs.hpp:17
uint64_t get_global_id_in_scope(eosio::name _me, eosio::name scope, eosio::name key)
Definition: table_counts.hpp:62
static uint128_t combine_checksum_ids(const checksum256 &hash, eosio::name username)
Definition: utils.hpp:11
RAM_PAYER_CLASS(Capital::vote, cooperative)