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
45 check(
amount.is_valid(),
"Неверный актив");
46 check(
amount.amount >= 0,
"Сумма должна быть неотрицательной");
50 eosio::asset
amount, eosio::name program_type, std::string memo) {
54 std::make_tuple(coopname, username, program_row.id,
amount, memo))
59 eosio::asset
amount, eosio::name program_type, std::string memo) {
63 std::make_tuple(coopname, username, program_row.id,
amount,
false, memo))
68 eosio::asset
amount, eosio::name program_type, std::string memo) {
72 std::make_tuple(coopname, username, program_row.id,
amount, memo))
76 std::make_tuple(coopname, username, program_row.id,
amount, memo))
81 eosio::asset
amount, eosio::name program_type, std::string memo) {
83 print(
"▶ Уменьшаем заблокированные средства кошелька пользователя: ",
amount,
" для пользователя: ",
85 print(
"▶ Программа: ", program_row.id);
86 print(
"▶ Доступно: ", program_row.available->amount);
87 print(
"▶ Заблокированные средства: ", program_row.blocked->amount);
88 print(
"▶ Сумма для уменьшения: ",
amount.amount);
91 std::make_tuple(coopname, username, program_row.id,
amount, memo))
95 std::make_tuple(coopname, username, program_row.id,
amount,
false, memo))
100 eosio::asset
amount, eosio::name program_type, std::string memo) {
104 std::make_tuple(coopname, username, program_row.id,
amount, memo))
109 eosio::asset
amount, eosio::name program_type, std::string memo) {
113 std::make_tuple(coopname, username, program_row.id,
amount, memo))
118 uint64_t program_id, std::string memo) {
122 std::make_tuple(coopname, username, program_row.id,
amount, memo))
127 uint64_t program_id, std::string memo) {
131 std::make_tuple(coopname, username, program_row.id,
amount, memo))
135 static std::optional<deposit>
get_deposit(eosio::name coopname,
const checksum256 &hash) {
137 auto secondary_index = primary_index.get_index<
"byhash"_n>();
139 auto itr = secondary_index.find(hash);
140 if (itr == secondary_index.end()) {
147 static std::optional<withdraw>
get_withdraw(eosio::name coopname,
const checksum256 &hash) {
149 auto secondary_index = primary_index.get_index<
"byhash"_n>();
151 auto itr = secondary_index.find(hash);
152 if (itr == secondary_index.end()) {
Definition: wallet.hpp:31
static void validate_asset(const eosio::asset &amount)
Definition: wallet.hpp:43
static eosio::name get_valid_wallet_action(const eosio::name &action)
Definition: wallet.hpp:38
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:67
static void unpay_membership_fee(name contract, name coopname, name username, eosio::asset amount, uint64_t program_id, std::string memo)
Definition: wallet.hpp:126
static std::optional< withdraw > get_withdraw(eosio::name coopname, const checksum256 &hash)
Definition: wallet.hpp:147
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:108
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:58
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:49
static std::optional< deposit > get_deposit(eosio::name coopname, const checksum256 &hash)
Definition: wallet.hpp:135
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:99
static void pay_membership_fee(name contract, name coopname, name username, eosio::asset amount, uint64_t program_id, std::string memo)
Definition: wallet.hpp:117
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:80
static constexpr eosio::symbol _root_govern_symbol
Definition: consts.hpp:209
static constexpr eosio::name _wallet
Definition: consts.hpp:153
static constexpr eosio::name _soviet
Definition: consts.hpp:156
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:45
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:41
Definition: eosio.msig.hpp:34
program get_program_or_fail(eosio::name coopname, uint64_t program_id)
Definition: programs.hpp:16
uint64_t get_program_id(const eosio::name &type)
Definition: programs.hpp:93
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:17
Definition: table_wallet_withdraws.hpp:18