COOPENOMICS  v1
Кооперативная Экономика
gateway.hpp
См. документацию.
1#pragma once
2
3#include <set>
4#include <string>
5
6#include <eosio/asset.hpp>
7#include <eosio/crypto.hpp>
8#include <eosio/eosio.hpp>
9
10#include "../../consts.hpp"
11#include "../actions.hpp"
12#include "../names.hpp"
13
14#define CREATEOUTPAY_SIGNATURE \
15 name coopname, name username, checksum256 outcome_hash, asset quantity, name callback_contract, \
16 name confirm_callback, name decline_callback
17
19
20namespace Gateway {
21
22static const std::set<eosio::name> gateway_income_actions = {
23 "deposit"_n,
24};
25
26static const std::set<eosio::name> gateway_outcome_actions = {
27 "withdraw"_n,
28};
29
30inline eosio::name get_valid_income_action(const eosio::name &action) {
31 eosio::check(gateway_income_actions.contains(action), "Недопустимое имя действия");
32 return action;
33}
34
35inline eosio::name get_valid_outcome_action(const eosio::name &action) {
36 eosio::check(gateway_outcome_actions.contains(action), "Недопустимое имя действия");
37 return action;
38}
39
40inline void create_outcome(name calling_contract, CREATEOUTPAY_SIGNATURE) {
41 Action::send<createoutpay_interface>(_gateway, Names::External::CREATE_OUTPAY, calling_contract, coopname,
42 username, outcome_hash, quantity, callback_contract, confirm_callback,
43 decline_callback);
44}
45
46} // namespace Gateway
static constexpr eosio::name _gateway
Definition: consts.hpp:152
#define CREATEOUTPAY_SIGNATURE
Definition: gateway.hpp:14
void(CREATEOUTPAY_SIGNATURE) createoutpay_interface
Definition: gateway.hpp:18
Definition: gateway.hpp:20
void create_outcome(name calling_contract, CREATEOUTPAY_SIGNATURE)
Definition: gateway.hpp:40
eosio::name get_valid_outcome_action(const eosio::name &action)
Definition: gateway.hpp:35
static const std::set< eosio::name > gateway_income_actions
Definition: gateway.hpp:22
static const std::set< eosio::name > gateway_outcome_actions
Definition: gateway.hpp:26
eosio::name get_valid_income_action(const eosio::name &action)
Definition: gateway.hpp:30
constexpr eosio::name CREATE_OUTPAY
Definition: names.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()