COOPENOMICS  v1
Кооперативная Экономика
invest.hpp
См. документацию.
1#pragma once
2
3#include <eosio/asset.hpp>
4#include <eosio/eosio.hpp>
5
23namespace MarketInvest {
24
25inline eosio::asset zero_asset() { return eosio::asset(0, _root_govern_symbol); }
26
27inline uint128_t mul(int64_t units, uint64_t acc) {
28 return static_cast<uint128_t>(units) * static_cast<uint128_t>(acc);
29}
30
32inline int64_t returned_of(const mkt_investor& i, uint64_t acc) {
33 const int64_t u = i.units();
34 if (i.status != Status::ACTIVE || u <= 0) return i.returned_fixed;
35 return i.returned_fixed + static_cast<int64_t>(mul(u, acc - i.acc_join) / SCALE);
36}
37
39inline uint64_t done_threshold(const mkt_investor& i) {
40 const int64_t u = i.units();
41 if (u <= 0) return OUT_OF_RANGE;
42 const int64_t remaining = u - i.returned_fixed;
43 if (remaining <= 0) return i.acc_join;
44 const uint128_t num = static_cast<uint128_t>(remaining) * SCALE;
45 const uint128_t step = (num + static_cast<uint128_t>(u) - 1) / static_cast<uint128_t>(u);
46 return i.acc_join + static_cast<uint64_t>(step);
47}
48
51inline void shift_base_money(mkt_invbranch& b, int64_t delta) {
52 const int64_t v = b.base_money_or_zero() + delta;
53 b.base_money = v > 0 ? v : 0;
54}
55
58 const int64_t u = i.units();
59 if (i.status == Status::ACTIVE && u > 0) {
60 // В s_fixed лежит прежний returned_fixed; приращение от acc_join до acc
61 // сидит в (acc × base − s_join) и вычитается вместе с base и s_join.
63 b.base -= u;
64 shift_base_money(b, -i.used_money.amount);
65 b.s_join -= mul(u, i.acc_join);
67 }
68 i.acc_join = b.acc;
69}
70
73 i.acc_join = b.acc;
74 const int64_t u = i.units();
75 if (i.status == Status::ACTIVE && u > 0) {
76 b.base += u;
77 shift_base_money(b, i.used_money.amount);
78 b.s_join += mul(u, b.acc);
80 }
82}
83
86inline int64_t outstanding(const mkt_invbranch& b) {
87 if (b.base <= 0) return 0;
88 const uint128_t accrued = mul(b.base, b.acc) - b.s_join;
89 const int64_t left = b.base - b.s_fixed - static_cast<int64_t>(accrued / SCALE);
90 return left > 0 ? left : 0;
91}
92
94inline void accept_repay(mkt_invbranch& b, int64_t amount) {
95 b.acc += static_cast<uint64_t>(static_cast<uint128_t>(amount) * SCALE /
96 static_cast<uint128_t>(b.base));
97}
98
101 int64_t money = 0;
102 int64_t property = 0;
103 int64_t total() const { return money + property; }
104};
105
108inline RepayParts split_repay(int64_t amount, int64_t money_units, int64_t units) {
109 RepayParts p;
110 if (amount <= 0 || units <= 0) {
111 p.property = amount > 0 ? amount : 0;
112 return p;
113 }
114 const int64_t m = money_units > units ? units : (money_units > 0 ? money_units : 0);
115 p.money = static_cast<int64_t>(static_cast<uint128_t>(amount) * static_cast<uint128_t>(m) /
116 static_cast<uint128_t>(units));
117 p.property = amount - p.money;
118 return p;
119}
120
127 leave_base(b, i);
128 const int64_t u = i.units();
129 int64_t excess = i.returned_fixed - u;
130 if (excess < 0) excess = 0;
131 i.returned_fixed -= excess;
134 return split_repay(excess, i.used_money.amount, u);
135}
136
140struct Claimable {
141 int64_t returned = 0;
142 int64_t unused = 0;
143 int64_t total() const { return returned + unused; }
144};
145
147 Claimable c;
148 int64_t r = returned_of(i, b.acc);
149 if (r > i.units()) r = i.units();
150 c.returned = r - i.claimed.amount;
151 if (c.returned < 0) c.returned = 0;
152 const bool release_unused = i.status == Status::DONE || b.base <= 0;
153 if (release_unused && i.unused() > 0) {
154 c.unused = i.unused();
155 // Деньги, выделенные в пул и ещё не израсходованные, держат неиспользованное
156 // у любого инициатора — и у завершившего возврат.
157 const int64_t free = b.unused_total.amount - b.reserved.amount;
158 if (c.unused > free) c.unused = free > 0 ? free : 0;
159 }
160 return c;
161}
162
164inline std::optional<mkt_invbranch> get_branch(eosio::name coopname, eosio::name braname) {
165 mkt_invbranches_index branches(_marketplace, coopname.value);
166 auto it = branches.find(braname.value);
167 if (it == branches.end()) return std::nullopt;
168 return *it;
169}
170
174inline eosio::asset free_of(eosio::name coopname, eosio::name braname) {
175 const auto b = get_branch(coopname, braname);
176 if (!b.has_value()) return zero_asset();
177 const eosio::asset free = b->unused_total - b->reserved;
178 return free.amount > 0 ? free : zero_asset();
179}
180
182inline void fund_pool(eosio::name actor, eosio::name coopname, eosio::name braname,
183 eosio::asset amount, const checksum256& hash) {
184 eosio::action(eosio::permission_level{actor, "active"_n}, _marketplace, "fundipool"_n,
185 std::make_tuple(coopname, braname, amount, hash)).send();
186}
187
189inline void unfund_pool(eosio::name actor, eosio::name coopname, eosio::name braname,
190 eosio::asset amount, const checksum256& hash) {
191 eosio::action(eosio::permission_level{actor, "active"_n}, _marketplace, "unfundipool"_n,
192 std::make_tuple(coopname, braname, amount, hash)).send();
193}
194
196inline void spent_pool(eosio::name actor, eosio::name coopname, eosio::name braname,
197 eosio::asset amount, const checksum256& hash) {
198 eosio::action(eosio::permission_level{actor, "active"_n}, _marketplace, "spentipool"_n,
199 std::make_tuple(coopname, braname, amount, hash)).send();
200}
201
205inline bool is_operator(eosio::name coopname, eosio::name braname, eosio::name username) {
206 const auto branch = get_branch_or_fail(coopname, braname);
207 return branch.trustee == username || branch.is_account_in_trusted(username);
208}
209
212inline bool has_agreement(eosio::name coopname, eosio::name username, eosio::name braname) {
213 mkt_invagreements_index agreements(_marketplace, coopname.value);
214 auto by_pair = agreements.get_index<"byuserbr"_n>();
215 return by_pair.find(combine_ids(username.value, braname.value)) != by_pair.end();
216}
217
219inline bool has_investments(eosio::name coopname, eosio::name username) {
220 mkt_investors_index investors(_marketplace, coopname.value);
221 auto by_user = investors.get_index<"byuser"_n>();
222 return by_user.find(username.value) != by_user.end();
223}
224
227inline void check_member_can_exit(eosio::name coopname, eosio::name username) {
228 mkt_investors_index investors(_marketplace, coopname.value);
229 mkt_invbranches_index branches(_marketplace, coopname.value);
230 auto by_user = investors.get_index<"byuser"_n>();
231 for (auto it = by_user.lower_bound(username.value);
232 it != by_user.end() && it->username == username; ++it) {
233 if (it->unused() <= 0) continue;
234 auto bit = branches.find(it->braname.value);
235 if (bit == branches.end()) continue;
236 eosio::check(bit->unused_total.amount - it->unused() >= bit->reserved.amount,
237 "MARKETPLACE_INVEST_EXIT_RESERVED: Выход из кооператива невозможен: средства инициатора выделены под расход участка — дождитесь его закрытия");
238 }
239}
240
241} // namespace MarketInvest
242
243namespace Marketplace {
244
249inline void add_investment(eosio::name coopname, eosio::name braname, eosio::name username,
250 eosio::asset money, eosio::asset property) {
251 using namespace MarketInvest;
252 mkt_invbranches_index branches(_marketplace, coopname.value);
253 auto bit = branches.find(braname.value);
254 if (bit == branches.end()) {
255 bit = branches.emplace(RamPayer::of(branches, coopname), [&](auto& b) {
256 b.braname = braname;
257 b.money_total = zero_asset();
258 b.property_total = zero_asset();
259 b.unused_total = zero_asset();
260 b.reserved = zero_asset();
261 b.spent_total = zero_asset();
262 b.repaid_total = zero_asset();
263 b.surplus_total = zero_asset();
264 });
265 }
266 mkt_invbranch b = *bit;
267
268 mkt_investors_index investors(_marketplace, coopname.value);
269 auto by_pair = investors.get_index<"bybruser"_n>();
270 auto it = by_pair.find(combine_ids(braname.value, username.value));
271 const bool fresh = it == by_pair.end();
272
273 mkt_investor row;
274 if (fresh) {
275 row.id = investors.available_primary_key();
276 row.braname = braname;
277 row.username = username;
278 row.status = Status::ACTIVE;
279 row.money = zero_asset();
280 row.property = zero_asset();
281 row.used_money = zero_asset();
282 row.claimed = zero_asset();
283 row.join_seq = ++b.join_seq;
284 row.joined_at = eosio::time_point_sec(eosio::current_time_point());
285 } else {
286 row = *it;
287 leave_base(b, row);
288 }
289
290 // До прибавки: у строки прежней сборки запасное значение — текущий остаток.
291 row.money_in = row.money_in_or_current() + money;
292 row.money += money;
293 row.property += property;
294 b.money_total += money;
295 b.property_total += property;
296 b.unused_total += money;
297 // Завершивший возврат возвращается в базу, только когда у него появилось
298 // невозмещённое — новое имущество. Новые деньги до расхода в базу не входят:
299 // он остаётся завершившим и может забрать их заявлением. Иначе он стоял бы в
300 // базе с нулевым остатком к возмещению, завершить возврат было бы нечем, и
301 // его неиспользованные деньги остались бы закрыты.
302 if (row.status == Status::DONE && row.units() > row.returned_fixed) row.status = Status::ACTIVE;
303 enter_base(b, row);
304
305 branches.modify(bit, RamPayer::of(branches, coopname), [&](auto& x) { x = b; });
306 if (fresh) {
307 investors.emplace(RamPayer::of(investors, coopname), [&](auto& x) { x = row; });
308 } else {
309 by_pair.modify(it, RamPayer::of(investors, coopname), [&](auto& x) { x = row; });
310 }
311}
312
327inline void route_initiator_share(eosio::name actor, eosio::name coopname, eosio::name braname,
328 eosio::asset amount, const checksum256& order_hash) {
329 using namespace MarketInvest;
330 int64_t to_repay = 0;
331 int64_t left = 0;
332
333 mkt_invbranches_index branches(_marketplace, coopname.value);
334 auto bit = branches.find(braname.value);
335 if (bit != branches.end() && bit->base > 0) {
336 left = outstanding(*bit);
337 to_repay = amount.amount < left ? amount.amount : left;
338 }
339
340 if (to_repay > 0) {
342 processes::marketplace::DUE, eosio::asset(to_repay, _root_govern_symbol),
343 braname, order_hash, Memo::get_invest_repay_memo());
344
345 mkt_invbranch b = *bit;
346 // Каждому инициатору возмещается пропорционально его единицам, поэтому
347 // доля денег во всём возмещении — денежная часть базы к базе.
348 const RepayParts repay = split_repay(to_repay, b.base_money_or_zero(), b.base);
349 if (repay.money > 0)
352 braname, order_hash, Memo::get_invest_cost_cover_memo());
353
354 accept_repay(b, to_repay);
355 b.repaid_total.amount += to_repay;
356
357 // Завершившие возврат — по индексу от наименьшего порога; каждый шаг
358 // меняет ключ строки на «вне базы», поэтому выборка начинается заново.
359 mkt_investors_index investors(_marketplace, coopname.value);
360 auto by_done = investors.get_index<"bydone"_n>();
361 const uint128_t from = combine_ids(braname.value, 0);
362 const uint128_t upto = combine_ids(braname.value, b.acc);
363 RepayParts excess;
364 for (auto it = by_done.lower_bound(from); it != by_done.end() && it->by_done() <= upto;
365 it = by_done.lower_bound(from)) {
366 mkt_investor row = *it;
367 const RepayParts e = complete(b, row);
368 excess.money += e.money;
369 excess.property += e.property;
370 by_done.modify(it, RamPayer::of(investors, coopname), [&](auto& x) { x = row; });
371 }
372
373 // Списание возместило весь непогашенный остаток участка: в базе не
374 // остаётся никого. Счётчик растёт с округлением вниз, поэтому инициатору
375 // могла остаться единица актива до порога завершения, и возврат завершался
376 // только следующим списанием. Возвращённое таких инициаторов фиксируется
377 // ровно в использованное — переведённая на кошелёк возмещения сумма это
378 // покрывает.
379 if (to_repay == left) {
380 const uint128_t all = combine_ids(braname.value, OUT_OF_RANGE);
381 for (auto it = by_done.lower_bound(from); it != by_done.end() && it->by_done() < all;
382 it = by_done.lower_bound(from)) {
383 mkt_investor row = *it;
384 const RepayParts e = complete(b, row);
385 row.returned_fixed = row.units();
386 excess.money += e.money;
387 excess.property += e.property;
388 by_done.modify(it, RamPayer::of(investors, coopname), [&](auto& x) { x = row; });
389 }
390 }
391
392 // Денежная доля переплаты не может превысить погашенное этим списанием —
393 // остальное считается долей имущества: кредитового сальдо по 26 не бывает.
394 if (excess.money > repay.money) {
395 excess.property += excess.money - repay.money;
396 excess.money = repay.money;
397 }
398 if (excess.total() > 0) {
399 b.surplus_total.amount += excess.total();
402 braname, order_hash, Memo::get_invest_surplus_memo());
403 if (excess.money > 0)
406 braname, order_hash, Memo::get_invest_cost_uncover_memo());
407 }
408 branches.modify(bit, RamPayer::of(branches, coopname), [&](auto& x) { x = b; });
409 }
410
411 const int64_t rest = amount.amount - to_repay;
412 if (rest > 0) {
413 Branch::accrue(actor, coopname, braname, eosio::asset(rest, _root_govern_symbol),
414 processes::marketplace::DUE, order_hash,
416 }
417}
418
422inline void release_investments_on_exit(eosio::name actor, eosio::name coopname,
423 eosio::name username) {
424 if (!MarketInvest::has_investments(coopname, username)) return;
425 eosio::action(eosio::permission_level{actor, "active"_n}, _marketplace, "exitinv"_n,
426 std::make_tuple(coopname, username)).send();
427}
428
429} // namespace Marketplace
static void apply(eosio::name actor, eosio::name coopname, eosio::name operation_code, eosio::name process_type, eosio::asset amount, eosio::name username, eosio::checksum256 process_hash, std::string memo)
Отправить inline action ledger2::apply.
Definition: ledger2.hpp:43
Константы контракта кооперативных участков
Definition: branch.hpp:55
static constexpr eosio::symbol _root_govern_symbol
Definition: consts.hpp:257
static constexpr eosio::name _marketplace
Definition: consts.hpp:193
permission_level
Definition: eosio.msig_tests.cpp:896
share_type amount
Definition: eosio.token_tests.cpp:174
void send(name contract, name action_name, name actor, Args &&... args)
Definition: actions.hpp:10
void accrue(eosio::name actor, eosio::name coopname, eosio::name braname, eosio::asset amount, eosio::name process_type, eosio::checksum256 process_hash, std::string memo)
Inline-вызов branch::accrue от контракта-источника членских взносов (requirement b6 «Экономика КУ»,...
Definition: branch.hpp:62
static constexpr eosio::name DONE
использованное возвращено, неиспользованное доступно к заявлению
Definition: table_marketplace_invest.hpp:49
static constexpr eosio::name ACTIVE
паевой взнос возвращается из экономии участка
Definition: table_marketplace_invest.hpp:48
Definition: invest.hpp:23
int64_t returned_of(const mkt_investor &i, uint64_t acc)
Возмещено инициатору при текущем счётчике участка, единицы актива.
Definition: invest.hpp:32
std::optional< mkt_invbranch > get_branch(eosio::name coopname, eosio::name braname)
Строка участка; без неё паевых взносов в участке нет.
Definition: invest.hpp:164
void unfund_pool(eosio::name actor, eosio::name coopname, eosio::name braname, eosio::asset amount, const checksum256 &hash)
Вернуть невыделенный остаток в средства инициаторов (marketplace::unfundipool).
Definition: invest.hpp:189
static constexpr uint64_t SCALE
Точность счётчика возврата: возвращено на единицу базы × SCALE.
Definition: table_marketplace_invest.hpp:43
void spent_pool(eosio::name actor, eosio::name coopname, eosio::name braname, eosio::asset amount, const checksum256 &hash)
Расход из средств инициаторов оплачен — в базу возврата (marketplace::spentipool).
Definition: invest.hpp:196
eosio::asset zero_asset()
Definition: invest.hpp:25
static constexpr uint64_t OUT_OF_RANGE
Ключ индекса для строк вне выборки (нет неиспользованных денег / вне базы).
Definition: table_marketplace_invest.hpp:45
bool is_operator(eosio::name coopname, eosio::name braname, eosio::name username)
Definition: invest.hpp:205
RepayParts split_repay(int64_t amount, int64_t money_units, int64_t units)
Definition: invest.hpp:108
eosio::asset free_of(eosio::name coopname, eosio::name braname)
Definition: invest.hpp:174
Claimable claimable_of(const mkt_invbranch &b, const mkt_investor &i)
Definition: invest.hpp:146
void enter_base(mkt_invbranch &b, mkt_investor &i)
Ввести инициатора в базу участка с текущей отметкой счётчика.
Definition: invest.hpp:72
uint64_t done_threshold(const mkt_investor &i)
Счётчик участка, при котором использованное инициатора вернётся целиком.
Definition: invest.hpp:39
void accept_repay(mkt_invbranch &b, int64_t amount)
Принять сумму возмещения в счётчик участка.
Definition: invest.hpp:94
bool has_agreement(eosio::name coopname, eosio::name username, eosio::name braname)
Definition: invest.hpp:212
void shift_base_money(mkt_invbranch &b, int64_t delta)
Definition: invest.hpp:51
uint128_t mul(int64_t units, uint64_t acc)
Definition: invest.hpp:27
void check_member_can_exit(eosio::name coopname, eosio::name username)
Definition: invest.hpp:227
void fund_pool(eosio::name actor, eosio::name coopname, eosio::name braname, eosio::asset amount, const checksum256 &hash)
Выделить средства инициаторов под расход или помощь участка (marketplace::fundipool).
Definition: invest.hpp:182
int64_t outstanding(const mkt_invbranch &b)
Definition: invest.hpp:86
RepayParts complete(mkt_invbranch &b, mkt_investor &i)
Definition: invest.hpp:126
void leave_base(mkt_invbranch &b, mkt_investor &i)
Вывести инициатора из базы участка, зафиксировав накопленное.
Definition: invest.hpp:57
bool has_investments(eosio::name coopname, eosio::name username)
Есть ли у пайщика строки инициатора: выходу нужно вычесть его из базы.
Definition: invest.hpp:219
std::string get_invest_surplus_memo()
Definition: memo.hpp:79
std::string get_invest_cost_cover_memo()
Definition: memo.hpp:83
std::string get_charge_due_distribute_memo()
Definition: memo.hpp:58
std::string get_invest_cost_uncover_memo()
Definition: memo.hpp:87
std::string get_invest_repay_memo()
Definition: memo.hpp:75
Canonical helpers контракта marketplace (Story 11.1).
Definition: dues.hpp:25
void add_investment(eosio::name coopname, eosio::name braname, eosio::name username, eosio::asset money, eosio::asset property)
Definition: invest.hpp:249
void release_investments_on_exit(eosio::name actor, eosio::name coopname, eosio::name username)
Definition: invest.hpp:422
void route_initiator_share(eosio::name actor, eosio::name coopname, eosio::name braname, eosio::asset amount, const checksum256 &order_hash)
Definition: invest.hpp:327
eosio::name of(const Table &table, eosio::name coopname)
Definition: ram_payer.hpp:78
constexpr eosio::name INVEST_COST_UNCOVER
Сторно погашения 26 на денежную долю переплаты возмещения, переведённой участку (только проводка Дт 2...
Definition: operations.hpp:134
constexpr eosio::name INVEST_REPAY
Возмещение паевых взносов инициаторов из экономии месяца участка (TRANSFER w.mkt.fee → w....
Definition: operations.hpp:130
constexpr eosio::name INVEST_COST_COVER
Погашение расходов и помощи участка, оплаченных деньгами инициаторов, членскими взносами (только пров...
Definition: operations.hpp:133
constexpr eosio::name INVEST_REPAY_SURPLUS
Переплата возмещения на границе завершения возврата — участку (TRANSFER w.mkt.repay → w....
Definition: operations.hpp:132
constexpr eosio::name DUE
Списание обеспечительной части по итогу периода участка (задача 99D-33): строка счётчика пайщика за п...
Definition: processes.hpp:81
action(permission_level{ _gateway, "active"_n}, _gateway, "adduser"_n, std::make_tuple(coopname, deposit->username, to_spread, to_circulation, eosio::current_time_point(), true)).send()
Definition: invest.hpp:140
int64_t unused
из неиспользованных денег
Definition: invest.hpp:142
int64_t total() const
Definition: invest.hpp:143
int64_t returned
из возмещённого
Definition: invest.hpp:141
Сумма возмещения, разделённая на долю денег и долю имущества.
Definition: invest.hpp:100
int64_t total() const
Definition: invest.hpp:103
int64_t property
без проводки: имущество на 10
Definition: invest.hpp:102
int64_t money
гасит 26 (Дт 86 / Кт 26)
Definition: invest.hpp:101
Паевые взносы инициаторов одного кооперативного участка и счётчик возврата (CRPS)....
Definition: table_marketplace_invest.hpp:108
eosio::binary_extension< int64_t > base_money
Definition: table_marketplace_invest.hpp:126
eosio::asset reserved
выделено в пул под расходы и помощь и ещё не израсходовано
Definition: table_marketplace_invest.hpp:113
eosio::asset unused_total
деньги инициаторов, ещё не израсходованные из пула и не забранные заявлением
Definition: table_marketplace_invest.hpp:112
eosio::asset surplus_total
переплата на границе завершения возврата, переданная на w.brn.common
Definition: table_marketplace_invest.hpp:116
eosio::asset money_total
внесено деньгами по строкам инициаторов участка (за вычетом забранного неиспользованного)
Definition: table_marketplace_invest.hpp:110
int64_t base_money_or_zero() const
Definition: table_marketplace_invest.hpp:129
eosio::asset property_total
внесено имуществом по цене приёма
Definition: table_marketplace_invest.hpp:111
uint128_t s_join
Σ units_i × acc_join_i по базе
Definition: table_marketplace_invest.hpp:119
int64_t base
Σ units активных инициаторов, единицы актива
Definition: table_marketplace_invest.hpp:117
eosio::asset repaid_total
возмещено из экономии участка на w.mkt.repay всего
Definition: table_marketplace_invest.hpp:115
uint64_t join_seq
Definition: table_marketplace_invest.hpp:121
uint64_t acc
возвращено на единицу базы × SCALE
Definition: table_marketplace_invest.hpp:118
int64_t s_fixed
Σ returned_fixed_i по базе
Definition: table_marketplace_invest.hpp:120
Инициатор кооперативного участка: одна строка на пару «участок — пайщик».
Definition: table_marketplace_invest.hpp:143
uint64_t acc_join
счётчик участка на момент последней фиксации
Definition: table_marketplace_invest.hpp:153
uint64_t acc_done
счётчик участка, при котором использованное будет возвращено целиком
Definition: table_marketplace_invest.hpp:154
eosio::asset used_money
из денег израсходовано пулом участка
Definition: table_marketplace_invest.hpp:150
eosio::asset money
внесено деньгами (за вычетом забранного неиспользованного)
Definition: table_marketplace_invest.hpp:148
eosio::time_point_sec joined_at
Definition: table_marketplace_invest.hpp:156
eosio::asset claimed
забрано из возвращённого заявлениями (без неиспользованного)
Definition: table_marketplace_invest.hpp:151
eosio::name braname
кооперативный участок
Definition: table_marketplace_invest.hpp:145
uint64_t join_seq
порядок входа в участок
Definition: table_marketplace_invest.hpp:155
eosio::name status
active | done (done с нулевым остатком — возмещено полностью)
Definition: table_marketplace_invest.hpp:147
eosio::asset property
внесено имуществом по цене приёма
Definition: table_marketplace_invest.hpp:149
eosio::binary_extension< eosio::asset > money_in
Definition: table_marketplace_invest.hpp:160
int64_t units() const
Definition: table_marketplace_invest.hpp:167
int64_t returned_fixed
возвращено на момент последней фиксации, единицы актива
Definition: table_marketplace_invest.hpp:152
eosio::name username
пайщик-инициатор
Definition: table_marketplace_invest.hpp:146
int64_t unused() const
Definition: table_marketplace_invest.hpp:170
uint64_t id
суррогатный ключ
Definition: table_marketplace_invest.hpp:144
eosio::asset money_in_or_current() const
Внесено деньгами всего; у строки прежней сборки — текущий остаток денег.
Definition: table_marketplace_invest.hpp:169
coobranch get_branch_or_fail(eosio::name coopname, eosio::name braname)
Definition: table_branch_branches.hpp:88
eosio::multi_index<"invbranches"_n, mkt_invbranch > mkt_invbranches_index
Definition: table_marketplace_invest.hpp:132
eosio::multi_index< "invagrbranch"_n, mkt_invagreement, eosio::indexed_by<"byuserbr"_n, eosio::const_mem_fun< mkt_invagreement, uint128_t, &mkt_invagreement::by_user_branch > >, eosio::indexed_by<"bybranch"_n, eosio::const_mem_fun< mkt_invagreement, uint64_t, &mkt_invagreement::by_branch > > > mkt_invagreements_index
Definition: table_marketplace_invest.hpp:89
eosio::multi_index< "investors"_n, mkt_investor, eosio::indexed_by<"bybranch"_n, eosio::const_mem_fun< mkt_investor, uint64_t, &mkt_investor::by_branch > >, eosio::indexed_by<"byuser"_n, eosio::const_mem_fun< mkt_investor, uint64_t, &mkt_investor::by_user > >, eosio::indexed_by<"bybruser"_n, eosio::const_mem_fun< mkt_investor, uint128_t, &mkt_investor::by_branch_user > >, eosio::indexed_by<"byunused"_n, eosio::const_mem_fun< mkt_investor, uint128_t, &mkt_investor::by_unused > >, eosio::indexed_by<"bydone"_n, eosio::const_mem_fun< mkt_investor, uint128_t, &mkt_investor::by_done > > > mkt_investors_index
Definition: table_marketplace_invest.hpp:192
static uint128_t combine_ids(const uint64_t &x, const uint64_t &y)
Definition: utils.hpp:7