COOPENOMICS  v1
Кооперативная Экономика
table_branch_reserves.hpp
См. документацию.
1#pragma once
2
3#include "../core/ram_payer.hpp"
4#include <eosio/asset.hpp>
5#include <eosio/binary_extension.hpp>
6#include <eosio/eosio.hpp>
7
8#include "../consts.hpp"
9#include "../core/utils.hpp"
10
42struct [[eosio::table, eosio::contract(BRANCH)]] branch_reserve {
43 uint64_t id;
44 eosio::name braname;
45 eosio::name username;
46 eosio::asset amount;
47
48 // Хвост строки — только binary_extension: строки, записанные до 99D-34,
49 // читаются без этих полей. Поля пишутся всегда вместе.
50 eosio::binary_extension<uint32_t> accrued_period;
51 eosio::binary_extension<eosio::asset> outstanding;
52
53 uint64_t primary_key() const { return id; }
54 uint64_t by_branch() const { return braname.value; }
55 uint64_t by_user() const { return username.value; }
56 uint128_t by_branch_user() const { return combine_ids(braname.value, username.value); }
57};
58
59typedef eosio::multi_index<
60 "reserves"_n, branch_reserve,
61 eosio::indexed_by<"bybranch"_n, eosio::const_mem_fun<branch_reserve, uint64_t, &branch_reserve::by_branch>>,
62 eosio::indexed_by<"byuser"_n, eosio::const_mem_fun<branch_reserve, uint64_t, &branch_reserve::by_user>>,
63 eosio::indexed_by<"bybruser"_n, eosio::const_mem_fun<branch_reserve, uint128_t, &branch_reserve::by_branch_user>>>
65
66// Плательщик за оперативную память строк таблицы — правило в lib/core/ram_payer.hpp.
contract
Definition: eosio.msig_tests.cpp:977
Definition: eosio.msig.hpp:34
Резерв социально-экономического обеспечения пайщика кооперативного участка (задача 99D-20,...
Definition: table_branch_reserves.hpp:42
uint64_t primary_key() const
Definition: table_branch_reserves.hpp:53
uint64_t by_user() const
Definition: table_branch_reserves.hpp:55
uint64_t by_branch() const
Definition: table_branch_reserves.hpp:54
eosio::name username
получатель: председатель либо доверенное лицо участка
Definition: table_branch_reserves.hpp:45
eosio::name braname
кооперативный участок
Definition: table_branch_reserves.hpp:44
eosio::binary_extension< uint32_t > accrued_period
период, по который начислено право (включительно)
Definition: table_branch_reserves.hpp:50
eosio::binary_extension< eosio::asset > outstanding
накопленное право на этот период: начислено минус подано
Definition: table_branch_reserves.hpp:51
eosio::asset amount
резерв в месяц, не выше потолка кооператива
Definition: table_branch_reserves.hpp:46
uint64_t id
суррогатный ключ (scope coopname)
Definition: table_branch_reserves.hpp:43
uint128_t by_branch_user() const
Definition: table_branch_reserves.hpp:56
Definition: table_registrator_orgs.hpp:17
RAM_PAYER_CLASS(branch_reserve, cooperative)
eosio::multi_index< "reserves"_n, branch_reserve, eosio::indexed_by<"bybranch"_n, eosio::const_mem_fun< branch_reserve, uint64_t, &branch_reserve::by_branch > >, eosio::indexed_by<"byuser"_n, eosio::const_mem_fun< branch_reserve, uint64_t, &branch_reserve::by_user > >, eosio::indexed_by<"bybruser"_n, eosio::const_mem_fun< branch_reserve, uint128_t, &branch_reserve::by_branch_user > > > branch_reserves_index
Definition: table_branch_reserves.hpp:64
static uint128_t combine_ids(const uint64_t &x, const uint64_t &y)
Definition: utils.hpp:7