rippled
Loading...
Searching...
No Matches
fee.h
1#pragma once
2
3#include <test/jtx/Env.h>
4#include <test/jtx/tags.h>
5
6#include <xrpl/basics/contract.h>
7#include <xrpl/protocol/STAmount.h>
8
9#include <optional>
10
11namespace xrpl {
12namespace test {
13namespace jtx {
14
16class fee
17{
18private:
19 bool manual_ = true;
20 bool increment_ = false;
22
23public:
24 explicit fee(autofill_t) : manual_(false)
25 {
26 }
27
28 explicit fee(increment_t) : increment_(true)
29 {
30 }
31
32 explicit fee(none_t)
33 {
34 }
35
36 explicit fee(STAmount const& amount) : amount_(amount)
37 {
38 if (!isXRP(*amount_))
39 Throw<std::runtime_error>("fee: not XRP");
40 }
41
42 explicit fee(std::uint64_t amount, bool negative = false) : fee{STAmount{amount, negative}}
43 {
44 }
45
46 void
47 operator()(Env&, JTx& jt) const;
48};
49
50} // namespace jtx
51} // namespace test
52} // namespace xrpl
A transaction testing environment.
Definition Env.h:119
Set the fee on a JTx.
Definition fee.h:17
std::optional< STAmount > amount_
Definition fee.h:21
fee(autofill_t)
Definition fee.h:24
void operator()(Env &, JTx &jt) const
Definition fee.cpp:10
fee(none_t)
Definition fee.h:32
fee(increment_t)
Definition fee.h:28
fee(std::uint64_t amount, bool negative=false)
Definition fee.h:42
fee(STAmount const &amount)
Definition fee.h:36
auto const amount
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
bool isXRP(AccountID const &c)
Definition AccountID.h:70
Execution context for applying a JSON transaction.
Definition JTx.h:25
Used for fee() calls that use an owner reserve increment.
Definition tags.h:34