7#include <eosio/eosio.hpp>
9#include "../../consts.hpp"
10#include "../actions.hpp"
11#include "../programs.hpp"
12#include "../soviet/soviet.hpp"
16#define COMPLETEWTHD_SIGNATURE name coopname, checksum256 withdraw_hash
17#define DECLINEWTHD_SIGNATURE name coopname, checksum256 withdraw_hash, std::string reason
22#define AUTHWTHD_SIGNATURE AUTHORIZE_CALLBACK_SIGNATURE
48 check(
amount.is_valid(),
"Неверный актив");
49 check(
amount.amount >= 0,
"Сумма должна быть неотрицательной");
53 eosio::asset
amount, eosio::name program_type, std::string memo) {
57 std::make_tuple(coopname, username, program_row.id,
amount, memo))
62 eosio::asset
amount, eosio::name program_type, std::string memo) {
66 std::make_tuple(coopname, username, program_row.id,
amount,
false, memo))
71 eosio::asset
amount, eosio::name program_type, std::string memo) {
75 std::make_tuple(coopname, username, program_row.id,
amount, memo))
79 std::make_tuple(coopname, username, program_row.id,
amount, memo))
84 eosio::asset
amount, eosio::name program_type, std::string memo) {
86 print(
"▶ Уменьшаем заблокированные средства кошелька пользователя: ",
amount,
" для пользователя: ",
88 print(
"▶ Программа: ", program_row.id);
89 print(
"▶ Доступно: ", program_row.available->amount);
90 print(
"▶ Заблокированные средства: ", program_row.blocked->amount);
91 print(
"▶ Сумма для уменьшения: ",
amount.amount);
94 std::make_tuple(coopname, username, program_row.id,
amount, memo))
98 std::make_tuple(coopname, username, program_row.id,
amount,
false, memo))
103 eosio::asset
amount, eosio::name program_type, std::string memo) {
107 std::make_tuple(coopname, username, program_row.id,
amount, memo))
112 eosio::asset
amount, eosio::name program_type, std::string memo) {
116 std::make_tuple(coopname, username, program_row.id,
amount, memo))
121 uint64_t program_id, std::string memo) {
125 std::make_tuple(coopname, username, program_row.id,
amount, memo))
130 uint64_t program_id, std::string memo) {
134 std::make_tuple(coopname, username, program_row.id,
amount, memo))
138 static std::optional<deposit>
get_deposit(eosio::name coopname,
const checksum256 &hash) {
140 auto secondary_index = primary_index.get_index<
"byhash"_n>();
142 auto itr = secondary_index.find(hash);
143 if (itr == secondary_index.end()) {
150 static std::optional<withdraw>
get_withdraw(eosio::name coopname,
const checksum256 &hash) {
152 auto secondary_index = primary_index.get_index<
"byhash"_n>();
154 auto itr = secondary_index.find(hash);
155 if (itr == secondary_index.end()) {
Definition: wallet.hpp:31
static void validate_asset(const eosio::asset &amount)
Definition: wallet.hpp:46
static eosio::name get_valid_wallet_action(const eosio::name &action)
Definition: wallet.hpp:41
WalletTables::deposits_index deposits_index
Definition: wallet.hpp:35
static void add_blocked_funds(eosio::name contract, eosio::name coopname, eosio::name username, eosio::asset amount, eosio::name program_type, std::string memo)
Definition: wallet.hpp:70
static void unpay_membership_fee(name contract, name coopname, name username, eosio::asset amount, uint64_t program_id, std::string memo)
Definition: wallet.hpp:129
static std::optional< withdraw > get_withdraw(eosio::name coopname, const checksum256 &hash)
Definition: wallet.hpp:150
static void unblock_funds(eosio::name contract, eosio::name coopname, eosio::name username, eosio::asset amount, eosio::name program_type, std::string memo)
Definition: wallet.hpp:111
WalletTables::users_index users_index
Definition: wallet.hpp:39
static void sub_available_funds(eosio::name contract, eosio::name coopname, eosio::name username, eosio::asset amount, eosio::name program_type, std::string memo)
Definition: wallet.hpp:61
static void add_available_funds(eosio::name contract, eosio::name coopname, eosio::name username, eosio::asset amount, eosio::name program_type, std::string memo)
Definition: wallet.hpp:52
static std::optional< deposit > get_deposit(eosio::name coopname, const checksum256 &hash)
Definition: wallet.hpp:138
WalletTables::withdraws_index withdraws_index
Definition: wallet.hpp:36
static void block_funds(eosio::name contract, eosio::name coopname, eosio::name username, eosio::asset amount, eosio::name program_type, std::string memo)
Definition: wallet.hpp:102
static void pay_membership_fee(name contract, name coopname, name username, eosio::asset amount, uint64_t program_id, std::string memo)
Definition: wallet.hpp:120
static void sub_blocked_funds(eosio::name contract, eosio::name coopname, eosio::name username, eosio::asset amount, eosio::name program_type, std::string memo)
Definition: wallet.hpp:83
static constexpr eosio::symbol _root_govern_symbol
Definition: consts.hpp:236
static constexpr eosio::name _wallet
Definition: consts.hpp:174
static constexpr eosio::name _soviet
Definition: consts.hpp:177
contract
Definition: eosio.msig_tests.cpp:977
permission_level
Definition: eosio.msig_tests.cpp:896
share_type amount
Definition: eosio.token_tests.cpp:174
#define AUTHWTHD_SIGNATURE
Definition: wallet.hpp:22
#define COMPLETEWTHD_SIGNATURE
Definition: wallet.hpp:16
void(COMPLETEWTHD_SIGNATURE) completewthd_interface
Definition: wallet.hpp:19
static const std::set< eosio::name > wallet_callback_actions
Definition: wallet.hpp:25
#define DECLINEWTHD_SIGNATURE
Definition: wallet.hpp:17
void(AUTHWTHD_SIGNATURE) authwthd_interface
Definition: wallet.hpp:23
void(DECLINEWTHD_SIGNATURE) declinewthd_interface
Definition: wallet.hpp:20
void send(name contract, name action_name, name actor, Args &&... args)
Definition: actions.hpp:10
multi_index< "withdraws"_n, withdraw, indexed_by<"byusername"_n, const_mem_fun< withdraw, uint64_t, &withdraw::by_username > >, indexed_by<"byhash"_n, const_mem_fun< withdraw, checksum256, &withdraw::by_hash > >, indexed_by<"bystatus"_n, const_mem_fun< withdraw, uint64_t, &withdraw::by_status > >, indexed_by<"bycreated"_n, const_mem_fun< withdraw, uint64_t, &withdraw::by_created > > > withdraws_index
Definition: table_wallet_withdraws.hpp:47
multi_index<"users"_n, user > users_index
Definition: table_wallet_users.hpp:46
multi_index< "deposits"_n, deposit, indexed_by<"byhash"_n, const_mem_fun< deposit, checksum256, &deposit::by_hash > >, indexed_by<"byusername"_n, const_mem_fun< deposit, uint64_t, &deposit::by_username > >, indexed_by<"bystatus"_n, const_mem_fun< deposit, uint64_t, &deposit::by_status > >, indexed_by<"bycreated"_n, const_mem_fun< deposit, uint64_t, &deposit::by_created > > > deposits_index
Definition: table_wallet_deposits.hpp:43
Definition: eosio.msig.hpp:34
program get_program_or_fail(eosio::name coopname, uint64_t program_id)
Definition: programs.hpp:24
uint64_t get_program_id(const eosio::name &type)
Definition: programs.hpp:99
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: table_wallet_deposits.hpp:19
Definition: table_wallet_users.hpp:23
Definition: table_wallet_users.hpp:39
Definition: table_wallet_withdraws.hpp:20