COOPENOMICS  v1
Кооперативная Экономика
table_apps_subs.hpp
См. документацию.
1#pragma once
2
3
4#include "../core/ram_payer.hpp"
5#include <eosio/eosio.hpp>
6#include <eosio/crypto.hpp>
7
8#include "../consts.hpp"
9#include "../core/utils.hpp"
10
11namespace Apps {
12
13using namespace eosio;
14
69struct [[eosio::table, eosio::contract(APPS)]] sub {
70 uint64_t id;
73 checksum256 chain_id;
74 name plan;
75 bool active;
76 time_point_sec start_at;
77 time_point_sec end_at;
78 time_point_sec created_at;
79 time_point_sec updated_at;
80 uint8_t attempt = 0;
81 checksum256 last_charge_intent_id = {};
82
83 uint64_t primary_key() const { return id; }
84 uint128_t by_cooppkg() const { return ((uint128_t)coopname.value << 64) | package_id.value; }
85 uint64_t by_coop() const { return coopname.value; }
86 uint64_t by_expires() const { return end_at.sec_since_epoch(); }
87};
88
89typedef eosio::multi_index<
90 "subs"_n, sub,
91 eosio::indexed_by<"bycooppkg"_n, eosio::const_mem_fun<sub, uint128_t, &sub::by_cooppkg>>,
92 eosio::indexed_by<"bycoop"_n, eosio::const_mem_fun<sub, uint64_t, &sub::by_coop>>,
93 eosio::indexed_by<"byexpires"_n, eosio::const_mem_fun<sub, uint64_t, &sub::by_expires>>>
95
96} // namespace Apps
97
98// Плательщик за оперативную память строк таблицы — правило в lib/core/ram_payer.hpp.
contract
Definition: eosio.msig_tests.cpp:977
Definition: apps.hpp:75
eosio::multi_index< "subs"_n, sub, eosio::indexed_by<"bycooppkg"_n, eosio::const_mem_fun< sub, uint128_t, &sub::by_cooppkg > >, eosio::indexed_by<"bycoop"_n, eosio::const_mem_fun< sub, uint64_t, &sub::by_coop > >, eosio::indexed_by<"byexpires"_n, eosio::const_mem_fun< sub, uint64_t, &sub::by_expires > > > subs_index
Definition: table_apps_subs.hpp:94
Definition: eosio.msig.hpp:34
Запись каталога: подписка кооператива на пакет.
Definition: table_apps_subs.hpp:69
bool active
Definition: table_apps_subs.hpp:75
uint64_t primary_key() const
Definition: table_apps_subs.hpp:83
uint64_t id
Definition: table_apps_subs.hpp:70
time_point_sec start_at
Definition: table_apps_subs.hpp:76
uint64_t by_expires() const
Definition: table_apps_subs.hpp:86
time_point_sec end_at
Definition: table_apps_subs.hpp:77
uint128_t by_cooppkg() const
Definition: table_apps_subs.hpp:84
name package_id
Definition: table_apps_subs.hpp:72
uint64_t by_coop() const
Definition: table_apps_subs.hpp:85
time_point_sec created_at
Definition: table_apps_subs.hpp:78
name plan
Definition: table_apps_subs.hpp:74
time_point_sec updated_at
Definition: table_apps_subs.hpp:79
checksum256 chain_id
Definition: table_apps_subs.hpp:73
name coopname
Definition: table_apps_subs.hpp:71
RAM_PAYER_CLASS(Apps::sub, contract)