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